:root {
  --bg-sky: #c3e8f7;
  --bg-sun: #f4c95d;
  --bg-pond: #4a90a4;
  --panel: rgba(255, 249, 235, 0.94);
  --panel-strong: #fffdf5;
  --ink: #16313f;
  --ink-soft: #456270;
  --success: #1f7a47;
  --success-bg: #d9f4de;
  --danger: #8e2d27;
  --danger-bg: #ffe0d9;
  --accent: #ef7d32;
  --accent-dark: #b75416;
  --shadow: 0 18px 44px rgba(22, 49, 63, 0.18);
  --radius-lg: 32px;
  --radius-md: 22px;
  --radius-sm: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  color: var(--ink);
  overscroll-behavior: none;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 34%),
    radial-gradient(circle at top right, rgba(244, 201, 93, 0.46), transparent 24%),
    linear-gradient(180deg, var(--bg-sky) 0%, #ebf8fc 48%, #fdf3d6 48%, #ebd89d 100%);
}

body.has-overlay {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 24vh;
  background:
    radial-gradient(circle at 12% 40%, rgba(60, 135, 87, 0.8) 0 18%, transparent 19%),
    radial-gradient(circle at 24% 65%, rgba(90, 148, 79, 0.7) 0 17%, transparent 18%),
    radial-gradient(circle at 80% 46%, rgba(61, 130, 83, 0.7) 0 17%, transparent 18%),
    linear-gradient(180deg, rgba(108, 165, 93, 0.12), rgba(81, 136, 76, 0.82));
  pointer-events: none;
}

.page-shell {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 12px 40px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.hero {
  display: grid;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.hero[hidden] {
  display: none;
}

.hero__logo {
  width: min(80px, 22vw);
  filter: drop-shadow(0 8px 20px rgba(22, 49, 63, 0.2));
}

.hero__copy {
  max-width: 680px;
}

.eyebrow,
.panel__label {
  margin: 0 0 8px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(1.6rem, 5vw, 4.8rem);
  line-height: 1;
}

.hero__lede {
  max-width: 58ch;
  font-size: clamp(0.88rem, 2.5vw, 1.05rem);
  line-height: 1.45;
  color: var(--ink-soft);
}

.game-card {
  position: relative;
  min-height: min(620px, 70dvh);
  border: 3px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 252, 242, 0.98)),
    var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.game-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(239, 125, 50, 0.18);
  filter: blur(3px);
}

.screen {
  display: none;
  position: relative;
  z-index: 1;
  padding: 14px;
}

.screen--active {
  display: block;
  animation: screen-in 280ms ease;
}

.panel {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px);
  border-radius: 28px;
  background: var(--panel-strong);
  box-shadow: inset 0 0 0 1px rgba(22, 49, 63, 0.08);
}

.panel--intro,
.panel--results {
  margin-top: clamp(20px, 5vh, 88px);
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.status-pill {
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(22, 49, 63, 0.08);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill--score {
  background: rgba(244, 201, 93, 0.28);
}

.question-layout {
  display: grid;
  gap: 18px;
}

.bird-panel,
.choices-panel,
.feedback-panel {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(22, 49, 63, 0.08);
}

.bird-frame {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 12px;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.86), rgba(195, 232, 247, 0.7)),
    #edfaff;
  transition: background 280ms ease, box-shadow 280ms ease;
}

.bird-frame img {
  width: 100%;
  max-width: 440px;
  max-height: min(280px, 30dvh);
  object-fit: contain;
  transition: opacity 280ms ease, transform 320ms ease, filter 280ms ease;
}

.bird-panel.is-answered .bird-frame {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.92), rgba(233, 245, 250, 0.82)),
    #f7fbfd;
  box-shadow: inset 0 0 0 1px rgba(22, 49, 63, 0.05);
}

.bird-panel.is-answered .bird-frame img {
  opacity: 0.72;
  transform: scale(0.97);
  filter: saturate(0.84);
}

.choices-panel__header {
  margin-bottom: 14px;
}

.choice-grid {
  display: grid;
  gap: 14px;
}

.choice-button {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px;
  border: 3px solid transparent;
  border-radius: 18px;
  background: #fff9e8;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background-color 140ms ease;
}

.choice-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(239, 125, 50, 0.46);
  box-shadow: 0 10px 26px rgba(22, 49, 63, 0.1);
}

.choice-button:active:not(:disabled) {
  transform: scale(0.97);
  border-color: rgba(239, 125, 50, 0.6);
}

.choice-button:focus-visible,
.button:focus-visible,
.answer-reveal:focus-visible,
.reveal-viewer__close:focus-visible {
  outline: 3px solid #143e65;
  outline-offset: 3px;
}

.choice-button:disabled {
  cursor: default;
}

.choice-button__image-wrap {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.choice-button__image-wrap img {
  width: 100%;
  max-width: 56px;
  max-height: 56px;
  object-fit: contain;
}

.choice-button__label {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
}

.choice-button__meta {
  display: block;
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.choice-button.is-correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.choice-button.is-wrong {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.choice-button.is-muted {
  opacity: 0.7;
}

.feedback-panel {
  margin-top: 18px;
}

.feedback-panel__layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

.feedback-panel__copy {
  display: grid;
  gap: 6px;
}

.feedback-panel__result {
  margin-bottom: 6px;
  font-size: 1.05rem;
  font-weight: 900;
}

.feedback-panel.is-success .feedback-panel__result {
  color: var(--success);
}

.feedback-panel.is-failure .feedback-panel__result {
  color: var(--danger);
}

.feedback-panel__explanation {
  line-height: 1.55;
  color: var(--ink-soft);
}

.answer-reveal {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 260ms ease,
    transform 320ms ease,
    filter 180ms ease;
}

.answer-reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.answer-reveal:hover {
  filter: saturate(1.05);
}

.answer-reveal:active {
  transform: translateY(0) scale(0.985);
}

.answer-reveal__frame {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 14px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.96), rgba(255, 248, 227, 0.78)),
    #fff8e9;
  box-shadow:
    inset 0 0 0 1px rgba(22, 49, 63, 0.07),
    0 14px 28px rgba(22, 49, 63, 0.08);
}

.answer-reveal__frame img {
  width: 100%;
  max-width: 340px;
  max-height: min(240px, 28dvh);
  object-fit: contain;
}

.answer-reveal__hint {
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
}

.reveal-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.reveal-viewer[hidden] {
  display: none;
}

.reveal-viewer__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.22), transparent 40%),
    rgba(12, 31, 39, 0.76);
  backdrop-filter: blur(12px);
}

.reveal-viewer__dialog {
  position: relative;
  width: min(96vw, 100%);
  max-height: 96dvh;
  padding: 20px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 238, 0.98)),
    var(--panel-strong);
  box-shadow: 0 28px 70px rgba(5, 22, 30, 0.32);
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: opacity 220ms ease, transform 280ms ease;
}

.reveal-viewer.is-visible .reveal-viewer__dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.reveal-viewer__close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 49, 63, 0.08);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease;
}

.reveal-viewer__close:hover {
  transform: translateY(-1px);
  background: rgba(22, 49, 63, 0.14);
}

.reveal-viewer__eyebrow {
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.reveal-viewer__title {
  margin-bottom: 16px;
  padding-right: 88px;
}

.reveal-viewer__art {
  display: grid;
  place-items: center;
  min-height: 320px;
  max-height: min(80dvh, 860px);
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.98), rgba(239, 248, 252, 0.88)),
    #f8fcff;
  box-shadow: inset 0 0 0 1px rgba(22, 49, 63, 0.08);
}

.reveal-viewer__art img {
  width: 100%;
  max-width: 100%;
  max-height: min(74dvh, 800px);
  object-fit: contain;
}

.feedback-panel .button {
  margin-top: 18px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 49, 63, 0.16);
}

.button:active {
  transform: scale(0.96);
}

.button--primary {
  background: linear-gradient(180deg, #ff944f, var(--accent));
  color: #fff9ef;
}

.button--secondary {
  background: linear-gradient(180deg, #5ba6ba, var(--bg-pond));
  color: white;
}

/* ── Small phones (≤ 374px) ── */
@media (max-width: 374px) {
  h1 {
    font-size: 1.4rem;
  }

  .choice-button {
    grid-template-columns: 48px 1fr;
    gap: 8px;
    padding: 8px;
  }

  .choice-button__image-wrap img {
    max-width: 40px;
    max-height: 40px;
  }

  .choice-button__label {
    font-size: 0.88rem;
  }

  .bird-frame {
    min-height: 120px;
  }
}

/* ── Standard phones (375px – 599px) ── */
@media (min-width: 375px) {
  .choice-grid {
    grid-template-columns: 1fr 1fr;
  }

  .choice-button {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 12px 8px;
  }

  .choice-button__image-wrap {
    width: 72px;
  }

  .choice-button__image-wrap img {
    max-width: 64px;
    max-height: 64px;
  }
}

/* ── Tablets (600px+) ── */
@media (min-width: 600px) {
  .page-shell {
    padding: 20px 20px 56px;
  }

  .hero {
    grid-template-columns: auto 1fr;
    gap: 18px;
  }

  .hero__logo {
    width: min(110px, 18vw);
  }

  .screen {
    padding: 22px;
  }

  .game-card {
    border-radius: var(--radius-lg);
    border-width: 4px;
  }

  .choice-grid {
    grid-template-columns: 1fr 1fr;
  }

  .choice-button {
    grid-template-columns: 80px 1fr;
    text-align: left;
    justify-items: start;
    padding: 12px;
  }

  .choice-button__image-wrap {
    width: auto;
  }

  .choice-button__image-wrap img {
    max-width: 72px;
    max-height: 72px;
  }

  .choice-button__label {
    font-size: 1rem;
  }

  .feedback-panel__result {
    font-size: 1.15rem;
  }

  .bird-frame {
    min-height: 220px;
  }

  .feedback-panel__layout {
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.9fr);
    gap: 20px;
  }

  .answer-reveal__frame {
    min-height: 220px;
  }

  .reveal-viewer {
    padding: 28px;
  }

  .reveal-viewer__dialog {
    padding: 28px;
  }
}

/* ── Larger tablets & desktop (760px+) ── */
@media (min-width: 760px) {
  .page-shell {
    padding: 32px 24px 72px;
  }

  .hero__logo {
    width: min(132px, 20vw);
  }

  h1 {
    font-size: clamp(2.2rem, 5vw, 4.8rem);
  }

  .screen {
    padding: 28px;
  }

  .question-layout {
    grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.05fr);
    align-items: start;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .choice-button {
    grid-template-columns: minmax(0, 96px) 1fr;
    gap: 14px;
  }

  .bird-frame {
    min-height: 240px;
  }

  .bird-frame img {
    max-height: 320px;
  }
}

/* ── Landscape phones ── */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    grid-template-columns: auto 1fr;
    gap: 12px;
    margin-bottom: 8px;
  }

  .hero__logo {
    width: 48px;
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 2px;
  }

  .hero__lede {
    display: none;
  }

  .game-card {
    min-height: auto;
  }

  .panel--intro,
  .panel--results {
    margin-top: 12px;
  }

  .screen {
    padding: 10px 14px;
  }

  .question-layout {
    grid-template-columns: minmax(180px, 0.6fr) 1fr;
    align-items: start;
    gap: 10px;
  }

  .bird-frame {
    min-height: 100px;
    padding: 8px;
  }

  .bird-frame img {
    max-height: 28dvh;
  }

  .choice-grid {
    grid-template-columns: 1fr 1fr;
  }

  .choice-button {
    grid-template-columns: 48px 1fr;
    padding: 6px;
    gap: 6px;
    min-height: 44px;
  }

  .choice-button__image-wrap img {
    max-width: 40px;
    max-height: 40px;
  }

  .status-bar {
    margin-bottom: 8px;
  }

  .status-pill {
    padding: 4px 10px;
    font-size: 0.8rem;
  }

  .feedback-panel {
    margin-top: 8px;
    padding: 10px;
  }
}

/* ── Hover-capable devices only ── */
@media (hover: hover) {
  .choice-button:hover:not(:disabled) {
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .choice-button:hover:not(:disabled) {
    transform: none;
    border-color: transparent;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
