/* Roaming Calculator. Colours and fonts are the website's (Website/css/site.css). The shapes
   follow Matt's house rule: one corner radius on everything, a rectangle with a slight curve. */
@font-face { font-family: 'Unbounded'; src: url('../assets/unbounded-latin.woff2') format('woff2'); font-weight: 500 700; font-display: swap; }
@font-face { font-family: 'Manrope'; src: url('../assets/manrope-latin.woff2') format('woff2'); font-weight: 500 800; font-display: swap; }

:root {
  --ground: #050506;
  --panel: #0e0e11;
  --soft: #c6c6ce;
  --line: rgba(255, 255, 255, 0.18);
  --radius: 10px;
  --head: 'Unbounded', sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
  --under: #30d158;
  --over: #ff453a;
  --unknown: #9a9aa5;
  --top: 64px;
}
* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; min-height: 100vh; background: var(--ground); color: #fff; font: 500 16px/1.5 var(--body); }
h1, h2, p, ol, ul { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
body.dropping::after { content: 'Drop the capture anywhere'; position: fixed; inset: 10px; z-index: 10; display: grid; place-items: center; border: 2px dashed #fff; border-radius: var(--radius); background: rgba(5, 5, 6, 0.85); font: 600 22px/1.2 var(--head); pointer-events: none; }

/* Glass cards: the same surface everywhere */
.card, .promise, .drop {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius); background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; transition: background 0.2s ease, border-color 0.2s ease; }
.btn:hover { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.6); }
.btn-main { border-color: #fff; background: #fff; color: #050506; }
.btn-main:hover { border-color: #e7e7ea; background: #e7e7ea; }
.link { padding: 0; border: 0; background: none; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; color: #fff; }
.label { display: block; font-weight: 800; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--soft); }
.small { font-size: 14px; color: var(--soft); text-wrap: pretty; }
.chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 8px; font-size: 12px; font-weight: 800; white-space: nowrap; }

.top { display: flex; align-items: center; gap: 16px; height: calc(var(--top) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; border-bottom: 1px solid var(--line); }
.brand img { display: block; }
.top-title { margin-right: auto; font: 600 15px/1 var(--head); letter-spacing: -0.01em; }

/* Before a capture is loaded */
.intro { max-width: 1180px; margin: 0 auto; padding: 56px 32px 64px; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 48px; align-items: center; }
.intro h1 { margin-top: 16px; font: 600 clamp(26px, 3.1vw, 40px)/1.14 var(--head); letter-spacing: -0.01em; text-wrap: balance; }
.intro .lead { margin-top: 18px; font-size: 18px; color: #e7e7ea; text-wrap: pretty; }
.drop { margin-top: 28px; padding: 22px; }
.drop .btn-main { min-height: 52px; padding: 0 28px; font-size: 14px; }
.note { margin-top: 12px; font-size: 14px; color: var(--soft); text-wrap: pretty; }
.message { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--over); border-radius: var(--radius); background: rgba(255, 69, 58, 0.12); font-weight: 600; text-wrap: pretty; }
.promise { margin-top: 16px; padding: 16px 18px; text-wrap: pretty; }
.intro-art { margin: 0; }
.intro-art img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); }
/* Each step is a number badge beside its text, both starting on the same line. */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 32px; margin-top: 48px; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; min-height: 28px; padding-left: 42px; color: var(--soft); counter-increment: step; text-wrap: pretty; }
.steps li strong { display: block; color: #fff; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 8px; font: 800 14px/1 var(--body); color: #fff; }
.explain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 40px; }
.explain .card { padding: 20px; }
.explain h2 { font: 600 16px/1.3 var(--head); }
.explain p { margin-top: 10px; font-size: 15px; color: var(--soft); text-wrap: pretty; }
.intro > .small { margin-top: 24px; }

/* With a capture loaded: choices on the left, results on the right */
.work { display: grid; grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
.side { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain; padding: 24px 20px 32px; border-right: 1px solid var(--line); background: var(--panel); }
.main { min-width: 0; max-width: 1240px; padding: 24px 28px 64px; }
.file-name { font-weight: 800; overflow-wrap: anywhere; }
.hint-text { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--soft); text-wrap: pretty; }
.hint-text .link { font-size: 13px; }
.warn-text { margin-top: 8px; font-size: 14px; font-weight: 600; color: #ffb4ae; }
.privacy { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.block { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 8px; padding: 6px 10px 6px 12px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); text-align: left; }
.row.pick { cursor: pointer; }
.row.pick:hover { border-color: rgba(255, 255, 255, 0.4); }
.row.active { border-color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.13); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 800; font-size: 15px; overflow-wrap: anywhere; }
.row-main small { font-size: 12px; font-weight: 600; color: var(--soft); font-variant-numeric: tabular-nums; }
.row input.name { width: 100%; min-height: 28px; margin-left: -6px; padding: 0 5px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 800; font-size: 15px; text-overflow: ellipsis; cursor: text; }
.row input.name:hover, .row input.name:focus { border-color: rgba(255, 255, 255, 0.4); background: rgba(5, 5, 6, 0.5); }
.count { flex: none; font-size: 12px; font-weight: 800; color: var(--soft); white-space: nowrap; }
.row.active .count { color: #fff; }
.device { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px; background: rgba(255, 255, 255, 0.9); cursor: pointer; }
.device span { display: block; background-repeat: no-repeat; }
.more { margin-top: 12px; font-size: 13px; }
.target-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 800; }
.target-row input[type="range"] { flex: 1; min-width: 0; height: 28px; accent-color: #fff; }
.target-row input[type="number"] { width: 76px; min-height: 40px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: var(--radius); background: rgba(255, 255, 255, 0.06); font-size: 16px; font-weight: 800; text-align: right; -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.card.board, .card.player-card { padding: 24px; }
.card h2 { margin-top: 10px; font: 600 clamp(20px, 2vw, 26px)/1.2 var(--head); letter-spacing: -0.01em; text-wrap: balance; }
.card .lead { margin-top: 8px; color: var(--soft); text-wrap: pretty; }
.label.spaced { margin-top: 24px; }
.rows { margin-top: 14px; }
/* One roam per row, the same columns in every row so the bars line up */
.roam-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 170px minmax(120px, 2fr) 92px minmax(0, 1.2fr); align-items: center; gap: 14px; width: 100%; min-height: 56px; margin-top: 8px; padding: 8px 14px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius); background: rgba(5, 5, 6, 0.45); text-align: left; cursor: pointer; }
.roam-row:hover { border-color: rgba(255, 255, 255, 0.4); }
.roam-row.active { border-color: rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.1); }
.roam-title { display: flex; flex-direction: column; min-width: 0; }
.roam-title b { font-weight: 800; }
.roam-title span { font-size: 13px; font-weight: 600; color: var(--soft); overflow-wrap: anywhere; }
.roam-title i { font-style: normal; opacity: 0.7; }
.roam-row .chip { justify-self: start; }
.bar { position: relative; height: 18px; border-radius: 5px; background: rgba(255, 255, 255, 0.08); }
.fill { position: absolute; left: 0; top: 0; bottom: 0; min-width: 4px; border-radius: 5px; background: var(--unknown); }
.fill.under { background: var(--under); }
.fill.over { background: var(--over); }
/* a bar that runs off the end of the scale fades out instead of stopping */
.fill.off-scale { border-radius: 5px 0 0 5px; -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
.bar .target { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: #fff; }
.roam-time { font: 600 16px/1 var(--head); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.roam-time.under { color: var(--under); }
.roam-time.over { color: #ff7a71; }
.roam-time.unknown { color: var(--soft); font-size: 13px; }
.roam-data { font-size: 13px; font-weight: 600; color: var(--soft); }

.player-card { margin-top: 20px; }
.player-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.player-title .label { flex-basis: 100%; }
.player-title h2 { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.stat { padding: 14px 16px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius); background: rgba(5, 5, 6, 0.5); }
.stat .number { margin-top: 8px; font: 700 26px/1 var(--head); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat.key .number { font-size: 34px; }
.stat .sub { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--soft); }
.stat.idle .number { color: var(--soft); }
.verdict-text { margin-top: 8px; font-weight: 700; line-height: 1.4; text-wrap: pretty; }
/* the verdict waits for the animation to finish */
.stat.verdict { transition: opacity 0.3s ease; }
.player-head:not(.done) .stat.verdict { opacity: 0.25; }
.player-head.done .stat.key.under, .player-head.done .stat.verdict.under { border-color: var(--under); }
.player-head.done .stat.key.over, .player-head.done .stat.verdict.over { border-color: var(--over); }
.player-head.done .stat.key.under .number { color: var(--under); }
.player-head.done .stat.key.over .number { color: #ff7a71; }

.player-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; }
.player-stage { min-width: 0; }
canvas { display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #101013; }
.controls { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; }
.call-note { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--soft); text-wrap: pretty; }
.controls .group { display: flex; gap: 6px; padding: 5px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius); background: rgba(5, 5, 6, 0.5); }
.controls button { min-width: 40px; min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 7px; background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 13px; cursor: pointer; white-space: nowrap; }
.controls button.wide { min-width: 72px; }
.controls button:hover { background: rgba(255, 255, 255, 0.18); }
.controls button[aria-pressed="true"], .controls #play { background: #fff; color: #050506; }

.frames { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 8px 8px 14px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius); background: rgba(5, 5, 6, 0.5); }
#frame-list { flex: 1 1 0; min-height: 200px; margin-top: 8px; padding: 0 6px 0 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; }
#frame-list button { display: grid; grid-template-columns: 34px 10px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: none; text-align: left; cursor: pointer; }
#frame-list button:hover { background: rgba(255, 255, 255, 0.08); }
#frame-list li.now button { border-color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.12); }
.frame-number, .frame-time { font-size: 12px; font-weight: 700; color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.frame-time { text-align: right; }
.frame-label { font-size: 13px; font-weight: 800; line-height: 1.3; }
.frame-label small { display: block; font-size: 11px; font-weight: 600; color: var(--soft); }
.frame-label em { font-style: normal; color: #ffb020; }
.swatch { display: block; width: 10px; height: 10px; border: 1px solid rgba(255, 255, 255, 0.7); border-radius: 3px; }

.parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.part { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--radius); background: rgba(5, 5, 6, 0.5); font-size: 14px; font-weight: 600; }
.part b { font: 600 15px/1 var(--head); font-variant-numeric: tabular-nums; }
.part small { width: 36px; text-align: right; color: var(--soft); font-weight: 700; }
.notes { margin-top: 16px; padding: 0; list-style: none; }
.notes li { position: relative; margin-top: 8px; padding-left: 18px; font-size: 15px; color: #e7e7ea; text-wrap: pretty; }
.notes li::before { content: ''; position: absolute; left: 0; top: 9px; width: 8px; height: 8px; border-radius: 3px; background: #ffb020; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }

@media (max-width: 1340px) {
  .player-grid { grid-template-columns: minmax(0, 1fr); }
  #frame-list { flex: none; max-height: 300px; }
  .roam-row { grid-template-columns: minmax(140px, 1fr) minmax(100px, 1.4fr) 92px; }
  .roam-row .chip { grid-column: 1; grid-row: 2; }
  .roam-row .roam-data { grid-column: 2 / 4; grid-row: 2; text-align: right; }
}

@media (max-width: 899px) {
  :root { --top: 52px; }
  .brand img { width: 105px; height: 32px; }
  .top { gap: 10px; padding-left: 14px; padding-right: 14px; }
  .top-title { display: none; }
  .brand { margin-right: auto; }
  .top .btn { min-height: 38px; padding: 0 12px; font-size: 11px; letter-spacing: 0.04em; }
  .intro { padding: 28px 16px 40px; }
  .intro-grid { grid-template-columns: 1fr; gap: 24px; }
  .intro .lead { font-size: 16px; }
  .steps, .explain { grid-template-columns: 1fr; }
  .steps { margin-top: 32px; }
  .work { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; padding: 20px 16px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 16px 16px 48px; }
  .card.board, .card.player-card { padding: 16px; }
  .roam-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px; }
  .roam-row .bar { grid-column: 1 / 3; grid-row: 2; }
  .roam-row .roam-time { grid-column: 2; grid-row: 1; }
  .roam-row .chip { grid-column: 1; grid-row: 3; }
  .roam-row .roam-data { grid-column: 2; grid-row: 3; }
  .stat.key .number { font-size: 30px; }
  .controls button { min-height: 40px; }
}
