/* Dark, large and touch-first: used at arm's length in a car. */
:root {
  color-scheme: dark;
  --bg: #111418;
  --panel: #1c2128;
  --line: #333a44;
  --text: #f1f3f5;
  --muted: #a7b0ba;
  --accent: #3fb6c4;
  --accent-text: #06262a;
  --good: #4cc38a;
  --bad: #ff7b72;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 20px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1 { margin: 0; font-size: 1.5rem; }
h2 { margin: 0 0 12px; font-size: 1.2rem; }
h3 { margin: 16px 0 8px; font-size: 1rem; color: var(--muted); font-weight: 600; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.error { min-height: 1.4em; margin: 12px 0; color: var(--bad); font-weight: 600; }
.lead { margin: 12px 0 16px; color: var(--muted); }
.pad { padding: 0 16px; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.topbar h1 { flex: 1; min-width: 0; }
.status { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.status.bad { color: var(--bad); font-weight: 700; }

.panel { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 72px; padding: 10px 18px;
  color: var(--text); background: #2a313a;
  border: 2px solid var(--line); border-radius: var(--radius);
  font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  touch-action: manipulation;
}
.btn:active { background: #3a434e; }
.btn:disabled { opacity: 0.55; }
.btn.primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.btn.selected { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.btn.running { color: #2a1400; background: #f2b84b; border-color: #f2b84b; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 48px; padding: 6px 14px; font-size: 0.9rem; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.big { min-height: 120px; font-size: 3rem; line-height: 1; }

.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

/* Sign in and home */
.center-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { display: grid; gap: 12px; width: min(480px, 100%); }
.login input { min-height: 72px; padding: 0 16px; color: var(--text); background: var(--bg); border: 2px solid var(--line); border-radius: var(--radius); font: inherit; }
.home { max-width: 1200px; margin: 0 auto; padding-bottom: 32px; }
.home .topbar { padding-inline: 16px; }
.home .lead { padding: 0 16px; }
.home .panel { margin: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; padding: 0 16px; }
.tile { display: grid; gap: 6px; align-content: center; min-height: 150px; padding: 20px; color: var(--text); background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); text-decoration: none; }
.tile:active { border-color: var(--accent); }
.tile strong { font-size: 1.3rem; }
.tile span { color: var(--muted); }
.steps { margin: 0; padding-left: 1.4em; }
.steps li { margin: 6px 0; }

/* Player */
.player { display: grid; grid-template-columns: minmax(320px, 2fr) minmax(360px, 3fr); gap: 16px; align-items: start; padding: 0 16px 32px; }
.now { position: sticky; top: 16px; text-align: center; }
.now img { display: block; width: min(100%, 38vh); height: auto; aspect-ratio: 1; margin: 0 auto 14px; border-radius: var(--radius); background: var(--bg); }
.track-title { font-size: 1.6rem; font-weight: 700; }
.transport { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 12px; margin-top: 16px; }
.side { display: grid; gap: 16px; min-width: 0; }

.result { display: grid; gap: 8px; margin-top: 14px; }
.result-row { display: grid; grid-template-columns: 7em 1fr; gap: 10px; padding: 10px 12px; background: var(--bg); border-left: 5px solid var(--line); border-radius: 8px; }
.result-row.good { border-left-color: var(--good); }
.result-row.bad { border-left-color: var(--bad); }

.counters { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.counter { display: grid; gap: 2px; padding: 10px; background: var(--bg); border-radius: 10px; text-align: center; }
.counter b { font-size: 2rem; line-height: 1.1; }
.counter span { color: var(--muted); font-size: 0.85rem; }
.counter.flash { animation: flash 1s ease-out; }
@keyframes flash { from { background: var(--accent); color: var(--accent-text); } to { background: var(--bg); } }

.events { margin: 0; padding: 0; list-style: none; font-size: 0.85rem; }
.events li { padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.kind-media, .kind-media td { color: var(--good); font-weight: 700; }
.kind-skip, .kind-skip td { color: var(--accent); font-weight: 600; }
.kind-error, .kind-error td { color: var(--bad); font-weight: 700; }
.kind-note, .kind-note td { color: #f2b84b; }

/* Debug */
.debug { display: grid; gap: 16px; padding: 16px; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.env { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 0; font-size: 0.85rem; }
.env dt { color: var(--muted); }
.env dd { margin: 0; overflow-wrap: anywhere; }
.actions { margin: 0; padding: 0; list-style: none; columns: 2; font-size: 0.85rem; }
.actions .yes { color: var(--good); }
.actions .no { color: var(--muted); }
.log-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 12px; font-size: 0.9rem; }
.log-tools input[type="checkbox"] { width: 24px; height: 24px; vertical-align: middle; }
.log-tools select { min-height: 48px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); }
td.detail { min-width: 280px; white-space: normal; overflow-wrap: anywhere; }
td.hit { color: var(--good); font-weight: 700; }
td.zero { color: var(--muted); }

@media (max-width: 860px) {
  .player { grid-template-columns: 1fr; }
  .now { position: static; }
  .status { display: none; }
}

/* Phone remote */
.remote { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; }
