/* AirPoint web. Telas de aparelho (celular e palco da tela) são sempre escuras;
   a página inicial e o painel de ajustes seguem o tema do sistema. */
:root {
  --bg: #EBEEF2; --panel: #FFFFFF; --ink: #131920; --muted: #5A6573; --line: #D2D8DF;
  --accent: #D8343C; --accent-soft: rgba(216, 52, 60, .11); --ok: #178F61;
  --dev-bg: #0B0E12; --dev-panel: #151A20; --dev-ink: #E8ECF0; --dev-muted: #8A949F;
  --dev-line: rgba(255, 255, 255, .09); --dev-accent: #F25B61; --dev-ok: #3CC48B; --dev-warn: #E2A23B;
  --wall-1: #1C2A39; --wall-2: #3A2C40; --wall-3: #121C26;
  --win: #F4F6F8; --win-ink: #1A2026; --win-muted: #66717D; --win-line: #D9DEE3; --win-sel: #D8343C;
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1115; --panel: #151A20; --ink: #E5E9ED; --muted: #8994A0; --line: #252D36;
    --accent: #F0565C; --accent-soft: rgba(240, 86, 92, .14); --ok: #38BD86; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1115; --panel: #151A20; --ink: #E5E9ED; --muted: #8994A0; --line: #252D36;
  --accent: #F0565C; --accent-soft: rgba(240, 86, 92, .14); --ok: #38BD86; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); margin: 0; font-size: 13.5px; }

.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand.small { font-size: 17px; gap: 8px; }
.brand.small svg { width: 24px; height: 24px; }

.btn-primary { border: 0; background: var(--accent); color: #fff; font-weight: 600; border-radius: 12px; padding: 13px 20px; }
.btn-primary.small { padding: 8px 14px; border-radius: 9px; font-size: 14px; }
.btn-ghost { border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 11px 18px; font-weight: 500; }
.btn-ghost.small { padding: 7px 12px; border-radius: 9px; font-size: 14px; }

/* ================= Página inicial ================= */
.landing { min-height: 100%; display: grid; place-items: center;
  padding-left: max(16px, var(--safe-l)); padding-right: max(16px, var(--safe-r));
  padding-block: calc(32px + var(--safe-t)) calc(40px + var(--safe-b)); }
.land-inner { width: min(860px, 100%); display: grid; gap: 22px; }
.landing h1 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(32px, 5.5vw, 56px); line-height: 1.02; letter-spacing: -.025em; text-wrap: balance; max-width: 16ch; }
.land-lede { margin: 0; font-size: 17px; color: var(--muted); max-width: 62ch; text-wrap: pretty; }
.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 620px) { .roles { grid-template-columns: minmax(0, 1fr); } }
.role { text-align: left; display: grid; gap: 6px; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); transition: border-color .15s, transform .15s; }
.role:hover { border-color: var(--accent); transform: translateY(-1px); }
.role svg { width: 40px; height: 40px; margin-bottom: 4px; }
.role strong { font-family: var(--f-display); font-weight: 500; font-size: 20px; letter-spacing: -.01em; }
.role span { color: var(--muted); font-size: 14px; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; max-width: 64ch; }
.steps b { font-weight: 600; }
.land-note { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 70ch; }
.land-note a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }

/* ================= Celular ================= */
.phone-view { position: fixed; inset: 0; background: var(--dev-bg); color: var(--dev-ink); display: flex; flex-direction: column; gap: 12px;
  padding: calc(10px + var(--safe-t)) max(14px, var(--safe-r)) calc(14px + var(--safe-b)) max(14px, var(--safe-l));
  overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ph-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ph-status { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .07); }
.ph-status span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-status .mono { color: var(--dev-muted); font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dev-muted); flex: none; }
.dot.ok { background: var(--dev-ok); }
.dot.busy { background: var(--dev-warn); animation: blink 1s infinite; }
.dot.error { background: var(--dev-accent); }
@keyframes blink { 50% { opacity: .35; } }
.ph-link { border: 0; background: transparent; color: var(--dev-muted); font-size: 14px; padding: 6px 4px; }
.ph-player { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.ph-player .chip { width: 14px; height: 14px; border-radius: 4px; }
.ph-player .mono { margin-left: auto; color: var(--dev-muted); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(255, 255, 255, .07); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 0; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--dev-muted); }
.seg button[aria-checked="true"] { background: rgba(255, 255, 255, .16); color: var(--dev-ink); }
.pad { flex: 1; min-height: 0; position: relative; border-radius: 26px; overflow: hidden; touch-action: none;
  background: radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, .06), rgba(255, 255, 255, .015)); border: 1px solid var(--dev-line); transition: box-shadow .2s; }
.pad.holding { box-shadow: inset 0 0 0 2px var(--player, var(--dev-accent)), inset 0 0 70px color-mix(in srgb, var(--player, var(--dev-accent)) 30%, transparent); }
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pad-hint { position: absolute; left: 0; right: 0; top: 18px; display: grid; justify-items: center; gap: 4px; text-align: center; padding: 0 16px; pointer-events: none; }
.pad-hint strong { font-family: var(--f-display); font-weight: 500; font-size: 21px; letter-spacing: -.01em; }
.pad-hint span { font-size: 12.5px; color: var(--dev-muted); white-space: pre-line; line-height: 1.45; }
.pad-read { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 11px; color: var(--dev-muted); pointer-events: none; }
.pad-flash { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 44px; pointer-events: none; opacity: 0; }
.pad-flash.on { animation: flash .6s ease-out; }
@keyframes flash { 0% { opacity: 1; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.15) translateY(-20px); } }
.ph-foot { display: grid; grid-template-columns: 1fr; }
.ph-foot button { border: 0; border-radius: 16px; padding: 15px; background: rgba(255, 255, 255, .1); color: var(--dev-ink); font-size: 15px; font-weight: 600; }
.ph-foot button:active { background: rgba(255, 255, 255, .18); }
.ph-foot button:disabled { opacity: .35; }

.sheet { position: absolute; inset: 0; background: rgba(5, 7, 10, .82); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 10; touch-action: auto; user-select: text; -webkit-user-select: text; }
.sheet-card { width: min(380px, 100%); background: var(--dev-panel); border: 1px solid var(--dev-line); border-radius: 22px; padding: 24px; display: grid; gap: 14px; }
.sheet-card h2 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 24px; letter-spacing: -.01em; }
.sheet-card p { margin: 0; color: var(--dev-muted); font-size: 14.5px; }
.sheet-card form { display: grid; gap: 10px; }
.sheet-card .btn-primary { background: var(--dev-accent); }
.sheet-card .btn-ghost { border-color: var(--dev-line); color: var(--dev-ink); }
.code-input { width: 100%; text-align: center; font-family: var(--f-mono); font-size: 30px; letter-spacing: .25em; text-transform: uppercase; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--dev-line); background: rgba(255, 255, 255, .06); color: var(--dev-ink); }
.code-input::placeholder { color: rgba(255, 255, 255, .18); }
.err { color: var(--dev-accent) !important; min-height: 1.2em; }

/* ================= Computador ================= */
.screen-view { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--dev-bg); color: var(--dev-ink); position: relative; }
.sc-top { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: calc(8px + var(--safe-t)) max(16px, var(--safe-r)) 8px max(16px, var(--safe-l)); border-bottom: 1px solid var(--dev-line); }
.tabs { display: inline-flex; border-radius: 10px; padding: 3px; background: rgba(255, 255, 255, .06); }
.tabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--dev-muted); }
.tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .14); color: var(--dev-ink); }
.sc-players { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.pchip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; border-radius: 999px; background: rgba(255, 255, 255, .06); font-size: 13px; white-space: nowrap; }
.pchip i { width: 12px; height: 12px; border-radius: 4px; display: block; }
.pchip .mono { color: var(--dev-muted); font-size: 12px; }
.pchip.empty { color: var(--dev-muted); background: transparent; border: 1px dashed var(--dev-line); }
.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-btn { border: 1px solid var(--dev-line); background: rgba(255, 255, 255, .04); color: var(--dev-ink); border-radius: 9px; padding: 6px 12px; font-size: 13.5px; }
.sc-btn:hover { background: rgba(255, 255, 255, .1); }
.sc-btn b { letter-spacing: .12em; margin-left: 4px; }

.stage { position: relative; overflow: hidden; container-type: size; user-select: none; -webkit-user-select: none; color: var(--win-ink);
  background: radial-gradient(70% 90% at 18% 12%, var(--wall-2), transparent 60%), radial-gradient(60% 80% at 88% 85%, #1F3E46, transparent 60%), linear-gradient(160deg, var(--wall-1), var(--wall-3)); }
.layer { position: absolute; inset: 0; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#cursors { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.cur { position: absolute; left: 0; top: 0; width: clamp(14px, 1.45cqw, 26px); will-change: transform; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55)); }
.cur svg { display: block; width: 100%; height: auto; overflow: visible; }
.cur .tag { position: absolute; left: 90%; top: 95%; font: 600 clamp(9px, .8cqw, 12px)/1 var(--f-body); padding: 3px 6px; border-radius: 6px; color: #fff; white-space: nowrap; }
.rawdot { position: absolute; left: 0; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 1.5px solid currentColor; opacity: .8; }
.pulse { position: absolute; width: clamp(18px, 2.4cqw, 44px); aspect-ratio: 1; border-radius: 50%; border: 2px solid currentColor; translate: -50% -50%; pointer-events: none; z-index: 38; animation: pulse .38s ease-out forwards; }
@keyframes pulse { from { scale: .3; opacity: 1; } to { scale: 1.4; opacity: 0; } }
.toast { position: absolute; right: 16px; top: 16px; background: rgba(244, 246, 248, .95); color: var(--win-ink); font-size: 14px; padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); z-index: 30; max-width: 40cqw; }

.hud { position: absolute; top: 14px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 18px; padding: 8px 18px; border-radius: 999px; background: rgba(10, 13, 17, .6); backdrop-filter: blur(6px); color: #EEF1F4; z-index: 6; pointer-events: none; white-space: nowrap; transition: opacity .2s; }
.hud-time { display: grid; justify-items: center; }
.hud-time b { font-weight: 500; font-size: clamp(16px, 1.7cqw, 26px); }
.hud-time span, .hs span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #A9B2BC; }
.hud-scores { display: flex; gap: 16px; }
.hs { display: grid; justify-items: center; }
.hs b { font-family: var(--f-mono); font-weight: 500; font-size: clamp(15px, 1.5cqw, 24px); }
.card { position: absolute; left: 50%; top: 52%; translate: -50% -50%; width: min(560px, 92cqw); max-height: 88cqh; overflow: auto; background: rgba(244, 246, 248, .96); color: var(--win-ink); border-radius: 22px; padding: 26px; display: grid; justify-items: center; gap: 12px; text-align: center; z-index: 8; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.card h3 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(20px, 2.4cqw, 32px); letter-spacing: -.01em; line-height: 1.1; }
.card p { margin: 0; font-size: 15px; color: var(--win-muted); max-width: 44ch; }
.board { width: 100%; display: grid; gap: 6px; }
.brow { display: grid; grid-template-columns: 22px 1fr repeat(3, auto); gap: 14px; align-items: center; padding: 8px 12px; border-radius: 10px; background: #fff; font-size: 14px; text-align: left; }
.brow i { width: 14px; height: 14px; border-radius: 4px; display: block; }
.brow b { font-family: var(--f-mono); font-weight: 500; }
.brow .muted { color: var(--win-muted); font-size: 12.5px; }
.brow.win { box-shadow: 0 0 0 2px var(--c); }
.diffs { display: flex; gap: 4px; background: #E3E7EB; border-radius: 10px; padding: 3px; }
.diffs button { border: 0; background: transparent; border-radius: 8px; padding: 6px 14px; font-size: 14px; color: var(--win-muted); }
.diffs button.on { background: #fff; color: var(--win-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.start { border: 0; background: var(--win-sel); color: #fff; border-radius: 999px; padding: 12px 34px; font-weight: 600; font-size: 16px; }
.best { font-size: 13px; color: var(--win-muted); font-family: var(--f-mono); }
.hov { outline: 2px solid rgba(216, 52, 60, .6); outline-offset: 1px; }

.icon { position: absolute; width: 8cqw; min-width: 64px; display: grid; justify-items: center; gap: 4px; padding: 6px; border-radius: 10px; color: #F1F4F7; font-size: clamp(11px, .95cqw, 14px); text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.icon svg { width: clamp(36px, 4.4cqw, 64px); height: auto; }
.icon.sel { background: rgba(255, 255, 255, .16); }
.icon.dragging { opacity: .85; scale: 1.06; }
.win { position: absolute; background: var(--win); border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .4); display: flex; flex-direction: column; overflow: hidden; font-size: clamp(12px, 1.05cqw, 16px); }
.win-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--win-line); font-weight: 600; font-size: .9em; color: var(--win-muted); }
.lights { display: flex; gap: 6px; margin-right: 8px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; background: #D0D5DA; display: block; }
.lights i.x { background: #E5605A; }
.notes-body { flex: 1; overflow: auto; padding: 16px 20px; line-height: 1.55; }
.notes-body h4 { margin: 0 0 8px; font-family: var(--f-display); font-size: 1.4em; }
.notes-body p { margin: 0 0 12px; color: #2A333C; }
.test-body { flex: 1; display: grid; place-items: center; align-content: center; gap: 10px; padding: 14px; text-align: center; }
.test-btn { border: 0; background: var(--win-sel); color: #fff; border-radius: 10px; padding: 12px 26px; font-weight: 600; }
.test-out { color: var(--win-muted); font-size: .92em; }
.test-count { font-size: 2.4em; color: var(--win-ink); }
.menu { position: absolute; background: rgba(246, 247, 249, .97); border-radius: 10px; padding: 5px; box-shadow: 0 12px 34px rgba(0, 0, 0, .35); min-width: 200px; z-index: 12; font-size: 14px; }
.menu div { padding: 6px 12px; border-radius: 6px; }
.menu div.hov { outline: 0; background: var(--win-sel); color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--win-line); margin: 4px 6px; }

.pair { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6, 9, 12, .55); backdrop-filter: blur(4px); z-index: 50; padding: 16px; }
.pair-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; background: var(--dev-panel); color: var(--dev-ink); border: 1px solid var(--dev-line); border-radius: 24px; padding: 28px; width: min(760px, 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
@media (max-width: 640px) { .pair-card { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; } }
.qr { width: min(260px, 60vw); aspect-ratio: 1; background: #fff; border-radius: 16px; padding: 14px; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; display: block; }
.pair-text { display: grid; gap: 10px; min-width: 0; }
.pair-text h2 { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 30px; letter-spacing: -.02em; }
.pair-text ol { margin: 0; padding-left: 20px; color: var(--dev-muted); display: grid; gap: 2px; }
.big-code { font-size: clamp(34px, 5vw, 54px); letter-spacing: .18em; font-weight: 500; line-height: 1.1; }
.pair-url { margin: 0; font-size: 12.5px; color: var(--dev-muted); overflow-wrap: anywhere; }
.pair-status { margin: 0; font-size: 14px; color: var(--dev-warn); }
.pair-status.ok { color: var(--dev-ok); }
.pair-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pair .btn-primary { background: var(--dev-accent); }
.pair .btn-ghost { border-color: var(--dev-line); color: var(--dev-ink); }

.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%); background: var(--panel); color: var(--ink); border-left: 1px solid var(--line); z-index: 60; overflow: auto;
  padding: calc(16px + var(--safe-t)) max(18px, var(--safe-r)) calc(24px + var(--safe-b)) 18px; display: grid; align-content: start; gap: 16px; box-shadow: -20px 0 50px rgba(0, 0, 0, .25); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; font-family: var(--f-display); font-weight: 500; font-size: 22px; }
.drawer .sc-btn { border-color: var(--line); color: var(--ink); background: transparent; }
.drawer .btn-ghost { border-color: var(--line); color: var(--ink); justify-self: start; }
.set { display: grid; gap: 14px; }
.set h3 { margin: 6px 0 0; font-size: 11.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.srow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; }
.srow label { font-size: 14px; }
.srow output { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }
.srow input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.srow small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 16px; height: 16px; }
.conn-list { display: grid; gap: 8px; }
.conn { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.conn i { width: 14px; height: 14px; border-radius: 4px; display: block; }
.conn small { grid-column: 2 / -1; color: var(--muted); font-family: var(--f-mono); font-size: 12px; }
.conn button { border: 0; background: transparent; color: var(--accent); font-size: 13px; padding: 2px 4px; }

@media (prefers-reduced-motion: reduce) {
  .pulse, .pad-flash.on { animation-duration: .01s; }
  .dot.busy { animation: none; }
  .role, .pad { transition: none; }
}
