/* Explore Utah Device Lab. Colors come from themes.css (one data-theme
   attribute on <html>; generated from src/themes.js). The look follows the
   Explore Utah game UI: dark panels, heavy all-caps titles with a bar under
   them, red-rock orange accent, a skyline behind the header. */
:root {
  --radius: 14px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --heavy: "Arial Black", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--font); }
img, svg, canvas { max-width: 100%; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent); color: var(--accent-ink); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); color: var(--text); padding: 8px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ── header with skyline ──────────────────────────────────── */
.top { position: relative; background: var(--header-bg); color: var(--header-ink); border-bottom: 3px solid var(--accent); overflow: hidden; }
.top::before {
  content: ""; position: absolute; inset: auto 0 0 0; height: 56px; pointer-events: none;
  background: var(--skyline);
  -webkit-mask: url(/img/skyline.svg) bottom / auto 100% repeat-x;
  mask: url(/img/skyline.svg) bottom / auto 100% repeat-x;
}
.top-inner { position: relative; max-width: 1120px; margin: 0 auto; padding: 12px 16px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--header-ink); text-decoration: none; }
.brand:hover { color: var(--header-ink); }
.brand img { width: 42px; height: 42px; }
.brand span { font: 900 19px/1 var(--heavy); letter-spacing: 1px; text-transform: uppercase; }
.brand small { display: block; margin-top: 4px; font: 800 11px/1 var(--font); letter-spacing: 2.5px; opacity: 0.85; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.nav a { color: var(--header-ink); text-decoration: none; font-weight: 800; padding: 8px 12px; border-radius: 10px; }
.nav a:hover { background: rgba(127, 127, 127, 0.22); color: var(--header-ink); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

/* ── layout & titles ──────────────────────────────────────── */
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 60px; }
h1, .title {
  font: 900 clamp(26px, 4.6vw, 38px)/1.1 var(--heavy); text-transform: uppercase; letter-spacing: 0.5px;
  margin: 6px 0 18px;
}
h1::after, .title::after { content: ""; display: block; width: 72px; height: 5px; margin-top: 12px; border-radius: 3px; background: var(--title-bar); }
h2 { font: 900 21px/1.2 var(--heavy); text-transform: uppercase; letter-spacing: 0.4px; margin: 30px 0 12px; }
h3 { font-size: 19px; margin: 0 0 6px; }
p.lead { font-size: 19px; color: var(--muted); max-width: 46em; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spacer { flex: 1; }
.card { background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.sky { background: var(--info-soft); border-color: var(--line); }
.card.sun { background: var(--warn-soft); border-color: var(--line); }
.card.pine { background: var(--ok-soft); border-color: var(--line); }
.card.rock { background: var(--accent-soft); border-color: var(--line); }
.card.sky, .card.sun, .card.pine, .card.rock { border-left: 5px solid var(--accent); }
.card.sky { border-left-color: var(--sky); }
.card.sun { border-left-color: var(--gold); }
.card.pine { border-left-color: var(--success); }
.stat { font: 900 40px/1.1 var(--heavy); margin: 8px 0; }
.stat small { font: 700 16px var(--font); color: var(--muted); }
.icon { width: 44px; height: 44px; flex: none; }

/* ── buttons & forms ──────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: 12px; border: 0;
  font: 800 18px/1.1 var(--font); cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
  transition: transform 80ms ease, box-shadow 80ms ease, background 120ms ease;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28); }
.btn.go { background: var(--success); color: var(--success-ink); }
.btn.warn { background: var(--danger); color: var(--danger-ink); }
.btn.sun { background: var(--gold); color: var(--gold-ink); }
.btn.go:hover, .btn.warn:hover, .btn.sun:hover { filter: brightness(1.07); }
.btn.go:hover { color: var(--success-ink); }
.btn.warn:hover { color: var(--danger-ink); }
.btn.sun:hover { color: var(--gold-ink); }
.btn.plain { background: var(--row); color: var(--text); box-shadow: 0 3px 0 var(--line); border: 1.5px solid var(--line); }
.btn.plain:hover { background: var(--row-hover); color: var(--text); }
.btn.small { min-height: 42px; padding: 8px 14px; font-size: 16px; }
.btn.big { min-height: 64px; font-size: 21px; padding: 14px 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
label { font-weight: 800; display: block; margin: 12px 0 6px; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; max-width: 560px; min-height: 50px; padding: 10px 14px; font: 18px var(--font);
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--inset); color: var(--text);
}
input::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.choices { display: flex; flex-wrap: wrap; gap: 10px; border: 0; padding: 0; margin: 14px 0; }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span { display: inline-flex; align-items: center; min-height: 52px; padding: 10px 20px; border: 2px solid var(--line); border-radius: 12px; font-weight: 800; background: var(--row); color: var(--text); cursor: pointer; }
.choice input:checked + span { border-color: var(--accent); background: var(--row-pick); }
.choice input:focus-visible + span { outline: 3px solid var(--gold); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.check input { width: 26px; height: 26px; accent-color: var(--accent); }
.check label { margin: 0; }

/* ── messages ─────────────────────────────────────────────── */
.note { border-radius: 12px; padding: 14px 16px; margin: 12px 0; font-weight: 600; border: 1.5px solid var(--line); }
.note.info { background: var(--info-soft); border-left: 5px solid var(--sky); }
.note.ok { background: var(--ok-soft); border-left: 5px solid var(--success); }
.note.bad { background: var(--danger-soft); border-left: 5px solid var(--danger); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel); color: var(--text); border: 1.5px solid var(--accent); padding: 14px 20px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); z-index: 50; max-width: calc(100% - 32px); }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: 14px; background: var(--row); color: var(--text); border: 1.5px solid var(--line); }
.pill.ready, .pill.live { background: var(--ok-soft); border-color: var(--success); }
.pill.busy, .pill.queued, .pill.starting { background: var(--warn-soft); border-color: var(--warn); }
.pill.resetting, .pill.ending { background: var(--info-soft); border-color: var(--sky); }
.pill.offline, .pill.error, .pill.unauthorized, .pill.failed, .pill.canceled, .pill.ended { color: var(--muted); }

/* ── landing ──────────────────────────────────────────────── */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(30px, 5.4vw, 50px); }
.kicker { font: 900 15px/1 var(--heavy); letter-spacing: 3px; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.hero-art { width: 100%; height: auto; border-radius: 20px; }
.steps { counter-reset: step; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); padding: 0; list-style: none; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 900; margin-bottom: 8px; }
footer { text-align: center; color: var(--muted); padding: 24px 16px 40px; font-size: 15px; border-top: 1.5px solid var(--line); }

/* ── themes picker ────────────────────────────────────────── */
.themes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); border: 0; padding: 0; margin: 0; }
.theme-opt { position: relative; margin: 0; cursor: pointer; }
.theme-opt input { position: absolute; opacity: 0; inset: 0; }
.theme-card { display: block; border-radius: 14px; padding: 12px; background: var(--bg); color: var(--text); border: 2px solid var(--line); min-height: 128px; }
.theme-opt input:checked + .theme-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
.theme-opt input:focus-visible + .theme-card { outline: 3px solid var(--gold); outline-offset: 3px; }
.theme-card strong { display: block; font: 900 14px/1.2 var(--heavy); text-transform: uppercase; letter-spacing: 0.4px; }
.theme-card strong::after { content: ""; display: block; width: 36px; height: 4px; margin: 6px 0; border-radius: 2px; background: var(--title-bar); }
.theme-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.swatches { display: flex; gap: 6px; margin-top: 8px; }
.swatches i { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); }
.swatches i:nth-child(1) { background: var(--panel); }
.swatches i:nth-child(2) { background: var(--accent); }
.swatches i:nth-child(3) { background: var(--gold); }
.swatches i:nth-child(4) { background: var(--sky); }
.swatches i:nth-child(5) { background: var(--success); }
.theme-card.auto { background: linear-gradient(135deg, #0B0F15 0 50%, #F3F6FA 50% 100%); }
.theme-card.auto strong, .theme-card.auto small { background: var(--panel); color: var(--text); border-radius: 8px; padding: 4px 6px; display: inline-block; }

/* ── tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--panel); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
th { background: var(--inset); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--row); }

/* ── dialog ───────────────────────────────────────────────── */
dialog { border: 1.5px solid var(--accent); border-radius: 18px; padding: 0; max-width: min(560px, calc(100% - 24px)); width: 100%; background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
dialog::backdrop { background: rgba(5, 8, 14, 0.6); }
dialog .dlg { padding: 22px; }
dialog h2 { margin-top: 0; }

/* ── live session ─────────────────────────────────────────── */
.live { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.timer { font: 900 30px/1 var(--heavy); font-variant-numeric: tabular-nums; background: var(--header-bg); color: var(--gold); border: 1.5px solid var(--line); padding: 10px 16px; border-radius: 12px; }
.timer.low { background: var(--danger); color: var(--danger-ink); }
.phone { position: relative; background: #0A0E14; border-radius: 26px; padding: 14px; border: 3px solid var(--line); display: grid; place-items: center; min-height: 260px; }
.phone canvas { display: block; width: 100%; height: auto; max-height: 76vh; object-fit: contain; border-radius: 12px; background: #000; touch-action: none; cursor: crosshair; }
.phone canvas:focus-visible { outline: 4px solid var(--gold); }
.overlay { position: absolute; inset: 14px; display: grid; place-items: center; text-align: center; color: #F3F6FA; background: rgba(10, 14, 20, 0.86); border-radius: 12px; padding: 20px; font-weight: 800; font-size: 20px; }
.keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.panel { margin-bottom: 14px; }
.logcat { height: 280px; overflow: auto; background: #070A10; color: #CFE3FF; font: 12px/1.45 ui-monospace, "SFMono-Regular", Menlo, monospace; padding: 10px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; border: 1.5px solid var(--line); margin-top: 8px; }
.shot img { width: 100%; border-radius: 10px; border: 1.5px solid var(--line); margin-top: 10px; }
.staffbar { background: var(--inset); border: 1.5px solid var(--gold); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.kv dt { font-weight: 800; }
.kv dd { margin: 0; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .live { grid-template-columns: 1fr; }
  .nav { margin-left: 0; width: 100%; }
  .nav a { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
