/* stage.css — 视频主舞台（水墨）：左/上 短片舞台，右/下 地图与行动 */
:root {
  --paper: #e8dfcb; --paper-light: #f1eadb; --ink: #1b1815; --ink-soft: #4a443c; --wash: #8c8577;
  --cinnabar: #b5311f; --cinnabar-deep: #7f1d12; --lamp: #e8a23a; --water: #3f5f6b; --night: #14110e;
  --radius: 6px; --fast: 160ms; --base: 420ms; --slow: 1200ms;
  --font-title: "Yoroll_taipei-sans-tc-bold", "Yoroll_source-han-sans-sc-medium", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Yoroll_source-han-sans-sc-medium", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.live {
  position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
  background: var(--night); color: var(--ink); font-family: var(--font-body); font-weight: 500;
}
.live *, .mode-badge { box-sizing: border-box; }
.live button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.live button:disabled { cursor: default; }

/* ---------- 舞台 ---------- */
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #0f0d0b; }
.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; background: #0f0d0b; }
#vEmerge { z-index: 2; }
.veil {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
  display: flex; align-items: center; gap: 12px; max-width: 86%; padding: 12px 18px;
  background: rgba(15, 13, 11, 0.78); border: 1px solid rgba(241, 234, 219, 0.28); border-radius: var(--radius); color: var(--paper-light);
}
.veil p { margin: 0; min-width: 0; font-size: clamp(13px, 1.5vw, 16px); line-height: 1.6; overflow-wrap: anywhere; }
.inkdot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--paper-light); animation: inkpulse 1.4s ease-in-out infinite; }
@keyframes inkpulse { 0%, 100% { transform: scale(0.5); opacity: 0.35; } 50% { transform: scale(1.15); opacity: 1; } }

.seal-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  display: flex; align-items: center; justify-content: center; min-width: 168px; max-width: 80%; min-height: 56px; padding: 10px 26px;
  background: var(--cinnabar); color: var(--paper-light); border: 2px solid rgba(241, 234, 219, 0.85); outline: 3px solid var(--cinnabar);
  border-radius: 4px; font-family: var(--font-title); font-weight: 700; font-size: clamp(17px, 2.2vw, 24px); letter-spacing: 0.12em;
  transition: transform var(--fast), background var(--fast);
}
.seal-btn:hover { background: #c43a26; }
.seal-btn:active { transform: translate(-50%, -50%) scale(0.96); background: var(--cinnabar-deep); }
.ghost-btn {
  position: absolute; right: 12px; bottom: 12px; z-index: 6; min-height: 36px; padding: 6px 14px;
  background: rgba(15, 13, 11, 0.6); color: #d9cfb8; border: 1px solid rgba(241, 234, 219, 0.35); border-radius: var(--radius); font-size: 13px;
  transition: background var(--fast);
}
.ghost-btn:hover { background: rgba(15, 13, 11, 0.85); }
.ghost-btn:active { background: rgba(127, 29, 18, 0.8); }
.subtitle {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0; padding: 22px 7% 20px; text-align: center; pointer-events: none;
  background: linear-gradient(to top, rgba(15, 13, 11, 0.86) 55%, rgba(15, 13, 11, 0)); color: #f4eee0;
  font-size: clamp(14px, 1.9vw, 22px); line-height: 1.65; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; animation: fadein var(--base) both;
}
.subtitle.voice { color: #d9cfb8; font-style: italic; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.mute {
  position: absolute; right: 10px; top: 10px; z-index: 7; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(241, 234, 219, 0.85); color: var(--ink); border: 1.5px solid rgba(27, 24, 21, 0.6); font-size: 15px;
  transition: transform var(--fast), opacity var(--fast);
}
.mute:hover { transform: scale(1.06); }
.mute:active { transform: scale(0.94); }
.mute.off { opacity: 0.6; }
.shajing {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 3; display: flex; gap: 0.2em; pointer-events: none;
  font-family: var(--font-title); font-weight: 700; font-size: clamp(44px, 9vw, 110px); color: var(--ink); text-shadow: 0 0 18px rgba(241, 234, 219, 0.9), 0 0 4px rgba(241, 234, 219, 0.9);
}
.shajing span { clip-path: inset(0 0 100% 0); animation: seep 1.3s ease-in forwards; }
.shajing span:nth-child(2) { animation-delay: 1.3s; }
@keyframes seep { to { clip-path: inset(0 0 0 0); } }
.endcard {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 8%;
  background: rgba(232, 223, 203, 0.86); animation: fadein var(--slow) both;
}
.endline { margin: 0; font-family: var(--font-title); font-weight: 700; font-size: clamp(20px, 3.4vw, 40px); color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.endrule { width: 120px; height: 1.5px; background: rgba(27, 24, 21, 0.6); }
.endseal { width: 18px; height: 18px; border-radius: 2px; background: var(--cinnabar); }

/* ---------- 侧栏 ---------- */
.panel {
  min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 16px 12px; background: var(--paper);
  background-image: radial-gradient(rgba(110, 90, 50, 0.07) 1px, transparent 1.4px); background-size: 7px 7px;
  border-left: 1.5px solid rgba(27, 24, 21, 0.55);
}
.hub-top { margin: 0; padding-bottom: 8px; border-bottom: 1.5px solid rgba(27, 24, 21, 0.5); font-family: var(--font-title); font-weight: 700; font-size: clamp(16px, 1.7vw, 22px); line-height: 1.4; overflow-wrap: anywhere; }
.hub { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; align-items: start; }
.mapcol, .actcol { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.map { position: relative; width: 100%; aspect-ratio: 1; container-type: inline-size; border: 1.5px solid rgba(27, 24, 21, 0.55); background: var(--paper-light); overflow: hidden; }
.map img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.seal {
  position: absolute; width: 15%; aspect-ratio: 1; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center;
  background: var(--cinnabar); color: var(--paper-light); border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(241, 234, 219, 0.8);
  font-family: var(--font-title); font-weight: 700; font-size: 8cqw; line-height: 1; transition: background var(--base);
}
.seal.tried { background: var(--wash); }
.seal.tried::before, .seal.tried::after { content: ""; position: absolute; left: -12%; right: -12%; top: 50%; height: 2px; background: var(--cinnabar-deep); }
.seal.tried::before { transform: rotate(45deg); }
.seal.tried::after { transform: rotate(-45deg); }
.seal.stamp { animation: stamp var(--base) cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes stamp { from { transform: translate(-50%, -50%) scale(1.7); } to { transform: translate(-50%, -50%) scale(1); } }
.ring { position: absolute; left: 66%; top: 23.7%; width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 0.9cqw solid var(--cinnabar); opacity: 0.75; transition: border-color var(--slow), opacity var(--slow), border-width var(--slow); }
.well-label { position: absolute; left: 73%; top: 23.7%; transform: translateY(-50%); font-family: var(--font-title); font-weight: 700; font-size: 6.4cqw; color: var(--ink); white-space: nowrap; clip-path: inset(0 0 100% 0); transition: clip-path 2.4s ease-in 0.6s; text-shadow: 0 0 6px var(--paper-light), 0 0 2px var(--paper-light); }
.waterline { position: absolute; inset: 0; width: 100%; height: 100%; }
.waterline line { stroke: var(--ink); stroke-width: 1.1; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 2.4s ease-in-out 2.6s; }
.map.emerged .ring { border-color: var(--cinnabar-deep); opacity: 1; border-width: 1.3cqw; }
.map.emerged .well-label { clip-path: inset(0 0 0 0); }
.map.emerged .waterline line { stroke-dashoffset: 0; }
.map.instant .ring, .map.instant .well-label, .map.instant .waterline line { transition: none; }
.traces { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; justify-items: center; }
.trace { width: min(100%, 34px); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid rgba(140, 133, 119, 0.7); color: var(--wash); font-family: var(--font-title); font-weight: 700; font-size: 14px; line-height: 1; transition: background var(--base), color var(--base), transform var(--base); }
.trace.lit { background: var(--ink); border-color: var(--ink); color: var(--paper-light); box-shadow: 3px -3px 0 -1px var(--cinnabar); }
.trace.pop { transform: scale(1.25); }

.choices { display: flex; flex-direction: column; gap: 6px; }
.opt {
  width: 100%; min-width: 0; min-height: 46px; display: flex; align-items: center; justify-content: center; padding: 0 8px 0 14px; text-align: center;
  border-style: solid; border-width: 9px 12px; border-image: url("assets/ui_btn_option.webp") 70 86 fill / 9px 12px stretch;
  background: transparent; color: var(--ink); font-size: clamp(13px, 1.25vw, 16px); line-height: 1.3; overflow-wrap: anywhere;
  transition: transform var(--fast), filter var(--fast), opacity var(--fast);
}
.opt span { min-width: 0; overflow-wrap: anywhere; }
.opt:hover:not(:disabled) { transform: translateX(2px); filter: brightness(1.04); }
.opt:active:not(:disabled) { transform: scale(0.97); filter: brightness(0.94); }
.opt:disabled { opacity: 0.55; }
.opt.tried { opacity: 0.5; color: var(--wash); text-decoration: line-through; }
.opt.final { min-height: 56px; font-family: var(--font-title); font-weight: 700; font-size: clamp(14px, 1.4vw, 18px); animation: fadein var(--slow) both; }
.free { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.free input { min-width: 0; height: 40px; padding: 0 10px; border: 1.5px solid rgba(27, 24, 21, 0.55); border-radius: var(--radius); background: var(--paper-light); color: var(--ink); font: inherit; font-size: 14px; }
.free input:focus { outline: 2px solid var(--cinnabar); outline-offset: 1px; }
.free input:disabled { opacity: 0.55; }
.free-go { height: 40px; padding: 0 14px; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--ink); color: var(--paper-light); font-size: 14px; transition: background var(--fast), transform var(--fast); }
.free-go:hover:not(:disabled) { background: var(--ink-soft); }
.free-go:active:not(:disabled) { transform: scale(0.96); }
.free-go:disabled { opacity: 0.5; }

.whisper { margin: 0; padding: 6px 10px; border-left: 3px solid var(--cinnabar); color: var(--ink-soft); font-size: 14px; line-height: 1.6; font-style: italic; overflow-wrap: anywhere; animation: fadein var(--base) both; }
.status { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.act-btn { min-height: 38px; padding: 6px 14px; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--paper-light); color: var(--ink); font-size: 14px; transition: background var(--fast), transform var(--fast); }
.act-btn:hover { background: #fff8ea; }
.act-btn:active { transform: scale(0.96); background: var(--paper); }
.items { margin: 0; color: var(--wash); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.log { font-size: 13px; color: var(--ink-soft); }
.log summary { cursor: pointer; padding: 4px 0; }
.log ol { margin: 6px 0 0; padding-left: 20px; max-height: 30vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; line-height: 1.6; overflow-wrap: anywhere; }
.log b { color: var(--ink); font-weight: 700; }
.foot { margin: auto 0 0; padding-top: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; color: var(--wash); font-size: 12px; }
.foot span { min-width: 0; overflow-wrap: anywhere; }
.link-btn { min-height: 32px; padding: 4px 8px; border: 0; background: transparent; color: var(--ink-soft); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--cinnabar); }
.link-btn:active { color: var(--cinnabar-deep); }
.mode-badge { position: fixed; left: 10px; top: 10px; z-index: 50; padding: 4px 10px; border-radius: 3px; background: var(--cinnabar); color: var(--paper-light); font-family: var(--font-body); font-size: 12px; letter-spacing: 0.1em; pointer-events: none; }

/* ---------- 竖屏：舞台在上，地图与行动在下 ---------- */
@media (max-aspect-ratio: 1/1) {
  .live { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .stage { width: 100%; aspect-ratio: 3 / 2; max-height: 44vh; }
  .panel { border-left: 0; border-top: 1.5px solid rgba(27, 24, 21, 0.55); padding: 12px 12px 10px; gap: 8px; }
  .hub-top { font-size: 16px; padding-bottom: 6px; }
  .opt { font-size: 13px; min-height: 44px; }
  .subtitle { font-size: 14px; padding: 16px 5% 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .inkdot, .seal.stamp, .shajing span, .subtitle, .endcard, .whisper, .opt.final { animation: none; }
  .shajing span { clip-path: none; }
  .ring, .well-label, .waterline line, .trace, .seal { transition: none; }
}
