:root {
  --ink: #172031;
  --muted: #7d8593;
  --line: #e9e9eb;
  --surface: #ffffff;
  --canvas: #f5f4f2;
  --accent: #ef3b2d;
  --accent-deep: #d8281d;
  --accent-soft: #fff0ed;
  --shadow: 0 12px 34px rgba(20, 26, 40, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.app-header {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 850; letter-spacing: -.4px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--accent); color: white; transform: rotate(-2deg); }
.brand-mark svg { width: 27px; height: 27px; fill: currentColor; stroke: none; }
.brand-mark .cut { fill: var(--accent); }
.brand-chip { color: var(--accent); background: var(--accent-soft); font-size: 9px; letter-spacing: 1.4px; padding: 4px 6px; border-radius: 5px; margin-left: 2px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.button { border: 0; min-height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button svg { width: 17px; }
.button.primary { color: white; background: var(--accent); box-shadow: 0 5px 13px rgba(239,59,45,.2); }
.button.primary:hover { background: var(--accent-deep); }
.button.ghost { background: #f4f4f5; color: #545b68; }
.button.compact { min-height: 34px; padding: 0 11px; font-size: 12px; }

.workspace { display: grid; grid-template-columns: 410px minmax(600px, 1fr); min-height: calc(100vh - 72px); }
.editor-panel { background: var(--surface); border-right: 1px solid var(--line); padding-bottom: 42px; overflow-y: auto; max-height: calc(100vh - 72px); position: sticky; top: 72px; transition: .25s ease; }
.panel-title-row { padding: 25px 25px 15px; display: flex; justify-content: space-between; align-items: center; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: 1.8px; }
h1, h2, p { margin-top: 0; }
.panel-title-row h1, .preview-topbar h2 { margin: 0; font-size: 21px; letter-spacing: -.5px; }
.icon-button { width: 34px; height: 34px; border: 0; display: grid; place-items: center; border-radius: 9px; background: transparent; color: #6f7681; cursor: pointer; }
.icon-button:hover { background: #f2f2f3; }
.icon-button svg { width: 18px; }
.icon-button.soft { background: #fff; border: 1px solid var(--line); }
.icon-button.danger-hover:hover { color: #c92b25; background: #fff0ee; border-color: #ffc7c2; }
.icon-button:disabled { opacity: .38; cursor: not-allowed; background: #f2f2f3; }
.route-manager { margin: 0 25px 15px; padding: 13px; background: #f7f7f8; border: 1px solid #ececef; border-radius: 12px; }
.route-manager-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.route-manager-head label { font-size: 11px; font-weight: 800; }
.route-manager-head span { color: var(--muted); font-size: 9px; }
.route-manager-controls { display: grid; grid-template-columns: minmax(0, 1fr) 34px 34px auto; gap: 6px; }
.route-manager-controls select { min-width: 0; height: 34px; padding: 0 30px 0 10px; border: 1px solid #dfe1e4; border-radius: 8px; color: var(--ink); background: #fff; outline: none; font-size: 11px; font-weight: 700; }
.route-manager-controls select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.route-manager-controls .icon-button { width: 34px; height: 34px; }
.tabs { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0 25px; padding: 4px; border-radius: 11px; background: #f3f3f4; }
.tab { padding: 9px 4px; border: 0; border-radius: 8px; color: #838995; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(20,30,40,.08); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.form-section { padding: 21px 25px 0; border-top: 1px solid var(--line); margin-top: 22px; }
.form-section.first { border: 0; margin-top: 0; }
.form-section h2 { font-size: 13px; margin-bottom: 14px; letter-spacing: -.1px; }
.section-heading-inline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading-inline h2 { margin-bottom: 3px; }
.section-subtitle { color: var(--muted); font-size: 11px; margin: 0 0 14px; }
.hint { font-size: 10px; color: #9b9fa8; }
.logo-row { display: flex; gap: 13px; align-items: flex-end; }
.logo-uploader { width: 60px; height: 60px; flex: 0 0 60px; padding: 0; border: 1px dashed #cdd0d5; border-radius: 13px; background: #fafafa; cursor: pointer; position: relative; overflow: visible; }
.logo-editor-preview { width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; border-radius: 13px; }
.logo-editor-preview img { max-width: 80%; max-height: 80%; object-fit: contain; }
.default-logo { width: 76%; height: 76%; border-radius: 50% 50% 47% 53%; display: grid; place-items: center; color: white; background: var(--accent); font-weight: 900; font-size: 21px; font-style: italic; box-shadow: inset 0 0 0 5px rgba(255,255,255,.85); }
.upload-badge { position: absolute; right: -5px; bottom: -5px; width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; box-shadow: 0 0 0 3px white; }
.upload-badge svg { width: 12px; }
.field { margin-bottom: 14px; }
.field.grow { flex: 1; margin-bottom: 0; }
.field label { display: flex; justify-content: space-between; margin-bottom: 6px; color: #5e6470; font-size: 11px; font-weight: 700; }
.field label span { color: #a4a8af; font-weight: 500; font-size: 9px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #dfe1e4; border-radius: 9px; background: #fff; color: var(--ink); outline: none; padding: 10px 11px; font-size: 13px; transition: .18s; }
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 38px; }
.input-with-icon svg { width: 16px; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--accent); }
.theme-options { display: grid; gap: 8px; }
.theme-card { display: grid; grid-template-columns: 35px 1fr 18px; align-items: center; gap: 10px; width: 100%; padding: 9px; border: 1px solid #e5e5e7; background: #fff; border-radius: 10px; text-align: left; cursor: pointer; }
.theme-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.theme-card > svg { display: none; width: 15px; color: var(--accent); }
.theme-card.selected > svg { display: block; }
.theme-card b, .theme-card small { display: block; }
.theme-card b { font-size: 12px; }
.theme-card small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.theme-swatch { width: 35px; height: 35px; border-radius: 9px; }
.theme-swatch.coral { background: #ef3b2d; }.theme-swatch.navy { background: #164c7e; }.theme-swatch.green { background: #168768; }

.stop-list { display: grid; gap: 8px; }
.stop-item { display: grid; grid-template-columns: 22px 30px 1fr auto; align-items: center; gap: 8px; border: 1px solid #e4e5e7; border-radius: 10px; background: white; padding: 9px; cursor: pointer; }
.stop-item.current { border-color: var(--accent); background: var(--accent-soft); }
.drag-handle { color: #b2b5bb; cursor: grab; font-size: 14px; letter-spacing: -2px; }
.stop-index { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: #737a86; background: #f1f2f3; font-size: 10px; font-weight: 800; }
.stop-item.current .stop-index { background: var(--accent); color: white; }
.item-copy { min-width: 0; }
.item-copy b, .item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-copy b { font-size: 12px; }
.item-copy small { font-size: 9px; color: #9398a1; margin-top: 2px; }
.item-actions { display: flex; gap: 2px; }
.mini-action { width: 25px; height: 25px; display: grid; place-items: center; border: 0; border-radius: 7px; color: #8a8f98; background: transparent; cursor: pointer; font-size: 13px; }
.mini-action:hover { color: var(--accent); background: var(--accent-soft); }

.preview-area { padding: 25px 30px 34px; min-width: 0; }
.preview-topbar { max-width: 1040px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: space-between; }
.preview-tools { display: flex; align-items: center; gap: 14px; }
.toggle-label { display: flex; align-items: center; gap: 8px; color: #666d78; font-size: 11px; font-weight: 650; cursor: pointer; }
.toggle-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 34px; height: 19px; border-radius: 20px; background: #c9ccd1; position: relative; transition: .2s; }
.switch::after { content: ""; width: 15px; height: 15px; background: #fff; position: absolute; top: 2px; left: 2px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.toggle-label input:checked + .switch { background: var(--accent); }
.toggle-label input:checked + .switch::after { transform: translateX(15px); }
.screen-stage { max-width: 1040px; margin: auto; padding: 12px; border-radius: 19px; background: #20242d; box-shadow: 0 25px 60px rgba(20, 24, 32, .18); }
.bus-screen { --screen-accent: #df1417; position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #fff; color: #090b0f; border-radius: 9px; container-type: inline-size; }
.bus-screen.theme-coral { --screen-accent: #d41519; }.bus-screen.theme-navy { --screen-accent: #164c7e; }.bus-screen.theme-green { --screen-accent: #168768; }
.screen-header { height: 15.2%; display: grid; grid-template-columns: 17% 59% 14% 10%; align-items: stretch; }
.screen-brand { display: flex; align-items: center; gap: 3.5%; padding: 1.2% 2.5%; overflow: hidden; }
.screen-logo { flex: 0 0 34%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; }
.screen-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.screen-logo .default-logo { font-size: 2.2cqw; box-shadow: inset 0 0 0 .45cqw rgba(255,255,255,.88); }
.screen-company { flex: 1 1 auto; min-width: 0; width: auto; max-width: none; font-size: 2.6cqw; line-height: 1.05; font-weight: 900; white-space: nowrap; word-break: normal; overflow: hidden; text-overflow: clip; }
.route-pill { background: var(--screen-accent); color: white; display: flex; align-items: center; justify-content: center; gap: 2.5%; border-radius: 0 0 3.5cqw 3.5cqw; overflow: hidden; padding: 0 2%; }
.route-pill strong { font-size: 4.7cqw; line-height: 1; white-space: nowrap; min-width: 0; overflow: hidden; }
.route-pill b { font-size: 3.65cqw; line-height: 1; white-space: nowrap; min-width: 0; overflow: hidden; }
.route-arrow { width: 4.3cqw; height: 2.3cqw; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.vehicle-block { display: grid; place-content: center; text-align: center; line-height: 1.05; }
.vehicle-block small { font-size: 1.7cqw; font-weight: 800; }.vehicle-block b { font-size: 2.2cqw; margin-top: .4cqw; }
.screen-header time { display: grid; place-items: center; font-weight: 900; font-size: 2.4cqw; }
.screen-accent { height: .65cqw; margin-top: .22cqw; background: var(--screen-accent); }
.screen-content { height: calc(84.8% - .87cqw); position: relative; display: grid; place-items: center; padding: 4.5% 6%; }
.screen-progress { position: absolute; z-index: 5; left: 0; bottom: 0; height: .45cqw; width: 0; background: var(--screen-accent); }
.bus-screen.is-playing .screen-progress { animation: slideProgress var(--duration, 8s) linear forwards; }
@keyframes slideProgress { from { width: 0; } to { width: 100%; } }

.screen-slide { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; animation: slideIn .35s ease both; }
.screen-slide > div { max-width: 100%; }
.screen-slide .cn, .screen-slide .en { text-wrap: balance; overflow-wrap: anywhere; }
@keyframes slideIn { from { opacity: 0; transform: translateY(1.2cqw); } to { opacity: 1; transform: none; } }
.welcome-slide { align-content: center; }
.welcome-slide .cn { font-size: 7.2cqw; font-weight: 900; letter-spacing: -.18cqw; line-height: 1.14; }
.welcome-slide .en { font-size: 4.6cqw; margin-top: 2.4cqw; line-height: 1.18; }
.welcome-slide .route-emphasis { font-weight: 900; }
.message-slide .cn, .terminus-slide .cn { font-size: 5.7cqw; font-weight: 900; line-height: 1.17; }
.message-slide .en, .terminus-slide .en { font-size: 3.8cqw; line-height: 1.18; margin-top: 2.6cqw; }
.station-slide .cn { font-size: 7cqw; font-weight: 900; line-height: 1.16; }
.station-slide .en { font-size: 4.8cqw; font-weight: 700; line-height: 1.22; margin-top: 2.8cqw; }
.station-slide .station-copy { width: calc(100% - 14cqw); }
.station-side-label { position: absolute; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; font-size: 3.7cqw; font-weight: 900; letter-spacing: .5cqw; line-height: 1; color: var(--screen-accent); }
.station-side-label.upcoming { left: 1.6cqw; }
.station-side-label.arrived { right: 1.6cqw; }
.next-slide { grid-template-columns: 11% 1fr; gap: 4%; text-align: left; }
.stop-rail { width: 4.8cqw; height: calc(90% - 4.2cqw); background: var(--screen-accent); position: relative; justify-self: center; align-self: start; margin-top: 1.8cqw; }
.stop-rail::after { content: ""; position: absolute; top: 100%; left: -2cqw; border-left: 4.4cqw solid transparent; border-right: 4.4cqw solid transparent; border-top: 4.2cqw solid var(--screen-accent); }
.rail-dot { position: absolute; left: 50%; transform: translateX(-50%); width: 5.2cqw; height: 5.2cqw; border-radius: 50%; background: white; border: .4cqw solid #737373; }
.rail-dot:nth-child(1) { top: 7%; }.rail-dot:nth-child(2) { top: 43%; }.rail-dot:nth-child(3) { top: 78%; }
.rail-dot.current { background: #ffc42e; }
.next-slide.two-stops .rail-dot:nth-child(1) { top: 18%; }
.next-slide.two-stops .rail-dot:nth-child(2) { top: 65%; }
.next-slide.two-stops .next-copy { display: flex; flex-direction: column; justify-content: center; height: 100%; }
.next-slide.two-stops .stop-preview { margin-bottom: 6cqw; }
.next-copy { width: 100%; align-self: center; }
.stop-preview { margin-bottom: 3.2cqw; }
.stop-preview:last-child { margin-bottom: 0; }
.stop-preview .cn { font-size: 3.35cqw; line-height: 1.1; }
.stop-preview .en { font-size: 2.6cqw; margin-top: .5cqw; }
.stop-preview.current .cn { font-size: 5cqw; font-weight: 900; }.stop-preview.current .en { font-size: 3.5cqw; font-weight: 800; }
.route-map-slide { display: flex; flex-direction: column; justify-content: center; align-items: stretch; text-align: left; }
.route-map-title { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 3.3cqw; }
.route-map-title strong { font-size: 3.3cqw; }.route-map-title span { color: #686e76; font-size: 1.5cqw; }
.route-line { height: .75cqw; background: var(--screen-accent); display: flex; justify-content: space-between; align-items: center; border-radius: 1cqw; padding: 0 1.3cqw; }
.map-stop { width: 1.9cqw; height: 1.9cqw; flex: 0 0 auto; background: white; border: .42cqw solid var(--screen-accent); border-radius: 50%; position: relative; }
.map-stop.current { width: 2.7cqw; height: 2.7cqw; background: #ffc42e; box-shadow: 0 0 0 .4cqw white; }
.map-label { position: absolute; top: 2.6cqw; left: 50%; transform: translateX(-50%); font-size: 1.45cqw; line-height: 1.15; writing-mode: vertical-rl; white-space: nowrap; }
.map-stop:nth-child(even) .map-label { top: auto; bottom: 2.6cqw; }

.playback-card { max-width: 1040px; min-height: 78px; margin: 18px auto 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px 20px; padding: 14px 17px; position: relative; }
.playback-main { display: flex; align-items: center; gap: 8px; }
.round-control { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #e2e3e6; border-radius: 50%; background: #fff; cursor: pointer; }
.round-control:hover { border-color: var(--accent); color: var(--accent); }
.round-control svg { width: 16px; }
.round-control.play { width: 43px; height: 43px; background: var(--accent); color: #fff; border: 0; box-shadow: 0 5px 14px rgba(239,59,45,.25); }
.pause-icon { display: none; }.is-auto .pause-icon { display: block; }.is-auto .play-icon { display: none; }
.playback-info { margin-left: 8px; padding-left: 15px; border-left: 1px solid var(--line); }
.playback-info span, .playback-info strong { display: block; }
.playback-info span { color: var(--muted); font-size: 9px; margin-bottom: 3px; }.playback-info strong { font-size: 12px; }
.auto-controls { display: flex; align-items: center; gap: 16px; }
.duration-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.duration-control input { width: 44px; border: 1px solid #dedfe3; padding: 6px 4px; text-align: center; border-radius: 7px; outline: none; }
.timeline-dots { grid-column: 1 / -1; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; display: flex; gap: 4px; }
.timeline-dot { height: 100%; flex: 1; border: 0; background: #ececef; padding: 0; cursor: pointer; border-radius: 3px; overflow: hidden; }
.timeline-dot.active { background: var(--accent); }
.media-status { grid-column: 1 / -1; color: #657080; font-size: 11px; min-height: 0; }
.media-status:empty { display: none; }
.screen-media { width: 100%; height: 100%; object-fit: contain; background: #08090c; }
.keyboard-hint { text-align: center; color: #959aa3; font-size: 10px; margin: 14px 0 0; }
.keyboard-hint kbd { font: inherit; color: #6a707a; background: #fff; border: 1px solid #dfe1e5; border-bottom-width: 2px; padding: 2px 6px; border-radius: 5px; }.keyboard-hint span { padding: 0 6px; }

.modal { width: min(440px, calc(100vw - 30px)); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 25px 80px rgba(20,25,35,.24); }
.modal::backdrop { background: rgba(23,32,49,.4); backdrop-filter: blur(3px); }
.modal form { padding: 24px; }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }.modal-heading h2 { margin: 0; font-size: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.announcement-fields { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.announcement-row { display: grid; grid-template-columns: minmax(0,1fr) auto 30px; gap: 8px; align-items: center; padding: 7px 0; }
.announcement-row b,.announcement-row small { display: block; }
.announcement-row b { font-size: 12px; }
.announcement-row small { font-size: 10px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.media-help { margin: 7px 0 0; font-size: 10px; color: var(--muted); line-height: 1.45; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #202632; color: white; border-radius: 10px; padding: 10px 15px; font-size: 12px; box-shadow: var(--shadow); transition: .25s; }.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.editor-collapsed .workspace { grid-template-columns: 0 minmax(600px, 1fr); } body.editor-collapsed .editor-panel { transform: translateX(-100%); overflow: hidden; }
body.editor-collapsed .preview-area::before { content: "☰ 设置"; position: fixed; left: 12px; top: 84px; z-index: 20; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 9px 12px; border-radius: 9px; font-size: 11px; font-weight: 800; cursor: pointer; }

.bus-screen:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; }
.bus-screen:fullscreen .screen-header { height: 15.2vh; }.bus-screen:fullscreen .screen-content { height: calc(84.8vh - .87cqw); }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 350px minmax(500px, 1fr); }
  .editor-panel { padding-bottom: 25px; }
  .preview-area { padding: 24px 18px; }
  .app-header { padding: 0 18px; }
}
@media (max-width: 820px) {
  .app-header { height: 62px; }#resetBtn { display: none; }
  .workspace { display: block; }
  .editor-panel { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-area { padding: 22px 10px; }
  .screen-stage { padding: 6px; border-radius: 12px; }
  .playback-card { grid-template-columns: 1fr; }.auto-controls { justify-content: space-between; }
  .panel-title-row { padding-left: 18px; padding-right: 18px; }.tabs { margin: 0 18px; }.form-section { padding-left: 18px; padding-right: 18px; }
  #collapseBtn { display: none; }
}
@media (max-width: 520px) {
  .brand-chip { display: none; }.header-actions .button { padding: 0 11px; }.header-actions .button svg { display: none; }
  .preview-topbar { align-items: flex-end; }.preview-tools .toggle-label { display: none; }
  .keyboard-hint { display: none; }.field-grid.two { grid-template-columns: 1fr; gap: 0; }
}
