:root {
  --bg: #faf5e8;
  --card: #ffffff;
  --ink: #1c1917;
  --muted: #57534e;
  --gold: #f59e0b;
  --teal: #0d9488;
  --pink: #ec4899;
  --cream: #fef3c7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Fredoka', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: var(--teal);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-shell {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 14px 48px;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 10px 14px;
  margin-bottom: 18px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.08rem;
}

.brand-link img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.top-nav a {
  color: var(--ink);
  font-size: 0.88rem;
  padding: 3px 8px;
  border-radius: 8px;
}

.top-nav a:hover {
  background: var(--cream);
  text-decoration: none;
}

.locale-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.locale-links a {
  font-size: 0.76rem;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: #fffdf7;
}

.hub-top-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.hub-badge {
  display: inline-block;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 800;
}

.sound-btn {
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
}

.mode-pills,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-pill,
.filter-pill {
  background: var(--card);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.mode-pill.is-active,
.filter-pill.is-on {
  background: var(--gold);
  box-shadow: 2px 2px 0 var(--ink);
}

.sticker-card {
  background: var(--card);
  border: 3.5px solid var(--ink);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 20px;
  overflow: hidden;
}

.main-h1 {
  margin: 0 0 10px;
  font-size: 1.75rem;
  line-height: 1.18;
}

.start-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
}

.squad-invite-banner {
  background: #ccfbf1;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

.btn-ink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 12px 18px;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  color: #ffffff;
}

.btn-ink:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.btn-big {
  width: 100%;
  padding: 15px 20px;
  font-size: 1.1rem;
}

.btn-pink {
  background: var(--pink);
}

.btn-teal {
  background: var(--teal);
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fffdf7;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}

.quick-jump-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.jump-tile {
  background: #fffdf7;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 12px 10px;
  font-weight: 800;
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.jump-tile:hover {
  background: var(--cream);
}

.q-meta {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: #e7e5e4;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: var(--teal);
  transition: width 0.2s ease;
}

.q-prompt {
  margin: 0 0 16px;
  font-size: 1.25rem;
  line-height: 1.3;
}

.choices-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fffdf7;
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 13px 14px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.choice-tile:hover:not(:disabled) {
  background: var(--cream);
}

.choice-tile.is-correct {
  background: #bbf7d0;
}

.choice-tile.is-wrong {
  background: #fecdd3;
}

.choice-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.reveal-card {
  padding: 0;
}

.reveal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  color: #ffffff;
  font-weight: 900;
  border-bottom: 3.5px solid var(--ink);
}

.reveal-body {
  padding: 20px;
}

.reveal-name {
  margin: 0 0 4px;
  font-size: 2rem;
}

.reveal-arch {
  margin: 0 0 10px;
  color: var(--teal);
  font-weight: 800;
}

.reveal-blurb {
  margin: 0 0 16px;
  color: var(--muted);
}

.synergy-card {
  background: #ccfbf1;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.synergy-card .kicker {
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--teal);
}

.synergy-card h3 {
  margin: 4px 0;
}

.synergy-card p {
  margin: 0;
  font-size: 0.92rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fffdf7;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
}

.stars {
  color: #d97706;
  letter-spacing: 2px;
}

.meta-pair-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.meta-box {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 10px 12px;
}

.meta-box span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 800;
}

.card-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

#result-card-canvas,
#wheel-card-canvas {
  width: 100%;
  max-width: 380px;
  height: auto;
  border-radius: 16px;
  border: 3px solid var(--ink);
}

.wheel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#spin-wheel-canvas {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
}

.wheel-result-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 3px dashed var(--ink);
}

.grade-pill {
  display: inline-block;
  background: var(--gold);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 900;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.action-row .btn-ink,
.action-row .btn-outline {
  flex: 1 1 160px;
}

/* Compact 6-column Dandy's-dle grid guaranteed to fit inside 390px */
.dle-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.dle-row {
  display: grid;
  grid-template-columns: 1.45fr repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.dle-cell {
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 7px 3px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f5f5f4;
}

.dle-head .dle-cell {
  background: var(--ink);
  color: #ffffff;
}

.cell-name {
  background: #fffdf7;
}

.cell-exact {
  background: #86efac;
}

.cell-higher,
.cell-lower {
  background: #fde047;
}

.cell-miss {
  background: #e7e5e4;
}

.empty-dle {
  text-align: center;
  color: var(--muted);
  padding: 12px;
  background: #fffdf7;
  border: 2px dashed var(--ink);
  border-radius: 12px;
}

.dle-banner {
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #bbf7d0;
}

.dle-banner.is-loss {
  background: #fecdd3;
}

.toon-tap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.toon-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: #fffdf7;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  min-width: 0;
}

.toon-tile:hover:not(:disabled) {
  background: var(--cream);
}

.toon-tile.is-used {
  opacity: 0.4;
  cursor: not-allowed;
}

.toon-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--ink);
}

.toon-tile-name {
  font-weight: 900;
  font-size: 0.92rem;
}

.toon-tile-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.tier-shelf {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}

.tier-badge {
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-weight: 900;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.tier-S { background: #fb7185; color: #fff; }
.tier-A { background: #fbbf24; }
.tier-B { background: #38bdf8; }
.tier-C { background: #a3e635; }
.tier-D { background: #d6d3d1; }

.tier-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  background: #fffdf7;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 8px;
}

.tier-chip {
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 0.84rem;
  cursor: pointer;
  font-family: inherit;
}

.tier-chip.is-selected {
  background: var(--teal);
  color: #ffffff;
}

.inspector-card {
  margin-top: 14px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 14px;
}

.inspector-card h3 {
  margin: 0 0 8px;
}

.inspector-card p {
  margin: 4px 0;
}

.trivia-explain {
  margin-top: 14px;
  background: var(--cream);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 14px;
}

.trivia-explain p {
  margin: 0 0 10px;
  font-weight: 700;
}

.ad-slot {
  margin: 20px 0;
  text-align: center;
}

.ad-slot[data-active='false'] {
  display: none;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.seo-section {
  margin-top: 28px;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 5px 5px 0 var(--ink);
  padding: 20px;
}

.seo-section h1,
.seo-section h2 {
  margin-top: 0;
}

.seo-section h2 {
  margin-top: 24px;
  font-size: 1.3rem;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.ref-table th,
.ref-table td {
  border: 2px solid var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.ref-table th {
  background: var(--cream);
}

.faq-item {
  border-top: 2px solid #e7e5e4;
  padding: 12px 0;
}

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 2px dashed var(--ink);
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.footer-links a {
  color: var(--ink);
}

.footer-notice {
  margin: 0;
}

@media (min-width: 760px) {
  .main-h1 {
    font-size: 2.2rem;
  }

  .stats-grid,
  .meta-pair-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toon-tap-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dle-cell {
    font-size: 0.88rem;
    padding: 9px 6px;
  }

  .seo-section {
    padding: 28px;
  }
}
