/* 一路有光 · 声态个人空间演示
   Night world of the short-film series. The stage is the space; controls sit at its edges by job
   (where you are, ways of seeing, the map, the two main acts, putting in order).
   Every button is drawn the same way as the figures: glowing words over a hand-drawn line, no box. */
:root {
  --bg-1: #0a0e1c; --bg-2: #121a30; --bg-3: #0c1122;
  --ink: #f1ece0; --muted: #8f98b3; --blue: #a9d6ff; --org: #ffa27c; --amb: #ffcf7a; --yel: #ffe28a;
  --rule: rgba(143, 152, 179, .24); --chip: rgba(12, 16, 32, .82); --chip-line: rgba(241, 236, 224, .32);
  --paper: #efe8d8; --paper-ink: #2b2720; --panel: rgba(12, 16, 32, .94);
  --glow: 0 0 8px rgba(241, 236, 224, .55), 0 0 18px rgba(241, 236, 224, .22);
  --f-kai: "LXGW WenKai", "Kaiti SC", "STKaiti", "KaiTi", "BiauKai", serif;
  --f-body: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg-1); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%); background-color: var(--bg-1); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.75; }
.page { width: 100%; min-height: 100vh; min-height: 100dvh; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--amb); outline-offset: 2px; }
.amb { color: var(--amb); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the one button: glowing words over a hand-drawn line ---------- */
.lb { position: relative; display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-kai); letter-spacing: .1em; line-height: 1.4;
  color: var(--ink); background: none; border: 0; border-radius: 0; cursor: pointer; text-decoration: none; text-shadow: var(--glow);
  font-size: .98rem; padding: 4px 10px 10px; transition: text-shadow .25s ease, color .25s ease; }
.lb .stroke { position: absolute; left: 9px; right: 9px; bottom: 2px; width: calc(100% - 18px); height: 7px; overflow: visible; pointer-events: none; animation: jitter .5s steps(3) infinite; }
.lb .stroke path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .38;
  filter: drop-shadow(0 0 2px currentColor); transition: opacity .25s ease; }
.lb:hover { text-shadow: 0 0 10px rgba(241, 236, 224, .85), 0 0 24px rgba(241, 236, 224, .35); }
.lb:hover .stroke path { opacity: .9; }
.lb:disabled { opacity: .35; cursor: default; }
.lb:disabled .stroke { animation: none; }
/* main acts: bigger, a light or a star in front, the line always lit */
.lb.main { font-size: 1.12rem; letter-spacing: .12em; gap: 9px; padding: 7px 16px 13px;
  background: radial-gradient(ellipse 72% 95% at 50% 55%, rgba(241, 236, 224, .08), rgba(241, 236, 224, 0) 70%); }
.lb.main .stroke { left: 12px; right: 12px; width: calc(100% - 24px); height: 8px; bottom: 3px; }
.lb.main .stroke path { stroke-width: 1.8; opacity: .75; filter: drop-shadow(0 0 2px currentColor) drop-shadow(0 0 6px currentColor); }
.lb.main:hover .stroke path { opacity: 1; }
/* on: the line lights up warm */
.lb[aria-pressed="true"] { color: var(--amb); text-shadow: 0 0 8px rgba(255, 207, 122, .7), 0 0 18px rgba(255, 207, 122, .3); }
.lb[aria-pressed="true"] .stroke path { opacity: 1; stroke-width: 1.8; filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 7px currentColor); }
/* quiet: the way out (先不写, 取消, 合上) */
.lb.quiet { color: var(--muted); text-shadow: none; }
.lb.quiet .stroke path { opacity: .25; filter: none; }
.lb.quiet:hover { color: var(--ink); }
.lb .star { color: var(--amb); font-size: .95rem; letter-spacing: 0; text-shadow: 0 0 6px var(--amb), 0 0 14px rgba(255, 207, 122, .5); }
.lb .count { font-family: var(--f-body); font-size: .76rem; letter-spacing: 0; color: var(--amb); text-shadow: 0 0 6px rgba(255, 207, 122, .8); margin-left: -3px; align-self: flex-start; }
.lb.pulse .stroke path { animation: lit 1.6s ease-in-out infinite; }
@keyframes lit { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes jitter { 0% { transform: translate(0, 0); } 33% { transform: translate(.5px, -.4px); } 66% { transform: translate(-.4px, .4px); } 100% { transform: translate(0, 0); } }
.spark { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--me, var(--blue)); box-shadow: 0 0 6px 1px var(--me, var(--blue)), 0 0 16px 4px rgba(241, 236, 224, .16); animation: breathe 2.8s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.85); opacity: .85; } 50% { transform: scale(1.15); opacity: 1; } }

/* ---------- stage ---------- */
.stage { position: relative; height: 100vh; height: 100dvh; min-height: 480px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 78%, rgba(18, 26, 48, .35) 30%, rgba(5, 7, 14, .82) 100%); }
.canvas-wrap { position: relative; height: 100%; min-width: 0; min-height: 0; }
#space { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; width: 100%; height: auto; touch-action: pan-y; cursor: grab; }
#space.dragging { cursor: grabbing; }
.hud { position: absolute; z-index: 3; display: flex; align-items: center; gap: 2px; }
.hud-tl { left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); }
.hud-tr { right: max(10px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); flex-wrap: wrap; justify-content: flex-end; }
.hud-bl { left: max(14px, env(safe-area-inset-left)); bottom: max(38px, env(safe-area-inset-bottom)); }
.hud-bc { left: 50%; bottom: max(38px, env(safe-area-inset-bottom)); transform: translateX(-50%); }
.hud-br { right: max(10px, env(safe-area-inset-right)); bottom: max(38px, env(safe-area-inset-bottom)); }
.namecard { display: flex; flex-direction: column; gap: 0; padding: 2px 4px; }
.namecard .name { font-family: var(--f-kai); font-size: 1.45rem; letter-spacing: .12em; line-height: 1.35; text-shadow: 0 0 12px rgba(241, 236, 224, .45); color: inherit; border: 0; padding: 0; background: none; text-align: left; cursor: pointer; }
.namecard .where { font-size: .78rem; color: var(--muted); letter-spacing: .06em; }

/* the map: the whole road at a glance, like a game's minimap */
.map { background: rgba(8, 11, 22, .82); border: 1px solid rgba(241, 236, 224, .16); border-radius: 10px; padding: 4px 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 0 0 18px rgba(241, 236, 224, .04); }
#minimap { display: block; width: 300px; height: 84px; cursor: pointer; touch-action: none; }

.acts { display: flex; align-items: center; gap: 14px; }

/* choosing moments to create from: what you picked on top (paper slips: they are your own words), every moment below */
.picker { position: absolute; z-index: 5; right: 10px; top: 10px; bottom: 10px; width: min(350px, 40%); display: flex; flex-direction: column; gap: 10px;
  background: rgba(10, 14, 28, .93); border: 1px solid rgba(241, 236, 224, .12); border-radius: 12px; padding: 14px 14px 8px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pk-head { display: flex; flex-direction: column; gap: 2px; }
.pk-head .cap-kicker { letter-spacing: .2em; margin: 0 0 2px; font-size: .72rem; }
.pk-title { font-family: var(--f-kai); font-size: 1.3rem; letter-spacing: .1em; text-shadow: 0 0 10px rgba(241, 236, 224, .4); }
.pk-sub { font-size: .8rem; color: var(--muted); }
.picked { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; align-items: flex-start; }
.picked .empty { font-size: .8rem; color: var(--muted); line-height: 1.6; }
.slip { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; background: var(--paper); color: var(--paper-ink); border: 0; border-radius: 2px; padding: 3px 8px;
  font-family: var(--f-kai); font-size: .86rem; line-height: 1.5; cursor: pointer; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.slip:nth-child(odd) { transform: rotate(-1deg); } .slip:nth-child(even) { transform: rotate(.8deg); }
.slip .d { font-family: var(--f-body); font-size: .68rem; color: #6d6656; flex: none; }
.slip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 5.6em; }
.slip .x { color: #6d6656; flex: none; }
.slip:hover .x { color: var(--paper-ink); }
.pk-filter { display: flex; flex-wrap: wrap; gap: 0; margin-left: -10px; }
.pk-filter .lb { font-size: .84rem; padding: 2px 9px 8px; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pk-list { list-style: none; margin: 0 -6px; padding: 0; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.pk-row { width: 100%; display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: start; text-align: left; background: none; border: 0; border-radius: 8px;
  color: var(--ink); padding: 5px 8px; cursor: pointer; font: inherit; }
.pk-row:hover, .pk-row:focus-visible { background: rgba(241, 236, 224, .07); }
.pk-row .ck { grid-row: span 2; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 1px dashed rgba(241, 236, 224, .5); display: grid; place-items: center; }
.pk-row .meta { display: flex; align-items: center; gap: 6px; font-size: .7rem; color: var(--muted); }
.pk-row .txt { font-family: var(--f-kai); font-size: .95rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pk-row[aria-pressed="true"] .ck { border: 0; background: var(--amb); box-shadow: 0 0 8px rgba(255, 207, 122, .8); }
.pk-row[aria-pressed="true"] .ck::after { content: ""; width: 4px; height: 7px; border: solid var(--bg-1); border-width: 0 1.6px 1.6px 0; transform: translate(0, -1px) rotate(45deg); }
.pk-row[aria-pressed="true"] .txt { color: var(--amb); text-shadow: 0 0 8px rgba(255, 207, 122, .35); }
.pk-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid rgba(241, 236, 224, .1); padding-top: 6px; margin-left: -10px; }
.pk-count { font-size: .8rem; color: var(--muted); }

/* captions over the picture (Studio-like: a small line, a rule, one sentence) */
.cap { position: absolute; z-index: 2; left: 50%; top: 15%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(560px, 80%); text-align: center; pointer-events: none; }
.cap a, .cap button { pointer-events: auto; }
.cap.side { left: 30%; top: 30%; }
.cap-kicker { font-size: .78rem; letter-spacing: .5em; margin-right: -.5em; color: var(--muted); }
.cap-rule { width: 26px; height: 1px; background: var(--ink); opacity: .6; }
.cap-line { font-family: var(--f-kai); font-size: clamp(1.15rem, 2.1vw, 1.6rem); letter-spacing: .2em; margin-right: -.2em; text-shadow: 0 0 14px rgba(241, 236, 224, .45), 0 2px 18px rgba(5, 7, 14, .9); }

/* writing a moment: no card, just a line to write on */
.veil { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 50%, rgba(5, 7, 14, .84) 25%, rgba(5, 7, 14, .9) 100%); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet { width: min(560px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sheet textarea { width: 100%; min-height: 0; resize: none; background: transparent; border: 0; border-bottom: 1px solid rgba(241, 236, 224, .35); border-radius: 0;
  font-family: var(--f-kai); font-size: clamp(1.2rem, 2.4vw, 1.6rem); line-height: 1.6; letter-spacing: .06em; text-align: center; color: var(--me, var(--blue));
  text-shadow: 0 0 10px currentColor; padding: 6px 4px 8px; caret-color: var(--ink); box-shadow: 0 10px 14px -14px rgba(241, 236, 224, .8); }
.sheet textarea::placeholder { color: rgba(241, 236, 224, .3); text-shadow: none; }
.sheet textarea:focus { outline: none; border-bottom-color: rgba(241, 236, 224, .75); }
.starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 2.2em; }
.sheet-acts { display: flex; align-items: center; gap: 18px; margin-top: 4px; }

/* the reminder slip and the info card */
.note { position: absolute; z-index: 3; right: 14px; top: 58px; width: 220px; background: var(--paper); color: var(--paper-ink); border-radius: 3px; padding: 10px 12px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45); transform: rotate(1.4deg); display: flex; flex-direction: column; gap: 2px; font-family: var(--f-kai); }
.note::before { content: ""; position: absolute; top: -7px; left: 50%; width: 46px; height: 14px; transform: translateX(-50%) rotate(-2deg); background: rgba(255, 207, 122, .7); }
.note-title { font-size: 1rem; }
.note-body { font-size: .95rem; line-height: 1.55; }
.note-ok { align-self: flex-end; font-family: var(--f-kai); font-size: .85rem; color: #6d6656; background: transparent; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.panel { position: absolute; z-index: 4; width: min(340px, calc(100% - 24px)); background: var(--panel); color: var(--ink); border: 1px solid rgba(241, 236, 224, .12); border-radius: 10px; padding: 12px 14px 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55); font-size: .92rem; line-height: 1.7; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.panel.paper { background: var(--paper); color: var(--paper-ink); border-color: var(--paper); font-family: var(--f-kai); font-size: 1.02rem; }
.panel .d { display: block; font-family: var(--f-body); font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.panel .d.gap { margin-top: 8px; }
.panel.paper .d { color: #6d6656; }
.panel .t { font-family: var(--f-kai); font-size: 1.15rem; display: block; margin-bottom: 2px; }
.panel .row { display: flex; gap: 2px; flex-wrap: wrap; margin: 6px 0 0 -10px; }
.panel.paper .lb { color: var(--paper-ink); text-shadow: none; }
.panel.paper .lb .stroke path { filter: none; opacity: .5; }
.panel .x { position: absolute; right: 6px; top: 4px; border: 0; background: transparent; color: inherit; font-size: 1.15rem; padding: 0 6px; cursor: pointer; }
.msg { position: absolute; z-index: 3; left: 50%; bottom: 144px; transform: translateX(-50%); width: min(660px, calc(100% - 32px)); font-family: var(--f-kai); font-size: 1.1rem; margin: 0; text-align: center; text-shadow: 0 0 10px rgba(241, 236, 224, .3); pointer-events: none; }
.msg:empty { display: none; }
.foot { position: absolute; z-index: 3; right: max(16px, env(safe-area-inset-right)); bottom: max(6px, env(safe-area-inset-bottom)); font-size: .65rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ---------- overlays (entering, the story player) ---------- */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(5, 7, 14, .9); display: grid; place-items: center; overflow-y: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-bottom, 0px)); }
.card { width: min(760px, 100%); background: rgba(14, 19, 36, .98); border: 1px solid var(--rule); border-radius: 14px; padding: clamp(18px, 3vw, 30px); display: flex; flex-direction: column; gap: 14px; }
.card.bare { background: none; border: 0; align-items: center; text-align: center; gap: 12px; }
.card-wide { width: min(1120px, 100%); }
.card h2 { font-family: var(--f-kai); font-weight: 400; font-size: 1.8rem; margin: 0; letter-spacing: .1em; text-shadow: 0 0 14px rgba(241, 236, 224, .35); }
.card-kicker { font-size: .8rem; color: var(--muted); letter-spacing: .08em; }
.card-body { font-size: .95rem; color: #cfd2db; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; }
.pick { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: center; text-align: left; }
#preview { width: 220px; height: 260px; margin: 0 auto; display: block; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt-label { font-size: .78rem; color: var(--muted); display: block; letter-spacing: .2em; }
.opt-set { display: flex; flex-wrap: wrap; gap: 0; margin-left: -10px; }
.swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
textarea { width: 100%; min-height: 88px; font-family: var(--f-kai); font-size: 1.1rem; color: var(--blue); background: rgba(10, 14, 28, .9); border: 1px dashed var(--blue); border-radius: 8px; padding: 10px 12px; resize: vertical; }
#story { display: block; width: 100%; height: auto; border-radius: 8px; background: radial-gradient(ellipse at 50% 70%, rgba(18, 26, 48, .3) 30%, rgba(5, 7, 14, .85) 100%); }
.story-ctl { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; min-height: 40px; margin-left: -10px; }
.story-ctl .lb.a { color: var(--amb); }
.story-ctl .lb.b { color: var(--blue); }
.story-ctl .lb.paper { color: var(--paper); }
.story-extra { display: flex; flex-direction: column; gap: 8px; }
.turn-hint { display: none; margin: 0; font-size: .82rem; color: var(--muted); text-align: center; }

/* ---------- narrow screens: controls move out of the picture ---------- */
@media (max-width: 980px) {
  .stage { display: grid; min-height: 580px; grid-template-columns: 1fr auto; grid-template-areas: "tl tr" "note note" "cap cap" "canvas canvas" "msg msg" "bl bl" "bc br" "foot foot"; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto auto; gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .picker { inset: 10px; width: auto; max-height: none; }
  .hud { position: static; transform: none; max-width: none; }
  .hud-tl { grid-area: tl; } .hud-tr { grid-area: tr; } .canvas-wrap { grid-area: canvas; height: auto; } .hud-bl { grid-area: bl; } .hud-bc { grid-area: bc; justify-content: flex-start; } .hud-br { grid-area: br; }
  .hud-bl, .map { width: 100%; } #minimap { width: 100%; }
  .note { grid-area: note; position: static; width: auto; transform: none; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .note::before { display: none; }
  .cap, .cap.side { grid-area: cap; position: static; transform: none; width: auto; padding: 2px 0 4px; }
  .msg { grid-area: msg; position: static; transform: none; width: auto; font-size: .9rem; }
  .foot { grid-area: foot; position: static; justify-self: end; }
}
@media (max-width: 620px) {
  .stage { grid-template-columns: 1fr; grid-template-areas: "tl" "tr" "note" "cap" "canvas" "msg" "bl" "bc" "br" "foot"; grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto auto auto auto; }
  .hud-tr { justify-content: flex-start; margin-left: -10px; }
  .hud-br { margin-left: -10px; }
  .pick { grid-template-columns: 1fr; }
  .acts { flex-wrap: wrap; }
  .turn-hint { display: block; }
  .card h2 { font-size: 1.5rem; }
  .cap-kicker { letter-spacing: .3em; margin-right: -.3em; }
  .cap-line { letter-spacing: .1em; margin-right: -.1em; font-size: 1.05rem; }
  .veil { position: fixed; z-index: 30; }
}
@media (prefers-reduced-motion: reduce) { .note, .slip:nth-child(odd), .slip:nth-child(even) { transform: none; } .spark, .lb .stroke, .lb.pulse .stroke path { animation: none; } }
