:root {
  --ink: #17211b;
  --muted: #5e6a62;
  --paper: #f5f1e8;
  --card: #fffdf8;
  --accent: #285b8f;
  --accent-dark: #173c64;
  --gold: #d79b42;
  --line: #d8d1c5;
  --good: #16784b;
  --bad: #a23434;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at top, #fff 0, var(--paper) 60%); }
button { font: inherit; }
.app-shell { width: min(1220px, 92vw); margin: 0 auto; padding: 2.5rem 0 4rem; }
.hero { text-align: center; }
.eyebrow { color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: .3rem 0 .7rem; font-family: Georgia, serif; font-size: clamp(2.6rem, 7vw, 5rem); line-height: .95; }
.hero > p:last-child, .choices-section > p { color: var(--muted); }
.toolbar { display: flex; justify-content: center; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1.5rem 0; }
.toolbar span { padding: .55rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
button { border: 0; }
#new-game, #play-again, .secondary-button { cursor: pointer; padding: .7rem 1rem; border-radius: 999px; font-weight: 800; }
#new-game, #play-again { color: white; background: var(--accent); }
#new-game:hover, #play-again:hover { background: var(--accent-dark); }
.secondary-button { color: var(--accent-dark); background: var(--card); border: 1px solid var(--accent); }
.secondary-button:hover:not(:disabled) { color: white; background: var(--accent); }
button:disabled { cursor: wait; opacity: .6; }
.status { min-height: 1.5rem; text-align: center; color: var(--muted); }
.status.error { color: var(--bad); }
.goal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.object-card { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr); background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 14px 45px rgb(35 31 24 / .08); }
.object-card img { width: 100%; height: 310px; object-fit: contain; padding: .5rem; background: #e9e4da; }
.card-label { position: absolute; z-index: 1; margin: .8rem; padding: .4rem .7rem; color: white; background: rgb(40 91 143 / .94); border-radius: 999px; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.target-card .card-label { background: rgb(166 105 23 / .94); }
.card-copy { align-self: center; padding: 1.35rem; }
.card-copy h2 { margin: 0 0 .6rem; font-family: Georgia, serif; font-size: clamp(1.25rem, 2.3vw, 2rem); }
.card-copy p { color: var(--muted); }
.choices-section, .journey { margin-top: 2rem; }
.choices-section h2, .choices-section > p, .journey h2 { text-align: center; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.choice-card { cursor: pointer; display: grid; grid-template-rows: 260px auto auto; overflow: hidden; padding: 0; color: var(--ink); text-align: left; background: var(--card); border: 2px solid transparent; border-radius: 16px; box-shadow: 0 8px 30px rgb(35 31 24 / .07); transition: transform .16s ease, border-color .16s ease; }
.choice-card:hover, .choice-card:focus-visible { transform: translateY(-4px); border-color: var(--gold); outline: none; }
.choice-card img { width: 100%; height: 100%; object-fit: contain; padding: .5rem; background: #e9e4da; }
.choice-title { padding: .85rem .9rem .2rem; font-weight: 800; }
.choice-provider { min-height: 2.3rem; padding: 0 .9rem .8rem; color: var(--muted); font-size: .82rem; }
.chain { display: flex; align-items: center; gap: .65rem; overflow-x: auto; padding: 1rem 0; }
.chain-step { flex: 0 0 105px; display: grid; gap: .35rem; text-align: center; font-size: .8rem; font-weight: 800; }
.chain-step img { width: 105px; height: 105px; object-fit: contain; padding: .25rem; background: #e9e4da; border: 1px solid var(--line); border-radius: 12px; }
.chain-arrow { flex: 0 0 auto; color: var(--accent); font-size: 1.6rem; font-weight: 900; }
.result { margin: 2rem auto 0; max-width: 680px; padding: 2rem; text-align: center; background: var(--card); border: 2px solid var(--bad); border-radius: 22px; }
.result.success { border-color: var(--good); }
.result h2 { margin-top: 0; font-family: Georgia, serif; font-size: 2rem; }
@media (max-width: 900px) {
  .goal-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .object-card { grid-template-columns: 1fr; }
  .object-card img { height: 280px; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice-card { grid-template-rows: 300px auto auto; }
}


.correct-route-panel {
  margin: 1.25rem 0;
  padding: 1rem;
  text-align: left;
  background: #f4f7fa;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.correct-route-panel h3,
.correct-route-panel > p {
  text-align: center;
}

.correct-route-panel .chain {
  justify-content: flex-start;
}

.chain-step small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.result > button + button,
.correct-route-panel + #play-again {
  margin-left: .5rem;
}
