/* === Global Styles === */
body {
  font-family: 'Segoe UI', sans-serif;
  background: #f5f5f5;
  height: 100%;
  margin: 0;
  padding: 0;
  color: #333;

  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  background: #ffffff;
  box-sizing: border-box;
  flex: 1;
}

/* === Header === */
h1 {
  text-align: center;
  color: #222;
  font-weight: 600;
  font-size: 1.8em;
  margin-bottom: 24px;
}

/* === Search Bar === */
.search-bar {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-bottom: 20px;
  align-items: stretch; /* 让元素高度对齐 */
}

.search-bar select {
  width: 120px;          /* 固定宽度 */
  padding: 10px;
  font-size: 0.95em;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  background-color: #fff;
}

.search-bar input {
  flex: 1 1 auto;        /* 伸缩自如 */
  padding: 12px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;          /* 防止溢出 */
}

.search-bar input:focus {
  border-color: #3498db;
}

.button-group {
  display: flex;
  gap: 10px;
  width: 220px;          /* 固定按钮组宽度（两个按钮各110px左右） */
  flex-shrink: 0;
}

.search-bar button {
  flex: 1;               /* 两按钮等宽 */
  padding: 12px 0;
  font-size: 1em;
  background-color: #3498db;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.search-bar button:hover {
  background-color: #2980b9;
}

/* === Results List === */
#results {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  list-style: none;
}

/* === Flat Card Style === */
.card {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 1.1em;
  font-weight: 600;
  color: #2c3e50;
}

.card-name {
  flex-grow: 1;
}

.card-id {
  color: #696969;         /* 浅灰色 */
  font-size: 0.9rem;  /* 比名称小 */
  margin-left: 6px;    /* 名称和ID间距 */
  font-weight: normal;
  user-select: text;   /* 允许选中ID */
}

.card-attribute {
  color: #888;
  font-size: 0.95em;
}

/* Card Body Layout (Image + Info Side by Side) */
.card-body {
  display: flex;
  flex-direction: row;
  gap: 14px;
  margin-top: 10px;
}

/* Card Image */
.card-image {
  width: 220px;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  border: 0px solid #ccc;
}

/* Card Info Text */
.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-level {
  margin-bottom: 4px;
  color: #f39c12;
  font-size: 0.95em;
}

.card-type {
  font-size: 0.95em;
  color: #555;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.95em;
  color: #444;
  margin-bottom: 8px;
  line-height: 1.5;
  white-space: pre-line;
}

.card-footer {
  text-align: right;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95em;
}

/* === Highlight Keywords === */
.card-desc b,
.card-name b {
  background-color: #ffe761;
  font-weight: bold;
}

/* === Pagination === */
#pagination {
  display: flex;
  align-items: flex-end; /* ⬅️ 底部对齐 */
  justify-content: center;
  gap: 14px;
  margin-top: 24px;
  flex-wrap: wrap;
  font-size: 0.95em;
}

.pagination-controls label {
  font-weight: normal;
  color: #333;
}

.pagination-controls select {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 0.95em;
  appearance: none; /* 移除部分浏览器默认箭头 */
}

#pagination button {
  padding: 10px 16px;
  font-size: 1em;
  border: none;
  border-radius: 4px;
  background-color: #2ecc71;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}

#pagination button:hover:not([disabled]) {
  background-color: #27ae60;
}

#pagination button[disabled] {
  background-color: #ccc;
  cursor: not-allowed;
}

#pagination span {
  font-size: 0.95em;
  color: #555;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95em;
  color: #333;
}

#per-page {
  padding: 6px 10px;
  font-size: 1em;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.image-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  cursor: grab;
  transition: transform 0.1s ease-out;
  user-select: none;
  touch-action: none;
}

.image-modal img:active {
  cursor: grabbing;
}

.image-modal .close-button {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 32px;
  color: white;
  background-color: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
  z-index: 1001;
  transition: background-color 0.2s ease;
  user-select: none;
}

.image-modal .close-button:hover {
  background-color: rgba(0,0,0,0.7);
}

.card-attribute {
  font-weight: bold;
  font-size: 0.85rem;
  text-align: center;
  padding: 4px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  line-height: 32px;
  color: white;
  display: inline-block;
  margin-left: auto;
  margin-right: 0;
}

.attr-地     { background-color: #A67C52; }  /* 棕色 */
.attr-水     { background-color: #2980b9; }  /* 深蓝 */
.attr-炎     { background-color: #e74c3c; }  /* 红色 */
.attr-风     { background-color: #27ae60; }  /* 绿色 */
.attr-光     { background-color: #f1c40f; } /* 黄色 + 黑字 */
.attr-暗     { background-color: #8e44ad; }  /* 深灰蓝 */
.attr-神     { background-color: #f1c40f; }  /* 紫色 */

.attr-circle {
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

.card-stats {
  text-align: right;
}

.lua-btn {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  background-color: #ADD8E6;
  border: none;
  color: white;
  border-radius: 3px;
  user-select: none;
}

.lua-btn:hover {
  background-color: #2980b9;
}

.lua-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lua-modal-content {
  background: #222;
  color: #eee;
  max-width: 90vw;
  max-height: 80vh;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  position: relative;
  font-family: monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.lua-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 32px;
  color: white;
  background-color: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  line-height: 38px;
  text-align: center;
  cursor: pointer;
  z-index: 1001;
  transition: background-color 0.2s ease;
  user-select: none;
}

.lua-modal-close:hover {
  background-color: rgba(0,0,0,0.7);
}

.category-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.category-tag {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  white-space: nowrap;
}

/* 🎨 个性化颜色：每种 tag 设置不同颜色 */
.category-tag[data-tag="炸魔陷"]     { background-color: #f44336; } /* 红 */
.category-tag[data-tag="炸怪"]       { background-color: #e91e63; } /* 粉红 */
.category-tag[data-tag="除外"]       { background-color: #9c27b0; } /* 紫 */
.category-tag[data-tag="送墓"]       { background-color: #673ab7; } /* 深紫 */
.category-tag[data-tag="回手"]       { background-color: #3f51b5; } /* 靛蓝 */
.category-tag[data-tag="回卡组"]     { background-color: #2196f3; } /* 蓝 */
.category-tag[data-tag="削手"]       { background-color: #03a9f4; } /* 淡蓝 */
.category-tag[data-tag="削卡组"]     { background-color: #00bcd4; } /* 青 */
.category-tag[data-tag="抽卡"]       { background-color: #009688; } /* 青绿 */
.category-tag[data-tag="检索"]       { background-color: #4caf50; } /* 绿 */
.category-tag[data-tag="回收"]       { background-color: #8bc34a; } /* 淡绿 */
.category-tag[data-tag="表示形式"]   { background-color: #cddc39; } /* 柠檬绿 */
.category-tag[data-tag="控制权"]     { background-color: #ffeb3b; color: #000; } /* 黄 */
.category-tag[data-tag="攻守变化"]   { background-color: #ffc107; color: #000; } /* 琥珀 */
.category-tag[data-tag="贯通"]       { background-color: #ff9800; } /* 橙 */
.category-tag[data-tag="多次攻击"]   { background-color: #ff5722; } /* 深橙 */
.category-tag[data-tag="攻击限制"]   { background-color: #795548; } /* 棕 */
.category-tag[data-tag="直接攻击"]   { background-color: #9e9e9e; } /* 灰 */
.category-tag[data-tag="特殊召唤"]   { background-color: #607d8b; } /* 蓝灰 */
.category-tag[data-tag="衍生物"]     { background-color: #6d4c41; } /* 棕灰 */
.category-tag[data-tag="种族"]       { background-color: #b71c1c; } /* 深红 */
.category-tag[data-tag="属性"]       { background-color: #880e4f; } /* 深粉 */
.category-tag[data-tag="伤害"]       { background-color: #4a148c; } /* 深紫 */
.category-tag[data-tag="回复"]       { background-color: #1a237e; } /* 深蓝 */
.category-tag[data-tag="破坏耐性"]   { background-color: #006064; } /* 深青 */
.category-tag[data-tag="效果耐性"]   { background-color: #1b5e20; } /* 深绿 */
.category-tag[data-tag="指示物"]     { background-color: #33691e; } /* 深橄榄 */
.category-tag[data-tag="赌博"]       { background-color: #827717; } /* 深柠檬 */
.category-tag[data-tag="融合相关"]   { background-color: #f57f17; } /* 深橙黄 */
.category-tag[data-tag="同调相关"]   { background-color: #ff6f00; } /* 深橘 */
.category-tag[data-tag="超量相关"]   { background-color: #e65100; } /* 深橘红 */
.category-tag[data-tag="效果无效"]   { background-color: #212121; } /* 近黑 */


/* === Responsive Layout === */
@media screen and (max-width: 600px) {
  .search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-bar select {
    width: 100%;
  }
  .search-bar input {
    width: 94%;
  }

  .button-group {
    display: flex;
    width: 100%;
    gap: 10px;
  }

  .button-group button {
    flex: 1;          /* 平分宽度 */
    min-width: 0;     /* 避免按钮撑开 */
  }

  .card-body {
    flex-direction: column;
    align-items: center;
  }

  .card-image {
    width: 80%;
    max-width: 220px;
  }

  .card-info {
    width: 100%;
  }

  .card-footer {
    text-align: center;
    margin-top: 6px;
  }

  #pagination {
    flex-wrap: nowrap;
    overflow-x: auto; /* 如果内容超出，允许横向滚动 */
    font-size: 12px
  }

  #pagination button {
    padding: 10px 5px; /* 保持上下10px，左右减半 */
  }
}

/* 高级查询网格样式 */
/* 高级查询字段统一布局 */
.adv-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.adv-grid input,
.adv-grid select {
  padding: 10px;
  font-size: 0.95em;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  width: 100%;
}

/* 限制下拉框高度用于多选 */
.adv-grid select {
  background-color: #fff;
}

.adv-grid button {
  padding: 12px 20px;
  font-size: 1em;
  background-color: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.adv-grid button:hover {
  background-color: #c0392b;
}

/* 响应式支持：中屏降为2列 */
@media screen and (max-width: 768px) {
  .adv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 响应式支持：小屏也保持2列 */
@media screen and (max-width: 480px) {
  .adv-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.announcement-bar {
  background-color: #B0C4DE;
  color: #2d3436;
  padding: 2px;
  font-size: 12px;
  font-weight: bold;
  border-bottom: 1px solid #dfe6e9;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.announcement-content {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  width: 100%;
  max-width: 1000px;
  justify-content: center;
}

#announcementText {
  flex: 1;
  text-align: center;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 5px;
  color: #2d3436;
}

.announcement-close {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  color: #2d3436;
  cursor: pointer;
}

/* === Footer === */
.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #2c2c2c;
  color: #ccc;
  padding: 10px 20px;
  font-size: 13px;
  position: relative;
  flex-wrap: wrap;
}

.footer-links {
  text-align: left;
  flex: 1;
  min-width: 200px;
}

.footer-links a {
  color: #ccc;
  text-decoration: none;
  margin: 0 8px;
}

.footer-icp {
  position: absolute;
  right: 20px;
  font-size: 12px;
}

.footer-icp a {
  color: #ccc;
  text-decoration: none;
}

/* === Responsive Footer === */
@media screen and (max-width: 600px) {
  .site-footer {
    flex-direction: column;
    text-align: center;
    padding: 8px 8px;
    font-size: 10px;
  }

  .footer-links {
      text-align: center;
      flex: 1;
      min-width: 200px;
    }

  .footer-icp {
    position: static;
    margin-top: 8px;
    font-size: 8px;
  }
}

.card-image-wrapper {
  position: relative;
  display: inline-block;
}

.card-limit-icon {
  position: absolute;
  top: -15px;
  left: -15px;
  width: 48px;
  height: 48px;
  z-index: 2;
}


.limit-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: white;
  margin-right: 6px;
  margin-bottom: 6px;
  vertical-align: middle;
  height: 18px; /* 你可以根据需要调整高度 */
  min-width: 36px; /* 保证宽度足够，文字居中 */
  box-sizing: border-box;
  user-select: none;
}

.limit-0 { background-color: red; }
.limit-1 { background-color: orange; }
.limit-2 { background-color: gold; color: black; }

/* 按钮容器：垂直居中，靠右固定 */
.scroll-buttons {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 999;
}

/* 圆形按钮样式 */
.scroll-buttons button {
  width: 50px;
  height: 50px;
  font-size: 20px;
  border: none;
  border-radius: 50%;
  background-color: #007bff;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s ease;
}

.scroll-buttons button:hover {
  background-color: #0056b3;
}

/* 响应式样式：小屏幕自动缩小按钮 */
@media screen and (max-width: 600px) {
  .scroll-buttons {
    right: 10px;
    gap: 10px;
  }

  .scroll-buttons button {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  user-select: none;
  white-space: nowrap;
}

.checkbox-group input[type="checkbox"] {
  margin: 0;
}

/* 遮罩层 */
.modal {
  display: none; /* 默认隐藏 */
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

/* 弹窗 */
.modal-content {
  background: #fff;
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
}

/* 选项区 */
.modal-options {
  flex: 1;
  overflow-y: auto;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #f5f5f5;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.modal-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.modal-actions button:last-child {
  background: #007bff;
  color: #fff;
}

/* 移动端优化 */
@media (max-width: 600px) {
  .modal-content {
    max-width: 100%;
    max-height: 90vh;
  }
}

:root{
    --radius: 999px;
    --pad-y: .2rem; --pad-x: .5rem;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

    /* 亮色主题 */
    --new-bg: #0ea5e9;   --new-fg: #ffffff;  /* 天蓝 */
    --chg-bg: #f59e0b;   --chg-fg: #111827;  /* 琥珀 */
    --muted: #6b7280;    --card: #ffffff;    --ink: #111827; --line: #e5e7eb;
}

/* 基础徽章 */
  .badge{
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: var(--pad-y) var(--pad-x);
    border-radius: var(--radius);
    font-size: .78rem; font-weight: 600; letter-spacing: .02em;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
    margin-right: 10px
  }

  .badge--new{ background: var(--new-bg); color: var(--new-fg); }
  .badge--chg{ background: var(--chg-bg); color: var(--chg-fg); }

  /* 可选：轻微呼吸动画（尊重减少动画偏好） */
  @media (prefers-reduced-motion: no-preference){
    .badge--new{ animation: pulse 1.6s ease-in-out infinite; }
    @keyframes pulse{
      0%, 100%{ transform: scale(1); filter: saturate(1); }
      60%    { transform: scale(1.04); filter: saturate(1.15); }
    }
  }

  @media (prefers-reduced-motion: no-preference){
    .badge--chg{ animation: pulse 1.6s ease-in-out infinite; }
    @keyframes pulse{
      0%, 100%{ transform: scale(1); filter: saturate(1); }
      60%    { transform: scale(1.04); filter: saturate(1.15); }
    }
  }

  /* 图标（纯 CSS 点） */
  .dot{ width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; display: inline-block; }