/* ─── Design Tokens ────────────────────────────────────────── */
:root {
  --bg:        #1c1914;
  --bg2:       #252019;
  --bg3:       #2f2921;
  --surface:   #38312a;
  --surface2:  #463e35;
  --border:    #574d43;
  --border2:   #726258;

  --gold:      #e8b84b;
  --gold2:     #f5d78e;
  --yellow:    #facc15;
  --green:     #4caf7d;
  --amber:     #f0a63a;
  --red:       #e05c5c;
  --blue:      #5b8dee;
  --purple:    #9b6dff;

  --text:      #f2e8d5;
  --text2:     #cbb898;
  --text3:     #968272;

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;

  --shadow:    0 8px 32px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.7);

  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Header ─────────────────────────────────────────────────── */
/* --- Top Brand Bar --- */
.top-brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #232220; /* Dark background like the reference image */
  color: #fff;
  padding: 12px 24px;
  border-bottom: 2px solid var(--accent);
  flex-wrap: wrap;
  gap: 16px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-link { display: inline-flex; }
.logo-link:hover .ugg-logo { opacity: .8; }

.ugg-logo {
  max-height: 70px;
  max-width: 200px;
  object-fit: contain;
  transition: opacity var(--transition);
  cursor: pointer;
  background: white;
  border-radius: 8px;
  padding: 4px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Cinzel', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: #f7ce46; /* Gold/yellow color */
}

.brand-sub {
  font-size: 0.85rem;
  color: #ccc;
}

.brand-center {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #dcdcdc;
  min-width: 280px;
}

.brand-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.brand-count {
  font-size: .9rem;
  color: var(--text2);
  white-space: nowrap;
}
.brand-count .highlight {
  color: #f7ce46;
  font-weight: 700;
  font-size: 1.05rem;
}
.brand-count-sub {
  font-size: .78rem;
  color: var(--text3);
}
.brand-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.draft-nav-btn,
.draft-nav-btn:link,
.draft-nav-btn:visited {
  display: inline-block;
  background: rgba(232,184,75,.15);
  border: 1px solid rgba(232,184,75,.4);
  color: #f7ce46;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.draft-nav-btn:hover {
  background: rgba(232,184,75,.28);
  border-color: #f7ce46;
}
.header-stats { display: flex; gap: 16px; }
.stat-item {
  font-size: .85rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
}

/* ─── Main ───────────────────────────────────────────────────── */
.main-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* Home */
.home-page {
  background:
    linear-gradient(180deg, rgba(28,25,20,.94), rgba(28,25,20,1) 42%),
    radial-gradient(circle at 20% 0%, rgba(232,184,75,.16), transparent 34%),
    var(--bg);
}

.home-page .top-brand-bar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(220px, 1fr);
  gap: 24px;
}

.home-page .brand-left {
  justify-self: start;
}

.home-page .brand-center {
  flex: none;
  justify-self: center;
  min-width: 0;
  max-width: 760px;
}

.home-page .brand-right {
  justify-self: end;
}

.home-brand-auth .auth-bar {
  justify-content: flex-end;
  margin-top: 0;
}

.home-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px 24px 72px;
}

.home-hero {
  max-width: 820px;
}

.home-kicker {
  color: var(--gold);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.home-hero h1 {
  font-size: clamp(2.1rem, 4vw, 4.3rem);
  line-height: 1.14;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 18px;
}

.home-hero p {
  max-width: 680px;
  color: var(--text2);
  font-size: 1.08rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.home-action,
.home-action:link,
.home-action:visited,
.home-line-btn,
.home-line-btn:link,
.home-line-btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  transition: border-color var(--transition), background var(--transition), color var(--transition), transform var(--transition);
}

.home-action {
  background: rgba(232,184,75,.12);
  border: 1px solid rgba(232,184,75,.42);
  color: var(--gold2);
}

.home-action:hover,
.home-line-btn:hover {
  transform: translateY(-1px);
}

.home-action:hover {
  background: rgba(232,184,75,.22);
  border-color: var(--gold);
}

.home-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 54px;
}

.home-tool {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(47,41,33,.7);
  padding: 18px;
}

.home-tool h2 {
  font-size: 1.05rem;
  color: var(--gold2);
  margin-bottom: 8px;
}

.home-tool p {
  color: var(--text2);
  font-size: .92rem;
}

.home-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  border: 1px solid rgba(232,184,75,.38);
  border-radius: var(--radius-sm);
  background: rgba(232,184,75,.08);
  padding: 20px;
}

.home-line h2 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.home-line p {
  color: var(--text2);
  font-size: .94rem;
}

.home-line-btn {
  flex-shrink: 0;
  background: rgba(232,184,75,.16);
  border: 1px solid rgba(232,184,75,.58);
  color: var(--gold2);
}

.home-line-btn:hover {
  background: rgba(232,184,75,.24);
  border-color: var(--gold);
}

/* ─── Filter Bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}
.filter-chips-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-wrap {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 14px;
  font-size: 1rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 40px 10px 42px;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232,184,75,.15);
}
.search-input::placeholder { color: var(--text3); }
.clear-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: .85rem;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}
.clear-btn:hover { color: var(--text); }

.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  color: var(--text2);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1000;
  font-weight: 600;
}

.chip-toggle {
  border-left: 1px solid var(--border2);
  padding-left: 14px;
  margin-left: 4px;
}
.chip-toggle.active {
  background: #5a1a1a;
  border-color: #c0392b;
  color: #ff8a7a;
  font-weight: 600;
}
.chip-toggle:hover { border-color: #c0392b; color: #ff8a7a; }

.deck-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}
.deck-filter label { font-size: .85rem; color: var(--text3); white-space: nowrap; }
.deck-filter select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px;
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}
.deck-filter select:focus { border-color: var(--gold); }
.deck-filter select option {
  background: var(--bg3);
  color: var(--text);
}

/* ─── Results Info ───────────────────────────────────────────── */
.results-info {
  font-size: .85rem;
  color: var(--text3);
  margin-bottom: 20px;
  min-height: 20px;
}

/* ─── Card Grid ──────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}

/* ─── Card Item ──────────────────────────────────────────────── */
.card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
}
.card-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--border2);
}
.card-item.type-minor  { --accent: var(--amber); }
.card-item.type-occupation { --accent: var(--yellow); }
.card-item.type-both   { --accent: var(--red); }

.card-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.card-item:hover::before { opacity: 1; }

.card-dup-excluded { opacity: .45; filter: grayscale(.7); }
.card-dup-excluded:hover { opacity: .7; }
.card-banned-excluded { opacity: .4; filter: grayscale(.8); }
.card-banned-excluded:hover { opacity: .65; }

.card-dup-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .12em;
  color: #fff;
  background: rgba(0,0,0,.45);
  pointer-events: none;
}
.card-ban-badge { background: rgba(120,20,20,.55); }

.card-thumb-wrap {
  width: 100%;
  aspect-ratio: 6 / 5;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}
.card-canvas {
  width: 100%;
  height: auto;
  display: block;
  vertical-align: top;
}

/* ── 牌力徽章（ELO / Tier）：預設隱藏，選牌力排序才顯示 ── */
.card-rating { display: none; }
.card-grid.show-rating .card-rating {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  padding: 2px 7px 2px 5px;
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 700;
  background: rgba(15, 20, 33, .82);
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
.card-rating .rating-tier {
  font-family: 'Cinzel', serif;
  font-size: .85rem;
  line-height: 1;
}
.card-rating .rating-elo {
  color: var(--text);
  font-weight: 600;
}
.rating-tier-s .rating-tier { color: #f5c842; }
.rating-tier-a .rating-tier { color: #4ade80; }
.rating-tier-b .rating-tier { color: #60a5fa; }
.rating-tier-c .rating-tier { color: #c084fc; }
.rating-tier-d .rating-tier { color: #fb923c; }
.rating-tier-e .rating-tier { color: #f87171; }
.rating-na .rating-tier,
.rating-banned .rating-tier { color: var(--text3); }

.card-body {
  padding: 12px 14px 14px;
}
.card-name {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.card-id {
  font-size: .72rem;
  color: var(--text3);
  font-family: 'Courier New', monospace;
  letter-spacing: .04em;
}
.card-type-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: .04em;
}
.badge-minor    { background: rgba(240,166,58,.15); color: var(--amber); }
.badge-occupation { background: rgba(250,204,21,.15); color: var(--yellow); }
.badge-both {
  display: inline-flex;
  overflow: hidden;
  border-radius: 100px;
  padding: 0;
}
.badge-both-minor {
  background: rgba(240,166,58,.18);
  color: var(--amber);
  padding: 2px 4px 2px 8px;
}
.badge-both-occ {
  background: rgba(224,92,92,.18);
  color: var(--red);
  padding: 2px 8px 2px 4px;
}
.modal-badge.badge-both .badge-both-minor { padding: 4px 5px 4px 12px; }
.modal-badge.badge-both .badge-both-occ   { padding: 4px 12px 4px 5px; }

.card-desc {
  font-size: .78rem;
  color: var(--text2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* bonus/vp indicators */
.card-tags {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.tag {
  font-size: .65rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}
.tag-vp     { background: rgba(221,204,28,.18);  color: #DDCC1C; }
.tag-vp-neg { background: rgba(136,136,136,.15); color: #888; }
.tag-bonus { background: rgba(232,184,75,.15);  color: var(--gold2); }
.tag-minus { background: rgba(224,92,92,.15);   color: var(--red); }
.tag-pass  { background: rgba(168,179,204,.12); color: var(--text2); }
.tag-ban   { background: rgba(192,57,43,.18);   color: #e74c3c; font-weight: 600; }
/* 卡牌功能實作狀態徽章（GM／YOYO 專用私有 tag，見 impl-status.js） */
.tag-impl-1 { background: rgba(232,184,75,.2);  color: #e8b84b; font-weight: 600; }
.tag-impl-2 { background: rgba(74,222,128,.18); color: #4ade80; font-weight: 600; }
.tag-impl-4 { background: rgba(192,57,43,.18);  color: #ff8a7a; font-weight: 600; }
.tag-bga {
  background: rgba(91,141,238,.2);
  color: #7aadff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tag-bga::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  background: url('images/bga-logo.png') center/contain no-repeat;
  border-radius: 3px;
  flex-shrink: 0;
}
.tag-replaces {
  background: rgba(91,141,238,.18);
  color: #9fc0ff;
  font-weight: 600;
}

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state p { font-size: 1.1rem; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(8px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  flex: 1;
  min-width: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(.95) translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  color: var(--text2);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 2;
}
.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border2);
}

.modal-nav-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 908px;
}
.modal-nav-btn {
  flex-shrink: 0;
  width: 44px;
  background: none;
  border: none;
  color: rgba(210, 50, 50, 0.8);
  font-size: 2.2rem;
  cursor: pointer;
  padding: 12px 6px;
  line-height: 1;
  transition: color .15s, transform .15s;
  display: none;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.modal-nav-btn:hover { color: rgba(230, 60, 60, 1); transform: scale(1.15); }
.modal-nav-btn:disabled { color: rgba(150, 150, 150, 0.3); cursor: default; transform: none; }
.modal-overlay.has-nav .modal-nav-btn { display: flex; }

.modal-keyboard-hint {
  display: none;
  text-align: center;
  color: var(--text3);
  font-size: 0.75rem;
  padding: 8px 0 14px;
  letter-spacing: 0.03em;
}
.modal-overlay.has-nav .modal-keyboard-hint { display: block; }

.modal-inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}

.modal-image-wrap {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
#modalCanvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.modal-badge {
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 4px;
}

.modal-info {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-right: 32px;
}
.modal-title {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.modal-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -8px;
}
.modal-id {
  font-family: 'Courier New', monospace;
  font-size: .82rem;
  color: var(--text3);
  letter-spacing: .06em;
}
.modal-ban-badge {
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  background: #c0392b;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: .04em;
}
.modal-bga-badge {
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  background: #3a6bc4;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: .04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.modal-bga-badge::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  background: url('images/bga-logo.png') center/contain no-repeat;
  border-radius: 3px;
  flex-shrink: 0;
}

.modal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.field-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.field-label {
  font-size: .7rem;
  color: var(--text3);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.field-value {
  font-size: .9rem;
  color: var(--text);
  font-weight: 500;
}
.field-value.highlight-vp      { color: #DDCC1C; }
.field-value.highlight-vp-neg  { color: #888; }
.field-value.highlight-bonus { color: var(--gold); }
.field-value.highlight-minus { color: var(--red); }
.field-value.highlight-pass  { color: var(--green); }
.field-value.highlight-replace { color: #9fc0ff; }

.modal-desc-wrap { margin-top: 6px; }
.modal-desc-label {
  font-size: .7rem;
  color: var(--text3);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.modal-desc {
  font-size: .95rem;
  color: var(--text2);
  line-height: 1.75;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.modal-effects-badge {
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  background: #5a7a4f;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: .02em;
}
.modal-online-impl-badge {
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  background: #2f9e44;
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: .02em;
  cursor: help;
}
.modal-effects-wrap { margin-top: 6px; }
.modal-effects-body {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.6;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.effects-section-title {
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}
.effects-section-title:first-child { margin-top: 0; }
.effects-meta-line {
  font-size: .78rem;
  color: var(--text3);
}
.effects-op-line {
  font-family: 'Courier New', monospace;
  font-size: .76rem;
  color: var(--text2);
  padding-left: 10px;
  word-break: break-all;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .home-page .top-brand-bar {
    display: flex;
  }
  .home-page .brand-right {
    align-items: flex-start;
    justify-self: auto;
  }
  .home-brand-auth .auth-bar {
    justify-content: flex-start;
  }
  .home-tool-grid {
    grid-template-columns: 1fr;
  }
  .home-line {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 700px) {
  .modal-inner { grid-template-columns: 1fr; }
  .modal-image-wrap { border-radius: var(--radius-lg) var(--radius-lg) 0 0; min-height: 200px; }
  .modal-fields { grid-template-columns: 1fr; }
  .header-inner { padding: 0 16px; }
  .main-container { padding: 20px 16px 40px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

@media (max-width: 540px) {
  /* Brand bar */
  .top-brand-bar { padding: 8px 12px; gap: 6px; }
  .ugg-logo { max-height: 38px; max-width: 120px; }
  .brand-title { font-size: .92rem; }
  .brand-sub { display: none; }
  .brand-center { display: none; }
  .brand-right { font-size: .8rem; }
  .brand-left { gap: 10px; }

  /* Main container */
  .main-container { padding: 14px 12px 60px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  /* Filter bar — 三列式佈局 */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .search-wrap { min-width: 0; width: 100%; }

  /* 橫向捲動 chip 列 */
  .filter-chips-row {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .filter-chips-row::-webkit-scrollbar { display: none; }
  .filter-chips { flex-wrap: nowrap; gap: 6px; }

  .chip { padding: 5px 11px; font-size: .82rem; white-space: nowrap; }
  .chip-toggle {
    white-space: nowrap;
    border-left: none;
    margin-left: 0;
    padding-left: 11px;
  }

  /* 牌組選單獨立一列，全寬 */
  .deck-filter { width: 100%; }
  .deck-filter label { display: none; }
  .deck-filter select { width: 100%; }

  /* Modal — bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
  }
  .modal-image-wrap {
    max-height: 200px;
    min-height: 160px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-info { padding: 18px 16px 28px; gap: 10px; }
  .modal-title { font-size: 1.2rem; }
  .modal-desc { font-size: .88rem; padding: 10px 12px; }
  .modal-nav-wrap { max-width: 100%; position: relative; }
  .modal-nav-btn {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    width: 36px;
    font-size: 1.8rem;
    z-index: 20;
  }
  .modal-nav-btn:disabled { transform: translateY(-50%); }
  .modal-nav-prev { left: 4px; }
  .modal-nav-next { right: 4px; }
  .modal-overlay.has-nav .modal-keyboard-hint { display: none; }

  /* Banlist — bottom sheet */
  .banlist-overlay {
    padding: 0;
    align-items: flex-end;
    overflow-y: hidden;
  }
  .banlist-modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 16px 32px;
    max-height: 88vh;
    overflow-y: auto;
  }
  .banlist-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
  .banlist-title { font-size: 1.1rem; }
}

/* ── Duplicate Compare (inline, index.html) ── */
.dup-cmp-overlay-inline {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(6px);
  z-index: 400;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
@media (max-width: 540px) {
  .home-main {
    padding: 44px 16px 56px;
  }
  .home-hero h1 {
    font-size: 2.1rem;
  }
  .home-hero p {
    font-size: 1rem;
  }
  .home-actions,
  .home-action {
    width: 100%;
  }
  .home-tool-grid {
    grid-template-columns: 1fr;
    margin-top: 36px;
  }
  .home-line {
    align-items: stretch;
    flex-direction: column;
  }
  .home-line-btn {
    width: 100%;
  }

  .dup-cmp-overlay-inline { padding: 0; align-items: flex-end; }
  .dup-ci-modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 88vh;
    padding: 18px 14px 28px;
  }
  .dup-ci-grid { grid-template-columns: 1fr; }
  .dup-ci-vs { display: none; }
}
.dup-cmp-overlay-inline.open { display: flex; }
.dup-ci-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 660px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.dup-ci-close {
  position: absolute;
  top: 14px; right: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 30px; height: 30px;
  color: var(--text2);
  cursor: pointer;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
}
.dup-ci-close:hover { background: var(--surface2); color: var(--text); }
.dup-ci-header {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1rem;
  margin-bottom: 20px;
  padding-right: 30px;
}
.dup-ci-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
}
.dup-ci-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 80px;
  color: var(--text3);
  font-size: .85rem;
}
.dup-ci-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: var(--radius);
  padding: 10px;
  border: 1px solid transparent;
}
.dup-ci-canon {
  background: rgba(232,184,75,.06);
  border-color: rgba(232,184,75,.25);
}
.dup-ci-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}
.dup-ci-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--text3);
}
.dup-ci-canon .dup-ci-label { color: var(--gold); }
.dup-ci-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.dup-ci-id {
  font-size: .72rem;
  color: var(--text3);
  font-family: 'Courier New', monospace;
}
.dup-ci-desc {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.6;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ── Banlist Modal (shared) ── */
.banlist-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.banlist-overlay.open { display: flex; }
.banlist-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 860px;
  padding: 28px;
}
.banlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.banlist-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.3rem;
  margin: 0;
}
.banlist-section { margin-bottom: 28px; }
.banlist-section-label {
  font-size: .8rem;
  color: var(--text3);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.banlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}
.banlist-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  opacity: .65;
}
.banlist-card:hover {
  border-color: #f87171;
  opacity: 1;
}
.banlist-card-thumb {
  width: 100%;
  aspect-ratio: 6/5;
  overflow: hidden;
  background: var(--bg);
}
.banlist-card-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
}
.banlist-card-name {
  font-size: .7rem;
  color: var(--text2);
  text-align: center;
  padding: 4px 6px 6px;
  line-height: 1.3;
}
.banlist-empty {
  font-size: .82rem;
  color: var(--text3);
  font-style: italic;
  padding: 4px 0;
}

/* Site Footer */
.site-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text3);
  padding: 24px 20px;
  opacity: 0.8;
  margin-top: auto;
}
.footer-donate-link {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(232,184,75,.35);
  padding-bottom: 1px;
  transition: color var(--transition), border-color var(--transition);
}
.footer-donate-link:hover {
  color: var(--gold2);
  border-color: var(--gold2);
}

/* ─── Donate Section (about page) ───────────────────────────── */
.donate-box {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}
.donate-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}
.donate-qr {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px;
}
.donate-qr-label {
  font-size: .88rem;
  color: var(--text3);
}
.donate-qr-hint {
  font-size: .82rem;
  color: var(--text3);
  opacity: .75;
}
.donate-thanks {
  margin-top: 24px;
  text-align: center;
}
.donate-thanks-title {
  font-size: .9rem;
  color: var(--text2);
  margin-bottom: 10px;
  font-weight: 600;
}
.donate-thanks-empty {
  font-size: .84rem;
  color: var(--text3);
  opacity: .6;
}
.donate-thanks-list {
  font-size: .9rem;
  color: var(--gold2);
  line-height: 2;
  letter-spacing: .04em;
}

/* ─── Homepage donate CTA ────────────────────────────────────── */
.home-donate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: var(--radius);
  background: rgba(76,175,125,.07);
  border: 1px solid rgba(76,175,125,.22);
  padding: 20px;
}
.home-donate h2 {
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 4px;
}
.home-donate p {
  color: var(--text2);
  font-size: .94rem;
}
.home-donate-btn,
.home-donate-btn:link,
.home-donate-btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  flex-shrink: 0;
  background: rgba(76,175,125,.16);
  border: 1px solid rgba(76,175,125,.5);
  color: #6fcfa0;
}
.home-donate-btn:hover {
  background: rgba(76,175,125,.26);
  border-color: var(--green);
  transform: translateY(-1px);
}
@media (max-width: 640px) {
  .home-donate {
    flex-direction: column;
    align-items: stretch;
  }
  .home-donate-btn { width: 100%; }
}

/* ── 首頁重大更新專區 ───────────────────────────── */
.home-updates {
  margin-top: 48px;
}
.home-updates-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.home-updates-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.home-updates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-update-card {
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  background: rgba(47,41,33,.7);
  padding: 14px 18px;
}
.home-update-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.home-update-date {
  font-size: .75rem;
  color: var(--text3);
}
.home-update-tag {
  font-size: .72rem;
  font-weight: 600;
  color: var(--gold);
  border: 1px solid rgba(232,184,75,.45);
  border-radius: 100px;
  padding: 1px 8px;
}
@keyframes update-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}
.home-update-new {
  font-size: .68rem;
  font-weight: 700;
  background: #c0392b;
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  animation: update-pulse 1.5s ease-in-out infinite;
}
.home-update-title {
  font-size: .98rem;
  font-weight: 700;
  color: var(--gold2);
  margin-bottom: 8px;
}
.home-update-items {
  padding-left: 18px;
  margin: 0;
}
.home-update-items li {
  font-size: .88rem;
  color: var(--text2);
  line-height: 1.7;
}
.home-updates-more {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text2);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.home-updates-more:hover {
  border-color: var(--gold);
  color: var(--gold);
}

@media (max-width: 640px) {
  .home-updates { margin-top: 32px; }
  .home-update-card { padding: 12px 14px; }
}
