:root {
    --ink: #18181b;
    --muted: #71717a;
    --subtle: #a1a1aa;
    --page: #f7f7f5;
    --surface: #ffffff;
    --surface-soft: #fafaf9;
    --line: #e4e4e2;
    --line-strong: #d4d4d1;
    --accent: #2563eb;
    --accent-soft: #eff6ff;
    --danger: #b4534b;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--page); }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.site-header, .page-shell, footer { width: min(1220px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; color: white; background: var(--ink); }
.brand-mark span { font-size: 14px; font-weight: 750; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 1px; color: var(--subtle); font-size: 8px; font-weight: 700; letter-spacing: .16em; }
.api-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22a06b; }
.api-status.loading .status-dot { background: #d97706; animation: pulse 1s infinite; }
.api-status.error .status-dot { background: #dc2626; }

.intro { display: grid; grid-template-columns: 1.2fr .8fr; align-items: end; gap: 64px; padding: 64px 0 42px; }
.eyebrow { margin: 0 0 13px; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.intro h1 { margin: 0; font-size: clamp(40px, 5vw, 66px); font-weight: 620; line-height: .98; letter-spacing: -.055em; }
.intro h1 em { color: var(--muted); font-style: normal; font-weight: 420; }
.intro-copy { max-width: 410px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }

.workspace { display: grid; grid-template-columns: minmax(315px,.72fr) minmax(540px,1.5fr); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.control-panel, .visual-panel { padding: 28px; }
.control-panel { border-right: 1px solid var(--line); background: var(--surface-soft); }
.panel-heading, .visual-header, .section-label, .timeline-heading, .parking-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading > div, .visual-header > div:first-child { display: flex; align-items: center; gap: 10px; }
.step-number { padding: 4px 6px; border-radius: 4px; color: var(--muted); background: #efefed; font-size: 9px; font-weight: 700; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
h3 { margin-bottom: 0; font-size: 13px; font-weight: 650; }
.text-button { padding: 5px 0; border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: 10px; font-weight: 650; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }

.dimension-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.field-group > span:first-child { display: block; margin: 0 0 6px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.input-shell { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); transition: border-color 140ms, box-shadow 140ms; }
.input-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,235,.08); }
.input-shell input { width: 100%; padding: 10px 11px; border: 0; outline: 0; background: transparent; font-size: 14px; font-weight: 600; }
.input-shell small { padding-right: 11px; color: var(--subtle); font-size: 9px; font-weight: 650; }

.vehicle-section { margin-top: 28px; }
.section-label p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.count-badge { display: grid; min-width: 24px; height: 24px; padding: 0 7px; place-items: center; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: var(--surface); font-size: 10px; font-weight: 650; }
.schedule-labels, .vehicle-row { display: grid; grid-template-columns: minmax(75px,1.2fr) minmax(52px,.8fr) minmax(52px,.8fr) 26px; align-items: center; gap: 7px; }
.schedule-labels { margin-top: 20px; padding: 0 2px 6px; color: var(--subtle); font-size: 8px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; }
.vehicle-list { max-height: 284px; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.vehicle-row { padding: 8px 0; border-top: 1px solid var(--line); animation: rowIn 180ms ease both; }
.vehicle-identity { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 10px; font-weight: 600; }
.vehicle-color { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--vehicle-color); }
.vehicle-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-input { width: 100%; padding: 8px 6px; border: 1px solid var(--line); border-radius: 6px; outline: none; background: var(--surface); text-align: center; font-size: 11px; font-weight: 600; }
.time-input:focus { border-color: var(--accent); }
.remove-vehicle { display: grid; width: 25px; height: 25px; place-items: center; border: 0; border-radius: 5px; color: var(--subtle); background: transparent; cursor: pointer; font-size: 16px; }
.remove-vehicle:hover { color: var(--danger); background: #fef2f2; }
.add-vehicle { display: flex; width: 100%; align-items: center; justify-content: center; gap: 7px; margin-top: 9px; padding: 9px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 650; }
.add-vehicle:hover { color: var(--ink); border-color: var(--muted); background: var(--surface); }
.add-vehicle span { font-size: 16px; font-weight: 400; line-height: 0; }
.form-message { min-height: 33px; padding: 10px 1px 0; color: var(--danger); font-size: 10px; line-height: 1.45; }
.form-message.success { color: #167a53; }
.solve-button { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 12px 14px; border: 0; border-radius: 7px; color: white; background: var(--ink); cursor: pointer; font-size: 11px; font-weight: 650; transition: background 140ms, transform 140ms; }
.solve-button:hover { background: #303035; transform: translateY(-1px); }
.solve-button:disabled { cursor: wait; opacity: .55; transform: none; }
.button-arrow { font-size: 15px; }

.visual-panel { min-width: 0; }
.playback-controls { display: flex; align-items: center; gap: 7px; }
.icon-button, .play-button { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); cursor: pointer; }
.play-button { color: white; border-color: var(--ink); background: var(--ink); }
.icon-button:hover { background: var(--surface-soft); }
.icon-button:disabled, .play-button:disabled { cursor: not-allowed; opacity: .35; }
.speed-control { display: flex; align-items: center; gap: 6px; margin-left: 3px; color: var(--muted); font-size: 9px; font-weight: 600; }
.speed-control select { padding: 7px 23px 7px 8px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: var(--surface); color: var(--ink); font-size: 10px; font-weight: 650; }

.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 24px 0 12px; }
.stat-card { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.stat-card span { color: var(--muted); font-size: 8px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.stat-card strong { color: var(--ink); font-size: 18px; font-weight: 600; letter-spacing: -.03em; }

.canvas-card { overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #f5f5f3; }
.parking-topline { padding: 11px 13px; border-bottom: 1px solid var(--line); background: var(--surface); }
.lot-label, .legend { display: flex; align-items: center; color: var(--muted); font-size: 8px; font-weight: 650; letter-spacing: .08em; }
.lot-label > span { width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #22a06b; }
.legend { gap: 12px; letter-spacing: 0; text-transform: none; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.legend-free { border: 1px solid var(--line-strong); background: var(--surface); }
.legend-occupied { background: var(--accent); }
.legend-route { height: 0 !important; border-top: 2px dashed var(--accent); border-radius: 0 !important; }
.canvas-wrap { position: relative; width: 100%; height: clamp(310px,36vw,470px); padding: 16px; }
#draw-canvas { display: block; width: 100%; height: 100%; }
.progress-track { height: 2px; background: #e8e8e6; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 160ms; }

.timeline-section { margin-top: 20px; }
.timeline-heading h3 { font-size: 12px; }
.timeline-heading span { color: var(--muted); font-size: 9px; }
.event-list { display: flex; gap: 7px; margin-top: 10px; padding: 1px 1px 8px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.empty-events { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); }
.empty-events p { margin: 0; font-size: 10px; }
.empty-events span { color: var(--accent); font-size: 16px; }
.event-card { flex: 0 0 142px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); transition: border-color 160ms, background 160ms, transform 160ms; }
.event-card.active { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); }
.event-card.done { opacity: .52; }
.event-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 8px; font-weight: 600; }
.event-type { display: inline-flex; align-items: center; gap: 5px; }
.event-type i { width: 6px; height: 6px; border-radius: 50%; background: var(--event-color); }
.event-card strong { display: block; margin-top: 6px; font-size: 10px; }
.event-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
footer { display: flex; justify-content: space-between; padding: 22px 0 32px; color: var(--subtle); font-size: 8px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.75); } }
@keyframes rowIn { from { opacity: 0; transform: translateY(-4px); } }

@media (max-width: 920px) {
    .intro { grid-template-columns: 1fr; gap: 20px; padding-top: 48px; }
    .intro-copy { max-width: 560px; }
    .workspace { grid-template-columns: 1fr; }
    .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
    .vehicle-list { max-height: 340px; }
}

@media (max-width: 600px) {
    .site-header, .page-shell, footer { width: min(100% - 28px,1220px); }
    .site-header { height: 62px; }
    .api-status span:last-child { display: none; }
    .intro { padding: 40px 0 30px; }
    .intro h1 { font-size: clamp(38px,12vw,54px); }
    .workspace { border-radius: 10px; }
    .control-panel, .visual-panel { padding: 20px 16px; }
    .visual-header { align-items: flex-start; }
    .speed-control span { display: none; }
    .stats-grid { gap: 5px; }
    .stat-card { display: block; padding: 9px; }
    .stat-card strong { display: block; margin-top: 4px; font-size: 17px; }
    .legend { display: none; }
    .canvas-wrap { height: 320px; padding: 9px; }
    footer { gap: 16px; }
    footer span:last-child { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
