/* Split-flap departure board — xscript.net */

:root {
  --bg: #0b0b0c;
  --panel: #17181a;
  --panel-head: #1f2023;
  --line: #2c2e32;
  --line-bright: #474a50;
  --text: #f3efe4;
  --muted: #8e9096;
  --dim: #5f6168;
  --accent: #ffd23f;
  --accent-ink: #111;
  --font-data: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-label: 'Barlow Condensed', 'Arial Narrow', var(--font-data);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  font-family: var(--font-data);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
}

button, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- App shell ---------- */
.db {
  height: 100vh;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}
.db:fullscreen { height: 100vh; width: 100vw; min-height: 0; }
.db:-webkit-full-screen { height: 100vh; width: 100vw; min-height: 0; }

.db[data-theme="led"] {
  --bg: #050403;
  --text: #ffa928;
  --accent: #ffa928;
  --accent-ink: #050403;
}

/* ---------- Header / controls ---------- */
.dh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: var(--panel-head);
  border-bottom: 2px solid var(--accent);
  flex: 0 0 auto;
  color: #f3efe4;
  transition: opacity 0.4s;
}
.dh-left, .dh-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dh-left { flex: 0 1 auto; }
.dh-right { gap: 8px; flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; }

.dh-logo {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 3px;
}
.dh-name { display: flex; flex-direction: column; line-height: 1.05; }
.dh-title { font-family: var(--font-label); font-weight: 700; font-size: 1.45rem; letter-spacing: 0.2em; }
.dh-sub { font-family: var(--font-label); font-size: 0.72rem; letter-spacing: 0.24em; color: var(--muted); white-space: nowrap; }
.dh-sim {
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  border: 1px dashed var(--line-bright);
  padding: 3px 7px;
  white-space: nowrap;
}

.dh-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-label);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.dh-pick select {
  background: #0b0b0c;
  color: #f3efe4;
  border: 1px solid var(--line-bright);
  padding: 5px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.dbtn {
  background: transparent;
  color: #f3efe4;
  border: 1px solid var(--line-bright);
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.dbtn:hover, .dbtn:focus-visible { background: rgba(255, 255, 255, 0.1); border-color: #f3efe4; }
.dbtn[aria-pressed="true"], .dbtn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* In fullscreen the bar floats over the board and fades when the mouse rests */
.db.is-fs .dh {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(31, 32, 35, 0.94);
}
.db.is-fs.is-idle .dh { opacity: 0; pointer-events: none; }
.db.is-fs.is-idle { cursor: none; }

/* ---------- Board ---------- */
.db-board {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.db-band {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.6vw, 26px);
  padding: clamp(8px, 1.6vh, 20px) clamp(14px, 3vw, 54px) clamp(4px, 0.8vh, 10px);
  border-bottom: 1px solid #1d1d20;
}
.db.is-msg .db-band { display: none; }

.db-icon {
  flex: 0 0 auto;
  width: clamp(34px, 6.2vh, 78px);
  height: clamp(34px, 6.2vh, 78px);
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 4px;
}
.db-icon svg { width: 76%; height: 76%; fill: var(--accent-ink); }
.db[data-theme="led"] .db-icon { background: transparent; box-shadow: inset 0 0 0 2px var(--accent); }
.db[data-theme="led"] .db-icon svg { fill: var(--accent); }

.db-heads { display: flex; flex-direction: column; min-width: 0; line-height: 1; }
.db-title {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: clamp(1.5rem, 5.4vh, 4.2rem);
  letter-spacing: 0.12em;
  color: var(--text);
  white-space: nowrap;
}
.db-subt {
  margin-top: 0.3em;
  font-family: var(--font-label);
  font-weight: 500;
  font-size: clamp(0.7rem, 1.7vh, 1.25rem);
  letter-spacing: 0.22em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.db[data-theme="led"] .db-subt { color: #9a6414; }

.db-clockbox { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.db-clock {
  font-family: var(--font-data);
  font-weight: 700;
  font-size: clamp(1.5rem, 5.6vh, 4.4rem);
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.db-clock small { font-size: 0.42em; color: var(--muted); font-weight: 600; margin-left: 0.1em; }
.db-date {
  margin-top: 0.35em;
  font-family: var(--font-label);
  font-size: clamp(0.7rem, 1.6vh, 1.2rem);
  letter-spacing: 0.22em;
  color: var(--muted);
}
.db.is-paused .db-clock { color: var(--muted); }

.db-canvas-wrap { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; }
.db-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- Message editor ---------- */
.msg-panel {
  position: absolute;
  top: 58px;
  right: 14px;
  z-index: 40;
  width: min(440px, calc(100% - 28px));
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-top: 2px solid var(--accent);
  padding: 12px 14px 14px;
  color: #d8d6d0;
  font-size: 0.72rem;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.msg-panel label { display: block; font-family: var(--font-label); font-size: 0.92rem; font-weight: 700; letter-spacing: 0.16em; color: #f3efe4; margin-bottom: 6px; }
.msg-panel textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  background: #0b0b0c;
  color: #f3efe4;
  border: 1px solid var(--line-bright);
  padding: 8px 9px;
  font-size: 0.82rem;
  line-height: 1.45;
  text-transform: uppercase;
}
.msg-note { margin-top: 6px; color: var(--muted); }
.msg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* ---------- Reference content ---------- */
.tool-info {
  max-width: 900px;
  margin: 44px auto 40px;
  padding: 0 24px;
  color: #a9a8a3;
  line-height: 1.7;
  font-size: 0.92rem;
}
.tool-info h1 { color: #f3efe4; font-size: 1.3rem; letter-spacing: 0.03em; margin-bottom: 14px; line-height: 1.35; }
.tool-info h2 {
  color: #f3efe4;
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 32px 0 10px;
  padding-left: 10px;
  border-left: 3px solid #ffd23f;
}
.tool-info h3 { color: #f3efe4; font-size: 0.94rem; margin: 22px 0 6px; }
.tool-info p { margin-bottom: 12px; }
.tool-info ul, .tool-info ol { margin: 0 0 12px 22px; }
.tool-info li { margin-bottom: 6px; }
.tool-info a { color: #ffd23f; }
.tool-info strong { color: #f3efe4; }
.tool-info kbd {
  font-family: var(--font-data);
  font-size: 0.8em;
  border: 1px solid #474a50;
  border-bottom-width: 2px;
  padding: 0 5px;
  border-radius: 3px;
  color: #f3efe4;
}
.glossary { margin: 0 0 12px; }
.glossary dt { color: #f3efe4; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.84rem; margin-top: 16px; }
.glossary dd { margin: 4px 0 0; }

.table-wrap { overflow-x: auto; margin: 0 0 14px; }
.status-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 520px; }
.status-table th, .status-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid #2c2e32; vertical-align: top; }
.status-table th { color: #f3efe4; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; border-bottom-color: #474a50; }
.status-table td:first-child { color: #f3efe4; font-weight: 600; white-space: nowrap; }

.site-foot {
  border-top: 1px solid #474a50;
  background: #1f2023;
  padding: 15px;
  text-align: center;
  font-size: 0.8rem;
}
.site-foot-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-foot-links a { color: #f3efe4; text-decoration: none; }
.site-foot-links a:hover { text-decoration: underline; }
.site-foot-note { color: #8e9096; font-size: 0.72rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .dh-pick span { display: none; }
}

@media (max-width: 1240px) {
  .dh-sub, .dh-sim { display: none; }
  .dh .dbtn { padding: 6px 7px; letter-spacing: 0.06em; }
  .dh-right { gap: 6px; }
}

@media (max-width: 900px) {
  .dh { flex-wrap: wrap; justify-content: center; }
  .dh-left, .dh-right { flex: 1 1 100%; justify-content: center; }
  .db { height: auto; min-height: 0; }
  .db-board { height: 78vh; min-height: 360px; flex: 0 0 auto; }
  .db.is-fs .db-board { height: 100vh; }
  .msg-panel { top: 110px; }
}

@media (max-width: 560px) {
  .db-board { height: 62vh; min-height: 300px; }
  .db-subt { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dh, .dbtn { transition: none; }
}
