/* ═══════════════════════════════════════════════
   RallyNote Pro — app.css
   Optimized: tablet (landscape+portrait) + mobile
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800;900&family=Barlow:wght@300;400;500;600&family=Share+Tech+Mono&display=swap');

/* ── TOKENS ── */
:root {
  --bg:       #0a0b0d;
  --s1:       #111318;
  --s2:       #191c23;
  --s3:       #21252f;
  --s4:       #2a2f3a;
  --border:   #2a2f3a;
  --acc:      #f5a623;
  --acc2:     #e8341a;
  --green:    #2ecc71;
  --blue:     #3b9ede;
  --violet:   #a78bfa;
  --teal:     #4ecdc4;
  --text:     #e8eaf0;
  --dim:      #7a8090;
  --muted:    #454b5a;
  --danger:   #e8341a;

  --topbar-h:   52px;
  --bottom-nav: 60px;
  --sidebar-w:  264px;
  --right-w:    272px;
  --font-cond:  'Barlow Condensed', sans-serif;
  --font-body:  'Barlow', sans-serif;
  --font-mono:  'Share Tech Mono', monospace;

  /* safe areas for iOS notch */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg); color: var(--text);
  height: 100dvh;
  overflow: hidden;
  display: flex; flex-direction: column;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
  padding-top: var(--sat);
  padding-left: var(--sal);
  padding-right: var(--sar);
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--s4); border-radius: 4px; }

/* ── SPLASH ── */
#splash {
  position: fixed; inset: 0; z-index: 999;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  animation: splashOut .4s ease .8s forwards;
}
@keyframes splashOut { to { opacity: 0; pointer-events: none; } }
.splash-logo {
  font-family: var(--font-cond); font-weight: 900; font-size: 48px;
  letter-spacing: 3px; color: var(--acc); text-transform: uppercase;
}
.splash-logo span { color: var(--acc2); }
.splash-sub { font-family: var(--font-cond); font-size: 13px; letter-spacing: 5px; color: var(--dim); }
.splash-ver { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 12px; }

/* ── TOPBAR ── */
#topbar {
  height: var(--topbar-h);
  background: var(--s1);
  border-bottom: 2px solid var(--acc);
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  flex-shrink: 0; z-index: 50; position: relative;
}
.tb-icon-btn {
  background: var(--s2); border: 1px solid var(--border);
  color: var(--dim); width: 36px; height: 36px;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tb-icon-btn:hover, .tb-icon-btn:active { background: var(--s3); color: var(--text); border-color: var(--acc); }
.logo {
  font-family: var(--font-cond); font-weight: 900; font-size: 20px;
  letter-spacing: 2px; color: var(--acc); text-transform: uppercase; white-space: nowrap;
}
.logo span { color: var(--acc2); }
.logo em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--dim); margin-left: 4px; }
.stage-pill {
  background: var(--acc2); color: #fff;
  font-family: var(--font-cond); font-weight: 700; font-size: 12px;
  letter-spacing: 1px; padding: 3px 10px; border-radius: 3px;
  text-transform: uppercase; white-space: nowrap; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis;
}
.spacer { flex: 1; }
.odo-pill {
  display: flex; align-items: center; gap: 5px;
  background: var(--s2); border: 1px solid var(--teal);
  color: var(--teal); font-family: var(--font-mono); font-size: 13px;
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
  transition: background .15s;
}
.odo-pill:hover { background: #0d2020; }
#top-clock {
  font-family: var(--font-mono); font-size: 17px; color: var(--acc); white-space: nowrap;
}

/* ── SIDEBAR ── */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; z-index: 59;
  background: #00000077;
}
#sidebar-overlay.open { display: block; }
#sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); z-index: 60;
  background: var(--s1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .25s ease;
  padding-top: calc(var(--topbar-h) + var(--sat));
  padding-bottom: var(--sab);
}
#sidebar.open { transform: translateX(0); }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--s2); border-bottom: 1px solid var(--border);
  font-family: var(--font-cond); font-size: 12px; letter-spacing: 2px;
  color: var(--dim); text-transform: uppercase; flex-shrink: 0;
}
.sidebar-add-btn {
  background: var(--acc); color: #000; border: none;
  width: 26px; height: 26px; border-radius: 4px;
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
#stage-list { flex: 1; overflow-y: auto; }
.stage-item {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s; border-left: 3px solid transparent;
}
.stage-item:hover { background: var(--s2); }
.stage-item.active { background: #1a1500; border-left-color: var(--acc); }
.stage-item .si-name {
  font-family: var(--font-cond); font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stage-item.active .si-name { color: var(--acc); }
.stage-item .si-meta { font-size: 11px; color: var(--dim); display: flex; gap: 8px; margin-top: 2px; }
.stage-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; font-family: var(--font-cond); letter-spacing: 1px; text-transform: uppercase; }
.sidebar-footer { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.sf-btn {
  background: var(--s2); border: 1px solid var(--border); color: var(--dim);
  padding: 8px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 13px; letter-spacing: 1px;
  text-transform: uppercase; transition: all .12s;
}
.sf-btn:hover { color: var(--text); border-color: var(--acc); }
.sf-btn.danger { color: var(--danger); border-color: var(--danger)44; }
.sf-btn.danger:hover { background: #2a0a08; }

/* ── APP WRAPPER ── */
#app-wrapper {
  flex: 1; display: flex; overflow: hidden;
  padding-bottom: var(--bottom-nav);
}

/* ── NOTES COLUMN ── */
#notes-col {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  min-width: 0;
}

/* ── EDITOR TOOLBAR ── */
#editor-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 10px;
  background: var(--s1); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.et-group { display: flex; align-items: center; gap: 4px; padding-right: 8px; border-right: 1px solid var(--border); }
.et-group:last-of-type { border-right: none; }
.et-right { margin-left: auto; }
.et-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--s2); border: 1px solid var(--border);
  color: var(--dim); padding: 5px 10px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 13px; letter-spacing: .5px;
  transition: all .12s; text-transform: uppercase;
}
.et-btn:hover, .et-btn.active { background: var(--s3); color: var(--text); border-color: var(--acc); }
.et-btn.active { color: var(--acc); }
.et-btn.voice-on { color: var(--acc2); border-color: var(--acc2); animation: recpulse 1s infinite; }
@keyframes recpulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.et-select {
  background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 5px 8px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 13px; cursor: pointer;
}
.et-select:focus { outline: none; border-color: var(--acc); }
.note-count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ── VOICE STRIP ── */
#voice-strip {
  display: none; align-items: center; gap: 10px;
  padding: 7px 12px; background: #1a0808;
  border-bottom: 1px solid var(--acc2); flex-shrink: 0;
  font-family: var(--font-cond); font-size: 13px; letter-spacing: 1px; color: var(--acc2);
}
#voice-strip.active { display: flex; }
.vs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acc2); animation: recpulse .6s infinite; flex-shrink: 0; }
.vs-stop {
  margin-left: auto; background: var(--acc2); border: none; color: #fff;
  padding: 4px 12px; border-radius: 3px; font-family: var(--font-cond);
  font-size: 12px; letter-spacing: 1px; cursor: pointer;
}

/* ── NOTES AREA ── */
#notes-area {
  flex: 1; overflow-y: auto; padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  -webkit-overflow-scrolling: touch;
}
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 160px; gap: 10px;
  color: var(--muted); text-align: center;
}
.empty-state svg { opacity: .2; }
.empty-state p { font-family: var(--font-cond); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; }

/* NOTE CARD */
.note-card {
  background: var(--s1); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  transition: border-color .15s;
}
.note-card:hover { border-color: var(--s4); }
.nc-header {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--s2); cursor: pointer; user-select: none;
  -webkit-user-select: none;
}
.nc-km {
  font-family: var(--font-mono); font-size: 12px; color: var(--teal);
  background: #0d2020; border: 1px solid var(--teal)55;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
}
.nc-badge {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: .5px; padding: 2px 7px; border-radius: 3px;
  text-transform: uppercase; flex-shrink: 0;
}
.nc-badge.curva    { background:#0d1a2a; color:var(--blue);   border:1px solid var(--blue)33;   }
.nc-badge.peligro  { background:#2a0a08; color:var(--acc2);   border:1px solid var(--acc2)33;   }
.nc-badge.nota     { background:#1a1500; color:var(--acc);    border:1px solid var(--acc)33;    }
.nc-badge.waypoint { background:#0d2010; color:var(--green);  border:1px solid var(--green)33;  }
.nc-badge.info     { background:#1a1520; color:var(--violet); border:1px solid var(--violet)33; }
.nc-text {
  flex: 1; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.nc-icons { display: flex; gap: 4px; flex-shrink: 0; }
.nc-icon {
  width: 26px; height: 26px; border-radius: 4px;
  background: var(--s3); border: 1px solid var(--border);
  color: var(--dim); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.nc-icon:hover { color: var(--acc); border-color: var(--acc); }
.nc-icon.hand { color: var(--teal); border-color: var(--teal)44; }
.nc-chevron { color: var(--muted); font-size: 11px; flex-shrink: 0; transition: transform .2s; }
.nc-chevron.open { transform: rotate(180deg); }

/* NOTE BODY (expanded) */
.nc-body { display: none; }
.nc-body.open { display: block; }
.nc-preview-text { padding: 10px 12px; font-size: 15px; font-family: var(--font-cond); line-height: 1.5; }
.nc-canvas-wrap { background: #0e1016; border-top: 1px solid var(--border); position: relative; }
.nc-canvas-img { width: 100%; display: block; max-height: 200px; object-fit: contain; }
.nc-edit-canvas {
  width: 100%; display: block; cursor: crosshair;
  touch-action: none; -webkit-touch-action: none;
  background: #0e1016;
}
.nc-draw-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 10px; background: var(--s2); border-top: 1px solid var(--border);
}
.nc-edit-area { padding: 8px 10px; background: var(--s2); border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.nc-edit-row { display: flex; gap: 6px; align-items: center; }
.nc-edit-input {
  flex: 1; background: var(--s3); border: 1px solid var(--border);
  color: var(--text); padding: 6px 9px; border-radius: 4px;
  font-family: var(--font-body); font-size: 14px; outline: none; resize: vertical;
}
.nc-edit-input:focus { border-color: var(--acc); }
.nc-km-edit {
  width: 80px; background: var(--s3); border: 1px solid var(--border);
  color: var(--teal); padding: 6px 8px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; outline: none;
}
.nc-km-edit:focus { border-color: var(--teal); }
.nc-actions { display: flex; gap: 6px; padding: 7px 10px; background: var(--s2); border-top: 1px solid var(--border); }
.na-btn {
  background: var(--s3); border: 1px solid var(--border);
  color: var(--dim); padding: 5px 12px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 12px; letter-spacing: .5px;
  text-transform: uppercase; transition: all .12s;
}
.na-btn:hover { color: var(--text); border-color: var(--acc); }
.na-btn.save { color: var(--green); border-color: var(--green)44; }
.na-btn.save:hover { background: #0d2010; }
.na-btn.del { color: var(--danger); border-color: var(--danger)44; }
.na-btn.del:hover { background: #2a0a08; }

/* ── ADD PANEL ── */
#add-panel {
  background: var(--s1); border-top: 2px solid var(--acc);
  flex-shrink: 0; padding: 10px;
}
.input-mode { display: none; }
.input-mode.active { display: block; }
.ap-row { display: flex; gap: 6px; align-items: flex-start; }
.nw-km {
  width: 80px; background: var(--s2); border: 1px solid var(--border);
  color: var(--teal); padding: 8px 8px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 13px; outline: none; flex-shrink: 0;
}
.nw-km:focus { border-color: var(--teal); }
.nw-type {
  background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 6px; border-radius: 4px;
  font-family: var(--font-cond); font-size: 13px; flex-shrink: 0;
}
.nw-text {
  flex: 1; min-width: 0; background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 9px; border-radius: 4px;
  font-family: var(--font-body); font-size: 14px; resize: none; outline: none;
}
.nw-text:focus { border-color: var(--acc); }
.add-btn {
  background: var(--acc); color: #000; border: none;
  padding: 8px 14px; border-radius: 4px;
  font-family: var(--font-cond); font-weight: 800; font-size: 18px;
  transition: background .12s; flex-shrink: 0;
}
.add-btn:hover, .add-btn:active { background: #ffc147; }
.quick-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.ql { font-family: var(--font-cond); font-size: 10px; letter-spacing: 1.5px; color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.quick-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.qb {
  background: var(--s2); border: 1px solid var(--border);
  color: var(--dim); padding: 3px 9px; border-radius: 3px;
  font-family: var(--font-cond); font-size: 12px; letter-spacing: .5px;
  text-transform: uppercase; transition: all .12s;
}
.qb:hover, .qb:active { border-color: var(--acc); color: var(--acc); background: #1a1500; }

/* ── HAND MODE ── */
.hand-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.hand-canvas {
  width: 100%; display: block;
  background: #0c0e12; border-radius: 4px;
  cursor: crosshair; touch-action: none; -webkit-touch-action: none;
  border: 1px solid var(--border);
}
#hand-canvas-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); pointer-events: none;
  font-family: var(--font-cond); font-size: 13px; letter-spacing: 1px;
}
#hand-canvas-placeholder p { text-transform: uppercase; }
.hand-canvas-wrap { position: relative; }
.draw-sz { accent-color: var(--acc); cursor: pointer; width: 70px; }
.draw-palette { display: flex; gap: 5px; align-items: center; }
.dp-color {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; transition: border-color .1s;
  flex-shrink: 0;
}
.dp-color.sel { border-color: #fff; transform: scale(1.15); }

/* ── RIGHT PANEL ── */
#right-panel {
  width: var(--right-w); flex-shrink: 0;
  background: var(--s1); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.rt-tabs { display: flex; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.rt-tab {
  flex: 1; padding: 11px 4px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  font-family: var(--font-cond); font-weight: 700; font-size: 12px;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted);
  cursor: pointer; transition: all .12s;
}
.rt-tab:hover { color: var(--text); }
.rt-tab.active { color: var(--acc); border-bottom-color: var(--acc); }
#rt-content { flex: 1; overflow-y: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
.rt-pane { display: none; }
.rt-pane.active { display: block; }
.rcard { background: var(--s2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
.rcard-label { font-family: var(--font-cond); font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* ODO */
.odo-big { font-family: var(--font-mono); font-size: 36px; color: var(--teal); line-height: 1; margin-bottom: 10px; }
.odo-big span { font-size: 16px; color: var(--dim); margin-left: 4px; }
.odo-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-bottom: 6px; }
.odo-btn {
  background: var(--s3); border: 1px solid var(--border); color: var(--text);
  padding: 7px 4px; border-radius: 4px;
  font-family: var(--font-cond); font-weight: 700; font-size: 13px;
  text-align: center; transition: all .12s;
}
.odo-btn:hover, .odo-btn:active { border-color: var(--teal); color: var(--teal); }
.odo-btn.pos { color: var(--teal); }
.odo-btn.pos:hover { background: #0d2020; }
.odo-row { display: flex; gap: 5px; margin-top: 5px; }
.odo-input {
  flex: 1; background: var(--s3); border: 1px solid var(--border);
  color: var(--teal); padding: 7px 8px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 14px; outline: none;
}
.odo-input:focus { border-color: var(--teal); }
.reset-btn { width: 100%; margin-top: 8px; color: var(--dim); font-size: 12px; }
.reset-btn:hover { color: var(--danger); border-color: var(--danger)44; }
.km-ref { font-family: var(--font-mono); font-size: 26px; color: var(--acc); }

/* TIMER */
.timer-disp {
  font-family: var(--font-mono); font-size: 38px; color: var(--acc);
  text-align: center; line-height: 1; margin-bottom: 2px;
}
.timer-disp span { font-size: 20px; color: var(--dim); }
.timer-state { font-family: var(--font-cond); font-size: 11px; letter-spacing: 2px; color: var(--muted); text-align: center; text-transform: uppercase; margin-bottom: 10px; }
.timer-btns { display: flex; gap: 6px; }
.tbtn {
  flex: 1; padding: 10px; border: none; border-radius: 4px;
  font-family: var(--font-cond); font-weight: 800; font-size: 18px;
  transition: all .12s;
}
.tbtn.start { background: var(--green); color: #000; }
.tbtn.stop  { background: var(--acc2);  color: #fff; }
.tbtn.reset { background: var(--s3); border: 1px solid var(--border); color: var(--dim); }
.tbtn.reset:hover { color: var(--text); }
.splits-card { margin-top: 10px; }
.split-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 8px; background: var(--s3); border: 1px solid var(--border);
  border-radius: 4px; margin-top: 4px;
  font-family: var(--font-mono); font-size: 13px;
}
.split-lbl { font-size: 10px; color: var(--muted); }
.split-val { color: var(--acc); }

/* STATS */
.stat-grid { display: flex; flex-direction: column; gap: 0; }
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-val { font-family: var(--font-mono); font-size: 15px; }
.stat-val.a { color: var(--acc); }
.stat-val.g { color: var(--green); }
.stat-val.r { color: var(--danger); }

/* ── BOTTOM NAV ── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav) + var(--sab));
  padding-bottom: var(--sab);
  background: var(--s1); border-top: 1px solid var(--border);
  display: flex; align-items: stretch; z-index: 40;
}
.bn-btn {
  flex: 1; background: transparent; border: none;
  color: var(--muted); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  font-family: var(--font-cond); font-size: 10px; letter-spacing: 1px;
  text-transform: uppercase; transition: color .12s; padding: 0;
}
.bn-btn:hover, .bn-btn.active { color: var(--acc); }
.bn-btn.active svg { stroke: var(--acc); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.75);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--s1); border: 1px solid var(--border);
  border-top: 3px solid var(--acc); border-radius: 8px;
  padding: 20px; width: 100%; max-width: 400px;
  max-height: 90dvh; overflow-y: auto;
}
.modal.wide { max-width: 700px; }
.modal-title { font-family: var(--font-cond); font-weight: 800; font-size: 18px; letter-spacing: 1px; text-transform: uppercase; color: var(--acc); margin-bottom: 14px; }
.ml { display: block; font-size: 11px; color: var(--dim); letter-spacing: 1.5px; text-transform: uppercase; margin: 10px 0 4px; }
.ml:first-of-type { margin-top: 0; }
.mi {
  width: 100%; background: var(--s2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; border-radius: 4px;
  font-family: var(--font-body); font-size: 14px; outline: none;
}
.mi:focus { border-color: var(--acc); }
.modal-btns { display: flex; gap: 8px; margin-top: 18px; }
.mbtn { flex: 1; padding: 10px; border-radius: 4px; border: none; font-family: var(--font-cond); font-weight: 700; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; transition: all .12s; }
.mbtn.ok { background: var(--acc); color: #000; }
.mbtn.ok:hover { background: #ffc147; }
.mbtn.cancel { background: var(--s3); color: var(--dim); }
.mbtn.cancel:hover { color: var(--text); }

/* Hand note modal */
.mhv-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mhv-canvas { width: 100%; border: 1px solid var(--border); border-radius: 4px; background: #0c0e12; cursor: crosshair; touch-action: none; -webkit-touch-action: none; display: block; }
.mhv-text-edit { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mhv-text-edit .mi { padding: 7px 9px; font-size: 13px; }

/* Export */
.export-pre { background: var(--s2); border: 1px solid var(--border); border-radius: 4px; padding: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; margin-bottom: 0; }

/* ── VOICE PANEL ─────────────────────────────── */
.voice-panel {
  display: flex; align-items: stretch; gap: 10px;
  padding: 10px;
}

/* Big mic toggle button */
.voice-mic-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-width: 100px; padding: 12px 10px;
  background: var(--s2); border: 2px solid var(--border);
  border-radius: 10px; color: var(--dim); cursor: pointer;
  transition: all .2s; flex-shrink: 0;
  position: relative; overflow: hidden;
}
.voice-mic-btn:hover { border-color: var(--acc); color: var(--acc); background: #1a1500; }
.voice-mic-btn.recording {
  background: #1a0808; border-color: var(--acc2); color: var(--acc2);
  animation: micPulse 1.4s ease-in-out infinite;
}
@keyframes micPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,52,26,.5); }
  50%      { box-shadow: 0 0 0 12px rgba(232,52,26,0); }
}
.mic-icon { display: flex; align-items: center; justify-content: center; }
.voice-mic-btn.recording .mic-icon svg { stroke: var(--acc2); }
.mic-label {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; text-align: center;
  line-height: 1.2;
}

/* Transcript area */
.voice-transcript-wrap {
  flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.vt-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.vt-label {
  font-family: var(--font-cond); font-size: 11px; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted);
}
.vt-label.listening { color: var(--acc2); }

/* Sound wave animation */
.vt-waves { display: flex; align-items: center; gap: 2px; height: 16px; }
.vt-waves span {
  display: block; width: 3px; border-radius: 2px;
  background: var(--muted); height: 4px;
  transition: background .2s;
}
.vt-waves.active span {
  background: var(--acc2);
  animation: wave 1s ease-in-out infinite;
}
.vt-waves.active span:nth-child(1) { animation-delay: 0s;    animation-duration: .9s; }
.vt-waves.active span:nth-child(2) { animation-delay: .15s;  animation-duration: .7s; }
.vt-waves.active span:nth-child(3) { animation-delay: .05s;  animation-duration: 1s;  }
.vt-waves.active span:nth-child(4) { animation-delay: .2s;   animation-duration: .8s; }
.vt-waves.active span:nth-child(5) { animation-delay: .1s;   animation-duration: .75s;}
@keyframes wave {
  0%,100% { height: 4px;  }
  50%      { height: 14px; }
}

.voice-transcript {
  flex: 1; background: var(--s2); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px;
  font-family: var(--font-body); font-size: 15px; color: var(--text);
  min-height: 48px; max-height: 90px; overflow-y: auto;
  line-height: 1.5; word-break: break-word;
  cursor: text; outline: none;
  -webkit-overflow-scrolling: touch;
}
.voice-transcript:focus { border-color: var(--acc); }
.vt-placeholder { color: var(--muted); font-size: 13px; font-style: italic; }
.voice-interim {
  font-family: var(--font-body); font-size: 13px;
  color: var(--dim); font-style: italic; min-height: 18px;
  padding: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Controls row */
.voice-controls {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  flex-direction: column; justify-content: flex-end;
}
.voice-clear-btn {
  background: var(--s3); border: 1px solid var(--border); color: var(--dim);
  padding: 6px 10px; border-radius: 4px; font-size: 14px; cursor: pointer;
  transition: all .12s; width: 100%;
}
.voice-clear-btn:hover { color: var(--danger); border-color: var(--danger)44; }

/* responsive voice panel */
@media (max-width: 599px) {
  .voice-panel { flex-direction: column; }
  .voice-mic-btn { flex-direction: row; min-width: unset; width: 100%; padding: 10px 14px; }
  .voice-controls { flex-direction: row; flex-wrap: wrap; }
  .voice-clear-btn { width: auto; flex: 1; }
}

/* ── RESPONSIVE ── */

/* Tablet portrait (< 900px): hide right panel, show via bottom nav */
@media (max-width: 899px) {
  #right-panel { display: none; }
  #right-panel.mobile-active { display: flex; position: fixed; inset: 0; top: var(--topbar-h); bottom: var(--bottom-nav); width: 100%; z-index: 30; }
  #notes-col.mobile-hidden { display: none; }
}

/* Landscape tablet (900px+): show both */
@media (min-width: 900px) {
  #bottom-nav .bn-btn[id="bn-odo"],
  #bottom-nav .bn-btn[id="bn-timer"],
  #bottom-nav .bn-btn[id="bn-stats"] { display: none; }
  #bottom-nav { justify-content: flex-start; padding-left: 12px; gap: 0; }
  #bottom-nav .bn-btn[id="bn-notes"] { max-width: 120px; }
  /* Keep bottom nav for notes toggle + stage access on tablet */
}

/* Large tablet / small laptop (1100px+) */
@media (min-width: 1100px) {
  #menu-toggle { display: none; }
  #sidebar {
    position: relative; top: auto; left: auto; bottom: auto;
    transform: none !important;
    width: var(--sidebar-w); flex-shrink: 0;
    padding-top: 0;
    border-top: none;
  }
  #sidebar-overlay { display: none !important; }
  #app-wrapper { flex-direction: row; }
}

/* Phone (< 600px) */
@media (max-width: 599px) {
  .logo em { display: none; }
  .stage-pill { display: none; }
  #top-clock { font-size: 14px; }
  .odo-pill span { display: inline; }
  .et-btn span { display: none; }
  .et-btn { padding: 5px 8px; }
  .ap-row { flex-wrap: wrap; }
  .nw-km { width: 70px; }
  .nw-type { flex: 1; }
  .nw-text { width: 100%; }
  #right-panel.mobile-active { width: 100%; }
}

/* Prevent canvas rubber-banding on iOS */
.hand-canvas, .nc-edit-canvas, .mhv-canvas {
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
