/* Handnotes — dark, glassy chrome floating over a full-bleed WebGL stage. */

:root {
  --bg:        #05060f;
  --ink:       #eef2ff;
  --muted:     #8b95b8;
  --line:      rgba(255,255,255,.10);
  --glass:     rgba(14,17,32,.72);
  --glass-hi:  rgba(30,36,64,.72);
  --accent:    #6f8cff;
  --accent-2:  #c96bff;
  --good:      #4fe0b0;
  --bad:       #ff6b6b;
  --r:         16px;
  --shadow:    0 24px 70px rgba(0,0,0,.55);
  --panel-w:   380px;
}

* { box-sizing: border-box; }
/* Class-level `display` beats the UA sheet's [hidden] rule, so restate it. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }

body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 18% -10%, #1c2350 0%, transparent 60%),
    radial-gradient(1000px 700px at 96% 105%, #3a1440 0%, transparent 58%),
    radial-gradient(700px 500px at 50% 50%, #0d1130 0%, transparent 70%),
    var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage, #overlay {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
}
#overlay { pointer-events: none; z-index: 4; }
#stage   { z-index: 1; touch-action: none; cursor: grab; }
#stage.grabbing { cursor: grabbing; }

/* ───────────────────────── top bar ───────────────────────── */
.bar {
  position: fixed; z-index: 6; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(5,6,15,.82), transparent);
  pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { font-size: 26px; filter: drop-shadow(0 0 14px rgba(111,140,255,.6)); }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: .2px; font-weight: 650; }
.brand p  { margin: 1px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.bar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; backdrop-filter: blur(14px);
  transition: background .16s, border-color .16s, transform .12s;
  white-space: nowrap;
}
.chip:hover  { background: var(--glass-hi); border-color: rgba(255,255,255,.22); }
.chip:active { transform: scale(.96); }
.chip.on { border-color: var(--accent); color: #cfd8ff; box-shadow: 0 0 0 3px rgba(111,140,255,.14); }

/* ───────────────────────── hand readouts ───────────────────────── */
.hands {
  position: fixed; z-index: 6; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; pointer-events: none;
}
.hcard {
  min-width: 190px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 13px; backdrop-filter: blur(16px); box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
.hcard.idle { opacity: .38; }
.hcard .top { display: flex; align-items: center; gap: 9px; }
.hcard .glyph { font-size: 21px; line-height: 1; }
.hcard .side  { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.hcard .g     { font-size: 14px; font-weight: 600; }
.hcard .act   { font-size: 12px; color: var(--accent); margin-top: 3px; }
.hcard .pinchbar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.10); margin-top: 8px; overflow: hidden; }
.hcard .pinchbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0%; }
.hcard[data-slot="0"] { border-color: rgba(111,140,255,.42); }
.hcard[data-slot="1"] { border-color: rgba(201,107,255,.42); }

/* ───────────────────────── camera pip ───────────────────────── */
.pip {
  position: fixed; z-index: 6; left: 18px; bottom: 18px;
  width: 220px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow); background: #000;
}
.pip canvas { display: block; width: 100%; height: auto; }
.pip-label {
  position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #9fb0e0;
  background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

/* ───────────────────────── panels ───────────────────────── */
.panel {
  position: fixed; z-index: 8; top: 68px; right: 14px; bottom: 14px; width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: 20px;
  backdrop-filter: blur(22px); box-shadow: var(--shadow);
  animation: slide .26s cubic-bezier(.2,.8,.25,1);
}
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
.panel.settings { width: 420px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.icon {
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 13px; line-height: 1;
}
.icon:hover { background: var(--glass-hi); }

.scrollarea { overflow-y: auto; padding: 4px 16px 20px; }
.scrollarea section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.scrollarea section:last-child { border-bottom: 0; }
.scrollarea h2 { font-size: 13px; margin: 0 0 4px; letter-spacing: .04em; }
.muted { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.muted.small { font-size: 12px; }

/* editor */
.editor { padding-bottom: 14px; }
.f-title, .f-body, .f-tag {
  font: inherit; color: var(--ink); background: rgba(255,255,255,.05);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; width: 100%;
}
.f-title { margin: 14px 16px 0; width: calc(100% - 32px); font-size: 17px; font-weight: 640; }
.f-body  { margin: 10px 16px 0; width: calc(100% - 32px); flex: 1; min-height: 160px; resize: none; line-height: 1.6; }
.f-title:focus, .f-body:focus, .f-tag:focus { outline: none; border-color: var(--accent); background: rgba(111,140,255,.10); }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 16px 0; }
.row.end { justify-content: space-between; }
.f-tag { flex: 1; }
.swatches { display: flex; gap: 8px; margin: 12px 16px 0; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; transform: scale(1.12); }
.saved { font-size: 12px; color: var(--good); min-height: 16px; }

button.ghost, button.danger, button.primary {
  font: inherit; font-size: 13px; border-radius: 10px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink);
}
button.ghost:hover { background: var(--glass-hi); }
button.ghost.on { border-color: #ffd166; color: #ffd166; }
button.wide { width: 100%; margin-top: 8px; }
button.danger { border-color: rgba(255,107,107,.4); color: #ff9a9a; }
button.danger:hover { background: rgba(255,107,107,.14); }
button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0;
  padding: 12px 26px; font-size: 15px; font-weight: 600; box-shadow: 0 10px 34px rgba(111,140,255,.35);
}
button.primary:hover { filter: brightness(1.08); }

/* bindings */
.bindings { display: flex; flex-direction: column; gap: 8px; }
.bind {
  display: grid; grid-template-columns: 30px 1fr 150px; gap: 10px; align-items: center;
  padding: 7px 9px; border-radius: 12px; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.bind.live { background: rgba(111,140,255,.14); border-color: rgba(111,140,255,.5); }
.bind .glyph { font-size: 20px; text-align: center; }
.bind .name  { font-size: 13px; font-weight: 560; }
.bind .hint  { font-size: 11px; color: var(--muted); }
select {
  font: inherit; font-size: 12.5px; color: var(--ink); background: rgba(255,255,255,.06);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; width: 100%; cursor: pointer;
}
select:focus { outline: none; border-color: var(--accent); }
option { background: #141830; }

/* sliders */
.sliders { display: flex; flex-direction: column; gap: 12px; }
.slider label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.slider label b { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.slider .sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
input[type=range] { width: 100%; accent-color: var(--accent); height: 18px; }
.toggle { display: flex; align-items: center; gap: 9px; font-size: 13px; margin-top: 11px; cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

.meter { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.meter > div { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; position: relative; }
.meter > div::after {
  content: ''; position: absolute; inset: 0 auto 0 0;
  width: var(--w, 0%); background: linear-gradient(90deg, var(--good), var(--accent)); border-radius: 999px;
}
.meter span { font-size: 12px; color: var(--muted); width: 46px; text-align: right; font-variant-numeric: tabular-nums; }

/* ───────────────────────── modals ───────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center;
  background: rgba(4,5,14,.72); backdrop-filter: blur(9px); padding: 24px;
}
.modal-card {
  width: min(620px, 100%); max-height: 86vh; overflow: auto;
  background: var(--glass); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 0 0 20px;
  animation: pop .3s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-card.center { text-align: center; padding: 40px 34px 34px; }
.modal-card.center h2 { margin: 14px 0 8px; font-size: 24px; }
.modal-card.center p  { color: var(--muted); margin: 0 auto 16px; max-width: 46ch; }
.modal-card.center button { margin: 6px 5px 0; }
.splash-mark { font-size: 56px; filter: drop-shadow(0 0 28px rgba(111,140,255,.6)); }
.err { color: var(--bad) !important; font-size: 13px; margin-top: 14px !important; }

.guide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px; }
.guide .g {
  display: flex; gap: 11px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px; background: rgba(255,255,255,.03);
}
.guide .g .glyph { font-size: 24px; line-height: 1.1; }
.guide .g b { display: block; font-size: 13px; }
.guide .g span { font-size: 12px; color: var(--muted); }
.modal-card > .muted { padding: 0 20px; }

/* ───────────────────────── toast ───────────────────────── */
.toast {
  position: fixed; z-index: 30; top: 76px; left: 50%; transform: translateX(-50%);
  background: var(--glass-hi); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 20px; font-size: 13.5px; box-shadow: var(--shadow); backdrop-filter: blur(16px);
  animation: pop .2s ease-out;
}

@media (max-width: 820px) {
  .panel, .panel.settings { width: auto; left: 12px; right: 12px; top: 62px; }
  .pip { width: 140px; }
  .guide { grid-template-columns: 1fr; }
  .brand p { display: none; }
  .chip { padding: 7px 10px; font-size: 12px; }
}
