@font-face {
  font-family: "Khand";
  src: url("../assets/fonts/khand-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Khand";
  src: url("../assets/fonts/khand-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #1b1c1e;
  --panel: #26282b;
  --panel-2: #303236;
  --line: #44474c;
  --gold: #C9A227;
  --gold-bright: #e3bb37;
  --text: #ffffff;
  --muted: #b4b7bc;
  --danger: #ff6b5e;
  --head: "Khand", "Arial Narrow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --dock-h: 112px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
h1, h2, h3 { font-family: var(--head); font-weight: 700; margin: 0; letter-spacing: 0.02em; line-height: 1.1; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
a { color: var(--gold-bright); }
button, input, textarea, select { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(6px + env(safe-area-inset-top)) 12px 6px;
  background: #141516;
  border-bottom: 2px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); min-width: 0; flex: 1; }
.brand h1 { font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav { flex: none; }
.nw { white-space: nowrap; margin-right: 10px; display: inline-block; }
.logo { width: 34px; height: 34px; object-fit: contain; flex: none; }
#nav { display: flex; gap: 4px; }
#nav a {
  font-family: var(--head); font-weight: 600; font-size: 19px; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 10px 9px; border-radius: 8px;
}
#nav a.on { color: #141516; background: var(--gold); }

main { padding: 14px 14px 32px; max-width: 760px; margin: 0 auto; }
main.walking { padding: 0 0 calc(var(--dock-h) + env(safe-area-inset-bottom) + 16px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 10px 20px;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--panel-2); color: var(--text);
  font-family: var(--head); font-weight: 700; font-size: 22px; letter-spacing: 0.03em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--gold); border-color: var(--gold); color: #141516; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.small { min-height: 48px; font-size: 19px; padding: 6px 14px; }
.btn.wide { width: 100%; }
.btn:active { transform: translateY(1px); filter: brightness(1.15); }

label.field { display: block; margin: 0 0 12px; color: var(--muted); font-size: 15px; }
input[type="text"], textarea, select {
  display: block; width: 100%; min-height: 56px; margin-top: 4px; padding: 12px 14px;
  background: #121314; color: var(--text);
  border: 2px solid var(--line); border-radius: 12px; font-size: 18px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 1px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }

/* Jobs */
.job-list { list-style: none; padding: 0; margin: 12px 0 0; }
.job-list li { display: flex; gap: 8px; margin-bottom: 10px; }
.job-open {
  flex: 1; min-width: 0; text-align: left; min-height: 72px; padding: 10px 14px;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; cursor: pointer;
}
.job-open.current { border-color: var(--gold); }
.job-open strong { display: block; font-family: var(--head); font-size: 26px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-open span { color: var(--muted); font-size: 15px; }

/* Walk */
.cam { position: relative; height: 36vh; min-height: 220px; background: #000; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; text-align: center; color: var(--muted); background: #0c0c0d;
}
.cam-msg:empty { display: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 0.35s ease-out; }
@keyframes flash { from { opacity: 0.85; } to { opacity: 0; } }

.context {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 8px 14px; background: #141516; border-bottom: 1px solid var(--line);
  font-family: var(--head); font-weight: 600; font-size: 22px; line-height: 1.15;
}
.context .sep { color: var(--gold); }
.context .now { color: var(--gold-bright); font-weight: 700; }

.heard { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 58px; border-bottom: 1px solid var(--line); }
.heard-text { flex: 1; min-width: 0; font-size: 19px; overflow-wrap: anywhere; }
.heard-text.interim { color: var(--muted); font-style: italic; }
.heard-text.ignored { color: #7d8085; }
.heard-text.acted { color: var(--text); font-weight: 600; }
.heard-text.hint { color: var(--muted); font-size: 16px; }

.walk-body { padding: 12px 14px 0; }
.shot { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0c0c0d; }
.shot canvas { display: block; width: 100%; height: auto; touch-action: manipulation; }
.shot.editing canvas { touch-action: none; }
.shot .empty { padding: 36px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 16px; }
.chip b { color: var(--gold-bright); font-family: var(--head); font-size: 21px; font-weight: 700; margin-left: 6px; }
.notes-line { margin: 8px 0 0; color: var(--muted); white-space: pre-line; }

.cmd { display: flex; gap: 8px; margin: 14px 0 0; }
.cmd input { margin-top: 0; }
.cmd .btn { flex: none; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom));
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: rgba(20, 21, 22, 0.96); border-top: 2px solid var(--gold);
}
.dock-btn {
  height: 84px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel-2);
  font-family: var(--head); font-weight: 700; font-size: 20px; line-height: 1.05; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.dock-btn small { font-family: var(--body); font-weight: 400; font-size: 12px; text-transform: none; color: inherit; opacity: 0.8; }
.listen { color: var(--muted); }
.listen .dot { width: 22px; height: 22px; border-radius: 50%; background: #6b6e73; }
.listen.on { color: #141516; background: var(--gold); border-color: var(--gold-bright); }
.listen.on .dot { background: #141516; animation: pulse 1.2s ease-in-out infinite; }
.listen.speaking { color: var(--gold-bright); border-color: var(--gold); }
.listen.speaking .dot { background: var(--gold); }
@keyframes pulse { 0%, 100% { transform: scale(0.7); opacity: 0.6; } 50% { transform: scale(1.15); opacity: 1; } }
.ptt.held { background: var(--gold); color: #141516; border-color: var(--gold-bright); }
.shutter {
  width: 92px; height: 92px; border-radius: 50%; border: 5px solid #fff; background: transparent; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; touch-action: manipulation;
}
.shutter::after { content: ""; width: 70px; height: 70px; border-radius: 50%; background: var(--gold); }
.shutter:active::after { transform: scale(0.9); }

/* Review and detail */
.room-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--gold); }
.room-head .num { color: var(--gold-bright); }
.op-card {
  display: grid; grid-template-columns: 132px 1fr; gap: 12px; width: 100%; text-align: left;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; cursor: pointer;
}
.op-card.current { border-color: var(--gold); }
.op-card .thumb { width: 132px; aspect-ratio: 4 / 3; background: #0c0c0d; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.op-card .thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.op-card h3 { color: var(--gold-bright); }
.op-card .kv { font-size: 16px; }
.op-card .kv b { font-family: var(--head); font-size: 20px; }

.meas-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.meas-row .name { font-family: var(--head); font-weight: 600; font-size: 22px; }
.meas-row input { margin-top: 0; text-align: center; font-family: var(--head); font-weight: 700; font-size: 22px; padding: 8px; }
.add-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; }
.add-row input { margin-top: 0; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; }
.thumbs button { flex: none; width: 76px; height: 76px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: #000; }
.thumbs button.on { border-color: var(--gold); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

.notice { border-left: 4px solid var(--gold); background: var(--panel); padding: 10px 12px; border-radius: 0 10px 10px 0; color: var(--muted); font-size: 15px; margin-bottom: 14px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--dock-h) + 26px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #fff; color: #141516; font-weight: 600; padding: 12px 18px; border-radius: 12px; z-index: 50;
  max-width: 90vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
#toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .listen.on .dot, .flash.go { animation: none; }
}
@media (max-width: 480px) {
  .brand h1 { font-size: 19px; }
  .logo { width: 28px; height: 28px; }
  #nav a { padding: 10px 7px; font-size: 18px; }
}
@media (max-width: 380px) {
  #nav a { font-size: 17px; padding: 10px 6px; }
  .op-card { grid-template-columns: 104px 1fr; }
  .op-card .thumb { width: 104px; }
}

/* ---------- polish pass ---------- */
body {
  background:
    radial-gradient(1200px 500px at 50% -120px, rgba(201, 162, 39, 0.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.top { background: linear-gradient(#17181a, #121314); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
#nav { background: #0c0d0e; border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
#nav a { border-radius: 9px; padding: 8px 10px; }
.panel { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.panel.accent { border-top: 3px solid var(--gold); }
.btn { transition: transform 0.08s, filter 0.15s; }
.btn.primary { background: linear-gradient(#dcb534, #b8921d); border-color: #e3bb37; box-shadow: 0 6px 16px rgba(201, 162, 39, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

.hero { padding: 10px 2px 16px; }
.hero h2 { font-size: 38px; }
.hero p { margin: 4px 0 0; }
.eyebrow { font-family: var(--head); font-weight: 600; font-size: 17px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-bright); margin: 0 0 2px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
.count { font-size: 18px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 2px 12px 0; }

.job-open { position: relative; padding: 12px 40px 12px 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.job-open::after { content: ""; position: absolute; right: 16px; top: 50%; width: 11px; height: 11px; border-right: 3px solid var(--gold); border-top: 3px solid var(--gold); transform: translateY(-50%) rotate(45deg); }
.job-open.current { background: linear-gradient(90deg, rgba(201, 162, 39, 0.14), var(--panel) 60%); }
.job-open span { display: block; }
.pills { display: flex !important; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pills em { font-style: normal; font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.pills em.gold { background: var(--gold); border-color: var(--gold); color: #141516; font-weight: 700; }
.job-del { flex: none; width: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.job-del:active { color: var(--danger); border-color: var(--danger); }
.empty-card { text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: 14px; padding: 28px 18px; margin-top: 12px; }
.empty-card img { width: 64px; height: 64px; opacity: 0.55; }
.empty-card p { margin: 8px 0 0; }

/* walk */
.cam { box-shadow: inset 0 -30px 40px -20px rgba(0, 0, 0, 0.6); }
.finder { position: absolute; inset: 14px; pointer-events: none; }
.finder i { position: absolute; width: 30px; height: 30px; border: 0 solid var(--gold-bright); opacity: 0.9; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8)); }
.finder i:nth-child(1) { left: 0; top: 0; border-left-width: 4px; border-top-width: 4px; border-top-left-radius: 8px; }
.finder i:nth-child(2) { right: 0; top: 0; border-right-width: 4px; border-top-width: 4px; border-top-right-radius: 8px; }
.finder i:nth-child(3) { right: 0; bottom: 0; border-right-width: 4px; border-bottom-width: 4px; border-bottom-right-radius: 8px; }
.finder i:nth-child(4) { left: 0; bottom: 0; border-left-width: 4px; border-bottom-width: 4px; border-bottom-left-radius: 8px; }
.context { background: linear-gradient(#17181a, #131415); }
.context .now { background: var(--gold); color: #141516; border-radius: 8px; padding: 1px 10px 0; }
.heard { background: rgba(255, 255, 255, 0.02); }
.wave { flex: none; display: flex; align-items: center; gap: 3px; height: 30px; width: 34px; }
.wave i { flex: 1; height: 6px; border-radius: 3px; background: #5d6065; }
.wave.on i { background: var(--gold-bright); animation: wave 0.9s ease-in-out infinite; }
.wave.on i:nth-child(2) { animation-delay: 0.15s; }
.wave.on i:nth-child(3) { animation-delay: 0.3s; }
.wave.on i:nth-child(4) { animation-delay: 0.45s; }
.wave.on i:nth-child(5) { animation-delay: 0.6s; }
.wave.speaking i { background: var(--gold); height: 14px; }
@keyframes wave { 0%, 100% { height: 6px; } 50% { height: 26px; } }

.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.readout:empty { display: none; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 6px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04); }
.tile span { display: block; font-family: var(--head); font-weight: 600; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.tile b { display: block; font-family: var(--head); font-weight: 700; font-size: 44px; line-height: 1.05; color: #5d6065; }
.tile.set { border-color: var(--gold); background: linear-gradient(160deg, rgba(201, 162, 39, 0.16), var(--panel) 70%); }
.tile.set b { color: var(--gold-bright); }
.shot { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); }
.shot .empty strong { font-family: var(--head); font-size: 26px; color: var(--text); }
.help { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.help summary { min-height: 52px; display: flex; align-items: center; padding: 0 14px; font-family: var(--head); font-weight: 600; font-size: 20px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); cursor: pointer; list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary::after { content: "+"; margin-left: auto; color: var(--gold-bright); font-size: 26px; }
.help[open] summary::after { content: "\2212"; }
.help ul { margin: 0; padding: 0 14px 12px 34px; color: var(--muted); }
.help li { margin: 4px 0; }
.help b { color: var(--gold-bright); }

.dock { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45); }
.dock-btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.shutter { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.5); }
.shutter::after { background: radial-gradient(circle at 35% 30%, #f0cd55, #b8921d); transition: transform 0.08s; }

/* review and detail */
.room-head .num { background: var(--gold); color: #141516; border-radius: 8px; padding: 0 10px; margin-right: 4px; }
.op-card { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.meas-row input { color: var(--gold-bright); }
#toast { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); border-left: 6px solid var(--gold); }
@media (prefers-reduced-motion: reduce) { .wave.on i { animation: none; height: 16px; } }
