:root {
  --ink: #214b43;
  --muted: #6d7e76;
  --paper: #fffdf7;
  --line: #dccdaf;
  --green: #438f69;
  --coral: #df745f;
  --accent: #4b8d67;
  color: var(--ink);
  background: #ece8d9;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 0; overflow-x: clip; }
body { background: radial-gradient(circle at 10% 8%, #fff, transparent 29rem), linear-gradient(145deg, #e3ecd9, #f3e8d5 55%, #e0e8da); }
button, a { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 24px auto 34px;
  overflow: hidden;
  border: 1px solid #d5c7a8;
  border-radius: 34px;
  background: rgba(255, 253, 247, .98);
  box-shadow: 0 24px 60px rgba(65, 73, 51, .15);
}

.game-bar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: #fff; }
.game-brand { min-width: 0; display: inline-flex; align-items: center; gap: 13px; padding: 4px 8px 4px 4px; border-radius: 18px; color: inherit; text-decoration: none; transition: background .18s ease; }
.game-brand:hover { background: #eef5e7; }
.game-brand:focus-visible, button:focus-visible { outline: 4px solid rgba(67, 143, 105, .3); outline-offset: 3px; }
.game-brand > span:last-child { display: grid; gap: 2px; }
.game-brand strong { font-size: clamp(18px, 2.3vw, 25px); }
.game-brand small { color: var(--muted); font-size: 13px; }
.game-icon { flex: 0 0 56px; width: 56px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: #efe0bc; }
.game-icon svg { width: 48px; height: 42px; fill: none; stroke: #6e5d44; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.age-pill, .counter { padding: 10px 15px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-weight: 900; }

.screen { display: none; }
.screen.is-active { display: block; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .12em; }
h1, h2, h3 { margin-top: 0; }
h1, h2, h3, p { overflow-wrap: anywhere; }

.home-screen { grid-template-columns: 1fr 1fr; gap: 28px 38px; padding: 48px 48px 36px; background: linear-gradient(110deg, #f8eed8 0 52%, #dfeeda 52%); }
.home-screen.is-active { display: grid; }
.hero-copy { align-self: center; }
.hero-copy h1 { margin-bottom: 18px; font-size: clamp(39px, 5vw, 58px); line-height: 1; letter-spacing: -.04em; }
.hero-copy > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: clamp(18px, 2vw, 21px); line-height: 1.46; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 9px; margin: 24px 0; }
.hero-facts span { padding: 9px 14px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-weight: 900; }
.primary-button, .secondary-button, .hint-button, .restart-button, .next-button, .check-button { min-height: 54px; padding: 13px 22px; border-radius: 17px; cursor: pointer; font-weight: 900; }
.primary-button, .next-button, .check-button { border: 0; color: #fff; background: var(--green); box-shadow: 0 7px 0 #2f7658; }
.primary-button:hover, .next-button:hover, .check-button:hover:not(:disabled) { filter: brightness(1.04); }

.hero-scene { position: relative; min-height: 355px; overflow: hidden; border: 1px solid #d7c9a8; border-radius: 32px; background: #dbe9ce; }
.hero-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-visitor { position: absolute; z-index: 2; right: 5%; top: 17%; width: 35%; height: 45%; object-fit: contain; filter: drop-shadow(0 5px 5px rgba(0,0,0,.2)); }
.hero-clue { position: absolute; z-index: 3; width: 20%; height: 24%; object-fit: contain; filter: drop-shadow(0 4px 3px rgba(0,0,0,.18)); }
.clue-one { left: 25%; bottom: 9%; }
.clue-two { left: 52%; bottom: 7%; transform: rotate(-9deg); }
.hero-tracks { position: absolute; z-index: 3; left: 9%; bottom: 20%; display: flex; gap: 9px; transform: rotate(-18deg); }
.hero-tracks i { width: 25px; height: 20px; border-radius: 55% 55% 45% 45%; background: rgba(83, 65, 42, .65); box-shadow: 6px -8px 0 -4px rgba(83,65,42,.65), -6px -8px 0 -4px rgba(83,65,42,.65); }

.how-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
.how-strip article { min-height: 114px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.how-strip b { flex: 0 0 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: var(--coral); font-size: 23px; }
.how-strip span { display: grid; gap: 4px; }
.how-strip small { color: var(--muted); }

.routes-screen, .play-screen, .result-screen { padding: 38px 42px 44px; }
.section-title, .task-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-title h2, .task-head h2 { margin-bottom: 0; font-size: clamp(28px, 4vw, 44px); }
.section-title > p { color: var(--muted); font-weight: 900; }
.route-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 16px; margin-top: 28px; }
.route-card { min-width: 0; display: flex; flex-direction: column; padding: 15px; border: 1px solid var(--line); border-radius: 25px; background: #fff; box-shadow: 0 12px 28px rgba(72, 66, 47, .09); }
.route-art { height: 170px; display: grid; place-items: center; overflow: hidden; border-radius: 18px; background: linear-gradient(145deg, #edf4df, #f5e3cb); }
.route-art img { width: 65%; height: 86%; object-fit: contain; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.route-card > p { margin: 17px 0 7px; color: var(--accent); font-size: 12px; font-weight: 900; }
.route-card h3 { min-height: 50px; margin-bottom: 8px; font-size: 22px; }
.route-card > small { min-height: 58px; color: var(--muted); font-size: 16px; line-height: 1.4; }
.route-meta { display: flex; justify-content: space-between; margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 13px; font-weight: 900; }
.route-progress { height: 8px; margin: 9px 0 16px; overflow: hidden; border-radius: 99px; background: #e8e4d7; }
.route-progress i { display: block; height: 100%; background: var(--accent); }
.route-card > button { min-height: 54px; display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; border: 0; border-radius: 17px; color: #fff; background: var(--accent); cursor: pointer; font-weight: 900; }
.back-link { margin-top: 26px; border: 0; background: transparent; color: #2d7355; cursor: pointer; font-weight: 900; }

.task-head { justify-content: flex-start; }
.task-head > div { flex: 1; }
.round-button { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 23px; }
.progress-line { height: 8px; margin: 18px 0; overflow: hidden; border-radius: 99px; background: #e8e4d7; }
.progress-line i { display: block; height: 100%; background: var(--accent); }
.task-title { display: flex; align-items: baseline; gap: 12px; }
.task-title span { color: var(--accent); font-size: 11px; font-weight: 900; }
.task-title h3 { margin: 0; font-size: 27px; }

.investigation-grid { display: grid; grid-template-columns: minmax(0, 1.36fr) minmax(285px, .64fr); gap: 14px; margin-top: 18px; }
.clue-scene { position: relative; min-width: 0; aspect-ratio: 3 / 2; overflow: hidden; border: 2px solid #d7c9ab; border-radius: 25px; background: #dce9cf; }
.scene-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene-evidence { position: absolute; z-index: 3; left: var(--x); top: var(--y); width: var(--size); aspect-ratio: 1; display: grid; place-items: center; padding: 4px; border: 3px solid rgba(255,255,255,.95); border-radius: 24px; background: rgba(255,253,244,.78); box-shadow: 0 0 0 4px rgba(46,104,78,.45), 0 9px 18px rgba(40,45,31,.18); transform: translate(-50%, -50%); cursor: pointer; transition: .18s ease; }
.scene-evidence:hover { transform: translate(-50%, -50%) translateY(-3px); }
.scene-evidence img { width: 88%; height: 78%; object-fit: contain; filter: drop-shadow(0 4px 3px rgba(0,0,0,.18)); }
.scene-evidence span { position: absolute; left: 50%; bottom: -10px; min-width: 74px; padding: 4px 7px; border-radius: 99px; color: #fff; background: #357b5b; transform: translateX(-50%); font-size: 10px; font-weight: 900; white-space: nowrap; }
.scene-evidence.is-found { border-color: #b7d8b5; background: rgba(225,242,220,.88); box-shadow: 0 0 0 4px rgba(79,146,97,.6); }
.scene-evidence.is-highlighted { animation: cluePulse 1.1s ease-in-out infinite alternate; }
@keyframes cluePulse { to { box-shadow: 0 0 0 9px rgba(245,184,69,.62), 0 10px 22px rgba(40,45,31,.2); } }
.scene-caption { position: absolute; z-index: 4; left: 14px; right: 14px; bottom: 12px; display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 14px; background: rgba(255,253,247,.92); box-shadow: 0 4px 12px rgba(0,0,0,.08); font-size: 12px; }
.scene-caption span { color: var(--muted); font-weight: 900; }
.visitor-reveal { position: absolute; z-index: 5; right: 4%; top: 5%; width: 29%; height: 42%; display: grid; grid-template-rows: auto 1fr auto; place-items: center; padding: 7px; border: 4px solid #fff; border-radius: 24px; color: #fff; background: rgba(49,118,85,.92); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.visitor-reveal span { font-size: 9px; font-weight: 900; letter-spacing: .09em; }
.visitor-reveal img { min-height: 0; width: 100%; height: 100%; object-fit: contain; }
.visitor-reveal b { font-size: 13px; }

.notebook-card { min-width: 0; padding: 18px; border: 1px solid #d6c29d; border-radius: 25px; background: repeating-linear-gradient(#fffdf8 0 34px, #e8dabe 35px); box-shadow: 0 10px 24px rgba(77,66,44,.09); }
.notebook-card h3 { margin-bottom: 14px; font-size: 21px; }
.evidence-tray { display: grid; gap: 9px; }
.evidence-note { min-height: 88px; display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; padding: 8px; border: 1px solid #ddcfb4; border-radius: 17px; background: rgba(255,255,255,.92); }
.evidence-note img { width: 66px; height: 66px; object-fit: contain; }
.evidence-note span { min-width: 0; display: grid; gap: 3px; }
.evidence-note small { color: var(--muted); line-height: 1.3; }
.evidence-note.is-empty { grid-template-columns: 1fr; padding-left: 18px; color: #859088; border-style: dashed; background: rgba(255,255,255,.67); }
.evidence-note.is-highlighted { border-color: #e4aa3e; box-shadow: 0 0 0 4px rgba(237,181,64,.23); }
.notebook-status { margin: 12px 2px 0; color: var(--muted); font-size: 13px; font-weight: 900; }

.suspect-panel, .control-card { margin-top: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 23px; background: #fff; }
.suspect-panel > header { display: flex; justify-content: space-between; gap: 15px; }
.suspect-panel h3 { margin: 0; }
.suspect-panel header > span { color: var(--muted); font-size: 13px; font-weight: 900; }
.suspect-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 15px 0; }
.suspect-grid button { min-height: 160px; display: grid; grid-template-rows: 1fr auto; padding: 8px; border: 2px solid #e1d5bd; border-radius: 18px; background: #fff; cursor: pointer; }
.suspect-grid button:disabled { cursor: not-allowed; }
.suspect-grid button.is-selected { border-color: var(--accent); background: #edf7ed; box-shadow: 0 0 0 4px rgba(68,143,105,.16); }
.suspect-grid button.is-eliminated { opacity: .24; filter: grayscale(1); }
.suspect-grid img { width: 100%; height: 112px; object-fit: contain; }
.suspect-grid b { font-size: 15px; }
.suspect-panel.is-locked .suspect-grid { opacity: .42; filter: grayscale(.55); }
.check-button { width: 100%; }
.check-button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

.control-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.feedback { min-height: 65px; display: grid; align-content: center; gap: 4px; padding: 10px 13px; border-radius: 15px; background: #f3f1e8; }
.feedback span { color: var(--muted); font-size: 13px; }
.feedback[data-tone="good"], .feedback[data-tone="success"] { background: #e2f1df; }
.feedback[data-tone="soft"] { background: #fff0e4; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.hint-button { color: #2d7355; border: 2px solid #91bea2; background: #eef8ef; }
.restart-button { border: 1px solid var(--line); background: #fff; }
.task-tabs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.task-tabs button { min-height: 36px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 900; }
.task-tabs .is-current { color: #fff; background: var(--accent); }
.task-tabs .is-done:not(.is-current) { background: #e4f1df; }

.result-screen.is-active { display: grid; grid-template-columns: .95fr 1.05fr; align-items: center; gap: 38px; min-height: 550px; }
.result-scene { position: relative; min-height: 380px; overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: #e4efd9; }
.result-scene img { position: absolute; object-fit: contain; }
.result-scene img:first-child { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.result-scene img:nth-child(2) { z-index: 2; left: 8%; bottom: 5%; width: 54%; height: 66%; filter: drop-shadow(0 5px 5px rgba(0,0,0,.2)); }
.result-scene img:last-child { z-index: 3; right: 7%; top: 15%; width: 32%; height: 39%; filter: drop-shadow(0 5px 4px rgba(0,0,0,.18)); }
.result-screen h2 { font-size: clamp(34px, 5vw, 56px); line-height: 1; }
.result-screen > div:last-child > p:not(.eyebrow) { color: var(--muted); font-size: 19px; }
.result-actions { display: flex; gap: 12px; }
.secondary-button { border: 2px solid #92bca3; background: #fff; }

@media (max-width: 900px) {
  .home-screen { grid-template-columns: 1fr; }
  .investigation-grid { grid-template-columns: 1fr; }
  .evidence-tray { grid-template-columns: repeat(3, 1fr); }
  .evidence-note { min-height: 132px; grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .control-card { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .result-screen.is-active { grid-template-columns: 1fr; }
  .result-scene { min-height: 310px; }
}

@media (max-width: 720px) {
  .app { width: calc(100% - 16px); margin: 8px auto 20px; border-radius: 24px; }
  .game-bar { min-height: 76px; padding: 10px 13px; }
  .game-icon { width: 46px; height: 46px; flex-basis: 46px; }
  .game-brand small { display: none; }
  .home-screen { padding: 30px 16px 20px; }
  .hero-copy h1 { font-size: clamp(35px, 10vw, 50px); }
  .hero-scene { min-height: 255px; }
  .how-strip { grid-template-columns: 1fr; }
  .routes-screen, .play-screen, .result-screen { padding: 28px 16px 32px; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .route-grid { grid-template-columns: 1fr; }
  .route-card h3, .route-card > small { min-height: 0; }
  .route-art { height: 160px; }
  .evidence-tray { grid-template-columns: 1fr; }
  .evidence-note { min-height: 86px; grid-template-columns: 70px 1fr; justify-items: stretch; text-align: left; }
  .suspect-panel > header { display: block; }
  .suspect-grid button { min-height: 132px; }
  .suspect-grid img { height: 88px; }
  .actions { display: grid; }
  .actions button { width: 100%; }
}

@media (max-width: 430px) {
  .game-brand strong { font-size: 16px; }
  .age-pill { display: none; }
  .hero-copy > p:not(.eyebrow) { font-size: 17px; }
  .hero-facts span { padding: 8px 10px; font-size: 13px; }
  .primary-button { width: 100%; }
  .hero-scene { min-height: 225px; }
  .how-strip article { min-height: 90px; padding: 13px; }
  .task-head { gap: 8px; }
  .task-head h2 { font-size: 23px; }
  .counter { padding: 7px 9px; font-size: 12px; }
  .task-title { display: block; }
  .task-title h3 { font-size: 23px; }
  .clue-scene { border-radius: 18px; }
  .scene-evidence { border-width: 2px; border-radius: 15px; box-shadow: 0 0 0 3px rgba(46,104,78,.45), 0 7px 13px rgba(40,45,31,.16); }
  .scene-evidence span { min-width: 0; padding: 3px 5px; font-size: 8px; }
  .scene-caption { left: 7px; right: 7px; bottom: 6px; padding: 6px 8px; font-size: 9px; }
  .notebook-card { padding: 13px; }
  .evidence-note { min-height: 76px; grid-template-columns: 58px 1fr; }
  .evidence-note img { width: 54px; height: 54px; }
  .evidence-note small { font-size: 11px; }
  .suspect-grid { gap: 5px; }
  .suspect-grid button { min-height: 112px; padding: 4px; }
  .suspect-grid img { height: 72px; }
  .suspect-grid b { font-size: 11px; }
  .result-actions { display: grid; }
  .result-actions button { width: 100%; }
}
