/* Story mode "The Climb": landing entry, chapter map, intro card, in-match hints, star result (story-ui.js). */

/* landing: the Story button spans the CTA row under Friends / Practice */
.cta-row .story-cta { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.story-cta-sub { font-size: 0.78rem; font-weight: 600; opacity: 0.8; }
.mode-icon.story { background: conic-gradient(from 45deg, #f6e58a 0 25%, #e3c233 0 50%, #8f7715 0 75%, #c9a52a 0); }
.story-card-progress { margin: 0 0 10px; font-weight: 800; color: var(--gold-dk, #8f7715); min-height: 1.2em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .story-card-progress { color: var(--gold); } }
:root[data-theme="dark"] .story-card-progress { color: var(--gold); }

/* chapter header */
.st-chapter { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 14px; overflow: hidden; }
.st-chapter::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--crew); }
.st-chapter h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 5vw, 2rem); }
.st-intro { margin: 0 0 10px; color: var(--muted); max-width: 62ch; line-height: 1.5; }
.st-totals { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; font-weight: 800; }
.st-totals span:last-child { color: var(--gold-dk, #8f7715); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .st-totals span:last-child { color: var(--gold); } }
:root[data-theme="dark"] .st-totals span:last-child { color: var(--gold); }

/* the path of encounters */
.st-path { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: none; }
.st-node { position: relative; }
.st-node:not(:last-child)::after { content: ""; position: absolute; left: 33px; bottom: -11px; width: 2px; height: 12px; background: var(--line); }
.st-node.cleared:not(:last-child)::after { background: var(--accent); }
.st-node-btn { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; }
.st-node-btn:hover:not([disabled]) { border-color: var(--accent); }
.st-node.next .st-node-btn { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.st-node.boss .st-node-btn { border-color: color-mix(in srgb, var(--gold) 70%, var(--line)); }
.st-node-btn[disabled] { opacity: 0.55; cursor: default; }
.st-num { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-family: "Russo One", sans-serif; font-size: 1.15rem;
  background: var(--bg); border: 1px solid var(--line); }
.st-node.cleared .st-num { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.st-node.boss .st-num { background: linear-gradient(135deg, var(--gold-lt), var(--gold)); color: #3a2f05; border-color: transparent; }
.st-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-info b { font-size: 1rem; }
.st-info span { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; }
.st-stars { display: inline-flex; gap: 1px; font-size: 1.05rem; letter-spacing: 0; white-space: nowrap; }
.st-stars span { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.st-stars span.on { color: var(--gold); text-shadow: 0 0 6px color-mix(in srgb, var(--gold) 50%, transparent); }

/* intro card */
.st-card { max-width: 520px; text-align: left; }
.st-card .st-card-actions { margin-top: 4px; }
.st-card-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.st-busts { display: flex; flex: 0 0 auto; }
.st-bust { display: inline-flex; width: 88px; height: 88px; border-radius: 18px; background: color-mix(in srgb, var(--crew) 22%, var(--bg)); border: 2px solid var(--crew); overflow: hidden; }
.st-bust + .st-bust { margin-left: -22px; }
.st-bust svg { width: 100%; height: 100%; }
.st-card-title { min-width: 0; }
.st-card-title h3 { margin: 0 0 4px; font-size: 1.3rem; }
.st-line { margin: 0; font-style: italic; color: var(--ink); }
.st-line span { font-style: normal; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.st-line span::before { content: "— "; }
.st-goals { list-style: none; margin: 8px 0 12px; padding: 0; display: grid; gap: 6px; }
.st-goals li { display: flex; gap: 8px; align-items: baseline; color: var(--muted); }
.st-goals li span { color: color-mix(in srgb, var(--muted) 55%, transparent); font-size: 1.05rem; }
.st-goals li.got { color: var(--ink); }
.st-goals li.got span { color: var(--gold); }
.st-card-actions .btn { min-height: 44px; }
@media (max-width: 480px) {
  .st-card-head { align-items: flex-start; }
  .st-bust { width: 72px; height: 72px; }
  .st-node-btn { grid-template-columns: 40px minmax(0, 1fr); }
  .st-node-btn .st-stars { grid-column: 2; }
  .st-num { width: 40px; height: 40px; }
}

/* in-match tip: a slim bar at the top of the well, never blocking input */
.st-journey { margin-bottom: 24px; }
.st-districts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.st-district { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; white-space: normal; padding: 16px; min-height: 100px; text-align: left; }
.st-district > span:last-child { font-size: .8rem; font-weight: 400; }
.st-district.selected { border: 2px solid var(--accent); }
.st-district:disabled { opacity: 1; color: var(--muted); background: var(--bg-deep); }
.st-crest { color: var(--accent); }
.st-briefing { line-height: 1.55; }
@media (max-width: 480px) { .st-district { padding: 12px; font-size: .86rem; } }
.story-hint { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 3; display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); color: var(--ink); border: 1px solid var(--accent); box-shadow: 0 6px 18px var(--shadow); font-size: 0.88rem; line-height: 1.35; pointer-events: auto; }
.story-hint span { flex: 1; }
.story-hint-x { flex: 0 0 auto; width: 32px; height: 32px; margin: -4px -4px -4px 0; border: 0; border-radius: 8px; background: transparent; font-size: 1.2rem; cursor: pointer; color: var(--muted); }

/* star result inside the end-of-match overlay */
.story-result { width: 100%; max-width: 300px; }
.st-result-stars { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 6px; text-align: left; }
.st-result-stars li { display: flex; gap: 8px; align-items: center; font-size: 0.86rem; color: var(--overlay-sub); opacity: 0.75; }
.st-result-stars li.got { opacity: 1; color: var(--on-strong); }
.st-star { flex: 0 0 auto; font-size: 1.5rem; line-height: 1; color: rgba(255,255,255,0.25); }
.st-result-stars li.got .st-star { color: var(--gold); text-shadow: 0 0 10px color-mix(in srgb, var(--gold) 60%, transparent); }
.story-result.animate li.got .st-star { animation: st-pop 0.45s cubic-bezier(.2,1.6,.4,1) both; animation-delay: calc(var(--i) * 0.22s + 0.15s); }
.st-result-stars li.new::after { content: "NEW"; margin-left: auto; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.1em; color: var(--gold); }
.st-reward { margin: 0 0 4px; font-weight: 800; color: var(--gold); }
.st-reward span { font-weight: 600; color: var(--overlay-sub); }
.st-tip { margin: 0 0 6px; font-size: 0.85rem; color: var(--overlay-sub); min-height: 0; }
.st-tip:empty { display: none; }
@keyframes st-pop { 0% { transform: scale(0.2) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .story-result.animate li.got .st-star { animation: none; } }
