:root {
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-card-hover: #1f2a42;
  --border: #2a3550;
  --text-primary: #e8eaf0;
  --text-secondary: #8892a8;
  --accent-cyan: #26c7ff;
  --accent-gold: #ffd700;
  --accent-purple: #a855f7;
  --tier1: #ffd700;
  --tier2: #c0c0c0;
  --tier3: #cd7f32;
  --rating-s: #ffd700;
  --rating-a: #4caf50;
  --rating-b: #78909c;
  --color-white: #e0e0e0;
  --color-green: #4caf50;
  --color-red: #f44336;
  --color-blue: #2196f3;
  --color-purple: #9c27b0;
  --color-yellow: #ffeb3b;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 4px 20px rgba(0,0,0,.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Noto Sans TC', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

.site-header {
  background: linear-gradient(135deg, #0f1629 0%, #1a1040 50%, #0f1629 100%);
  border-bottom: 2px solid var(--accent-cyan);
  padding: 2rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 12rem;
}
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(38,199,255,.12) 0%, transparent 60%);
  pointer-events: none;
}
.header-inner { position: relative; z-index: 1; }

.site-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  letter-spacing: 0.08em;
}
.title-holo { color: var(--accent-cyan); }
.title-card { color: var(--text-primary); }
.title-meta {
  display: inline-block;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  padding: 0 0.4em;
  margin-left: 0.3em;
  border-radius: 4px;
  font-size: 0.75em;
}
.site-subtitle {
  color: var(--text-secondary);
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.lang-btn {
  background: rgba(255,255,255,.08);
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.lang-btn:hover { color: var(--text-primary); border-color: var(--accent-cyan); }
.lang-btn.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  font-weight: 700;
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 3.5rem;
}
.nav-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.nav-btn:hover { color: var(--text-primary); border-color: var(--accent-cyan); }
.nav-btn.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
  font-weight: 700;
}

.filter-bar {
  background: var(--bg-secondary);
  padding: 0.8rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; align-items: center; gap: 0.5rem; }
.filter-group label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.color-filters, .type-filters, .tier-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.color-btn, .type-btn, .tier-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.color-btn:hover, .type-btn:hover, .tier-btn:hover { border-color: var(--accent-cyan); color: var(--text-primary); }
.color-btn.active {
  background: var(--c, var(--accent-cyan));
  color: var(--ct, var(--bg-primary));
  border-color: transparent;
  font-weight: 700;
}
.type-btn.active, .tier-btn.active {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: transparent;
  font-weight: 700;
}
.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 280px;
  font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--accent-cyan); }

#mainContent { min-height: 80vh; }
.view { display: none; padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.view.active { display: block; }
.loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 4rem;
  font-size: 1.1rem;
}

/* Tier Section */
.tier-section { margin-bottom: 2.5rem; }
.tier-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border);
}
.tier-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 0.3rem 1rem;
  border-radius: var(--radius);
  letter-spacing: 0.05em;
}
.tier-badge[data-tier="1"] { background: var(--tier1); color: #1a1200; }
.tier-badge[data-tier="2"] { background: var(--tier2); color: #1a1a1a; }
.tier-badge[data-tier="3"] { background: var(--tier3); color: #1a1200; }
.tier-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.tier-criteria {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-left: auto;
  font-style: italic;
}

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.deck-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 20px rgba(38,199,255,.1);
}
.deck-card-image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--bg-secondary);
}
.deck-card-body { padding: 1rem; }
.deck-card-top { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.deck-vtuber {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 4px;
}
.deck-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.deck-ratings {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.rating-chip {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 3px;
}
.rating-label { color: var(--text-secondary); }
.rating-value { font-weight: 700; }
.rating-value[data-val="◎"] { color: var(--rating-s); }
.rating-value[data-val="○"] { color: var(--rating-a); }
.rating-value[data-val="△"] { color: var(--rating-b); }
.deck-features {
  font-size: 0.82rem;
  color: var(--text-secondary);
  list-style: none;
}
.deck-features li { padding-left: 1em; text-indent: -1em; margin-bottom: 0.2rem; }
.deck-features li::before { content: '▸ '; color: var(--accent-cyan); }
.deck-recipe-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(38,199,255,.85);
  color: var(--bg-primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.deck-no-image {
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  font-size: 2rem;
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Deck Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
#cardModal { z-index: 110; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
  margin: 0.8rem;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--accent-cyan); color: var(--bg-primary); }

.modal-deck-header { padding: 1.5rem 1.5rem 0; }
.modal-deck-header img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.modal-deck-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.modal-deck-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.modal-deck-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.modal-section {
  padding: 0 1.5rem 1.5rem;
}
.modal-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.8rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.card-entry {
  display: flex;
  gap: 1rem;
  padding: 0.8rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  border: 1px solid var(--border);
}
.card-entry:hover { border-color: var(--accent-cyan); }
.card-entry-img {
  width: 80px;
  height: 112px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.card-entry-info { flex: 1; min-width: 0; }
.card-entry-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}
.card-entry-id {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-bottom: 0.3rem;
  font-family: 'Orbitron', monospace;
}
.card-entry-role {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: pre-line;
  line-height: 1.5;
}

.strategy-block {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
}
.strategy-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--accent-gold);
}
.strategy-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-line;
}

.modal-source-link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--accent-cyan);
  color: var(--bg-primary);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 700;
  transition: opacity 0.15s;
}
.modal-source-link:hover { opacity: 0.85; }

/* Clickable cards in deck modals */
.clickable-card {
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Official Deck Modal */
.official-oshi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.official-oshi img {
  width: 80px;
  border-radius: 6px;
}
.official-oshi span {
  font-weight: 600;
  font-size: 1rem;
}
.official-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}
.official-card-entry {
  text-align: center;
  position: relative;
}
.official-card-entry img {
  width: 100%;
  border-radius: 4px;
}
.official-card-count {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-cyan);
}
.official-card-id {
  display: block;
  font-size: 0.65rem;
  color: var(--text-secondary);
}
.official-key-card {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 8px;
}
.official-key-card img {
  width: 80px;
  border-radius: 4px;
  flex-shrink: 0;
}
.official-key-card-name {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.official-key-card-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Rule Badges */
.gallery-card-img-wrap {
  position: relative;
}
.card-rule-badges {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  z-index: 2;
}
.card-rule-badge {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}
.card-rule-badge.restricted {
  background: rgba(244,67,54,.9);
  color: #fff;
}
.card-rule-badge.errata {
  background: rgba(255,152,0,.9);
  color: #fff;
}
.card-rule-badges-detail {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.card-rule-badges-detail .card-rule-badge {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
}
.card-rule-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
}
.card-rule-note {
  font-size: 0.78rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
}
.card-rule-note.restricted-note {
  color: #f44336;
}
.card-rule-note.errata-note {
  color: #ff9800;
}
.card-rule-articles {
  margin-top: 0.5rem;
}
.card-rule-articles-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.3rem;
}
.rule-articles-list {
  list-style: none;
  padding: 0;
}
.rule-article-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.75rem;
  padding: 0.2rem 0;
}
.rule-article-date {
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 0.7rem;
}
.rule-article-link {
  color: var(--accent-cyan);
  text-decoration: none;
}
.rule-article-link:hover {
  text-decoration: underline;
}

/* Card Gallery */
.card-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.8rem;
}
.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.gallery-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.gallery-card-img {
  width: 100%;
  aspect-ratio: 5/7;
  object-fit: cover;
  display: block;
  background: var(--bg-secondary);
}
.gallery-card-info {
  padding: 0.4rem 0.5rem;
}
.gallery-card-name {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-card-meta {
  font-size: 0.65rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.3rem;
  align-items: center;
}
.gallery-card-color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
}
.card-count-info {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Card Modal */
.card-modal-content { max-width: 720px; }
.card-detail {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
}
.card-detail-img {
  width: 240px;
  flex-shrink: 0;
  border-radius: var(--radius);
  object-fit: contain;
}
.card-detail-info { flex: 1; }
.card-detail-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.card-detail-id {
  font-family: 'Orbitron', monospace;
  font-size: 0.8rem;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}
.card-detail-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}
.tag-chip {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.card-detail-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.stat-label { color: var(--text-secondary); font-weight: 500; }
.stat-value { color: var(--text-primary); }
.card-detail-effects {
  font-size: 0.85rem;
  line-height: 1.7;
}
.card-variants {
  margin-bottom: 1rem;
}
.card-variants-label {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.card-variants-grid {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.card-variant-thumb {
  width: 60px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.12s;
  text-align: center;
}
.card-variant-thumb img {
  width: 100%;
  display: block;
}
.card-variant-thumb.active {
  border-color: var(--accent-cyan);
}
.card-variant-thumb:hover {
  transform: scale(1.05);
}
.card-variant-rarity {
  display: block;
  font-size: 0.6rem;
  color: var(--text-secondary);
  padding: 1px 0;
  background: var(--bg-secondary);
}
.effect-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.5rem;
}
.effect-name {
  font-weight: 700;
  color: var(--accent-gold);
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}
.effect-text {
  color: var(--text-secondary);
  white-space: pre-line;
}

/* Tournament View */
.tournament-header {
  margin-bottom: 2rem;
}
.tournament-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
}
.tournament-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.tournament-event-section {
  margin-bottom: 2rem;
}
.tournament-event-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border);
}
.tournament-event-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
.tournament-event-date {
  font-size: 0.78rem;
  color: var(--accent-cyan);
  opacity: 0.8;
}
.tournament-event-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.tournament-event-location {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
}
.tournament-event-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tournament-event-status.upcoming {
  background: rgba(0, 200, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 200, 255, 0.3);
}
.upcoming-event {
  opacity: 0.7;
}
.tournament-no-deck-placeholder {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px dashed var(--border);
}
.usage-chart-wrapper {
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.8rem 1rem;
}
.usage-chart-wrapper[open] > summary {
  margin-bottom: 0.6rem;
}
.usage-chart-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
}
.usage-chart-title::-webkit-details-marker { display: none; }
.usage-chart-title::before {
  content: '▶';
  font-size: 0.6rem;
  transition: transform 0.2s;
}
.usage-chart-wrapper[open] > .usage-chart-title::before {
  transform: rotate(90deg);
}
.usage-chart-scope {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-secondary);
}
.usage-chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.usage-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.usage-bar-label {
  font-size: 0.75rem;
  color: var(--text-primary);
  min-width: 110px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usage-bar-track {
  flex: 1;
  height: 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  transition: width 0.4s ease;
  min-width: fit-content;
}
.usage-bar-pct {
  font-size: 0.68rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.usage-chart-source {
  margin-top: 0.5rem;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.6;
}
.tournament-deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.8rem;
}
.tournament-deck-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.tournament-deck-card:hover {
  border-color: var(--accent-gold);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow), 0 0 20px rgba(255,215,0,.08);
}
.tournament-deck-top {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.6rem;
}
.tournament-oshi-img {
  width: 60px;
  height: 84px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.tournament-oshi-placeholder {
  width: 60px;
  height: 84px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border-radius: 4px;
  flex-shrink: 0;
}
.tournament-deck-info {
  flex: 1;
  min-width: 0;
}
.tournament-deck-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.tournament-deck-oshi {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.tournament-placement {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,215,0,.15);
  color: var(--accent-gold);
  border: 1px solid rgba(255,215,0,.3);
}
.tournament-deck-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Missing deck card */
.tournament-deck-card.missing-deck {
  opacity: 0.55;
  border-style: dashed;
  cursor: default;
}
.tournament-deck-card.missing-deck:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
  background: var(--bg-card);
}
.missing-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.missing-deck-note {
  font-style: italic;
  color: var(--text-secondary);
}

/* Tournament Modal */
.tournament-oshi-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: var(--accent-purple);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 0.4rem;
}
.tournament-event-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: rgba(38,199,255,.15);
  color: var(--accent-cyan);
  font-size: 0.78rem;
  border: 1px solid rgba(38,199,255,.3);
  margin-right: 0.4rem;
}
.tournament-placement-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  background: rgba(255,215,0,.12);
  color: var(--accent-gold);
  font-size: 0.78rem;
  border: 1px solid rgba(255,215,0,.25);
}
.dl-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.6rem;
}
.dl-card-entry {
  display: flex;
  gap: 0.6rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  align-items: center;
}
.dl-card-entry:hover { border-color: var(--accent-cyan); }
.dl-card-img {
  width: 48px;
  height: 67px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.dl-card-placeholder {
  width: 48px;
  height: 67px;
  background: var(--bg-secondary);
  border-radius: 3px;
  flex-shrink: 0;
}
.dl-card-info { flex: 1; min-width: 0; }
.dl-card-name {
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dl-card-id {
  font-family: 'Orbitron', monospace;
  font-size: 0.65rem;
  color: var(--accent-cyan);
}
.dl-card-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.site-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.site-footer a { color: var(--accent-cyan); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.skel-line { background: var(--bg-card); border-radius: 4px; }
.skel-card {
  height: 280px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  animation: skel-pulse 1.5s ease-in-out infinite;
}
@keyframes skel-pulse { 0%, 100% { opacity: .6; } 50% { opacity: .3; } }

/* ── Guides View ── */
.guides-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.guides-header h2 {
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.guides-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  min-height: 2.88rem;
}
.guides-search-box {
  max-width: 400px;
  margin: 0.6rem auto 0;
}
.guides-count {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.guides-load-more-wrap {
  text-align: center;
  margin: 1.5rem 0;
}
.guides-load-more-btn {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border: none;
  border-radius: 8px;
  padding: 0.7rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.guides-load-more-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}
.guide-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.guide-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.guide-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}
.guide-card-img.card-art {
  object-position: center 20%;
}
.guide-card-noimg {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--bg-secondary);
  border-radius: 12px 12px 0 0;
}
.guide-card-body {
  padding: 0.8rem;
  flex: 1;
}
.guide-card-top {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.guide-source-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}
.guide-source-badge.tier-src {
  background: var(--accent-pink);
  color: #fff;
}
.guide-source-badge.guide-src {
  background: var(--accent-cyan);
  color: #000;
}
.guide-source-badge.official-src {
  background: linear-gradient(135deg, #f5af19, #f12711);
  color: #fff;
}
.guide-tier-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.5rem;
  border-radius: 8px;
  font-weight: 700;
  background: rgba(255,255,255,0.1);
  color: var(--text-secondary);
}
.guide-tier-badge[data-tier="1"] { background: #ffd700; color: #000; }
.guide-tier-badge[data-tier="2"] { background: #c0c0c0; color: #000; }
.guide-tier-badge[data-tier="3"] { background: #cd7f32; color: #000; }
.guide-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  line-height: 1.3;
}
.guide-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.4rem;
}
.guide-color-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: auto;
}
.guide-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.2);
}
.guide-card-meta {
  display: flex;
  gap: 0.8rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.guide-card-date {
  color: var(--accent-cyan);
  opacity: 0.8;
}

@media (max-width: 600px) {
  /* Header compact */
  .site-header { padding: 1.2rem 0.8rem; min-height: 9rem; }
  .site-subtitle { font-size: 0.78rem; }
  .lang-switcher { margin-top: 0.5rem; }
  .lang-btn { padding: 2px 10px; font-size: 0.72rem; }

  /* Nav compact */
  .main-nav { padding: 0.6rem; gap: 0.35rem; min-height: 2.8rem; }
  .nav-btn { padding: 0.4rem 0.9rem; font-size: 0.82rem; }

  /* Filter compact */
  .filter-bar { padding: 0.6rem 0.8rem; min-height: 4.2rem; gap: 0.6rem; }
  .filter-group label { font-size: 0.72rem; }
  .color-btn, .type-btn, .tier-btn { padding: 2px 8px; font-size: 0.72rem; }
  .search-input { width: 100%; }
  .color-filters, .tier-filters, .type-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .color-filters::-webkit-scrollbar,
  .tier-filters::-webkit-scrollbar,
  .type-filters::-webkit-scrollbar { display: none; }

  /* Content compact */
  .view { padding: 1rem; }
  .guides-header { margin-bottom: 0.8rem; }
  .guides-header h2 { font-size: 1.2rem; margin-bottom: 0.2rem; }
  .guides-desc { font-size: 0.8rem; min-height: 2.56rem; }
  .guides-count { margin-bottom: 0.6rem; }

  /* Cards compact */
  .guide-card { min-height: 240px; }
  .guide-card-img, .guide-card-noimg { height: 140px; }
  .guide-card-body { padding: 0.6rem; }
  .guide-card-title { font-size: 0.88rem; }
  .guide-card-desc {
    font-size: 0.72rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .skel-card { height: 240px; }

  /* Grids */
  .deck-grid { grid-template-columns: 1fr; }
  .guides-grid { grid-template-columns: 1fr; }
  .tournament-deck-grid { grid-template-columns: 1fr; }
  .dl-card-grid { grid-template-columns: 1fr; }
  .card-gallery { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .card-modal-content .modal-close { float: none; display: block; margin: 0.5rem 0.5rem -2rem auto; }
  .card-detail { flex-direction: column; align-items: center; text-align: center; }
  .card-detail-img { width: 180px; }
  .card-detail-info { width: 100%; }
  .card-detail-tags { justify-content: center; }
  .card-detail-stats { grid-template-columns: auto auto; width: fit-content; margin-left: auto; margin-right: auto; gap: 0.3rem 0.8rem; }
  .card-detail-effects { text-align: left; }

  /* Footer compact */
  .site-footer { padding: 1.2rem 0.8rem; }
}
