:root {
  --bg: #071b37;
  --card: #112b4a;
  --text: #f1f7ff;
  --muted: #b2c5de;
  --accent: #ffd24f;
  --accent-dark: #7d5e00;
  --wrong: #ff836f;
  --right: #91ef8a;
  --border: #264b77;
  --board-bg: #0f2f44;
  --tile: #28a24d;
  --tile-border: #1e7e3b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 50% -10%, #1c4a7b 0%, #0d2d4f 40%, var(--bg) 100%);
  min-height: 100vh;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

h1 {
  margin: 0;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #a7dcff;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.creator-note {
  color: #d8e9fb;
  line-height: 1.5;
}

.creator-note a {
  color: #8bd3ff;
}

.card {
  background: linear-gradient(180deg, #15365d 0%, #112b4a 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(4, 10, 25, 0.45);
  padding: 18px;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: center;
}

.hero-copy h2 {
  margin-top: 0;
}

.hero-art {
  min-height: 260px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(164, 208, 255, 0.24);
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 210, 79, 0.28) 0 8%, transparent 9%),
    radial-gradient(circle at 80% 18%, rgba(111, 240, 186, 0.24) 0 7%, transparent 8%),
    radial-gradient(circle at 72% 72%, rgba(139, 211, 255, 0.24) 0 10%, transparent 11%),
    linear-gradient(180deg, #143c67 0%, #0d2740 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.hero-art::before,
.hero-art::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: 999px;
}

.hero-art::before {
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 210, 79, 0.8) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 24%, rgba(139, 211, 255, 0.85) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 40%, rgba(145, 239, 138, 0.85) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 56%, rgba(255, 131, 111, 0.85) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 72%, rgba(255, 210, 79, 0.8) 0 7px, transparent 8px),
    radial-gradient(circle at 50% 88%, rgba(139, 211, 255, 0.85) 0 7px, transparent 8px);
  width: 68%;
  left: 16%;
  right: auto;
  opacity: 0.95;
}

.hero-art::after {
  background:
    linear-gradient(120deg, transparent 0 20%, rgba(255, 255, 255, 0.18) 20% 24%, transparent 24% 40%, rgba(255, 255, 255, 0.14) 40% 44%, transparent 44% 60%, rgba(255, 255, 255, 0.12) 60% 64%, transparent 64% 80%, rgba(255, 255, 255, 0.14) 80% 84%, transparent 84%),
    linear-gradient(90deg, transparent 0 30%, rgba(84, 212, 255, 0.65) 30% 34%, transparent 34% 66%, rgba(145, 239, 138, 0.55) 66% 70%, transparent 70%);
  clip-path: polygon(20% 0%, 34% 0%, 82% 100%, 68% 100%);
  transform: rotate(8deg);
}

.start-art {
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 210, 79, 0.28) 0 8%, transparent 9%),
    radial-gradient(circle at 80% 18%, rgba(111, 240, 186, 0.24) 0 7%, transparent 8%),
    radial-gradient(circle at 72% 72%, rgba(139, 211, 255, 0.24) 0 10%, transparent 11%),
    radial-gradient(circle at 26% 76%, rgba(255, 131, 111, 0.18) 0 10%, transparent 11%),
    linear-gradient(180deg, #173e6b 0%, #0d2740 100%);
}

.end-art {
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 210, 79, 0.34) 0 8%, transparent 9%),
    radial-gradient(circle at 82% 22%, rgba(255, 131, 111, 0.26) 0 8%, transparent 9%),
    radial-gradient(circle at 68% 74%, rgba(145, 239, 138, 0.22) 0 10%, transparent 11%),
    radial-gradient(circle at 26% 76%, rgba(139, 211, 255, 0.24) 0 10%, transparent 11%),
    linear-gradient(180deg, #21446f 0%, #102943 100%);
}

.leaderboard-card {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #2d537e;
  background: rgba(8, 28, 52, 0.45);
}

.leaderboard-head h3 {
  margin: 0 0 4px;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(17, 47, 79, 0.78);
  border: 1px solid rgba(109, 152, 196, 0.25);
}

.leaderboard-rank {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: linear-gradient(180deg, #ffd24f 0%, #f2ba21 100%);
  color: #523800;
}

.leaderboard-name {
  font-weight: 800;
}

.leaderboard-detail {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.leaderboard-time {
  font-weight: 900;
  color: #dff8a8;
}

.leaderboard-empty {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #40658c;
  color: var(--muted);
  text-align: center;
}

.progress-wrap {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(11, 34, 59, 0.92);
  border: 1px solid #30557f;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #cfe5ff;
  font-size: 0.92rem;
  font-weight: 700;
}

.gene-progress {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 4px;
}

.progress-node {
  position: relative;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #426a95;
  background: linear-gradient(180deg, #193752 0%, #10263c 100%);
  overflow: hidden;
}

.progress-node::before,
.progress-node::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.16);
}

.progress-node::before {
  top: 4px;
  height: 7px;
}

.progress-node::after {
  bottom: 4px;
  height: 7px;
}

.progress-node span {
  position: absolute;
  inset: 8px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-node.done {
  border-color: #39c267;
  background: linear-gradient(180deg, #37bb5f 0%, #1d7c39 100%);
}

.progress-node.correct {
  border-color: #39c267;
  background: linear-gradient(180deg, #41cf6b 0%, #217f3d 100%);
}

.progress-node.wrong {
  border-color: #ff8371;
  background: linear-gradient(180deg, #ff8b78 0%, #a5302a 100%);
}

.progress-node.current {
  border-color: #ffd24f;
  background: linear-gradient(180deg, #ffd24f 0%, #f0b61e 100%);
  box-shadow: 0 0 16px rgba(255, 210, 79, 0.24);
}

.progress-node.correct span,
.progress-node.wrong span {
  background: rgba(255, 255, 255, 0.18);
}

.progress-node.current span {
  background: rgba(85, 60, 0, 0.22);
}

.timer-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 98px;
  padding: 10px 12px;
  border: 2px solid #4975a4;
  border-radius: 12px;
  background: radial-gradient(circle at top, #1e4e7a 0%, #143554 70%, #102a43 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.timer-label,
.timer-seconds {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.timer-value {
  display: block;
  font-size: 3.4rem;
  line-height: 1;
  font-weight: 900;
  color: #fff4b0;
  text-shadow: 0 0 14px rgba(255, 210, 79, 0.45);
}

.timer-panel.warning .timer-value {
  color: #ffd0b8;
  text-shadow: 0 0 14px rgba(255, 131, 111, 0.55);
  animation: timerPulse 1s steps(2, end) infinite;
}

@keyframes timerPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

.puzzle-wrap {
  background: var(--board-bg);
  border: 2px solid #2e618a;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.puzzle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 56px;
}

.puzzle-tile {
  width: 34px;
  height: 42px;
  border-radius: 6px;
  border: 2px solid var(--tile-border);
  background: linear-gradient(180deg, #37bb5f 0%, var(--tile) 100%);
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.puzzle-tile.hidden-tile {
  color: transparent;
  background: linear-gradient(180deg, #2a9047 0%, #237a3c 100%);
}

.puzzle-space {
  width: 18px;
}

.options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

button {
  font: inherit;
}

.option-btn,
.primary {
  border: 1px solid #6a92bf;
  background: #e5f1ff;
  color: #17375a;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.option-btn:hover:not(:disabled),
.primary:hover {
  background: #d4e9ff;
}

.primary:disabled {
  cursor: default;
  opacity: 0.6;
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.9;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.option-label {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #17375a;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  line-height: 1.35;
}

.option-btn.correct {
  border-color: #69d96f;
  background: #e5fae9;
}

.option-btn.wrong {
  border-color: #ff7f71;
  background: #ffe9e5;
}

.feedback {
  min-height: 24px;
  margin-top: 12px;
  font-weight: 700;
}

.feedback.good {
  color: var(--right);
}

.feedback.bad {
  color: var(--wrong);
}

.letter-bank-wrap {
  margin-top: 14px;
  background: rgba(14, 36, 64, 0.7);
  border: 1px solid #345d87;
  border-radius: 10px;
  padding: 10px;
}

.letter-bank {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 6px;
}

.letter-btn {
  border: 1px solid #567ca8;
  background: linear-gradient(180deg, #245f9b 0%, #1e4f84 100%);
  color: #f7fbff;
  border-radius: 7px;
  padding: 8px 0;
  font-weight: 700;
  cursor: pointer;
}

.letter-btn:disabled {
  cursor: default;
  opacity: 1;
}

.letter-btn.active {
  border-color: #ffd24f;
  background: linear-gradient(180deg, #ffd24f 0%, #f5ba1b 100%);
  color: #553c00;
  box-shadow: 0 0 0 1px rgba(255, 210, 79, 0.35), 0 0 18px rgba(255, 210, 79, 0.2);
}

.letter-btn.locked {
  background: linear-gradient(180deg, #193856 0%, #132b43 100%);
  border-color: #355877;
  color: #7f9dbb;
  opacity: 0.72;
}

.letter-btn.used {
  background: linear-gradient(180deg, #6b2b2b 0%, #481d1d 100%);
  border-color: #a64e4e;
  color: #ffd7d7;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 215, 0.08);
}

input[type="text"] {
  width: 100%;
  border: 1px solid #6f92b9;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  margin-top: 10px;
  color: #103254;
}

input[type="text"]:disabled {
  opacity: 0.7;
  background: #d8e2ec;
}

.actions {
  margin-top: 10px;
}

.high-score-entry {
  margin: 16px 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #41688f;
  background: rgba(7, 26, 47, 0.5);
}

.sources {
  font-size: 0.88rem;
  color: #b8cae0;
  line-height: 1.5;
}

.sources a {
  color: #8bd3ff;
}

@media (max-width: 720px) {
  .app {
    padding: 10px 8px 18px;
  }

  .card {
    padding: 10px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 180px;
  }

  .status-row {
    grid-template-columns: 0.9fr 0.8fr 1.1fr;
    gap: 5px;
    margin-bottom: 8px;
    align-items: stretch;
  }

  .status-row > div:not(.timer-panel) {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6px 4px;
    min-height: 44px;
    border: 1px solid #345d87;
    border-radius: 10px;
    background: rgba(10, 31, 54, 0.88);
    font-size: 0.8rem;
  }

  .timer-panel {
    min-height: 44px;
    padding: 5px 6px;
    gap: 1px;
  }

  .timer-value {
    font-size: 1.8rem;
  }

  .progress-wrap,
  .puzzle-wrap,
  .letter-bank-wrap {
    padding: 7px;
    margin-bottom: 7px;
  }

  .progress-head {
    margin-bottom: 6px;
    font-size: 0.76rem;
  }

  .letter-bank {
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 3px;
  }

  .leaderboard-item {
    grid-template-columns: auto 1fr;
  }

  .leaderboard-time {
    grid-column: 1 / -1;
    padding-left: 44px;
  }

  .gene-progress {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 3px;
  }

  .puzzle-tile {
    width: 22px;
    height: 27px;
    font-size: 0.82rem;
    border-width: 1px;
  }

  .puzzle {
    gap: 3px;
    min-height: 34px;
  }

  .puzzle-space {
    width: 8px;
  }

  #question-text {
    margin: 4px 0 0;
    font-size: 0.96rem;
    line-height: 1.2;
  }

  .options {
    gap: 6px;
    margin-top: 6px;
  }

  .option-btn,
  .primary {
    padding: 6px 8px;
  }

  .option-label {
    min-width: 20px;
    height: 20px;
    font-size: 0.68rem;
  }

  .option-text {
    font-size: 0.84rem;
    line-height: 1.18;
  }

  .feedback {
    min-height: 14px;
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .letter-btn {
    padding: 4px 0;
    font-size: 0.68rem;
  }

  .meta {
    font-size: 0.78rem;
  }

  .timer-label,
  .timer-seconds {
    font-size: 0.58rem;
    letter-spacing: 0.05em;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.35rem;
  }

  .subtitle {
    margin: 4px 0 8px;
    font-size: 0.82rem;
  }

  .card {
    padding: 8px;
  }

  .timer-value {
    font-size: 1.5rem;
  }

  .gene-progress {
    gap: 2px;
  }

  .progress-node {
    height: 18px;
  }

  .puzzle-tile {
    width: 18px;
    height: 22px;
    font-size: 0.7rem;
    border-width: 1px;
  }

  .letter-bank {
    grid-template-columns: repeat(13, minmax(0, 1fr));
  }

  .letter-btn {
    padding: 3px 0;
    font-size: 0.62rem;
  }

  #question-text {
    font-size: 0.86rem;
  }

  .option-text {
    font-size: 0.78rem;
  }

  .status-row > div:not(.timer-panel) {
    font-size: 0.72rem;
    min-height: 38px;
  }

  .timer-panel {
    min-height: 38px;
  }
}
