:root {
  --bg: #101922;
  --panel: #172533;
  --panel-2: #203346;
  --text: #fffaf0;
  --muted: #a8b4bf;
  --cyan: #6ee7f9;
  --mint: #70f0b4;
  --gold: #ffd166;
  --coral: #ff7a6b;
  --line: rgba(255,255,255,.1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% -5%, rgba(112,240,180,.22), transparent 34%),
    radial-gradient(circle at 85% 15%, rgba(110,231,249,.18), transparent 30%),
    linear-gradient(180deg, #101922, #132131 56%, #0f1720);
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 16px;
}

button { font: inherit; }
.app {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
}
header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
}
.brand span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: var(--panel-2);
  font-size: 24px;
}
.brand strong { font-size: 20px; letter-spacing: -.04em; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--cyan);
  background: rgba(23,37,51,.78);
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}
.best-score {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(23,37,51,.6);
  font-size: 14px;
  font-weight: 700;
}
.best-score strong { color: var(--gold); }

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.screen {
  display: none;
  width: 100%;
  padding: 24px 0 34px;
  text-align: center;
  animation: enter .25s ease;
}
.screen.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

.image-stack {
  min-height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.image-stack span {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, var(--panel-2), var(--panel));
  box-shadow: 0 22px 55px rgba(0,0,0,.22);
  font-size: 40px;
  transform: rotate(-7deg);
}
.image-stack span:nth-child(2) { z-index: 2; width: 98px; height: 98px; color: #101922; background: var(--gold); transform: translateY(-9px) rotate(4deg); }
.image-stack span:nth-child(3) { transform: rotate(8deg); }
.image-stack span:nth-child(4) { transform: rotate(-2deg); }

.eyebrow {
  margin: 24px 0 10px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1, h2 { margin: 0; letter-spacing: -.055em; line-height: 1.06; }
h1 { font-size: clamp(44px, 9vw, 68px); }
h2 { font-size: clamp(30px, 7vw, 46px); }
.intro {
  max-width: 520px;
  margin: 18px auto 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}
.rule-grid {
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.rule-grid div,
.prompt-card,
.picture-card,
.answer-button,
.score-panel,
.feedback-icon,
.result-icon {
  border: 1px solid var(--line);
  background: rgba(23,37,51,.82);
  box-shadow: 0 18px 50px rgba(0,0,0,.15);
}
.rule-grid div {
  min-height: 86px;
  padding: 14px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 17px;
}
.rule-grid strong { color: var(--mint); font-size: 26px; line-height: 1; }
.rule-grid span { margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 58px;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
}
.primary-button {
  border: 0;
  color: #101922;
  background: var(--gold);
  box-shadow: 0 14px 36px rgba(255,209,102,.18);
}
.secondary-button {
  margin-top: 10px;
  color: white;
  border: 1px solid var(--line);
  background: transparent;
}
.primary-button:active,
.secondary-button:active,
.answer-button:active { transform: scale(.985); }

.game { align-self: stretch; }
.game-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.game-head strong { color: var(--gold); }
.progress {
  height: 7px;
  margin: 13px 0 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
}
.progress i {
  display: block;
  width: 12.5%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--cyan), var(--gold));
  transition: width .25s ease;
}
.prompt-card {
  padding: 22px;
  border-radius: 24px;
}
.prompt-card .eyebrow { margin-top: 0; }
.prompt-card p:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}
.picture-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.picture-card {
  min-height: 116px;
  padding: 10px;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 20px;
  transition: .2s ease;
}
.picture-card.dimmed { opacity: .38; transform: scale(.96); }
.picture-card span { font-size: 42px; }
.picture-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.answer-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.answer-button {
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 16px;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}
.answer-button:hover { border-color: var(--gold); }
.answer-button.correct { border-color: var(--mint); background: rgba(112,240,180,.16); }
.answer-button.wrong { border-color: var(--coral); background: rgba(255,122,107,.14); }
.answer-button:disabled { cursor: default; opacity: .72; }

.feedback-icon,
.result-icon {
  width: 122px;
  height: 122px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 34px;
  font-size: 62px;
}
.feedback > p:not(.eyebrow) {
  max-width: 460px;
  margin: 16px auto 28px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}
.score-panel {
  width: min(260px, 100%);
  min-height: 210px;
  margin: 26px auto;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 32px;
}
.score-panel span { color: var(--muted); font-size: 14px; font-weight: 800; }
.score-panel strong { margin: 4px 0; color: var(--gold); font-size: 58px; line-height: 1; }
.score-panel small { color: var(--muted); font-size: 14px; }

footer {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}
footer a { color: var(--cyan); text-decoration: none; font-weight: 800; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  padding: 12px 16px;
  border-radius: 12px;
  color: #101922;
  background: white;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: .2s ease;
  font-size: 13px;
  font-weight: 800;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .app { padding: 0 16px; }
  .brand strong { font-size: 16px; }
  .best-score { font-size: 12px; }
  .image-stack span { width: 66px; height: 66px; font-size: 33px; }
  .image-stack span:nth-child(2) { width: 78px; height: 78px; }
  .rule-grid { grid-template-columns: 1fr; }
  .picture-grid { grid-template-columns: repeat(2, 1fr); }
  .answer-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; text-align: center; }
}

@media (max-height: 720px) {
  header { min-height: 62px; }
  .screen { padding-top: 6px; }
  .image-stack { min-height: 92px; }
  .image-stack span { width: 60px; height: 60px; font-size: 30px; }
  .image-stack span:nth-child(2) { width: 72px; height: 72px; }
  .picture-card { min-height: 94px; }
}
