:root {
  --bg: #0b1119; --panel: #131c27; --card: #18232f; --line: #263444; --txt: #dbe5ef; --dim: #8496a8;
  --pri: #2f9bff; --ok: #35d07f; --warn: #ffb92e; --bad: #ff5a4d;
  --coin: #f2b632; --bill: #35c27a; --ticket: #4aa8ff;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--txt); font: 14px/1.55 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; background: #223142; border: 1px solid #31455b; border-radius: 6px; padding: 5px 11px; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { background: #2b3f55; border-color: #46627f; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
button.pri:hover:not(:disabled) { background: #55adff; }
button.warn { background: #5a2b25; border-color: #8a3d33; }
button.mini { padding: 1px 8px; font-size: 12px; border-radius: 10px; }
select, input { background: #0f1822; border: 1px solid #31455b; border-radius: 6px; padding: 5px 8px; }
h3, h4, h5, p { margin: 0; }
.dim { color: var(--dim); }

/* ---------- header ---------- */
header { flex: none; display: flex; align-items: center; gap: 22px; padding: 9px 16px; background: linear-gradient(#17222f, #111a25); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { background: var(--pri); color: #fff; font-weight: 800; letter-spacing: 1px; padding: 6px 9px; border-radius: 7px; }
.brand b { display: block; font-size: 16px; line-height: 1.2; }
.brand small { color: var(--dim); font-size: 12px; }
nav { display: flex; background: #0d151e; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
nav button { border: 0; background: none; padding: 6px 18px; border-radius: 7px; color: var(--dim); font-weight: 600; }
nav button.on { background: var(--pri); color: #fff; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tools button.on { background: #1c4f80; border-color: var(--pri); color: #fff; }
.tools label { color: var(--dim); font-size: 12px; display: flex; align-items: center; gap: 6px; margin-left: 6px; }

/* ---------- layout ---------- */
main { flex: 1; min-height: 0; display: flex; }
#stage { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#stage canvas { display: block; width: 100%; height: 100%; outline: none; }
#stage.alarm::after { content: ""; position: absolute; inset: 0; border: 6px solid var(--bad); pointer-events: none; animation: al .3s 4 alternate; }
@keyframes al { from { opacity: 1; } to { opacity: .15; } }
#side { flex: none; width: 430px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.pane { display: none; flex-direction: column; gap: 10px; }
body[data-mode=structure] .pane[data-pane=structure], body[data-mode=passenger] .pane[data-pane=passenger], body[data-mode=staff] .pane[data-pane=staff] { display: flex; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.card > h3 { font-size: 13px; color: #9fd0ff; letter-spacing: .5px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card > h3 small, .card > h3 .inline { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 12px; }
.card > h3 .mini { margin-left: auto; }
.card > h3 select { padding: 2px 6px; max-width: 190px; }

/* ---------- stage overlays ---------- */
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lab { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; padding: 1px 7px; border-radius: 10px; background: rgba(16, 28, 40, .82); border: 1px solid #3c5670; color: #cfe3f7; }
.lab.sel { background: var(--pri); border-color: #8fcaff; color: #fff; font-weight: 600; }
.lab.hint { background: var(--warn); border-color: #ffe2a1; color: #2a1c00; font-weight: 700; }
.chip { position: absolute; left: 14px; top: 12px; padding: 5px 14px; border-radius: 16px; font-weight: 700; background: #1c2733; border: 1px solid var(--line); }
.chip.ok { background: #0f3a25; border-color: var(--ok); color: #7df0b0; }
.chip.warn { background: #40300a; border-color: var(--warn); color: #ffd675; }
.chip.bad { background: #47160f; border-color: var(--bad); color: #ffa79f; }
.help { position: absolute; left: 14px; bottom: 10px; color: #5f7386; font-size: 12px; }
#toast { position: absolute; left: 50%; top: 14px; transform: translate(-50%, -20px); opacity: 0; transition: .25s; padding: 9px 18px; border-radius: 8px; background: #1d2b3a; border: 1px solid #3b556f; max-width: 70%; pointer-events: none; font-weight: 600; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.warn { background: #4a3608; border-color: var(--warn); color: #ffe3a1; }
#toast.bad { background: #55170f; border-color: var(--bad); color: #ffd2cd; }
#toast.ok { background: #0f3a25; border-color: var(--ok); color: #b2f5d0; }

/* ---------- structure ---------- */
.grp { margin-bottom: 8px; }
.grp h5 { font-size: 12px; color: var(--txt); margin-bottom: 4px; display: flex; }
.grp h5 small { margin-left: auto; color: var(--dim); font-weight: 400; }
#tree button, .quick button { font-size: 12px; padding: 2px 9px; margin: 0 4px 4px 0; border-radius: 12px; }
#tree button.on, .quick button.on { background: var(--pri); border-color: var(--pri); color: #fff; }
#info h4 { font-size: 15px; margin-bottom: 5px; color: #fff; }
#info p { color: #c3d0dd; }
#info table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
#info th, #info td { border: 1px solid var(--line); padding: 4px 7px; text-align: left; vertical-align: top; }
#info th { width: 34%; color: #9fd0ff; font-weight: 500; background: #142030; }
#demos h5 { font-size: 12px; color: var(--dim); margin: 6px 0 4px; }
#demos h5:first-child { margin-top: 0; }
#demos button { font-size: 12.5px; margin: 0 5px 5px 0; }

/* ---------- passenger ---------- */
#pscreen { background: #0c2f55; border: 5px solid #05090d; border-radius: 8px; min-height: 250px; display: flex; flex-direction: column; overflow: hidden; }
#pscreen.busy { pointer-events: none; }
.ps-head { display: flex; align-items: center; padding: 6px 10px; background: #134a85; font-size: 13px; }
.ps-mode { margin-left: auto; padding: 0 9px; border-radius: 10px; font-weight: 700; font-size: 12px; background: #0f3a25; color: #7df0b0; }
.ps-mode.warn { background: #40300a; color: #ffd675; } .ps-mode.bad { background: #47160f; color: #ffa79f; }
.ps-body { flex: 1; padding: 10px; display: flex; flex-direction: column; gap: 9px; }
.ps-title { font-size: 16px; font-weight: 700; display: flex; align-items: baseline; }
.ps-title small { margin-left: auto; font-weight: 400; color: #9fd0ff; font-size: 12px; }
.ps-line { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px 0; position: relative; }
.ps-line .st { background: none; border: 0; padding: 0 0 2px; display: flex; flex-direction: column; align-items: center; font-size: 11.5px; line-height: 1.3; border-radius: 6px; position: relative; }
.ps-line .st i { width: 14px; height: 14px; border-radius: 50%; border: 3px solid #ffd675; background: #0c2f55; margin: 4px 0 3px; position: relative; z-index: 1; }
.ps-line .st::before { content: ""; position: absolute; top: 9px; left: 0; right: 0; height: 4px; background: #ffd675; }
.ps-line .st em { font-style: normal; color: #ffd675; font-size: 11px; }
.ps-line .st:hover:not(:disabled) { background: #1b518c; }
.ps-line .st.here i { background: #ff5a4d; border-color: #fff; } .ps-line .st.here { opacity: 1; }
.ps-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ps-row span { color: #9fd0ff; font-size: 12.5px; margin-right: 2px; }
.ps-row .pri, .ps-row .warn { margin-left: auto; }
.ps-row button { background: #1b518c; border-color: #3b79bd; }
.ps-row.big button { font-size: 18px; font-weight: 700; padding: 8px 15px; }
.ps-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; }
.ps-pay div { background: #0a2543; border-radius: 6px; padding: 6px 0; }
.ps-pay label { display: block; font-size: 12px; color: #9fd0ff; }
.ps-pay b { font-size: 24px; } .ps-pay .g { color: #7df0b0; } .ps-pay .o { color: #ffd675; }
.ps-acc { display: flex; gap: 12px; font-size: 12.5px; } .ps-acc .y { color: #7df0b0; } .ps-acc .n { color: #ff8d83; text-decoration: line-through; }
.ps-big { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 30px; font-weight: 800; text-align: center; padding: 14px; }
.ps-big small { font-size: 13px; font-weight: 400; color: #9fd0ff; margin-top: 6px; }
.ps-big.bad { color: #ff8d83; } .ps-big.ok { color: #7df0b0; }
.ps-msg { margin-top: auto; font-size: 12.5px; color: #ffe3a1; background: rgba(0, 0, 0, .25); padding: 4px 8px; border-radius: 5px; }
.ps-off { flex: 1; background: #040506; color: #3a4652; display: flex; align-items: center; justify-content: center; min-height: 250px; }
.wallet > div { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; flex-wrap: wrap; }
.wallet > div:last-child { margin-bottom: 0; }
.wallet span { width: 34px; color: var(--dim); font-size: 12px; }
.coin { width: 46px; height: 46px; border-radius: 50%; padding: 0; font-weight: 700; font-size: 12px; color: #2b2410; border: 2px solid rgba(0, 0, 0, .25); }
.coin.c1 { background: radial-gradient(circle at 35% 30%, #fff, #b9c2cb); } .coin.c5 { background: radial-gradient(circle at 35% 30%, #f7dd9a, #c08a3a); width: 40px; height: 40px; }
.coin.ct { background: radial-gradient(circle at 35% 30%, #c98080, #7a2f2f); color: #fff; font-size: 11px; }
.bill { width: 50px; height: 30px; padding: 0; font-weight: 700; color: #fff; border: 1px solid rgba(255, 255, 255, .35); border-radius: 3px; }
.b5 { background: #8e6bb0; } .b10 { background: #4a86c5; } .b20 { background: #b98a4a; } .b50 { background: #3f9a6b; } .b100 { background: #d0505a; } .bf { background: #9aa0a6; color: #333; font-size: 12px; }
.coin:hover:not(:disabled), .bill:hover:not(:disabled), .svc:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-2px); }
.svc { background: #1f6fd0; border-color: #6aa8f0; color: #fff; height: 30px; font-weight: 600; }
.tray { display: flex; align-items: center; gap: 8px; min-height: 30px; background: #0f1822; border-radius: 6px; padding: 4px 10px; }
.tray button { margin-left: auto; background: var(--ok); border-color: var(--ok); color: #05301a; font-weight: 700; }
.stock { font-size: 12.5px; color: #b5c4d3; }

/* ---------- staff ---------- */
.task-pick { display: flex; gap: 6px; margin-bottom: 8px; } .task-pick select { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: center; } .task-head span { margin-left: auto; font-size: 12px; background: #47160f; color: #ffa79f; padding: 0 8px; border-radius: 10px; }
.sym { color: #ffd675; margin: 4px 0; font-weight: 600; }
#quiz { background: #0f1822; border: 1px dashed #46627f; border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
#quiz label { display: block; padding: 2px 0; cursor: pointer; } #quiz small { display: block; color: var(--warn); margin: 4px 0; } #quiz button { margin-top: 6px; }
.steps { margin: 8px 0 0; padding-left: 0; list-style: none; counter-reset: s; max-height: 215px; overflow-y: auto; position: relative; }
.steps li { counter-increment: s; position: relative; padding: 4px 6px 4px 30px; border-radius: 6px; color: var(--dim); font-size: 13px; }
.steps li::before { content: counter(s); position: absolute; left: 4px; top: 5px; width: 19px; height: 19px; border-radius: 50%; background: #223142; color: var(--dim); font-size: 11px; display: flex; align-items: center; justify-content: center; }
.steps li.done { color: #7fae96; } .steps li.done::before { content: "✓"; background: #14573a; color: #b2f5d0; }
.steps li.cur { background: #2a2410; color: #ffe9b8; font-weight: 600; } .steps li.cur::before { background: var(--warn); color: #2a1c00; }
.sel-name { font-weight: 700; margin: 4px 0 6px; color: #fff; }
.act { display: block; width: 100%; text-align: left; margin-bottom: 5px; padding: 7px 11px; border-left: 3px solid var(--pri); }
.act.na { border-left-color: #55606c; color: #b5c0cb; }
.lcd { background: #1a3fd0; border: 6px solid #9aa5b0; border-radius: 6px; padding: 9px 11px; color: #fff; font-family: "Menlo", "Consolas", "PingFang SC", monospace; }
.lcd.off { background: #0a0f2a; color: #55618f; text-align: center; padding: 22px 10px; }
.lcd h5 { text-align: center; font-size: 14px; margin-bottom: 6px; }
.lcd-menu button, .lcd > button { display: block; width: 100%; text-align: left; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); margin-bottom: 4px; color: #fff; }
.lcd-menu button:hover, .lcd > button:hover { background: rgba(255, 255, 255, .25) !important; }
.lcd .back { background: none; border-style: dashed; margin-top: 4px; }
.lcd label { display: flex; align-items: center; gap: 8px; margin: 5px 0; } .lcd input { flex: 1; min-width: 0; background: #0c2390; border-color: #6f8cff; color: #fff; }
.lcd-out { background: rgba(0, 0, 0, .28); border-radius: 4px; padding: 5px 8px; margin: 6px 0; font-size: 12.5px; color: #e5ecff; }
.lcd-out:empty { display: none; }
.lcd small { display: block; opacity: .7; font-size: 11.5px; }

/* ---------- log ---------- */
.logcard { margin-top: auto; }
#log { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow-y: auto; font-size: 12.5px; }
#log li { padding: 3px 0; border-bottom: 1px dashed #223142; color: #b5c4d3; }
#log li:first-child { color: #fff; }
#log b { display: inline-block; min-width: 34px; text-align: center; margin-right: 7px; padding: 0 6px; border-radius: 9px; font-size: 11px; background: #2a3a4c; color: #cfe0f0; }
#log .t-coin { background: #4b3a0d; color: var(--coin); } #log .t-bill { background: #0f3a25; color: var(--bill); } #log .t-ticket { background: #10355c; color: var(--ticket); } #log .t-alarm { background: #55170f; color: #ffb3ab; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; background: rgba(4, 8, 12, .72); display: none; align-items: center; justify-content: center; z-index: 10; }
#modal.show { display: flex; }
#modal-body { width: min(560px, 92vw); max-height: 86vh; overflow: auto; background: var(--card); border: 1px solid #3b556f; border-radius: 12px; padding: 20px 24px; }
#modal-body h3 { color: #7df0b0; font-size: 18px; margin-bottom: 12px; }
#modal-body h4 { color: #9fd0ff; font-size: 13px; margin: 12px 0 3px; }
#modal-body ol { margin: 0; padding-left: 20px; }
.score { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; color: var(--dim); font-size: 12px; }
.score div { background: #0f1822; border-radius: 8px; padding: 8px 0; } .score b { display: block; font-size: 26px; color: #fff; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 1100px) { #side { width: 360px; } header { gap: 10px; } .brand small { display: none; } }
@media (max-width: 760px) { body { overflow: auto; } main { flex-direction: column; } #stage { height: 56vh; flex: none; } #side { width: auto; border-left: 0; } header { flex-wrap: wrap; } }

/* ---------- courseware figures ---------- */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; margin-bottom: 8px; }
.figs.row { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.fig { padding: 3px; background: #fff; border: 1px solid #31455b; border-radius: 6px; display: flex; flex-direction: column; overflow: hidden; }
.fig:hover:not(:disabled) { background: #fff; border-color: var(--pri); box-shadow: 0 0 0 2px rgba(47, 155, 255, .35); }
.fig img { width: 100%; height: 70px; object-fit: contain; display: block; background: #fff; }
.figs.row .fig img { height: 92px; }
.fig span { font-size: 11px; line-height: 1.25; color: #1c2a38; padding: 3px 2px 1px; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#gallery h5, #info h5, #demofig h5 { font-size: 12px; color: var(--dim); margin: 8px 0 5px; }
#gallery h5:first-child { margin-top: 0; }
.opfig { margin-top: 8px; border-top: 1px dashed #31455b; padding-top: 8px; }
.opfig b { display: block; font-size: 12px; color: #ffd675; margin-bottom: 6px; }
#modal.wide #modal-body { width: min(900px, 94vw); }
.lightbox img { display: block; max-width: 100%; max-height: 62vh; margin: 0 auto 12px; background: #fff; border-radius: 6px; }
.lightbox h3 { color: #fff !important; } .lightbox p { color: #c3d0dd; } .lightbox small { color: var(--dim); }
#notes ol { margin: 0; padding-left: 20px; color: #c3d0dd; font-size: 13px; } #notes li { margin-bottom: 3px; }
#quizcard label { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; } #quizcard label span { flex: 1; } #quizcard select { width: 190px; padding: 3px 6px; }
#quizcard label.right select { border-color: var(--ok); } #quizcard label.wrong select { border-color: var(--bad); }
.quizbar { display: flex; align-items: center; gap: 10px; } #quizres { font-size: 12.5px; color: #ffd675; }

.viewbar { position: absolute; right: 12px; top: 10px; display: flex; align-items: center; gap: 6px; background: rgba(15, 24, 34, .86); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.viewbar span { color: var(--dim); font-size: 12px; margin-right: 2px; }
.viewbar button { font-weight: 600; }
.viewbar button.on { background: var(--pri); border-color: var(--pri); color: #fff; }
@media (max-width: 760px) { .viewbar span { display: none; } .viewbar { right: 8px; left: 8px; top: 48px; justify-content: center; } }
