:root {
  --text: #1d1d1f;
  --muted: #86868b;
  --border: rgba(20, 30, 60, 0.08);
  --accent: #0a7cff;
  --danger: #e0342e;
  --ok: #2fa864;
  --warn: #c77d00;
  --card: #ffffff;
  --hover: rgba(20, 30, 60, 0.05);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, 0.05), 0 4px 14px rgba(20, 30, 60, 0.05);
  --shadow-lg: 0 8px 30px rgba(20, 30, 60, 0.12);
  --ease: cubic-bezier(0.22, 0.8, 0.26, 0.99);
  --spring: cubic-bezier(0.34, 1.4, 0.44, 1);
}
* { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  font: 15px/1.5 "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 15% -5%, rgba(180, 200, 255, 0.55), transparent 60%),
    radial-gradient(800px 500px at 95% 10%, rgba(230, 190, 230, 0.4), transparent 60%),
    radial-gradient(700px 600px at 60% 110%, rgba(170, 215, 240, 0.5), transparent 60%),
    linear-gradient(165deg, #dde5f2 0%, #e7ebf4 45%, #d8e2ee 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
.layout { display: flex; gap: 18px; padding: 18px; min-height: 100vh; min-height: 100dvh; }

/* snappier touch: no double-tap zoom delay, no gray tap flash */
button, a, input, select, textarea, label { touch-action: manipulation; }
body { -webkit-tap-highlight-color: transparent; }

/* film-grain overlay — breaks digital flatness, fixed + non-interactive */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(10, 124, 255, 0.2); }

/* ---------- entry animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}
.sidebar, .capture-bar, .panel { animation: panelIn 0.5s var(--ease) backwards; }
.capture-bar { animation-delay: 0.05s; }
.panel { animation-delay: 0.1s; }

/* staggered content entry — only when switching views (.view-enter set by app.js) */
#view.view-enter > * { animation: fadeUp 0.4s var(--ease) backwards; }
#view.view-enter > *:nth-child(1) { animation-delay: 0.02s; }
#view.view-enter > *:nth-child(2) { animation-delay: 0.05s; }
#view.view-enter > *:nth-child(3) { animation-delay: 0.08s; }
#view.view-enter > *:nth-child(4) { animation-delay: 0.11s; }
#view.view-enter > *:nth-child(5) { animation-delay: 0.14s; }
#view.view-enter > *:nth-child(6) { animation-delay: 0.17s; }
#view.view-enter > *:nth-child(7) { animation-delay: 0.2s; }
#view.view-enter > *:nth-child(8) { animation-delay: 0.23s; }
#view.view-enter > *:nth-child(9) { animation-delay: 0.26s; }
#view.view-enter > *:nth-child(10) { animation-delay: 0.29s; }
#view.view-enter > *:nth-child(n+11) { animation-delay: 0.32s; }

/* ---------- floating sidebar ---------- */
.sidebar {
  width: 208px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 16px 10px 12px;
  display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 18px;
  height: calc(100vh - 36px);
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 14.5px;
  padding: 2px 8px 16px;
}
.brand-badge {
  width: 26px; height: 26px; flex-shrink: 0;
  background: rgba(20, 30, 60, 0.06);
  font-size: 14px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-spacer { flex: 1; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  text-align: left; background: none; border: none;
  color: #3a3a3c; font-size: 14px; font-family: inherit;
  padding: 7px 10px; border-radius: 10px; cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav-btn svg {
  width: 17px; height: 17px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
  color: #6e6e73;
  transition: color 0.18s var(--ease), transform 0.25s var(--spring);
}
.nav-btn:hover { background: var(--hover); }
.nav-btn:hover svg { transform: translateY(-1px); }
.nav-btn:active { transform: scale(0.97); }
.nav-btn.active { background: rgba(20, 30, 60, 0.08); font-weight: 600; }
.nav-btn.active svg { color: var(--accent); }
.badge {
  background: var(--accent); color: #fff; border-radius: 10px;
  font-size: 11px; font-weight: 600; padding: 1px 7px; margin-left: auto;
  animation: fadeUp 0.3s var(--ease);
}
.badge:empty { display: none; }

/* ---------- main column ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

.capture-bar {
  display: flex; gap: 10px; align-items: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 6px 8px 6px 16px;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.capture-bar:focus-within {
  border-color: rgba(10, 124, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(10, 124, 255, 0.12), var(--shadow-lg);
  transform: translateY(-1px);
}
.capture-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
  transition: stroke 0.2s, transform 0.3s var(--spring);
}
.capture-bar:focus-within .capture-icon { stroke: var(--accent); transform: rotate(90deg); }
.capture-bar input {
  flex: 1; background: none; border: none; color: var(--text);
  padding: 9px 2px; font-size: 15px; font-family: inherit; outline: none;
}
.capture-bar input::placeholder { color: var(--muted); }
#micBtn {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  width: 38px; height: 38px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.06);
  transition: transform 0.2s var(--spring), background 0.2s, box-shadow 0.2s;
}
#micBtn:hover { transform: scale(1.06); box-shadow: 0 3px 10px rgba(20, 30, 60, 0.12); }
#micBtn:active { transform: scale(0.92); }
#micBtn svg {
  width: 17px; height: 17px; fill: none; stroke: #3a3a3c;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 52, 46, 0.45); }
  60% { box-shadow: 0 0 0 9px rgba(224, 52, 46, 0); }
}
#micBtn.recording { background: var(--danger); border-color: var(--danger); animation: micPulse 1.4s ease-out infinite; }
#micBtn.recording svg { stroke: #fff; }
#captureStatus { color: var(--muted); font-size: 13px; padding-right: 8px; white-space: nowrap; animation: fadeUp 0.25s var(--ease); }
#captureStatus:empty { display: none; }

.panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 28px 32px 44px;
  flex: 1;
}

h1 { font-size: 27px; font-weight: 800; letter-spacing: -0.6px; margin: 0 0 2px; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; margin: 30px 0 10px; }
.eyebrow {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); background: rgba(20, 30, 60, 0.05);
  padding: 3px 11px; border-radius: 999px; margin: 0 0 12px;
}
.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: rgba(20, 30, 60, 0.06); border-radius: 5px;
  padding: 1px 5px; font-size: 13px;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 12px 16px; margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease),
              opacity 0.25s var(--ease), background 0.25s var(--ease);
}
.card:hover { box-shadow: 0 4px 16px rgba(20, 30, 60, 0.1); transform: translateY(-1.5px); }
.card .grow { flex: 1; min-width: 0; }
.card .title { font-weight: 500; overflow-wrap: break-word; transition: color 0.25s var(--ease); }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.done { background: rgba(255, 255, 255, 0.5); box-shadow: none; }
.card.done .title { text-decoration: line-through; color: var(--muted); }
.card.removing { opacity: 0; transform: scale(0.97) translateY(-2px); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.pill {
  display: inline-block; font-size: 12px; font-weight: 500;
  padding: 1px 9px; border-radius: 20px;
  background: rgba(20, 30, 60, 0.05);
  color: #5a5a5e; margin-right: 6px;
}
.pill.overdue { background: rgba(224, 52, 46, 0.1); color: var(--danger); }
.pill.today { background: rgba(199, 125, 0, 0.12); color: var(--warn); }

button.small {
  background: rgba(20, 30, 60, 0.05); border: none; color: #3a3a3c;
  border-radius: 999px; padding: 5px 13px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: background 0.18s var(--ease), transform 0.18s var(--spring), box-shadow 0.18s var(--ease);
}
button.small:hover { background: rgba(20, 30, 60, 0.1); transform: translateY(-1px); }
button.small:active { transform: scale(0.94); }
button.small.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(10, 124, 255, 0.35); }
button.small.primary:hover { background: #0068df; box-shadow: 0 3px 10px rgba(10, 124, 255, 0.35); }
button.small.danger:hover { background: rgba(224, 52, 46, 0.12); color: var(--danger); }

input[type="checkbox"] {
  width: 18px; height: 18px; margin-top: 2px;
  accent-color: var(--accent); cursor: pointer;
  transition: transform 0.2s var(--spring);
}
input[type="checkbox"]:hover { transform: scale(1.12); }
input[type="checkbox"]:active { transform: scale(0.85); }

/* ---------- forms ---------- */
.form-row { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: flex-start; }
.form-row input, .form-row select, .form-row textarea {
  background: #fff; border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
  outline: none; box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 124, 255, 0.15);
}
.form-row input.wide, .form-row textarea.wide { flex: 1; min-width: 200px; }
.form-row button.small { padding: 9px 16px; }

.empty {
  color: var(--muted); padding: 30px 16px; text-align: center; font-size: 14px;
  border: 1.5px dashed rgba(20, 30, 60, 0.13); border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
}

/* ---------- inline edit ---------- */
.edit-form {
  flex-direction: column; align-items: stretch; gap: 12px;
  border-color: rgba(10, 124, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(10, 124, 255, 0.12), var(--shadow-lg);
}
.edit-form .edit-fields { margin-bottom: 0; }
.edit-form .edit-fields input, .edit-form .edit-fields select, .edit-form .edit-fields textarea {
  background: #fff; border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
  outline: none; box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.edit-form .edit-fields input:focus, .edit-form .edit-fields select:focus, .edit-form .edit-fields textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10, 124, 255, 0.15);
}
.edit-form .edit-fields input.wide, .edit-form .edit-fields textarea.wide { flex: 1; min-width: 200px; }
.edit-actions { display: flex; gap: 8px; }

/* ---------- stat tiles ---------- */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px 20px; min-width: 118px;
  transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat .n { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ---------- gamification ---------- */
.game-strip {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 14px 18px; margin-top: 14px;
}
.game-strip .grow { flex: 1; min-width: 0; }
.lvl-badge {
  width: 44px; height: 44px; flex-shrink: 0;
  background: linear-gradient(145deg, #0a7cff, #0057c2);
  color: #fff; font-size: 19px; font-weight: 800;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(10, 124, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-variant-numeric: tabular-nums;
}
.game-title { font-size: 14px; }
.game-meta { font-size: 12px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.xp-bar {
  height: 7px; border-radius: 99px; margin-top: 5px;
  background: rgba(20, 30, 60, 0.07); overflow: hidden;
}
.xp-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #0a7cff, #38b6ff);
  transition: width 0.8s var(--ease);
}
.today-goal { position: relative; flex-shrink: 0; width: 52px; height: 52px; }
.ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-variant-numeric: tabular-nums;
}
.ring-label b { font-size: 13px; }
.ring-label span { color: var(--muted); }
.streak-chip {
  flex-shrink: 0; font-size: 14px; font-weight: 700;
  background: rgba(20, 30, 60, 0.05); color: var(--muted);
  border-radius: 999px; padding: 7px 14px;
  font-variant-numeric: tabular-nums;
  filter: grayscale(1); opacity: 0.7;
}
.streak-chip.lit {
  filter: none; opacity: 1;
  background: rgba(255, 149, 0, 0.12); color: #c25e00;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 16px) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.xp-toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.92); color: #fff;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(20, 30, 60, 0.3);
  z-index: 200; pointer-events: none;
  animation: toastIn 0.35s var(--spring);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.xp-toast.leaving { opacity: 0; transform: translate(-50%, 10px); }

.levelup {
  position: fixed; inset: 0; z-index: 210; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.levelup-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  font-size: 18px; font-weight: 800; letter-spacing: -0.3px;
  padding: 18px 30px; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(20, 30, 60, 0.25);
  animation: toastIn 0.45s var(--spring);
}
@keyframes confettiFly {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(1.15) rotate(24deg); }
}
.confetti {
  position: absolute; font-size: 20px;
  animation: confettiFly 1.5s var(--ease) forwards;
}

/* ---------- integrations ---------- */
.oura-strip {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 12px 18px; margin-top: 12px;
}
.oura-strip .o-emoji { font-size: 22px; }
.oura-strip .o-meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.oura-strip .o-meta b { color: var(--text); }
.oura-ring { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.oura-ring .ring-wrap { position: relative; width: 46px; height: 46px; }
.oura-ring .ring-label { font-size: 12px; font-weight: 700; }
.oura-ring .o-label {
  font-size: 10px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em;
}

/* ---------- trend charts ---------- */
.chart-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 30, 60, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 14px 16px 8px; margin-bottom: 10px;
  position: relative;
}
.chart-card h3 { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.chart-card .legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.chart-card .legend .dot { width: 8px; height: 8px; margin-right: 5px; }
.chart-card svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-band { fill: transparent; outline: none; }
.chart-band:focus-visible { fill: rgba(10, 124, 255, 0.06); }
.xhair { stroke: rgba(20, 30, 60, 0.22); stroke-width: 1; pointer-events: none; }
.chart-bar { transition: opacity 0.15s var(--ease); }
.chart-bar.lift { opacity: 0.72; }
.hm-cell { outline: none; transition: opacity 0.15s var(--ease); }
.hm-cell:hover { opacity: 0.75; }
.hm-cell:focus-visible { stroke: var(--accent); stroke-width: 1.5; }
.chart-tip {
  position: absolute; top: 0; left: 0;
  transform: translate(-50%, -100%);
  background: rgba(29, 29, 31, 0.92); color: #fff;
  font-size: 12px; line-height: 1.45;
  padding: 7px 11px; border-radius: 9px;
  box-shadow: 0 6px 20px rgba(20, 30, 60, 0.25);
  pointer-events: none; white-space: nowrap; z-index: 5;
  opacity: 0; transition: opacity 0.15s var(--ease);
}
.chart-tip.show { opacity: 1; }
.chart-tip .t-date { color: rgba(255, 255, 255, 0.65); font-size: 10.5px; margin-bottom: 2px; }
.chart-tip .t-row { display: flex; align-items: center; gap: 6px; }
.chart-tip .t-row span { color: rgba(255, 255, 255, 0.75); }
.chart-tip .t-key { width: 10px; height: 2px; border-radius: 1px; display: inline-block; flex-shrink: 0; }
.chart-tip b { font-variant-numeric: tabular-nums; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kanban .col {
  background: rgba(20, 30, 60, 0.035);
  border-radius: 14px; padding: 12px;
}
.kanban .col h3 {
  font-size: 12.5px; color: var(--muted); font-weight: 600;
  text-transform: capitalize; letter-spacing: 0.1px; margin: 0 0 10px 4px;
}
.kanban .card { flex-direction: column; gap: 6px; }

/* ---------- tablet: icon-only sidebar rail ---------- */
@media (min-width: 801px) and (max-width: 1080px) {
  .sidebar { width: 64px; padding: 14px 8px 10px; align-items: center; }
  .brand { padding-bottom: 14px; }
  .brand-badge + * { display: none; }
  .brand { font-size: 0; gap: 0; }
  .nav-btn { font-size: 0; gap: 0; justify-content: center; padding: 10px; position: relative; width: 44px; }
  .nav-btn svg { width: 19px; height: 19px; }
  .badge { position: absolute; top: 2px; right: 2px; margin: 0; font-size: 9px; padding: 0 5px; }
}

@media (max-width: 800px) {
  .layout {
    flex-direction: column;
    padding: 10px 10px calc(86px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  /* sidebar becomes a floating bottom tab bar */
  .sidebar {
    position: fixed; left: 10px; right: 10px; top: auto;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto; height: 66px; z-index: 100;
    flex-direction: row; align-items: stretch; gap: 0;
    padding: 6px; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand, .sidebar-spacer { display: none; }
  .nav-btn {
    flex-direction: column; justify-content: center; gap: 3px;
    font-size: 9.5px; font-weight: 500; padding: 4px 11px;
    flex-shrink: 0; position: relative;
  }
  .nav-btn svg { width: 20px; height: 20px; }
  .badge {
    position: absolute; top: 4px; right: 4px; margin: 0;
    font-size: 9px; padding: 0 5px;
  }

  /* capture stays reachable at the top */
  .capture-bar { position: sticky; top: 8px; z-index: 90; }

  .panel { padding: 18px 14px 30px; border-radius: 16px; }
  h1 { font-size: 23px; }

  /* stats scroll horizontally instead of wrapping */
  .stat-row {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -14px; margin-right: -14px; padding: 2px 14px 6px;
  }
  .stat-row::-webkit-scrollbar { display: none; }
  .stat { min-width: 106px; flex-shrink: 0; padding: 12px 16px; }

  .game-strip { flex-wrap: wrap; gap: 12px; }
  .game-strip .grow { min-width: 100%; order: 3; }

  /* comfortable touch targets */
  button.small { padding: 9px 15px; font-size: 13.5px; }
  input[type="checkbox"] { width: 22px; height: 22px; }
  .card { padding: 13px 14px; }
  .form-row input, .form-row select, .form-row textarea { padding: 10px 12px; font-size: 16px; }

  /* forms: tidy 2-column grid instead of ragged wrapping */
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .form-row input, .form-row select, .form-row textarea { width: 100%; min-width: 0; }
  .form-row input.wide, .form-row textarea.wide, .form-row label { grid-column: 1 / -1; }
  .form-row button.small { grid-column: 1 / -1; justify-self: start; padding: 10px 22px; }

  /* glass blur is GPU-heavy on phones: soften it */
  .sidebar, .capture-bar, .panel {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .kanban { grid-template-columns: 1fr; }
  .xp-toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
