@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/geist-regular.ttf") format("truetype");
}
@font-face {
  font-family: Geist;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/geist-medium.ttf") format("truetype");
}
:root {
  --ground: #f2f4f7;
  --surface: #fff;
  --raised: #e9edf2;
  --border: #e1e5ea;
  --rule: #edf0f3;
  --control: #bdc5ce;
  --text: #17191c;
  --muted: #5e6570;
  --primary: #17191c;
  --data: #1d5fbf;
  --bar: #6b7280;
  --negative: #9f252b;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 12px;
  --pad: 24px;
  --cost-value-size: clamp(2rem, 1.5rem + 1vw, 2.25rem);
  --cost-label-size: clamp(1.125rem, 1rem + .4vw, 1.25rem);
  --cost-pad: 20px;
  --cost-gap: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 14px/1.45 Geist, system-ui, sans-serif;
}
main { max-width: 1176px; margin: 0 auto; padding: 24px; }
#stop { position: absolute; top: 12px; right: 12px; z-index: 4; white-space: nowrap; }
#live-message { position: absolute; bottom: 12px; left: 12px; z-index: 2; max-width: calc(100% - 24px); padding: 8px 12px; border-radius: var(--radius-control); background: var(--surface); font-size: 12px; color: var(--muted); }
#live-message:empty { display: none; }
/* At the full 1128px canvas: 320px palette + 12px gap + 796px stage = 1128px. */
.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-areas: "palette stage" ". cost"; gap: var(--gap); }
.stage { grid-area: stage; position: relative; display: flex; flex-direction: column; min-width: 0; }
.camera { --gesture-diameter: clamp(192px, 26vw, 248px); position: relative; flex: 1; min-height: 320px; overflow: hidden; border-radius: var(--radius-card); background: #0a0a0a; }
video { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
#gesture-overlay { position: absolute; left: 12px; bottom: 12px; z-index: 1; display: grid; place-items: center; width: var(--gesture-diameter); height: var(--gesture-diameter); border: 1px solid var(--border); border-radius: 50%; background: var(--surface); font-size: calc(var(--gesture-diameter) * .71); line-height: 1; pointer-events: none; user-select: none; }
#gesture-overlay[aria-label="Detected pose: L shape"] { font-size: calc(var(--gesture-diameter) * .62); }
#gesture-overlay:not([hidden]) ~ #live-message { left: auto; right: 12px; max-width: calc(100% - var(--gesture-diameter) - 36px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.gate { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 24px; background: var(--raised); text-align: center; }
.gate-content { max-width: 340px; }
.gate h2 { font-size: 20px; line-height: 1.3; margin: 0 0 12px; font-weight: 500; }
.gate p { color: var(--muted); margin: 0 0 20px; font-size: 14px; line-height: 1.5; }
button, .gate-action { font: inherit; border: 1px solid var(--control); border-radius: var(--radius-control); padding: 9px 14px; background: var(--surface); color: var(--text); cursor: pointer; min-height: 44px; }
button:hover:not(:disabled), .gate-action:hover { border-color: var(--text); }
button:active:not(:disabled), .gate-action:active { transform: translateY(1px); }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--data); outline-offset: 3px; }
.gate button, .gate-action { background: var(--primary); color: var(--surface); border-color: var(--primary); padding-inline: 20px; }
.gate button:hover:not(:disabled), .gate-action:hover { background: #34383d; border-color: #34383d; }
.gate button:disabled { background: #d4dae2; color: #3d434d; border-color: #d4dae2; }
.gate-action { display: inline-flex; align-items: center; text-decoration: none; }
.emoji-glyph { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.palette { grid-area: palette; min-width: 0; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.row { display: grid; grid-template-rows: 1fr auto; gap: 4px; width: 100%; min-height: 56px; margin: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); text-align: left; }
.choice-name { display: flex; gap: 7px; align-items: center; min-width: 0; }
.emoji { font-size: 19px; line-height: 22px; height: 22px; width: 22px; flex: none; text-align: center; }
.label { font-size: 13px; line-height: 16px; }
.probability { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 8px; }
.track { position: relative; height: 4px; background: var(--rule); overflow: hidden; }
.fill { position: absolute; inset: 0 auto 0 0; background: var(--bar); width: 0; }
.pct { font-variant-numeric: tabular-nums; font-size: 12px; line-height: 16px; text-align: right; }
.row.top { border-color: #92aed4; }
.row.top .fill { background: var(--data); }
.row.top .pct { color: var(--data); font-weight: 500; }
.cost-meter { grid-area: cost; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--cost-gap) var(--pad); min-width: 0; padding: var(--cost-pad) var(--pad); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.cost-label { flex: 1 1 14ch; color: var(--muted); font-size: var(--cost-label-size); line-height: 1.35; }
#cost { display: block; max-width: 100%; color: var(--text); font-size: var(--cost-value-size); font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.03em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 292px minmax(0, 1fr); }
}
@media (max-width: 800px) {
  main { padding: 16px; }
  .workspace { grid-template-columns: 1fr; grid-template-areas: "stage" "cost" "palette"; }
  .palette { margin-top: var(--gap); }
  .camera { flex: none; aspect-ratio: 4 / 3; min-height: 252px; }
  .choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  #stop { padding: 8px 12px; font-size: 13px; }
  .camera { --gesture-diameter: 160px; }
  .camera:has(#live-message:not(:empty)) { --gesture-diameter: 136px; }
  .camera:has(#live-message:not(:empty)) #gesture-overlay { top: 12px; left: 12px; right: auto; bottom: auto; }
  #gesture-overlay:not([hidden]) ~ #live-message { left: 12px; max-width: calc(100% - 24px); }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .row { min-height: 64px; padding: 10px; }
  .label { font-size: 14px; }
  .gate { padding: 20px; }
  .gate h2 { font-size: 18px; margin-bottom: 10px; }
  .gate p { font-size: 13px; margin-bottom: 16px; }
  .cost-meter { flex-direction: column; align-items: flex-start; padding: var(--cost-pad); }
  .cost-label { flex: none; }
}
@media (max-width: 350px) {
  .row { padding-inline: 8px; }
  .label { font-size: 13px; }
  .choice-name { gap: 5px; }
}
@media (min-width: 561px) and (max-height: 600px) {
  .camera { --gesture-diameter: clamp(144px, calc(100dvh - 128px), 248px); }
  #gesture-overlay, #live-message { top: 76px; bottom: auto; }
}
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled), .gate-action:active { transform: none; }
}
