/**
 * Design tokens, global elements, and the connection screen.
 * CSS files are loaded in the order shown in index.html so later feature and
 * responsive rules can safely refine these foundations.
 */
:root {
  color-scheme: dark;
  --bg: #060d18;
  --surface: #0c1726;
  --surface-2: #111f31;
  --surface-3: #17283c;
  --line: #20364d;
  --line-strong: #31506d;
  --text: #eef7ff;
  --muted: #8ba1b6;
  --mint: #66f7c2;
  --mint-dark: #103d35;
  --blue: #5b8cff;
  --amber: #ffc66d;
  --red: #ff7e8a;
  --shadow: 0 24px 70px rgb(0 0 0 / 38%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 78% 9%, #102b3c 0, transparent 26rem), var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 clamp(18px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid rgb(139 161 182 / 15%); background: rgb(6 13 24 / 82%); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 24px; font-weight: 900; color: #07131d; background: linear-gradient(135deg, var(--mint), #9bffe0); box-shadow: 0 0 28px rgb(102 247 194 / 24%); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: .01em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { min-height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: rgb(17 31 49 / 72%); cursor: pointer; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.theme-toggle:hover { border-color: var(--line-strong); color: var(--text); background: var(--surface-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.theme-toggle-icon { font-size: 17px; line-height: 1; }
.theme-toggle-label { font-size: 13px; font-weight: 750; }
.theme-toggle-track { width: 32px; height: 18px; position: relative; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 99px; background: #091522; transition: .18s ease; }
.theme-toggle-track i { width: 12px; height: 12px; position: absolute; top: 2px; left: 2px; border-radius: 50%; background: #71869a; transition: transform .18s ease, background .18s ease; }
.local-pill, .connection-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 99px; white-space: nowrap; }
.local-pill i, .connection-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 9px var(--mint); }
.connection-pill i { background: #607488; box-shadow: none; }
.connection-pill.connected { color: var(--mint); border-color: rgb(102 247 194 / 35%); background: rgb(102 247 194 / 6%); }
.connection-pill.connected i { background: var(--mint); box-shadow: 0 0 9px var(--mint); }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; font-weight: 750; font-size: 15px; cursor: pointer; transition: .18s ease; white-space: nowrap; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button.primary { color: #06130f; background: var(--mint); box-shadow: 0 8px 24px rgb(102 247 194 / 14%); }
.button.primary:hover:not(:disabled) { background: #8fffd8; box-shadow: 0 10px 28px rgb(102 247 194 / 22%); }
.button.secondary { color: var(--text); background: #122135; border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { border-color: #4a6b8a; background: #17293e; }
.button.compact { padding: 8px 12px; }
.button.large { padding: 14px 20px; font-size: 16px; }
.button.danger-text { color: var(--red); background: transparent; border-color: rgb(255 126 138 / 25%); }
.text-link { border: 0; color: var(--mint); background: transparent; cursor: pointer; padding: 12px; font-weight: 700; }
.route-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.eyebrow { margin: 0 0 8px; color: var(--mint); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .16em; }

.welcome { min-height: calc(100vh - 76px); padding: 6vw clamp(22px, 7vw, 110px); display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); align-items: center; gap: clamp(45px, 8vw, 130px); overflow: hidden; }
.welcome-copy { max-width: 620px; }
.welcome h1 { font-size: clamp(46px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; margin: 0 0 26px; }
.welcome h1 span { color: var(--mint); }
.lead { color: #a8bbcc; line-height: 1.75; font-size: 19px; max-width: 570px; }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 30px; }
.support-note { display: flex; gap: 10px; max-width: 520px; color: var(--muted); font-size: 14px; line-height: 1.5; margin-top: 24px; }
.support-note > span:first-child { color: var(--blue); }
.welcome-visual { position: relative; min-height: 510px; display: grid; place-items: center; }
.welcome-visual::before { content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%; background: radial-gradient(circle, rgb(102 247 194 / 11%), transparent 67%); border: 1px solid rgb(102 247 194 / 8%); }
.device-card { width: min(100%, 640px); position: relative; z-index: 1; border: 1px solid #28445e; border-radius: 24px; padding: 24px; background: linear-gradient(145deg, rgb(19 35 52 / 92%), rgb(8 20 32 / 95%)); box-shadow: var(--shadow), inset 0 1px rgb(255 255 255 / 5%); transform: perspective(900px) rotateY(-5deg) rotateX(3deg); }
.device-card-top { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; }
.device-card-top b { margin-left: auto; color: var(--text); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 12px var(--mint); }
.mini-keyboard { width: max-content; display: grid; gap: 7px; margin: 24px auto; }
.mini-row { width: max-content; display: flex; gap: 7px; }
.mini-key { width: var(--mini-key-width); height: 47px; flex: 0 0 var(--mini-key-width); border-radius: 7px; background: linear-gradient(#1e344b, #13263a); border: 1px solid #31516c; box-shadow: inset 0 -3px rgb(0 0 0 / 18%); }
.mini-key.glow { border-color: var(--mint); box-shadow: inset 0 -3px rgb(0 0 0 / 18%), 0 0 13px rgb(102 247 194 / 28%); }
.device-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.device-stats span { background: rgb(6 16 27 / 70%); border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.device-stats small, .device-stats strong { display: block; }
.device-stats small { color: var(--muted); font-size: 12px; }
.device-stats strong { margin-top: 4px; font-size: 16px; }
.feature-float { position: absolute; z-index: 2; display: flex; gap: 11px; align-items: center; padding: 13px 16px; border: 1px solid var(--line-strong); border-radius: 14px; background: rgb(12 25 40 / 94%); box-shadow: 0 14px 32px rgb(0 0 0 / 35%); }
.feature-float > span { width: 34px; height: 34px; display: grid; place-items: center; color: var(--mint); background: var(--mint-dark); border-radius: 9px; }
.feature-float strong, .feature-float small { display: block; }
.feature-float strong { font-size: 14px; }
.feature-float small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.float-one { left: -2%; bottom: 15%; }
.float-two { right: 0; top: 11%; }
