:root {
  color-scheme: light;
  --ink: #234f46;
  --muted: #627b75;
  --paper: #fffaf0;
  --cream: #f7efd9;
  --line: #dfcfaa;
  --mint: #dff1e7;
  --green: #3e9d7d;
  --green-dark: #26765e;
  --coral: #f17363;
  --yellow: #f8bf49;
  --purple: #8068b3;
  font-family: Inter, Nunito, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12px 12px, rgba(224, 198, 142, .22) 0 2px, transparent 2.5px) 0 0 / 28px 28px,
    #fbf6e8;
}
button, a { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}
.screen { display: none; }
.screen.is-active { display: block; animation: appear .28s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }

.game-topbar, .play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(179, 151, 91, .22);
  font-size: 25px;
}
.brand b, .brand small { display: block; }
.brand b { font-size: 20px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.album-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px solid #cbded4;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(65, 114, 96, .16);
  cursor: pointer;
}
.album-button b { padding: 4px 8px; border-radius: 99px; background: var(--mint); }

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
  min-height: 455px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 40px;
  background: var(--paper);
  box-shadow: 0 15px 0 rgba(182, 151, 86, .14), 0 26px 45px rgba(71, 66, 46, .12);
}
.hero-copy { padding: 70px 46px 56px; }
.eyebrow {
  display: block;
  color: #9b6a29;
  font: 800 13px/1.3 Georgia, serif;
  letter-spacing: .14em;
}
.hero-copy h1, .play-heading h1, .result-card h1 {
  margin: 12px 0 20px;
  font: 800 clamp(52px, 7vw, 82px)/.95 Georgia, serif;
  letter-spacing: -.03em;
}
.hero-copy p { max-width: 600px; margin: 0; color: #4f6964; font-size: 21px; line-height: 1.55; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 32px; }
.hero-facts span { padding: 10px 14px; border-radius: 99px; background: #fff; box-shadow: 0 5px 15px rgba(55, 73, 63, .08); font-weight: 700; }
.hero-scene {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #cfeadf 0 56%, #a8cf9f 56% 100%);
}
.hero-scene::before, .hero-scene::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 210px;
  border-radius: 50%;
  background: #79b474;
}
.hero-scene::before { right: -80px; bottom: -30px; }
.hero-scene::after { left: -110px; bottom: -85px; background: #8ec38b; }
.hero-spot {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.82);
  box-shadow: 0 12px 0 rgba(49, 105, 80, .15);
}
.hero-spot img { width: 155px; height: 155px; object-fit: contain; }
.hero-spot--one { left: 35px; top: 60px; }
.hero-spot--two { right: 27px; bottom: 35px; width: 165px; height: 165px; }
.hero-spot--two img { width: 145px; height: 145px; }
.hero-curtain {
  position: absolute;
  z-index: 3;
  right: 28px;
  top: 35px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 230px;
  height: 180px;
  overflow: hidden;
  border: 8px solid rgba(255,255,255,.85);
  border-radius: 28px;
  background: #f6c95f;
  box-shadow: 0 12px 0 rgba(44, 90, 71, .15);
}
.hero-curtain i, .missing-curtain i { align-self: stretch; background: repeating-linear-gradient(90deg, #f17665 0 18px, #e35f53 18px 34px); }
.hero-curtain i:first-child, .missing-curtain i:first-child { clip-path: polygon(0 0,100% 0,72% 100%,0 100%); }
.hero-curtain i:last-child, .missing-curtain i:last-child { clip-path: polygon(0 0,100% 0,100% 100%,28% 100%); }
.hero-curtain b { color: #fff; font: 800 54px Georgia, serif; text-shadow: 0 3px 0 rgba(80, 55, 20, .18); }

.routes-section { margin-top: 58px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 20px; }
.section-heading h2 { margin: 5px 0 0; font: 800 clamp(34px, 5vw, 50px)/1.05 Georgia, serif; }
.section-heading p { margin: 0 0 6px; color: var(--muted); }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.route-card {
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 28px;
  background: #fffaf2;
  box-shadow: 0 9px 0 rgba(185, 153, 83, .15);
}
.route-preview { position: relative; display: flex; justify-content: center; align-items: end; height: 185px; padding: 18px 20px 0; background: var(--route-bg); }
.route-preview img { width: 105px; height: 132px; margin: 0 -15px; object-fit: contain; filter: drop-shadow(0 8px 4px rgba(46, 78, 63, .14)); }
.route-preview img:nth-child(2) { width: 125px; height: 150px; z-index: 2; }
.route-body { padding: 24px; }
.route-body > span { color: var(--route-accent); font-weight: 900; letter-spacing: .1em; font-size: 12px; }
.route-body h3 { margin: 7px 0 8px; font: 800 28px/1.1 Georgia, serif; }
.route-body p { min-height: 72px; margin: 0; color: var(--muted); line-height: 1.5; }
.route-progress { height: 8px; margin: 18px 0; overflow: hidden; border-radius: 99px; background: #eee8d8; }
.route-progress i { display: block; height: 100%; border-radius: inherit; background: var(--route-accent); }
.route-body button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--route-accent);
  box-shadow: 0 5px 0 color-mix(in srgb, var(--route-accent), #173b32 30%);
  font-weight: 900;
  cursor: pointer;
}
.route-body button b { padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.2); }

.play-screen { max-width: 1060px; margin: 0 auto; }
.icon-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border: 2px solid #cbded4;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 0 rgba(65,114,96,.14);
  font-size: 24px;
  cursor: pointer;
}
.play-heading { flex: 1; }
.play-heading h1 { margin: 4px 0 0; font-size: clamp(34px, 5vw, 56px); }
.round-badge { display: grid; place-items: center; min-width: 82px; min-height: 64px; padding: 8px; border: 2px solid #cfe2d7; border-radius: 18px; background: #fff; }
.round-badge b { font-size: 25px; }
.round-badge span { color: var(--muted); font-size: 12px; font-weight: 800; }
.progress-track { height: 10px; margin-bottom: 18px; overflow: hidden; border-radius: 99px; background: #e7e1d2; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #62b7a0); transition: width .3s ease; }
.memory-stage, .answer-panel, .feedback, .result-card {
  border: 2px solid var(--line);
  border-radius: 30px;
  background: rgba(255,250,240,.96);
  box-shadow: 0 9px 0 rgba(185,153,83,.14);
}
.memory-stage { padding: 28px; text-align: center; }
.stage-copy span { color: #9b6a29; font-weight: 900; letter-spacing: .11em; font-size: 12px; }
.stage-copy h2 { margin: 6px 0; font: 800 clamp(29px, 4vw, 42px)/1.1 Georgia, serif; }
.stage-copy p { margin: 0; color: var(--muted); }
.lineup { display: grid; grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr)); gap: 14px; margin: 26px 0 22px; }
.lineup[data-count="3"] { --count: 3; max-width: 730px; margin-left: auto; margin-right: auto; }
.lineup[data-count="4"] { --count: 4; }
.lineup[data-count="5"] { --count: 5; }
.memory-card {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1 / 1;
  padding: 12px;
  border: 2px solid #cce0d4;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(59, 105, 87, .13);
}
.picture { display: grid; place-items: center; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.picture img { width: 100%; height: 100%; object-fit: contain; }
.primary-button, .secondary-button, .hint-button {
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 16px;
  font-weight: 900;
  cursor: pointer;
}
.primary-button { border: 0; color: #fff; background: var(--green); box-shadow: 0 6px 0 var(--green-dark); }
.secondary-button { border: 2px solid #c8ddd2; background: #fff; box-shadow: 0 4px 0 rgba(65,114,96,.14); }
.ready-button { min-width: 235px; }
.missing-card { padding: 0; overflow: hidden; background: #fff2d5; }
.missing-curtain { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; height: 100%; overflow: hidden; }
.missing-curtain b { color: #fff; font: 800 clamp(34px, 6vw, 62px) Georgia, serif; text-shadow: 0 3px 0 rgba(89,53,35,.16); }
.answer-panel { margin-top: 20px; padding: 25px; }
.answer-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.answer-heading h2 { margin: 3px 0 0; font: 800 34px Georgia, serif; }
.hint-button { border: 2px solid #e2c56c; background: #fff1b9; box-shadow: 0 4px 0 #d9b951; }
.options-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.options-grid:has(.option-card:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 720px; margin-left: auto; margin-right: auto; }
.options-grid:has(.option-card:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.option-card {
  min-width: 0;
  padding: 10px;
  border: 2px solid #d9d2bd;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(113, 91, 47, .13);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease;
}
.option-card:hover { transform: translateY(-3px); border-color: var(--green); }
.option-card .picture { height: auto; aspect-ratio: 1 / 1; }
.option-card b { display: block; min-height: 38px; padding-top: 8px; font-size: 15px; line-height: 1.2; }
.option-card.is-wrong { border-color: #ee8a7d; background: #fff1ee; animation: shake .3s ease; }
.option-card.is-correct { border-color: var(--green); background: #e4f5eb; box-shadow: 0 5px 0 #87bea9; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.feedback { display: flex; align-items: center; gap: 14px; margin-top: 20px; padding: 18px 20px; }
.feedback > span { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border-radius: 16px; background: #fff; font-size: 25px; }
.feedback div { flex: 1; }
.feedback b { font-size: 20px; }
.feedback p { margin: 3px 0 0; color: var(--muted); line-height: 1.4; }
.feedback button { min-height: 48px; padding: 10px 20px; border: 0; border-radius: 14px; color: #fff; background: var(--green); box-shadow: 0 5px 0 var(--green-dark); font-weight: 900; cursor: pointer; }
.feedback.is-success { border-color: #9bcdb7; background: #e5f5ec; }
.feedback.is-error { border-color: #ebbaaf; background: #fff1ed; }
.feedback.is-hint { border-color: #e4cd7d; background: #fff6d7; }

.result-screen { max-width: 820px; margin: 60px auto 0; }
.result-card { padding: 55px 40px; text-align: center; }
.result-stars { font-size: 46px; }
.result-card h1 { font-size: clamp(45px, 7vw, 70px); }
.result-card > p { max-width: 630px; margin: 0 auto; color: var(--muted); font-size: 19px; line-height: 1.5; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 560px; margin: 28px auto; }
.result-stats span { padding: 16px; border-radius: 18px; background: #eef6ef; }
.result-stats b, .result-stats small { display: block; }
.result-stats b { font: 800 34px Georgia, serif; }
.result-stats small { color: var(--muted); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.album-dialog {
  width: min(1060px, calc(100% - 30px));
  max-height: min(850px, calc(100dvh - 30px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 30px;
  color: var(--ink);
  background: #fffaf0;
  box-shadow: 0 25px 80px rgba(20, 45, 37, .35);
}
.album-dialog::backdrop { background: rgba(33, 61, 54, .65); backdrop-filter: blur(7px); }
.album-shell { padding: 28px; }
.album-shell header { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.album-shell h2 { margin: 5px 0; font: 800 42px Georgia, serif; }
.album-shell p { margin: 0; color: var(--muted); }
.album-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.album-card { min-width: 0; padding: 12px; border: 2px solid #d3e2da; border-radius: 20px; text-align: center; background: #fff; }
.album-card .picture { height: auto; aspect-ratio: 1 / 1; }
.album-card strong, .album-card small { display: block; }
.album-card strong { margin-top: 8px; }
.album-card small { margin-top: 3px; color: var(--muted); }
.album-card.is-locked { color: #8a918d; background: #f0eee7; }
.album-card.is-locked .picture b { font: 800 42px Georgia, serif; }

@media (max-width: 900px) {
  .hero-card { grid-template-columns: 1fr; }
  .hero-copy { padding: 48px 34px; }
  .hero-scene { min-height: 365px; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card { display: grid; grid-template-columns: 290px 1fr; }
  .route-preview { height: 100%; min-height: 250px; }
  .route-body p { min-height: 0; }
  .lineup[data-count="5"], .options-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .album-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  .app { width: min(100% - 18px, 1120px); padding-top: 12px; }
  .game-topbar { align-items: flex-start; }
  .album-button span:nth-child(2) { display: none; }
  .brand small { display: none; }
  .hero-card { border-radius: 27px; }
  .hero-copy { padding: 36px 24px; }
  .hero-copy h1 { font-size: 50px; }
  .hero-copy p { font-size: 17px; }
  .hero-facts span { font-size: 13px; }
  .hero-scene { min-height: 310px; }
  .hero-spot { width: 135px; height: 135px; }
  .hero-spot img { width: 120px; height: 120px; }
  .hero-spot--one { left: 20px; top: 24px; }
  .hero-spot--two { right: 18px; bottom: 20px; width: 120px; height: 120px; }
  .hero-spot--two img { width: 108px; height: 108px; }
  .hero-curtain { right: 18px; top: 20px; width: 175px; height: 135px; }
  .routes-section { margin-top: 42px; }
  .section-heading { display: block; }
  .section-heading p { margin-top: 10px; }
  .route-card { display: block; }
  .route-preview { height: 190px; min-height: 0; }
  .play-header { gap: 11px; }
  .play-heading h1 { font-size: 29px; }
  .round-badge { min-width: 64px; min-height: 55px; }
  .memory-stage, .answer-panel { padding: 17px; border-radius: 24px; }
  .lineup { gap: 8px; margin: 20px 0; }
  .lineup[data-count="4"], .lineup[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .memory-card { padding: 6px; border-radius: 17px; }
  .answer-heading { align-items: flex-start; }
  .answer-heading h2 { font-size: 28px; }
  .hint-button { min-height: 45px; padding: 8px 11px; font-size: 13px; }
  .options-grid, .options-grid:has(.option-card:nth-child(4):last-child), .options-grid:has(.option-card:nth-child(3):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .option-card b { font-size: 13px; }
  .feedback { align-items: flex-start; flex-wrap: wrap; }
  .feedback div { min-width: calc(100% - 68px); }
  .feedback button { width: 100%; }
  .result-screen { margin-top: 20px; }
  .result-card { padding: 40px 18px; }
  .result-stats { gap: 6px; }
  .result-stats span { padding: 11px 5px; }
  .result-stats b { font-size: 27px; }
  .result-actions { display: grid; }
  .album-shell { padding: 20px 14px; }
  .album-shell h2 { font-size: 34px; }
  .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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