:root {
  --wall: #F1E3CB; --wall-shade: #E6D3B4; --wood: #B06F48; --wood-dark: #8A5236;
  --frame: #F7EDDC; --frame-edge: #D9C3A0; --ink: #3A2C35; --brass: #D6A35A;
  --red: #C4553F; --red-dark: #9E3F2F; --paper: #FBF4E6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--wall); color: var(--ink); overflow: hidden;
  font-family: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.car {
  position: relative; height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(0,0,0,.06), transparent 90px), var(--wall);
}
.car::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 21%; z-index: 0;
  background: repeating-linear-gradient(90deg, transparent 0 78px, rgba(0,0,0,.07) 78px 80px), linear-gradient(var(--wood), var(--wood-dark));
  border-top: 6px solid var(--wood-dark);
}

/* 顶栏 */
.top { width: 100%; max-width: 1180px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 6; height: 40px; }
.brand { font-size: 15px; letter-spacing: .14em; opacity: .55; }
.icons { display: flex; gap: 6px; }
.icon {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(58,44,53,.07);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: .02em;
}
.icon svg { width: 18px; height: 18px; }
.icon.on { background: var(--ink); color: var(--wall); }
.rack {
  width: 100%; max-width: 1180px; height: 14px; margin: 6px 0 14px; position: relative; z-index: 2;
  border-bottom: 3px solid var(--brass); border-radius: 0 0 4px 4px;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(214,163,90,.55) 10px 12px);
}

/* 车窗 */
.window-wrap { position: relative; width: 100%; max-width: 1180px; flex: 1; min-height: 0; z-index: 2; display: flex; }
.window {
  position: relative; flex: 1; border-radius: 34px; overflow: hidden; border: 14px solid var(--frame); background: #222;
  box-shadow: 0 0 0 2px var(--frame-edge), 0 18px 30px -18px rgba(58,44,53,.45), inset 0 0 0 3px rgba(0,0,0,.12), inset 0 10px 24px rgba(0,0,0,.25);
}
.window > svg.scene, .window > canvas.fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.window > canvas.fx { pointer-events: none; }
.window .mullion { position: absolute; left: 0; right: 0; top: 17%; height: 9px; background: var(--frame); box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.window .glass {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 0 18%, rgba(255,255,255,.13) 18% 24%, transparent 24% 28%, rgba(255,255,255,.08) 28% 30%, transparent 30%),
    radial-gradient(120% 80% at 50% 120%, rgba(0,0,0,.18), transparent 60%);
}
.curtain {
  position: absolute; top: -6px; bottom: 24%; width: 9%; min-width: 30px; max-width: 70px; z-index: 3;
  background: repeating-linear-gradient(90deg, var(--red) 0 10px, var(--red-dark) 10px 13px);
  border-radius: 0 0 40% 40% / 0 0 22% 22%; box-shadow: 0 8px 14px -8px rgba(0,0,0,.4);
}
.curtain.l { left: -8px; clip-path: polygon(0 0, 100% 0, 70% 72%, 100% 100%, 0 100%); }
.curtain.r { right: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 30% 72%); }
.curtain::after { content: ""; position: absolute; left: 0; right: 0; top: 68%; height: 8px; background: var(--brass); }

/* 其他乘客 */
.passengers { position: absolute; left: 0; right: 0; bottom: -2px; height: 30%; pointer-events: none; z-index: 4; }
.pax { position: absolute; bottom: 0; height: 100%; aspect-ratio: 9 / 10; transition: opacity 1.2s; }
.pax svg { width: 100%; height: 100%; overflow: visible; }
.pax .head { transform-box: fill-box; transform-origin: 50% 90%; transition: transform .6s; }
.pax .zz { opacity: 0; transition: opacity 1s; }
.pax.doze .head { transform: rotate(18deg) translateY(4px); }
.pax.doze .zz { opacity: .8; animation: zz 3s ease-in-out infinite; }
.pax.leaving { opacity: 0; }
@keyframes zz { 50% { transform: translate(4px, -6px); } }
.pax:nth-child(1) { left: 6%; } .pax:nth-child(2) { right: 8%; height: 86%; }
.pax:nth-child(3) { left: 40%; height: 78%; } .pax:nth-child(4) { left: 24%; height: 70%; } .pax:nth-child(5) { right: 26%; height: 74%; }
@media (max-aspect-ratio: 1/1) { .pax:nth-child(n+3) { display: none; } }

/* 窗台、动作按钮 */
.sill {
  width: calc(100% + 24px); max-width: 1204px; height: 22px; position: relative; z-index: 5; margin-top: -4px;
  background: linear-gradient(var(--wood), var(--wood-dark)); border-radius: 6px; box-shadow: 0 10px 16px -8px rgba(0,0,0,.35);
}
.sill .items { position: absolute; bottom: 20px; right: 16%; display: flex; align-items: flex-end; gap: 10px; pointer-events: none; }

/* 下半部分 */
.lower { position: relative; z-index: 5; width: 100%; max-width: 1180px; display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 18px; }
.plaque {
  background: var(--paper); border: 2px solid var(--brass); border-radius: 12px; padding: 10px 18px 11px; min-width: 260px; max-width: 100%; text-align: center;
  box-shadow: 0 2px 0 var(--frame-edge), 0 8px 14px -10px rgba(0,0,0,.4); position: relative;
}
.plaque::before, .plaque::after { content: ""; position: absolute; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--brass); }
.plaque::before { left: 7px; } .plaque::after { right: 7px; }
.plaque .place { font-size: 20px; letter-spacing: .02em; }
.plaque .place small { font-size: 13px; opacity: .55; margin-left: 4px; }
.plaque .meta { font-size: 14px; margin-top: 3px; display: flex; gap: 8px; justify-content: center; opacity: .85; font-variant-numeric: tabular-nums; }
.plaque .meta b { font-weight: 500; color: var(--red); }
.plaque .countdown { font-size: 15px; margin-top: 6px; color: var(--red); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.plaque .countdown small { display: block; font-size: 12px; color: var(--ink); opacity: .6; margin-top: 2px; letter-spacing: 0; }
.plaque .sub { font-size: 12px; margin-top: 6px; opacity: .55; }
.main-btn {
  border: 0; border-radius: 999px; padding: 14px 44px; font-size: 17px; letter-spacing: .12em; position: relative;
  background: var(--red); color: #FFF4E6; box-shadow: 0 3px 0 var(--red-dark), 0 12px 20px -10px rgba(0,0,0,.5);
}
.main-btn .dot { position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #FFE08A; }
@media (min-width: 900px) {
  .car { padding-left: 40px; padding-right: 40px; }
  .window { border-width: 18px; border-radius: 44px; }
  .lower { flex-direction: row; justify-content: space-between; align-items: center; padding: 22px 8px 0; }
}
@media (max-height: 640px) { .plaque .sub { display: none; } .lower { gap: 10px; padding-top: 12px; } }

/* 心愿回顾：大站时轻轻显示一次 */
.reminder {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 7; width: min(86%, 560px);
  text-align: center; color: #FFF8EC; text-shadow: 0 2px 12px rgba(0,0,0,.45); opacity: 0; transition: opacity 2.5s; pointer-events: none;
}
.reminder.show { opacity: 1; }
.reminder q { display: block; font-size: clamp(18px, 3.4vw, 28px); line-height: 1.5; }
.reminder small { display: block; margin-top: 10px; font-size: 14px; opacity: .85; }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); z-index: 50;
  background: rgba(58,44,53,.9); color: var(--wall); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 底部弹出层 */
.sheet-bg { position: fixed; inset: 0; background: rgba(30,22,28,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--paper); width: 100%; max-width: 560px; max-height: 88dvh; overflow: auto; border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: up .25s ease-out;
}
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet h2 { font-size: 19px; font-weight: 600; margin-bottom: 12px; }
.sheet p.note { font-size: 13px; opacity: .65; line-height: 1.55; margin: 10px 0; }
.sheet textarea, .sheet input {
  width: 100%; border: 1.5px solid var(--frame-edge); border-radius: 12px; background: #fff; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--ink);
}
.sheet textarea { min-height: 84px; resize: none; }
.sheet input.code { text-transform: uppercase; letter-spacing: .2em; text-align: center; font-size: 20px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.btn { flex: 1; border: 0; border-radius: 12px; padding: 13px; font-size: 15px; background: rgba(58,44,53,.08); }
.btn.primary { background: var(--red); color: #FFF4E6; }
.link { background: none; border: 0; text-decoration: underline; font-size: 13px; opacity: .65; margin-top: 14px; display: block; margin-inline: auto; }
.codebox { text-align: center; padding: 14px; border: 1.5px dashed var(--brass); border-radius: 14px; margin: 8px 0; }
.codebox .code { font-size: 28px; letter-spacing: .14em; font-weight: 700; font-variant-numeric: tabular-nums; user-select: all; }
.qr { display: grid; place-items: center; margin: 10px auto 0; width: 168px; height: 168px; background: #fff; border-radius: 10px; padding: 8px; }
.qr img, .qr canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.tickets { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.tk img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 6px 16px -10px rgba(0,0,0,.5); }
.tk .row { margin-top: 8px; }
.wish { background: #fff; border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; margin: 6px 0; min-height: 44px; }
.section { margin-top: 22px; }
.section h3 { font-size: 14px; font-weight: 600; opacity: .7; margin-bottom: 6px; }

/* 地图 */
.mappanel {
  position: absolute; top: 52px; right: 16px; z-index: 30; width: min(360px, calc(100% - 32px));
  background: var(--paper); border-radius: 16px; padding: 12px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5);
}
.mapsvg { width: 100%; height: auto; display: block; }
.mapstrip { width: 100%; height: auto; display: block; margin-bottom: 6px; border-bottom: 1px dashed var(--frame-edge); }
.mapstrip .route { fill: none; stroke: var(--frame-edge); stroke-width: 1.2; }
.mapstrip .done { fill: none; stroke: var(--red); stroke-width: 1.8; }
.mapstrip .here { fill: var(--red); stroke: #fff; stroke-width: 1.5; }
.mapsvg a, .mapinfo a { color: inherit; text-decoration: none; }
.mapsvg .route { fill: none; stroke: var(--frame-edge); stroke-width: 2.5; stroke-dasharray: 4 5; stroke-linecap: round; }
.mapsvg .done { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mapsvg .dots circle { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.mapsvg .dots circle.passed { fill: var(--red); stroke: var(--red); }
.mapsvg .dots text { font-size: 9px; fill: var(--ink); opacity: .7; }
.mapsvg .here { fill: var(--red); stroke: #fff; stroke-width: 2; }
.mapsvg .here-glow { fill: var(--red); opacity: .2; animation: pulse 2s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .05; } }
.mapinfo { font-size: 13px; text-align: center; margin-top: 6px; }
.credit { font-size: 10px; text-align: center; margin-top: 6px; opacity: .5; }
.credit a { color: inherit; }

/* 全屏：只留车窗和角落的小字 */
.fs-info { display: none; }
body.fs .top, body.fs .rack, body.fs .lower, body.fs .mappanel, body.fs .curtain, body.fs .sill { display: none; }
body.fs .car { padding: 0; }
body.fs .window-wrap { max-width: none; }
body.fs .car::after { display: none; }
body.fs .window { border: 0; border-radius: 0; box-shadow: none; }
body.fs .window .mullion { display: none; }
body.fs .fs-info {
  display: block; position: fixed; right: 18px; bottom: 14px; z-index: 20; color: #FFF8EC; font-size: 13px;
  text-shadow: 0 1px 6px rgba(0,0,0,.6); opacity: .85; text-align: right; pointer-events: none;
}
body.fs.ui .fs-exit { display: grid; }
.fs-exit { display: none; position: fixed; top: 14px; right: 14px; z-index: 21; background: rgba(0,0,0,.35); color: #fff; }
body.fs.hide-cursor, body.fs.hide-cursor * { cursor: none !important; }

/* 分享预览图 */
body.og .fs-info, body.og .fs-exit, body.og .toast, body.og .poles { display: none !important; }
.og-title { position: fixed; left: 64px; top: 64px; z-index: 30; color: #FFF8EC; text-shadow: 0 2px 18px rgba(40,20,40,.45); }
.og-title b { display: block; font-size: 84px; letter-spacing: .04em; font-weight: 700; }
.og-title span { display: block; font-size: 34px; margin-top: 6px; }
.og-title small { display: block; font-size: 22px; margin-top: 16px; opacity: .85; }

/* 车窗上滑过的纸条（行驶中，下一站的） */
.slips { position: absolute; left: 14px; right: 14px; top: calc(17% + 14px); height: 150px; z-index: 3; overflow: hidden; pointer-events: none; }
.slips .lbl {
  position: absolute; left: 14px; top: 2px; font-size: 12px; padding: 4px 11px; border-radius: 999px; pointer-events: auto;
  background: rgba(251,244,230,.88); color: var(--ink); text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.slips .nc { position: absolute; top: 34px; left: 100%; --w: 100px; pointer-events: auto; }
.slips .nc .txt { font-size: 11px; -webkit-line-clamp: 5; }
.slips .nc .tip b { font-size: 12px; }
.slips .nc .tip p { font-size: 10px; -webkit-line-clamp: 2; }
@media (max-width: 600px) { .slips { height: 124px; } .slips .nc { --w: 84px; top: 32px; padding: 11px 7px 5px; } .slips .nc .txt { font-size: 10px; -webkit-line-clamp: 4; } .slips .nc .by { display: none; } }

/* 站台上的留言板（停站时，本站的） */
.nboard {
  position: absolute; left: calc(14px + 4%); right: calc(14px + 4%); bottom: 66px; z-index: 3;
  background: #C9A273; border: 8px solid #8A5A3A; border-radius: 10px; padding: 8px 10px 10px;
  box-shadow: 0 10px 18px -8px rgba(0,0,0,.5), inset 0 0 0 1px rgba(0,0,0,.1);
  background-image: radial-gradient(rgba(0,0,0,.08) 1px, transparent 1.5px), radial-gradient(rgba(255,255,255,.12) 1px, transparent 1.5px);
  background-size: 7px 7px, 11px 11px;
}
.nboard .head { display: flex; align-items: center; gap: 8px; color: #3A2C35; font-size: 13px; font-weight: 600; }
.nboard .head .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(251,244,230,.85); padding: 4px 10px; border-radius: 6px; }
.nboard .head button, .nboard .head a {
  border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12px; text-decoration: none; white-space: nowrap; cursor: pointer;
  background: rgba(251,244,230,.92); color: var(--ink);
}
.nboard .head .go { background: var(--red); color: #FFF6EC; }
.nboard .row { display: flex; gap: 14px; overflow-x: auto; padding: 12px 4px 2px; scrollbar-width: none; }
.nboard .row::-webkit-scrollbar { display: none; }
.nboard .row .nc { --w: 96px; padding: 12px 8px 6px; }
.nboard .row .nc .txt { font-size: 11px; }
@media (min-height: 820px) and (min-width: 900px) { .nboard .row .nc { --w: 116px; } .nboard .row .nc .txt { font-size: 12px; } }
.nboard .empty { padding: 18px 6px 8px; font-size: 13px; color: #3A2C35; }
.nboard.fold .row, .nboard.fold .empty { display: none; }
@media (max-width: 600px) { .nboard { left: 18px; right: 18px; border-width: 6px; } .nboard .row .nc { --w: 84px; } .nboard .head .all { display: none; } }
body.fs .slips, body.fs .nboard { display: none !important; }

/* 浏览器语言和页面不一致时的一次性提示 */
.langhint { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 6px;
  background: #3A2C35; color: #FBF4E6; text-decoration: none; font-size: 13px; padding: 7px 8px 7px 14px; border-radius: 999px; box-shadow: 0 6px 16px -8px rgba(0,0,0,.5); }
.langhint button { border: 0; background: rgba(255,255,255,.15); color: inherit; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; line-height: 1; }
/* Turnstile：只有需要用户点一下时才出现 */
.tsbox { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; }
