/* Skyline Studio. The game's own navy, orange and Barlow; the route map is the one loud thing. */
@font-face { font-family: Barlow; src: url(fonts/Barlow-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Barlow; src: url(fonts/Barlow-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: Barlow; src: url(fonts/Barlow-Bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --deep: #08142B; --panel: #0F1F3D; --raised: #142849; --line: #22406E;
  --text: #E8EEF8; --dim: #9DB0CE; --orange: #FF8A1F; --blue: #5AA2EE;
  --green: #3CCB7F; --red: #F4716D; --yellow: #F5C04A;
  --chart-draft: #DD6F0A; --chart-live: #3B8FE8;
  --rail: 208px; --inspector: 348px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--deep); color: var(--text); font: 400 15px/1.45 Barlow, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; margin: 0; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 700; margin: 0 0 8px; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 10px; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.num { text-align: right; }
.err { color: var(--red); }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; min-width: 0; }

/* controls */
button, .btn { font: 600 14px/1 Barlow, sans-serif; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 8px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover:not(:disabled), .btn:hover { border-color: var(--dim); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--orange); border-color: var(--orange); color: #1B0F00; }
button.primary:hover:not(:disabled), .btn.primary:hover { background: #FF9C42; border-color: #FF9C42; }
button.danger { color: var(--red); border-color: #7A3440; background: transparent; }
button.danger:hover:not(:disabled) { border-color: var(--red); }
button.quiet { background: transparent; border-color: transparent; color: var(--dim); padding: 6px 8px; }
button.quiet:hover:not(:disabled) { color: var(--text); border-color: var(--line); }
input, select, textarea { font: 400 14px/1.3 Barlow, sans-serif; font-variant-numeric: tabular-nums; color: var(--text); background: var(--deep); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--orange); padding: 0; }
input:disabled, select:disabled, textarea:disabled { opacity: .65; }
input.changed, select.changed { border-color: var(--orange); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
label.field > small { display: block; color: var(--dim); font-size: 12.5px; margin-top: 3px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 9px; align-items: center; padding: 15px 14px 12px; font-weight: 700; font-size: 16px; line-height: 1.15; color: var(--text); text-decoration: none; }
.brand svg { flex: none; }
.rail nav { padding: 2px 8px 10px; }
.rail .group { color: var(--dim); font-size: 12.5px; padding: 12px 8px 4px; }
.rail a.item { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 6px 8px; border-radius: 4px; border-left: 3px solid transparent; }
.rail a.item:hover { background: var(--raised); }
.rail a.item.on { background: var(--raised); border-left-color: var(--orange); font-weight: 600; }
.badge { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 9px; background: var(--line); }
.badge.bad { background: var(--red); color: #2B0605; }
.badge.warn { background: var(--yellow); color: #2A1E00; }
.rail .who { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.draftbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.draftbar select { width: auto; max-width: 240px; font-weight: 600; }
.body { flex: 1; min-height: 0; display: flex; }
.page { flex: 1; min-width: 0; overflow: auto; padding: 18px 22px 40px; }
.page.flush { padding: 0; display: flex; flex-direction: column; }
.inspector { width: var(--inspector); flex: none; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px; }
.head { margin-bottom: 14px; }
.head p { color: var(--dim); max-width: 75ch; margin: 4px 0 0; }
section.block { margin-bottom: 26px; }

/* tables */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 13px; color: var(--dim); padding: 7px 9px; border-bottom: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
th.num { text-align: right; }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--orange); }
td { padding: 5px 9px; border-bottom: 1px solid rgba(34, 64, 110, .55); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.pick { cursor: pointer; }
tbody tr.pick:hover { background: var(--raised); }
tbody tr.on { background: var(--raised); box-shadow: inset 3px 0 0 var(--orange); }
td input { min-width: 74px; padding: 4px 6px; }
td input[type=number] { text-align: right; }
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { appearance: none; margin: 0; }
td.wide { min-width: 132px; }
.sticky th { position: sticky; top: 0; z-index: 2; }
.sticky th:first-child, .sticky td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.sticky th:first-child { z-index: 3; }

/* notices */
.problems { border-left: 3px solid var(--red); background: rgba(240, 84, 79, .1); padding: 9px 12px; margin-bottom: 14px; border-radius: 0 5px 5px 0; }
.problems.warn { border-left-color: var(--yellow); background: rgba(245, 192, 74, .09); }
.problems ul { margin: 4px 0 0; padding-left: 18px; }
.good { color: var(--green); }
.state { font-weight: 600; font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: var(--line); white-space: nowrap; }
.pill.new { background: #2B5A99; }
.pill.planned { background: #5A4A9C; }
.pill.in_progress { background: #A65A0E; }
.pill.done { background: #1E7A4C; }
.pill.declined { background: #4A5670; }
.pill.needs_info { background: #8A6A12; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 7px 10px; color: var(--dim); }
.tabs button.on { color: var(--text); border-bottom-color: var(--orange); }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--raised); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 5px; padding: 9px 12px; }
.toast.bad { border-left-color: var(--red); }
.confirm { border: 1px solid var(--red); border-radius: 5px; padding: 10px 12px; margin-top: 10px; }
.secret { background: var(--deep); border: 1px dashed var(--orange); border-radius: 5px; padding: 9px; overflow-wrap: anywhere; font-size: 13.5px; user-select: all; }

/* the route map */
.mapbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 14px 20px 10px; }
.mapbar h1 { font-size: 22px; }
.map { position: relative; flex: 1; overflow: auto; background-color: var(--deep); background-image: radial-gradient(rgba(143, 163, 196, .16) 1px, transparent 1.4px); background-size: 22px 22px; }
.map-inner { position: relative; }
.map svg.lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.route-name { position: absolute; left: 0; width: 186px; padding: 0 8px 0 18px; background: linear-gradient(90deg, var(--deep) 85%, transparent); text-align: left; border: 0; border-radius: 0; color: var(--text); display: block; z-index: 3; line-height: 1.2; font-size: 14px; font-weight: 700; }
.route-name small { display: block; color: var(--dim); font-weight: 400; font-size: 12.5px; margin-top: 2px; }
.route-name.on { color: var(--orange); }
.stop { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; display: block; background: none; border: 0; padding: 0; color: var(--text); z-index: 2; cursor: pointer; font-weight: 400; touch-action: none; }
.stop:hover:not(:disabled) .dot { transform: scale(1.14); }
.stop .opens { position: absolute; left: 20px; bottom: 21px; max-width: 132px; width: max-content; padding: 0 3px; border-radius: 3px; background: rgba(8, 20, 43, .86); font-size: 12px; line-height: 1.2; color: var(--yellow); text-align: left; font-weight: 600; }
.stop .opens:empty { display: none; }
.stop .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--deep); border: 5px solid var(--c); display: grid; place-items: center; font: 700 11px/1 Barlow; transition: transform .1s; }
.stop.on .dot { background: var(--orange); border-color: var(--orange); color: #1B0F00; box-shadow: 0 0 0 4px rgba(255, 138, 31, .3); }
.stop.bad .dot { border-color: var(--red); }
.stop.target .dot { box-shadow: 0 0 0 5px rgba(255, 255, 255, .5); }
.stop .fare { position: absolute; left: 20px; top: 22px; width: max-content; padding: 0 3px; border-radius: 3px; background: rgba(8, 20, 43, .86); text-align: left; font-size: 13px; font-weight: 600; line-height: 1.2; }
.stop .fare small { display: block; font-size: 12px; font-weight: 400; color: var(--dim); }
.stop-add { position: absolute; margin-left: -14px; width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px dashed var(--line); background: var(--deep); color: var(--dim); font-size: 17px; z-index: 2; }
.stop-add:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
.effect-row { display: grid; grid-template-columns: 1fr 76px 26px; gap: 6px; align-items: center; margin-bottom: 6px; }
.need-row { display: grid; grid-template-columns: 1fr 26px; gap: 6px; align-items: center; margin-bottom: 6px; }
.x { padding: 0; width: 26px; height: 28px; font-size: 15px; }

/* charts */
.chart { display: block; width: 100%; height: auto; }
.chart text { fill: var(--dim); font: 400 12.5px Barlow, sans-serif; }
.chart text.value { fill: var(--text); font-weight: 600; }
.chart .grid { stroke: var(--line); stroke-opacity: .55; stroke-width: 1; }
.legend { display: flex; gap: 16px; font-size: 13.5px; margin-bottom: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.tip { position: absolute; pointer-events: none; background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 4; }
.chartbox { position: relative; }

/* sign in */
.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); }
.gate-art { background: var(--panel); border-right: 1px solid var(--line); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.gate-art h1 { font-size: 34px; max-width: 16ch; }
.gate-art > svg { width: 100%; max-height: 300px; }
.gate-form { display: flex; align-items: center; justify-content: center; padding: 28px; }
.gate-form form { width: 100%; max-width: 340px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .main { height: auto; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail nav { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 8px 8px; }
  .rail .group { display: none; }
  .rail .who { margin: 0; }
  .body { flex-direction: column; }
  .page { overflow: visible; padding: 14px; }
  .map { min-height: 420px; }
  .inspector { width: 100%; border-left: 0; border-top: 1px solid var(--line); }
  .gate { grid-template-columns: 1fr; }
  .gate-art { padding: 22px; border-right: 0; border-bottom: 1px solid var(--line); }
  .gate-art > svg { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
