:root,
body[data-theme="tropical-storm"] {
  --bg: #0f2b30;
  --bg-top: #14616b;
  --surface: #198490;
  --surface-elevated: #22a6b4;
  --accent: #ffd93d;
  --accent-2: #ff7f50;
  --accent-soft: rgba(255, 217, 61, 0.22);
  --text-primary: #f4ffff;
  --text-secondary: #bee8ea;
  --success: #6cf4a7;
  --error: #ff7070;
  --warning: #ffe36b;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="pixel-sunrise"] {
  --bg: #24113a;
  --bg-top: #4a1f63;
  --surface: #5d2d78;
  --surface-elevated: #74409a;
  --accent: #ffb000;
  --accent-2: #ff5e5b;
  --accent-soft: rgba(255, 176, 0, 0.26);
  --text-primary: #fff8ef;
  --text-secondary: #f1cbb6;
  --success: #65e58d;
  --error: #ff6666;
  --warning: #ffe066;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="tropical-storm"] {
  --bg: #0f2b30;
  --bg-top: #14616b;
  --surface: #198490;
  --surface-elevated: #22a6b4;
  --accent: #ffd93d;
  --accent-2: #ff7f50;
  --accent-soft: rgba(255, 217, 61, 0.22);
  --text-primary: #f4ffff;
  --text-secondary: #bee8ea;
  --success: #6cf4a7;
  --error: #ff7070;
  --warning: #ffe36b;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="sunset-racer"] {
  --bg: #2a1020;
  --bg-top: #6d1f4b;
  --surface: #983060;
  --surface-elevated: #c44479;
  --accent: #ffb347;
  --accent-2: #ff5c8a;
  --accent-soft: rgba(255, 179, 71, 0.22);
  --text-primary: #fff7f4;
  --text-secondary: #f0c3cb;
  --success: #6ceb8f;
  --error: #ff7070;
  --warning: #ffe066;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="candy-comet"] {
  --bg: #20104b;
  --bg-top: #4724a8;
  --surface: #5f35cc;
  --surface-elevated: #784ae4;
  --accent: #ff7ad9;
  --accent-2: #ffd84d;
  --accent-soft: rgba(255, 122, 217, 0.22);
  --text-primary: #fbf7ff;
  --text-secondary: #d8caf4;
  --success: #6df2a0;
  --error: #ff6f7d;
  --warning: #ffe066;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="jade-flare"] {
  --bg: #0d2a23;
  --bg-top: #15705a;
  --surface: #1d9174;
  --surface-elevated: #26b08d;
  --accent: #ffcf33;
  --accent-2: #ff6b35;
  --accent-soft: rgba(255, 207, 51, 0.2);
  --text-primary: #f4fffb;
  --text-secondary: #bde7db;
  --success: #7dff9f;
  --error: #ff6d6d;
  --warning: #ffe36b;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="starfruit-dojo"] {
  --bg: #2d1b0f;
  --bg-top: #7a4a17;
  --surface: #a9631f;
  --surface-elevated: #cf7f28;
  --accent: #e7ff52;
  --accent-2: #ff784f;
  --accent-soft: rgba(231, 255, 82, 0.2);
  --text-primary: #fffdf3;
  --text-secondary: #efdcb6;
  --success: #7df39b;
  --error: #ff6f6f;
  --warning: #ffe56d;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="dragon-fruit"] {
  --bg: #2b1029;
  --bg-top: #8a1f68;
  --surface: #b72d87;
  --surface-elevated: #db45a4;
  --accent: #9cff57;
  --accent-2: #ffd447;
  --accent-soft: rgba(156, 255, 87, 0.2);
  --text-primary: #fff8fd;
  --text-secondary: #f0c8e7;
  --success: #74ffad;
  --error: #ff7078;
  --warning: #ffe56d;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="turbo-sakura"] {
  --bg: #24173d;
  --bg-top: #6f3ccf;
  --surface: #8d55e6;
  --surface-elevated: #a873f2;
  --accent: #7af6ff;
  --accent-2: #ffd84d;
  --accent-soft: rgba(122, 246, 255, 0.22);
  --text-primary: #fff8fc;
  --text-secondary: #ddd2f7;
  --success: #73f7a2;
  --error: #ff6e78;
  --warning: #ffe56d;
  --line: rgba(255, 255, 255, 0.12);
}

body[data-theme="sky-arena"] {
  --bg: #12305b;
  --bg-top: #2a7de1;
  --surface: #44a1ff;
  --surface-elevated: #63b7ff;
  --accent: #ffef5a;
  --accent-2: #ff8c42;
  --accent-soft: rgba(255, 239, 90, 0.2);
  --text-primary: #f7fcff;
  --text-secondary: #d2e7fb;
  --success: #76f5a0;
  --error: #ff7171;
  --warning: #ffe56d;
  --line: rgba(255, 255, 255, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  background:
    radial-gradient(circle at top, var(--accent-soft), transparent 35%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 100%);
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 1rem;
}

.site-header,
.section-heading,
.results-actions,
.support-actions,
.results-strip {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-header,
.section-heading {
  justify-content: space-between;
}

.site-header {
  padding: 0.5rem 0 1.25rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.inline-form {
  margin: 0;
}

.nav-button {
  border: 0;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.site-nav a,
.inline-link,
.tile-meta,
.support-copy,
.hud-label {
  color: var(--text-secondary);
}

.wordmark {
  font-family: "Audiowide", sans-serif;
  font-size: clamp(1.35rem, 4vw, 2rem);
  color: var(--accent);
}

.page-shell {
  display: grid;
  gap: 1rem;
}

.hero-panel,
.panel,
.answer-card,
.action-tile,
.stat-card {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--line);
  border-radius: 24px;
}

.hero-panel,
.panel {
  padding: 1.4rem;
}

.panel-muted {
  background: rgba(37, 44, 51, 0.85);
}

body[data-theme="pixel-sunrise"] .panel-muted {
  background: rgba(116, 64, 154, 0.85);
}

body[data-theme="tropical-storm"] .panel-muted {
  background: rgba(34, 166, 180, 0.85);
}

body[data-theme="sunset-racer"] .panel-muted {
  background: rgba(196, 68, 121, 0.85);
}

body[data-theme="candy-comet"] .panel-muted {
  background: rgba(120, 74, 228, 0.85);
}

body[data-theme="jade-flare"] .panel-muted {
  background: rgba(38, 176, 141, 0.85);
}

body[data-theme="starfruit-dojo"] .panel-muted {
  background: rgba(207, 127, 40, 0.85);
}

body[data-theme="dragon-fruit"] .panel-muted {
  background: rgba(219, 69, 164, 0.85);
}

body[data-theme="turbo-sakura"] .panel-muted {
  background: rgba(242, 108, 186, 0.85);
}

body[data-theme="sky-arena"] .panel-muted {
  background: rgba(99, 183, 255, 0.85);
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.4rem);
}

h2 {
  font-size: 1.35rem;
}

.lede,
.feature-list,
.support-copy,
.stack-form label,
input {
  font-size: 1rem;
}

.lede,
.support-copy,
.feature-list p,
.action-tile p {
  color: var(--text-secondary);
}

.tile-grid {
  display: grid;
  gap: 1rem;
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.action-tile {
  display: flex;
  justify-content: space-between;
  align-items: end;
  min-height: 180px;
  padding: 1.25rem;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.action-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 164, 76, 0.45);
}

.action-tile-practice {
  background: linear-gradient(180deg, rgba(63, 174, 114, 0.08), rgba(26, 31, 36, 0.9));
}

.action-tile-ranked {
  background: linear-gradient(180deg, rgba(201, 164, 76, 0.12), rgba(26, 31, 36, 0.9));
}

.action-tile.is-disabled {
  opacity: 0.6;
}

.feature-list {
  margin: 1rem 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.45rem;
}

.pill,
.hud-value,
.button,
.leaderboard-score {
  font-family: "Manrope", sans-serif;
}

.pill,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.pill {
  padding: 0.35rem 0.8rem;
  background: rgba(201, 164, 76, 0.14);
  color: var(--accent);
  font-size: 0.9rem;
}

.button {
  padding: 0.9rem 1.2rem;
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  background: var(--accent);
  color: #111315;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--line);
}

.stack-form {
  display: grid;
  gap: 0.8rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font: inherit;
}

select option {
  color: #111315;
  background: #ffffff;
}

input[type="file"] {
  padding: 0.6rem 0;
  border: 0;
  background: transparent;
}

.field,
.admin-form,
.admin-filter-grid {
  display: grid;
  gap: 0.5rem;
}

.admin-form {
  gap: 1rem;
}

.field-grid {
  display: grid;
  gap: 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-row input {
  width: auto;
}

.field label {
  font-weight: 700;
}

.admin-filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.field-actions {
  align-self: end;
}

.admin-shell {
  width: min(100%, 820px);
  margin: 0 auto;
}

.admin-table {
  display: grid;
  gap: 0.75rem;
}

.admin-table-row {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.8fr 0.6fr 1.2fr 0.8fr 0.9fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.admin-table-head {
  background: rgba(201, 164, 76, 0.08);
  color: var(--text-secondary);
  font-weight: 800;
}

.tiny-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  margin: 0.1rem 0.2rem 0.1rem 0;
}

.danger-link {
  color: var(--error);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.image-preview-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
}

.image-preview-card img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  padding: 0.75rem;
}

.preview-panel {
  display: grid;
  gap: 0.25rem;
}

.hint-image-panel,
.review-image-panel {
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem;
}

.hint-image-panel img,
.review-image-panel img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin: 0 auto;
}

.game-shell {
  display: grid;
  gap: 1rem;
}

.game-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border-radius: 22px;
  background: rgba(10, 11, 13, 0.72);
  border: 1px solid var(--line);
}

.hud-group {
  display: grid;
  gap: 0.2rem;
}

.hud-group-progress {
  justify-items: end;
}

.hud-value {
  font-size: 1.15rem;
}

.heart-row {
  display: flex;
  gap: 0.35rem;
  font-size: 1.1rem;
}

.heart {
  transition: transform 0.2s ease, color 0.2s ease, text-shadow 0.2s ease;
}

.heart.is-full {
  color: var(--error);
}

.heart.is-empty {
  color: rgba(255, 255, 255, 0.28);
}

.heart.is-lost-now {
  color: #ff7676;
  transform: scale(1.45);
  text-shadow: 0 0 16px rgba(214, 69, 69, 0.65);
  animation: heart-loss 0.8s ease;
}

@keyframes heart-loss {
  0% {
    transform: scale(1.85);
  }
  35% {
    transform: scale(1.15) rotate(-10deg);
  }
  100% {
    transform: scale(1.45);
  }
}

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #f0c96c);
}

.question-panel {
  min-height: 170px;
}

.answers-grid {
  display: grid;
  gap: 0.8rem;
}

.answer-card {
  position: relative;
  width: 100%;
  min-height: 72px;
  padding: 1rem 1.1rem;
  color: var(--text-primary);
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.answer-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-width: 3px;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 164, 76, 0.18);
}

.answer-card:disabled {
  cursor: default;
}

.answer-card.is-selected {
  border-width: 3px;
  border-color: var(--warning);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(224, 161, 59, 0.2);
}

.answer-card.is-correct {
  background: rgba(63, 174, 114, 0.18);
  border-color: var(--success);
  border-width: 3px;
}

.answer-card.is-incorrect {
  background: rgba(214, 69, 69, 0.14);
  border-color: var(--error);
  border-width: 3px;
}

.answer-card.is-muted {
  color: rgba(247, 244, 237, 0.34);
  background: rgba(0, 0, 0, 0.24);
  border-color: rgba(255, 255, 255, 0.06);
}

.answer-text-hidden {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(247, 244, 237, 0.55);
}

.answer-burst {
  position: absolute;
  right: 1rem;
  top: 0.9rem;
  color: var(--accent);
  font-weight: 800;
}

.feedback-banner {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 2px solid var(--line);
  font-weight: 800;
}

.feedback-banner.is-correct {
  border-color: var(--success);
  background: rgba(63, 174, 114, 0.14);
}

.feedback-banner.is-incorrect {
  border-color: var(--error);
  background: rgba(214, 69, 69, 0.14);
}

.results-strip {
  flex-wrap: wrap;
  margin: 1rem 0;
}

.stat-card {
  min-width: 150px;
  padding: 1rem;
  display: grid;
  gap: 0.25rem;
}

.stat-card strong {
  font-size: 1.5rem;
}

.final-score-pop {
  display: inline-block;
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  line-height: 1;
  transform-origin: center;
  animation: final-score-pop 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 42%, transparent);
}

@keyframes final-score-pop {
  0% {
    transform: scale(0.55);
    opacity: 0.35;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.review-list,
.leaderboard-list,
.flash-stack {
  display: grid;
  gap: 0.75rem;
}

.review-card,
.leaderboard-row {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.review-card {
  padding: 1rem;
}

.answer-ok {
  color: var(--success);
}

.answer-bad {
  color: var(--error);
  text-decoration: line-through;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
}

.leaderboard-row.is-me {
  background: rgba(201, 164, 76, 0.12);
  border-color: rgba(201, 164, 76, 0.35);
}

.leaderboard-rank {
  font-size: 1.2rem;
  text-align: center;
}

.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: #111315;
  font-weight: 800;
}

.medal-gold {
  background: linear-gradient(180deg, #f5d66d, #c9a44c);
}

.medal-silver {
  background: linear-gradient(180deg, #e2e6ed, #9fa7b5);
}

.medal-bronze {
  background: linear-gradient(180deg, #d99b72, #9f6543);
}

.leaderboard-score {
  font-size: 1.1rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-badge {
  width: 5rem;
  height: 5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Audiowide", sans-serif;
  font-size: 1.8rem;
  color: #111315;
}

.avatar-white-belt {
  background: linear-gradient(180deg, #f4f3ef, #d5d4cf);
}

.avatar-green-belt {
  background: linear-gradient(180deg, #72d48d, #3fae72);
}

.avatar-brown-belt {
  background: linear-gradient(180deg, #cc9a72, #8b5e3a);
}

.avatar-black-belt {
  background: linear-gradient(180deg, #4e545d, #13161a);
  color: #f7f4ed;
}

.badge-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.badge-card {
  border-radius: 18px;
  border: 1px solid rgba(201, 164, 76, 0.18);
  background: linear-gradient(180deg, rgba(201, 164, 76, 0.12), rgba(255, 255, 255, 0.03));
  padding: 1rem;
}

.admin-table-row-style {
  grid-template-columns: 1.2fr 1fr 0.9fr 0.5fr 0.8fr 0.6fr;
}

.admin-table-row-category {
  grid-template-columns: 1fr 0.8fr 0.4fr 1.3fr 0.5fr;
}

.flash {
  border-radius: 16px;
  padding: 0.85rem 1rem;
}

.flash-warning {
  background: rgba(224, 161, 59, 0.12);
  border: 1px solid rgba(224, 161, 59, 0.35);
}

@media (min-width: 900px) {
  .app-shell {
    width: min(100%, 1200px);
  }

  .game-shell {
    width: min(100%, 66vw);
    margin: 0 auto;
  }

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

  .field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .admin-table-row {
    grid-template-columns: 1fr;
  }

  .admin-table-head {
    display: none;
  }
}
