:root {
  --hm-ink: #02060f;
  --hm-cream: #faebd4;
  --hm-teal: #5aa08f;
  --hm-teal-dk: #487860;
  --hm-amber: #d08030;
  --line: #1c2830;
  --muted: #9fb0ab;
  --panel: #0b1218;
  --ok: #3ecf78;
  --bad: #d07070;
}

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

html, body {
  min-height: 100%;
  background: var(--hm-ink);
  color: var(--hm-cream);
  font-family: "Avenir Next", "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--hm-teal); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

header {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #070c12;
  position: sticky; top: 0; z-index: 20;
}
header .brand { display: flex; align-items: center; gap: 10px; }
header .brand img { width: 36px; height: 36px; }
header h1 { font-size: 15px; letter-spacing: .14em; text-transform: uppercase; }
header h1 span { color: var(--hm-teal); }
header .tag { color: var(--hm-amber); font-size: 11px; letter-spacing: .2em; font-weight: 700; }
header .spacer { flex: 1; }
header .home {
  padding: 8px 12px; border: 1px solid var(--hm-teal-dk); border-radius: 8px;
  color: var(--hm-cream); font-size: 13px; font-weight: 700;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 16px 64px;
}

.lede { color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 72ch; margin-bottom: 22px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.card h2 {
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--hm-amber); margin-bottom: 10px;
}
.card p.hint { font-size: 13px; color: var(--muted); line-height: 1.45; margin-bottom: 10px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

.btn {
  appearance: none; border: 1px solid var(--line); background: #141c24;
  color: var(--hm-cream); padding: 10px 14px; border-radius: 8px;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.btn:hover { border-color: var(--hm-teal-dk); }
.btn.primary { background: var(--hm-amber); color: var(--hm-ink); border-color: var(--hm-amber); }
.btn.teal { background: var(--hm-teal); color: var(--hm-ink); border-color: var(--hm-teal); }
.btn.ghost { background: transparent; border-color: var(--hm-teal-dk); }
.btn:disabled { opacity: .5; cursor: default; }

.file, textarea, input[type="password"], input[type="text"], select {
  width: 100%;
  padding: 10px 12px;
  border: 1px dashed var(--hm-teal-dk);
  border-radius: 8px;
  background: #0a1016;
  color: var(--hm-cream);
  font-size: 13px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
input[type="password"], input[type="text"], select { border-style: solid; }

label.lab {
  display: block; font-size: 12px; color: var(--muted); margin: 10px 0 6px;
}
label.lab b { color: var(--hm-cream); font-weight: 600; }

.key-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.key-state { font-size: 12px; color: var(--muted); margin-top: 6px; }
.key-state.on { color: var(--ok); }

.queue { display: flex; flex-direction: column; gap: 10px; }
.job {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #0a1016;
  cursor: pointer;
}
.job.active { border-color: var(--hm-teal); }
.job .who { font-weight: 700; font-size: 14px; }
.job .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.job .pill {
  display: inline-block; margin-top: 8px;
  font-size: 10px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 99px;
}
.pill.ready { background: #1a2a22; color: var(--ok); }
.pill.wait { background: #2a2214; color: var(--hm-amber); }
.pill.run { background: #1a2a33; color: var(--hm-teal); }
.pill.err { background: #2a1515; color: var(--bad); }
.pill.demo { background: var(--hm-amber); color: var(--hm-ink); }

.poster {
  width: 100%; aspect-ratio: 16/9; object-fit: cover;
  border-radius: 8px; background: #000; margin-bottom: 10px;
}

.scoreline {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 10px; align-items: center; margin: 12px 0 16px;
}
.scoreline .team { text-align: center; }
.scoreline .name { font-size: 13px; font-weight: 700; }
.scoreline .pts { font-size: clamp(32px, 8vw, 52px); font-weight: 800; color: var(--hm-amber); line-height: 1; }
.scoreline .vs { color: var(--muted); font-weight: 700; }

.summary { font-size: 14px; line-height: 1.55; color: var(--hm-cream); margin-bottom: 14px; }
.summary.muted { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
.time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
.time:hover { color: var(--hm-amber); }

.progress {
  height: 6px; border-radius: 3px; background: #141c24; overflow: hidden; margin: 10px 0;
  display: none;
}
.progress.on { display: block; }
.progress i {
  display: block; height: 100%; width: 34%;
  background: var(--hm-teal);
  animation: scan 1.2s linear infinite;
}
@keyframes scan { from { transform: translateX(-110%); } to { transform: translateX(430%); } }

.flash { font-size: 13px; color: var(--muted); min-height: 1.3em; margin-top: 6px; }
.flash.err { color: var(--bad); }

.empty { color: var(--muted); font-size: 13px; padding: 8px 2px; }

footer {
  text-align: center; color: var(--hm-teal-dk); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase; margin-top: 28px;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  header { position: static; }
}
@media (max-width: 390px) {
  .scoreline .pts { font-size: 28px; }
  .key-row { grid-template-columns: 1fr; }
}

/* ---------- 3-step flow ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center;
  margin-bottom: 18px; padding: 20px;
  border: 1px solid var(--line); border-radius: 14px;
  background:
    radial-gradient(600px 220px at 85% 0%, rgba(208,128,48,.16), transparent 70%),
    radial-gradient(500px 220px at 0% 100%, rgba(90,160,143,.14), transparent 70%),
    var(--panel);
}
.hero-h { font-size: clamp(20px, 3.4vw, 30px); line-height: 1.15; margin-bottom: 8px; }
.hero .lede { margin-bottom: 12px; }
.hero-cta { display: flex; flex-direction: column; gap: 6px; align-items: stretch; max-width: 260px; }
.hero-cta small { color: var(--muted); font-size: 12px; text-align: center; }
.btn.big { padding: 14px 20px; font-size: 15px; box-shadow: 0 0 0 0 rgba(208,128,48,.5); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(208,128,48,.45); } 70% { box-shadow: 0 0 0 14px rgba(208,128,48,0); } 100% { box-shadow: 0 0 0 0 rgba(208,128,48,0); } }
@media (prefers-reduced-motion: reduce) { .btn.big { animation: none; } }
.steps { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; }
.steps li {
  display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px 5px 5px;
}
.steps li b {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: #141c24; color: var(--hm-cream); font-size: 11px;
}
.steps li.done { color: var(--hm-cream); border-color: var(--hm-teal-dk); }
.steps li.done b { background: var(--hm-teal); color: var(--hm-ink); }

.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.drop {
  display: block; position: relative; text-align: center; cursor: pointer;
  border: 1px dashed var(--hm-teal-dk); border-radius: 10px; padding: 16px 12px; background: #0a1016;
}
.drop:hover { border-color: var(--hm-teal); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop b { display: block; font-size: 14px; }
.drop small { color: var(--muted); font-size: 12px; }

.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.wide { width: 100%; }
a.btn { display: inline-block; }
.hint.small, p.small { font-size: 12px !important; margin-top: 6px; }
.muted { color: var(--muted); }

.keybox { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.keybox summary { cursor: pointer; font-size: 12px; color: var(--muted); font-weight: 700; }

.job { position: relative; }
.job .x {
  position: absolute; top: 6px; right: 8px; appearance: none; border: 0; background: none;
  color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1;
}
.job .x:hover { color: var(--bad); }

.res-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr); gap: 18px; align-items: start; }
.player { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #000; margin-bottom: 10px; display: block; }
.share { position: sticky; top: 76px; }
table.agg { margin-top: 6px; }
.timeline select {
  width: 100%; padding: 5px 6px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: #0a1016;
}
.timeline td { vertical-align: top; }
.timeline .note { color: var(--muted); font-size: 11px; margin-top: 3px; }
.timeline tr.ok td { background: rgba(62,207,120,.05); }
.timeline .ops { white-space: nowrap; }
.timeline .ops button {
  appearance: none; border: 1px solid var(--line); background: #0a1016; color: var(--muted);
  border-radius: 6px; width: 28px; height: 28px; cursor: pointer;
}
.timeline tr.ok .ops button[data-op="ok"] { color: var(--ok); border-color: var(--ok); }
.timeline .ops button[data-op="rm"]:hover { color: var(--bad); border-color: var(--bad); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-cta { max-width: none; }
  .res-grid { grid-template-columns: 1fr; }
  .share { position: static; }
}
@media (max-width: 560px) {
  .timeline th:nth-child(4), .timeline td:nth-child(4) { display: none; }
}
@media print {
  header, .hero, .grid, .share, .ops, #add-tag, footer { display: none !important; }
  html, body { background: #fff; color: #000; }
  .card { border: 0; background: #fff; }
  .timeline select { border: 0; background: none; color: #000; -webkit-appearance: none; appearance: none; }
}
.job .meta { overflow-wrap: anywhere; }
.timeline td:nth-child(2) select { min-width: 66px; }
