:root {
  --bg: #f4efe3;
  --bg-deep: #17324d;
  --panel: rgba(255, 250, 240, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(23, 50, 77, 0.12);
  --shadow: 0 28px 60px rgba(23, 50, 77, 0.18);
  --text: #183049;
  --muted: #526579;
  --gold: #f2b84b;
  --gold-deep: #d7921f;
  --mint: #7fd0c0;
  --coral: #f0855f;
  --white: #fffdf8;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(127, 208, 192, 0.35), transparent 26%),
    radial-gradient(circle at 85% 15%, rgba(240, 133, 95, 0.22), transparent 20%),
    linear-gradient(145deg, #f8f3e8 0%, #edf3f7 48%, #e6eef5 100%);
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

button {
  font: inherit;
}

.page-glow {
  position: fixed;
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.page-glow-left {
  top: -7rem;
  left: -5rem;
  background: rgba(127, 208, 192, 0.7);
}

.page-glow-right {
  right: -4rem;
  bottom: -6rem;
  background: rgba(242, 184, 75, 0.6);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1380px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 2vw, 2rem) 2.5rem;
}

.screen {
  display: block;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 0.4rem 1.5rem 0;
}

.topbar-brand h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.7rem);
  line-height: 0.95;
  font-family: Georgia, "Times New Roman", serif;
}

.topbar-actions {
  display: grid;
  gap: 0.85rem;
  justify-items: end;
}

.topbar-context {
  margin: 0;
  max-width: 26rem;
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
}

.hero-header,
.home-hero {
  margin-bottom: 1.5rem;
  padding: 1.3rem 1.5rem 0;
}

.hero-kicker,
.section-label {
  margin: 0 0 0.55rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-deep);
}

.hero-header h1 {
  margin: 0;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 0.92;
  font-family: Georgia, "Times New Roman", serif;
}

.hero-intro {
  max-width: 48rem;
  margin: 0.85rem 0 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
}

.home-screen {
  display: grid;
  gap: 1.6rem;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 0.75fr);
  gap: 1.25rem;
  align-items: stretch;
}

.home-copy h2 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.1rem);
  line-height: 1.02;
  font-family: Georgia, "Times New Roman", serif;
}

.home-highlight {
  padding: 1.4rem;
  border-radius: 1.8rem;
  background:
    radial-gradient(circle at top right, rgba(242, 184, 75, 0.32), transparent 38%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.94) 0%, rgba(244, 239, 227, 0.96) 100%);
  border: 1px solid rgba(23, 50, 77, 0.08);
  box-shadow: 0 20px 40px rgba(23, 50, 77, 0.08);
}

.home-highlight h3,
.home-highlight p {
  margin: 0;
}

.home-highlight h3 {
  font-size: 1.6rem;
  font-family: Georgia, "Times New Roman", serif;
}

.home-highlight p:last-child {
  margin-top: 0.7rem;
  color: var(--muted);
  line-height: 1.7;
}

.lesson-selection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
}

.lesson-selection-grid.is-grade-selection {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lesson-option {
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.08);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.lesson-option-media {
  position: relative;
  height: 16rem;
  overflow: hidden;
}

.lesson-option-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.84);
}

.grade-option .lesson-option-media {
  background: rgba(255, 255, 255, 0.84);
}

.grade-option {
  cursor: pointer;
}

.grade-option .lesson-option-media img {
  padding: 0.7rem;
}

.lesson-option-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 50, 77, 0.04) 0%, rgba(23, 50, 77, 0.44) 100%);
}

.lesson-count-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1;
  padding: 0.48rem 0.78rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--bg-deep);
  font-size: 0.78rem;
  font-weight: 800;
}

.lesson-option-body {
  display: grid;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1.35rem;
}

.lesson-option-body h3,
.lesson-option-body p {
  margin: 0;
}

.lesson-option-body h3 {
  font-size: 1.95rem;
  font-family: Georgia, "Times New Roman", serif;
}

.lesson-option-body p {
  color: var(--muted);
  line-height: 1.65;
}

.lesson-option-button {
  justify-self: start;
}

.grade-media-button {
  position: absolute;
  right: 0.9rem;
  bottom: 0.85rem;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 0.95rem;
  background: linear-gradient(135deg, var(--gold) 0%, #ffd98c 100%);
  color: #332000;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(23, 50, 77, 0.2);
}

.game-screen .hero-header h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.7rem);
  line-height: 0.98;
  font-family: Georgia, "Times New Roman", serif;
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 1.35rem;
}

.board-panel,
.focus-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 1.4rem;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.panel-note {
  margin: 0;
  max-width: 18rem;
  text-align: right;
  color: var(--muted);
  line-height: 1.5;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.board-card,
.status-card {
  position: relative;
  min-height: 13rem;
  border-radius: 1.55rem;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(23, 50, 77, 0.12);
}

.board-card {
  background: var(--panel-strong);
  border: 1px solid rgba(23, 50, 77, 0.08);
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.board-card.is-selected {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 28px 48px rgba(242, 184, 75, 0.3);
}

.board-card.is-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 3px solid rgba(242, 184, 75, 0.9);
  border-radius: inherit;
}

.board-card.is-drawn img {
  filter: saturate(0.72) brightness(0.84);
}

.card-image-shell {
  height: 100%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
}

.card-image-shell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.9rem 0.9rem 1rem;
  background: linear-gradient(180deg, rgba(23, 50, 77, 0) 0%, rgba(23, 50, 77, 0.86) 100%);
  color: var(--white);
}

.card-footer p,
.card-footer h3 {
  margin: 0;
}

.card-footer p {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.92;
}

.card-footer h3 {
  margin-top: 0.3rem;
  font-size: 1.1rem;
}

.order-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  min-width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: rgba(242, 184, 75, 0.95);
  color: #2b1e00;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(23, 50, 77, 0.22);
}

.drawn-chip {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  padding: 0.38rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--bg-deep);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-card {
  padding: 1rem;
  background:
    radial-gradient(circle at top right, rgba(242, 184, 75, 0.3), transparent 38%),
    linear-gradient(160deg, #183049 0%, #21486d 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}

.status-card h3,
.status-card p,
.status-card li {
  margin: 0;
}

.status-headline {
  font-size: 1.35rem;
  font-family: Georgia, "Times New Roman", serif;
}

.status-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.status-metric {
  padding: 0.8rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.12);
}

.status-metric span {
  display: block;
  font-size: 0.78rem;
  opacity: 0.86;
}

.status-metric strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.35rem;
}

.order-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.order-list li {
  padding: 0.4rem 0.58rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.84rem;
}

.order-empty {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
}

.hero-card {
  position: relative;
  display: grid;
  gap: 1.15rem;
  padding: 1rem;
  border-radius: 1.8rem;
  min-height: 24rem;
  background:
    radial-gradient(circle at top, rgba(242, 184, 75, 0.36), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 245, 234, 0.96) 100%);
  overflow: hidden;
  border: 1px solid rgba(23, 50, 77, 0.08);
}

.hero-visual {
  position: relative;
  min-height: 16rem;
  border-radius: 1.45rem;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.94), rgba(232, 240, 245, 0.86)),
    linear-gradient(160deg, rgba(127, 208, 192, 0.22), rgba(242, 184, 75, 0.18));
  display: grid;
  place-items: center;
}

.hero-placeholder {
  max-width: 16rem;
  text-align: center;
  line-height: 1.7;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-image {
  width: min(94%, 31rem);
  aspect-ratio: 553 / 360;
  object-fit: contain;
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 30px 60px rgba(23, 50, 77, 0.22);
}

.hero-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(24, 48, 73, 0.84);
  color: var(--white);
  font-weight: 700;
  z-index: 2;
}

.hero-flare {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.55), transparent 38%),
    conic-gradient(from 180deg, rgba(242, 184, 75, 0), rgba(242, 184, 75, 0.36), rgba(127, 208, 192, 0.08), rgba(242, 184, 75, 0));
  opacity: 0;
  pointer-events: none;
}

.hero-copy {
  display: grid;
  gap: 0.45rem;
  align-content: start;
}

.hero-round {
  margin: 0;
  color: var(--gold-deep);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h3 {
  margin: 0;
  font-size: clamp(1.8rem, 2.6vw, 2.45rem);
  font-family: Georgia, "Times New Roman", serif;
}

.hero-copy p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.hero-card.is-revealed .hero-image {
  animation: hero-pop 880ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.hero-card.is-revealed .hero-flare {
  animation: hero-flare 900ms ease-out both;
}

.focus-status-slot {
  margin-bottom: 1rem;
}

.focus-status-slot .status-card {
  min-height: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1rem;
}

.focus-panel > .controls {
  margin: 0 0 1rem;
}

.action-button {
  border: none;
  border-radius: 999px;
  padding: 1rem 1.45rem;
  min-width: 10rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.action-button.compact {
  min-width: 0;
  padding: 0.8rem 1rem;
}

.action-button:hover {
  transform: translateY(-2px);
}

.action-button:active {
  transform: translateY(1px);
}

.action-button.primary {
  background: linear-gradient(135deg, var(--gold) 0%, #ffd98c 100%);
  color: #332000;
  box-shadow: 0 16px 28px rgba(242, 184, 75, 0.3);
}

.action-button.secondary {
  background: rgba(24, 48, 73, 0.08);
  color: var(--bg-deep);
}

.live-status {
  min-height: 1.5rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
}

@keyframes hero-pop {
  0% {
    transform: translateY(26px) scale(0.75) rotate(-6deg);
    opacity: 0;
  }
  56% {
    transform: translateY(-8px) scale(1.03) rotate(1deg);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes hero-flare {
  0% {
    opacity: 0;
    transform: scale(0.92);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

@media (max-width: 1100px) {
  .app-topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .app-topbar {
    display: grid;
  }

  .topbar-actions {
    justify-items: start;
  }

  .topbar-context {
    text-align: left;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .panel-note {
    max-width: none;
  }

  .hero-card {
    min-height: 0;
  }

  .lesson-selection-grid.is-grade-selection {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lesson-selection-grid.is-grade-selection .lesson-option-media {
    height: 7.5rem;
  }

  .lesson-selection-grid.is-grade-selection .lesson-option-body {
    gap: 0.45rem;
    padding: 0.85rem 0.95rem 1rem;
  }

  .lesson-selection-grid.is-grade-selection .lesson-option-body h3 {
    font-size: 1.45rem;
  }

  .lesson-selection-grid.is-grade-selection .lesson-option-body p {
    font-size: 0.9rem;
    line-height: 1.35;
  }

  .lesson-selection-grid.is-grade-selection .grade-media-button {
    right: 0.65rem;
    bottom: 0.55rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-inline: 0.8rem;
  }

  .hero-header,
  .app-topbar,
  .home-hero {
    padding-inline: 0.25rem;
  }

  .board-panel,
  .focus-panel {
    padding: 1rem;
    border-radius: 1.5rem;
  }

  .panel-heading {
    align-items: start;
    flex-direction: column;
  }

  .panel-note {
    text-align: left;
  }

  .lesson-selection-grid {
    grid-template-columns: 1fr;
  }

  .lesson-selection-grid.is-grade-selection {
    grid-template-columns: 1fr;
  }

  .lesson-option {
    border-radius: 1.5rem;
  }

  .lesson-option-media {
    height: 12rem;
  }

  .lesson-option-body h3 {
    font-size: 1.5rem;
  }

  .card-grid {
    gap: 0.6rem;
  }

  .board-card,
  .status-card {
    min-height: 9.5rem;
    border-radius: 1.15rem;
  }

  .card-footer {
    padding: 0.65rem;
  }

  .card-footer h3 {
    font-size: 0.93rem;
  }

  .card-footer p,
  .drawn-chip,
  .order-badge,
  .status-card,
  .order-list li {
    font-size: 0.72rem;
  }

  .status-headline {
    font-size: 1.05rem;
  }

  .hero-visual {
    min-height: 18rem;
  }

  .hero-copy h3 {
    font-size: 1.55rem;
  }

  .action-button {
    flex: 1 1 10rem;
  }
}
