/* The Path Game — builds on the colors in styles.css */

body.game { min-height: 100vh; }

.game-header { max-width: 1200px; margin: 0 auto; padding: 20px 16px 4px; }
.game-header h1 { font-family: "EB Garamond", Georgia, serif; font-size: clamp(2rem, 6vw, 3rem); margin: 4px 0 0; }
.back-link { color: var(--muted); font-weight: 600; text-decoration: none; font-size: .9rem; }
.back-link:hover { color: var(--accent); }

.screen { max-width: 1200px; margin: 0 auto; padding: 12px 16px 24px; }
.card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; }

/* Start */
.start-card { max-width: 720px; margin: 0 auto; display: grid; gap: 20px; }
.big-intro { font-size: 1.2rem; margin: 0; }
.field { border: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.field > span, .field legend { font-weight: 800; font-size: .95rem; padding: 0; margin-bottom: 8px; }
.field input[type="text"] {
  font: inherit; font-size: 1.1rem; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--ring); background: var(--bg); color: var(--ink); width: 100%;
}
.field input[type="text"]:focus { outline: none; border-color: var(--accent); }
.avatars { display: flex; flex-wrap: wrap; gap: 10px; }
.avatar { font-size: 1.8rem; width: 60px; height: 60px; padding: 0; border-radius: 16px; border-width: 2px; }
.avatar.on { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.08); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.level input { position: absolute; opacity: 0; }
.level-card {
  display: grid; gap: 4px; padding: 16px; border-radius: 16px; border: 2px solid var(--ring);
  cursor: pointer; height: 100%; color: var(--muted);
}
.level-card strong { font-size: 1.25rem; color: var(--ink); }
.level-card .ages { font-weight: 800; color: var(--accent); }
.level input:checked + .level-card { border-color: var(--accent); background: var(--accent-soft); }
.level input:focus-visible + .level-card { outline: 3px solid var(--accent); outline-offset: 2px; }
button.huge { font-size: 1.3rem; padding: 16px 28px; justify-self: start; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.scores h3 { font-size: .95rem; margin: 0 0 4px; }
.scores ol { margin: 0; padding-left: 1.3em; color: var(--muted); }

/* Play */
.hud {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  font-weight: 800; padding: 8px 4px 12px;
}
.hud-stop { color: var(--muted); }
.hud-score { margin-left: auto; color: var(--accent); font-size: 1.15rem; }
.hud-streak { color: var(--hell); }

.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.board-wrap { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 8px; }
#board { display: block; width: 100%; height: auto; }

@media (max-width: 800px) {
  .play-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  #screen-play .board-wrap { position: sticky; top: 0; z-index: 5; }
  #screen-play #board { max-height: 36vh; margin: 0 auto; }
  .hud { font-size: .9rem; }
}

.challenge { min-height: 280px; }
.challenge-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; color: var(--accent); margin: 0; }
.challenge-q { font-size: clamp(1.25rem, 3.5vw, 1.6rem); line-height: 1.35; margin: 6px 0 16px; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; text-align: left;
  font-size: 1.1rem; padding: 14px 16px; border-radius: 14px; border-width: 2px;
  transition: transform .15s, background .2s;
}
.option:not(:disabled):hover { transform: translateY(-2px); background: var(--accent-soft); }
.option .key {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: .85rem;
  background: var(--accent-soft); color: var(--accent);
}
.option:disabled { cursor: default; opacity: .6; }
.option.correct { opacity: 1; background: var(--heaven); border-color: var(--heaven); color: var(--bg); }
.option.correct .key, .option.wrong .key { background: rgba(255, 255, 255, .25); color: inherit; }
.option.wrong { opacity: 1; background: var(--hell); border-color: var(--hell); color: var(--bg); }
.shake { animation: shake .35s; }

.options.order { gap: 16px; }
.order-slots { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; counter-reset: s; }
.order-slots li {
  counter-increment: s; position: relative; min-height: 58px; border: 2px dashed var(--ring); border-radius: 12px;
  display: grid; place-items: center; text-align: center; font-weight: 800; font-size: .85rem; color: var(--muted); padding: 16px 2px 4px;
}
.order-slots li::before { content: counter(s); position: absolute; top: 2px; left: 6px; font-size: .7rem; }
.order-slots li.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.order-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.order-choices .option { font-size: 1rem; padding: 10px 16px; }

.hint-btn { margin-top: 14px; }
.hint { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 12px 0 0; }

.result { margin-top: 18px; border-top: 2px solid var(--ring); padding-top: 14px; }
.result-title { font-size: 1.4rem; font-weight: 800; margin: 0 0 6px; }
.result-title.good { color: var(--heaven); }
.result-title.bad { color: var(--hell); }
.result-text { margin: 0 0 12px; }
.passage { margin: 0 0 16px; }
.passage summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.passage blockquote { font-family: "EB Garamond", Georgia, serif; font-size: 1.15rem; margin: 8px 0 0; padding-left: 14px; border-left: 3px solid var(--accent); }
.passage sup { font-family: Inter, sans-serif; font-size: .6em; font-weight: 700; color: var(--accent); margin-right: 3px; }

.timer { height: 10px; border-radius: 5px; background: var(--accent-soft); overflow: hidden; margin-bottom: 14px; }
#timer-bar { display: block; height: 100%; width: 100%; background: var(--heaven); border-radius: 5px; }
#timer-bar.low { background: var(--hell); }

/* Board */
.g-ring { fill: none; stroke: var(--ring); stroke-width: 2; stroke-dasharray: 2 8; stroke-linecap: round; }
.g-road { fill: none; stroke: var(--line); stroke-width: 4; }
.g-road.to-heaven { stroke: var(--heaven); }
.g-road.to-hell { stroke: var(--hell); }
.g-arrow { fill: var(--line); }
.g-arrow.to-heaven { fill: var(--heaven); }
.g-arrow.to-hell { fill: var(--hell); }
.g-cross { fill: var(--cross); }
.g-stairs { fill: none; stroke: var(--line); stroke-width: 4; stroke-linejoin: round; }
.g-step-label { font-weight: 800; font-size: 24px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 6px; }
.g-step.here .g-step-label { fill: var(--accent); }
.g-node { fill: var(--surface); stroke: var(--line); stroke-width: 3; }
.g-station.heaven .g-node { stroke: var(--heaven); }
.g-station.hell .g-node, .g-station.apostasy .g-node { stroke: var(--hell); }
.g-station.here .g-node { stroke: var(--accent); stroke-width: 7; fill: var(--accent-soft); }
.g-station.done .g-node { fill: var(--accent-soft); }
.g-label { font-family: "EB Garamond", Georgia, serif; font-weight: 700; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.g-church { fill: var(--line); }
.g-check { font-size: 30px; font-weight: 800; fill: var(--heaven); opacity: 0; text-anchor: middle; dominant-baseline: central; }
.g-station.done .g-check { opacity: 1; }
.g-part { transition: opacity .7s ease; }
.g-part.veiled { opacity: 0; }
.g-token { pointer-events: none; }
.g-token-bg { fill: var(--surface); stroke: var(--accent); stroke-width: 4; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .25)); }

/* Certificate */
.certificate { text-align: center; border: 6px double var(--accent); }
.cert-kicker { text-transform: uppercase; letter-spacing: .15em; font-weight: 800; color: var(--accent); margin: 0; }
.certificate h2 { font-family: "EB Garamond", Georgia, serif; font-size: 2.2rem; margin: 4px 0 12px; }
.cert-name { font-family: "EB Garamond", Georgia, serif; font-size: 2.4rem; font-weight: 700; margin: 4px 0; border-bottom: 2px solid var(--ring); display: inline-block; padding: 0 20px; }
.cert-score { font-weight: 800; color: var(--accent); }
.cert-verse { font-family: "EB Garamond", Georgia, serif; font-size: 1.2rem; font-style: italic; }
.cert-verse span { display: block; font-style: normal; font-size: .9rem; color: var(--muted); }
.cert-date { color: var(--muted); }
.end-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.button-link { align-self: center; color: var(--accent); font-weight: 700; }

/* Celebrations */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.spark {
  position: fixed; z-index: 60; pointer-events: none; color: var(--accent); font-size: 18px;
  animation: spark .8s ease-out forwards;
}
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .g-part, .option { transition: none; }
}

@media print {
  body { background: #fff; }
  .game-header, .no-print, #screen-end .board-wrap { display: none !important; }
  #screen-end .play-layout { display: block; }
  .certificate { box-shadow: none; }
}
