/* Web-only additions to the app's style.css: sign-in, the Youku watch button, the account line and phones. */
.account { margin-top: 14px; padding: 12px 6px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.account span { font-size: 12px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .text { justify-self: start; padding: 0; }

.watch-now { display: flex; align-items: center; min-height: 104px; margin-bottom: 18px; }
.watch-now .big { padding: 16px 30px; font-size: 18px; border-radius: 999px; }
.watching { display: flex; align-items: center; gap: 16px; width: 100%; }
.watching > div { flex: 1; display: grid; }
.watching strong { font: 600 24px var(--serif); color: var(--gold-soft); }
.watching small { color: var(--muted); font-size: 14px; }
.watching .pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--crimson); box-shadow: 0 0 0 0 rgba(177, 48, 63, .6); animation: beat 1.6s infinite; }
@keyframes beat { 70% { box-shadow: 0 0 0 12px rgba(177, 48, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(177, 48, 63, 0); } }

/* Keepsakes are drawn off screen at full size, then turned into a PNG. */
#keepsake-stage { position: fixed; left: -12000px; top: 0; width: 1080px; height: 1350px; pointer-events: none; }

/* Phones and narrow windows: the sidebar becomes a bar at the bottom. */
@media (max-width: 860px) {
  aside { inset: auto 0 0 0; width: auto; height: auto; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); flex-direction: row; z-index: 20; border-right: 0; border-top: 1px solid var(--line); }
  .brand, .lang-pick label, .account span { display: none; }
  nav { margin: 0; flex: 1; display: flex; justify-content: space-around; gap: 0; }
  .nav { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; position: relative; }
  .nav span { max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
  .nav-badge { position: absolute; top: 0; right: 4px; }
  .account { display: none; }
  .lang-pick { position: fixed; top: 10px; right: 12px; margin: 0; padding: 0; }
  .lang-pick select { width: auto; padding: 6px 8px; font-size: 13px; }
  main { margin-left: 0; padding: 20px 16px 96px; }
  .page-head, .map-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .fp-grid, .fp-pages, .cheer-grid, .card-layout, .tiles { grid-template-columns: 1fr; }
  .fp-card { grid-template-columns: 110px 1fr; }
  h1 { font-size: 36px; }
  .watch-now .big { width: 100%; }
  .watching { flex-wrap: wrap; }
}

/* The painted map (Codex, design/journey-map) with the chapter panel beside it on wide screens and below it
   on phones, so nothing covers the scenes. */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.map-wrap .map { width: 100%; max-width: calc((100vh - 190px) * 988 / 724); margin: 0; background: #e9dcc3; }
.map-wrap .chapter-panel { position: static; width: auto; }
.map-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-art .road-done { stroke: #e8b44f; stroke-width: 4; stroke-dasharray: 1 9; opacity: .95; filter: drop-shadow(0 0 3px rgba(255, 236, 190, .9)); }
.map .node .medal { width: 40px; height: 40px; border: 2px solid #f3d797; background: #b1303f; color: #fff4dc; box-shadow: 0 3px 10px rgba(40, 20, 10, .45); }
.map .node .medal b { font: 700 20px/1 var(--serif); }
.map .node.current .medal { width: 50px; height: 50px; border-width: 3px; box-shadow: 0 0 0 6px rgba(243, 215, 151, .45), 0 0 0 13px rgba(243, 215, 151, .18), 0 4px 14px rgba(40, 20, 10, .5); }
.map .node.locked .medal { width: 34px; height: 34px; border: 2px solid rgba(90, 60, 40, .55); background: rgba(247, 236, 214, .82); box-shadow: 0 2px 8px rgba(40, 20, 10, .3); }
.map .node.locked .medal svg { stroke: #6b4b33; width: 16px; height: 16px; }
.map .node.locked.goal .medal { width: 40px; height: 40px; border-color: #b8893b; }
.map .node.locked.goal .medal svg { stroke: #9a6b22; width: 20px; height: 20px; }
.map .node .label { width: auto; min-width: 90px; max-width: 160px; margin-top: 5px; padding: 3px 9px; border-radius: 8px; background: rgba(247, 236, 214, .86); box-shadow: 0 2px 8px rgba(40, 20, 10, .25); }
.map .node .label small { color: #9b2c39; font-size: 9px; }
.map .node .label strong, .map .node.locked .label strong, .map .node.current .label strong { color: #3a2416; font-size: 15px; }
.map .node.locked .label { background: rgba(247, 236, 214, .7); }
.map .node.locked .label small { color: #7a5a40; }
.map .node .here { margin-bottom: 6px; padding: 3px 10px; background: #b1303f; color: #fff4dc; border: 1px solid #f3d797; }
.map .node .here.soft { background: rgba(247, 236, 214, .9); color: #3a2416; border-color: #b8893b; }
@media (max-width: 1100px) { .map-wrap { grid-template-columns: 1fr; } .map-wrap .map { max-width: none; } }
@media (max-width: 860px) {
  main { padding-top: 60px; }
  .map-wrap { width: 100%; }
  .map-wrap .chapter-panel { position: static; width: auto; margin: 14px 0 0; }
  .sched-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draw-bar { flex-wrap: wrap; }
  .draw-text { min-width: 170px; }
  .draw-bar .primary { width: 100%; }
  .fp-page { white-space: normal; text-align: left; min-width: 0; }
  .fp-page > span { min-width: 0; }
  .fp-hero { gap: 16px; }
  .fp-hero .hn-logo.big { width: 64px; height: 64px; font-size: 32px; }
}

/* Until we know whether the fan is signed in, show neither the app nor the sign-in form. */
body.booting > aside, body.booting > main { visibility: hidden; }

/* Daily film question. */
.quiz-dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); color: var(--paper); }
.quiz-dialog::backdrop { background: rgba(10, 2, 4, .7); }
.quiz-box { padding: 26px 24px 20px; display: grid; gap: 14px; }
.quiz-box h2 { margin: 0; font: 600 26px/1.3 var(--serif); }
.quiz-options { display: grid; gap: 10px; }
.quiz-option { display: flex; gap: 12px; align-items: center; text-align: left; white-space: normal; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); color: var(--paper); font-size: 15px; }
.quiz-option b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); font: 600 14px var(--serif); }
.quiz-option:not(:disabled):hover { border-color: var(--gold); background: rgba(226, 184, 102, .08); }
.quiz-option:disabled { cursor: default; opacity: .75; }
.quiz-option.right { opacity: 1; border-color: var(--jade); background: rgba(95, 163, 138, .18); }
.quiz-option.right b { background: var(--jade); border-color: var(--jade); color: #10261f; }
.quiz-option.wrong { opacity: 1; border-color: var(--crimson); background: rgba(177, 48, 63, .18); }
.quiz-result { margin: 0; min-height: 22px; font-size: 14px; color: var(--muted); }
.quiz-result.right { color: #8fd3b6; } .quiz-result.wrong { color: #f0a0a8; }
.quest.missed { opacity: .7; }

/* Running watch session: a bar at the top of every page except Watch, where the panel shows it. */
.watch-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; margin: -28px -36px 20px; padding: 10px 36px; background: rgba(42, 16, 21, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.watch-bar > div { flex: 1; display: grid; min-width: 0; }
.watch-bar strong { font: 600 18px var(--serif); color: var(--gold-soft); }
.watch-bar small { color: var(--muted); font-size: 12px; }
.watch-bar .pulse, .watching .pulse { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--crimson); animation: beat 1.6s infinite; }
.watch-bar .primary { padding: 8px 14px; font-size: 13px; }
.watch-actions { display: flex; gap: 10px; align-items: center; }
@media (max-width: 860px) {
  .watch-bar { margin: -60px -16px 16px; padding: 10px 16px; flex-wrap: wrap; top: 0; }
  .watch-bar > div { flex-basis: calc(100% - 30px); padding-right: 120px; } /* room for the language picker */
  .watch-bar .text { margin-left: 24px; }
  .watch-actions { width: 100%; justify-content: space-between; }
}

/* Invite friends: the fan's public page doubles as the invite link. */
.invite { margin-top: 18px; display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: center; }
.invite .hint { margin: 6px 0; }
.invite small { color: var(--gold); }
.invite-link input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--paper); font-size: 14px; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }
@media (max-width: 860px) { .invite { grid-template-columns: 1fr; } }

/* Two places to watch. */
.watch-start { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.watch-start .hint { flex-basis: 100%; margin: 0; }
.watch-start .secondary.big { padding: 16px 30px; font-size: 18px; border-radius: 999px; }
@media (max-width: 860px) { .watch-start .big { width: 100%; } }
@media (max-width: 860px) {
  .watching > div { flex-basis: calc(100% - 30px); }
  .watching strong { font-size: 22px; }
  .watching .watch-actions { width: 100%; justify-content: space-between; }
  #toast { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); width: auto; max-width: none; transform: none; }
}

/* Phones: smaller markers; only the current chapter keeps its label so the scenes stay visible. */
@media (max-width: 860px) {
  .map .node { transform: translate(-50%, -50%) scale(.72); }
  .map .node .label { display: none; }
  .map .node.current .label { display: block; }
  .map .node .here { display: none; }
}
/* Locked chapters are disabled buttons; keep them readable on the bright painting. */
.map .node:disabled { opacity: 1; cursor: default; }
