/* ============================================================================
   Game of Will - design system
   A dark HUD: deep near-black ground, one accent per attribute, numbers set in
   a tabular mono so progress reads like an instrument panel, not a webpage.
   ========================================================================== */

:root {
  --bg: #08080e;
  --bg-2: #0b0b13;
  --surface: #12121c;
  --surface-2: #181826;
  --surface-3: #1f1f30;
  --border: #262638;
  --border-bright: #35354d;

  --text: #ececf5;
  --text-2: #a5a5c0;
  --text-3: #6f6f8c;

  --accent: #6366f1;
  --accent-soft: #6366f133;
  --gold: #eab308;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;

  --str: #ef4444;
  --end: #f59e0b;
  --vit: #22c55e;
  --wlth: #14b8a6;
  --mind: #8b5cf6;
  --disc: #3b82f6;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, monospace;
  --sans: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;

  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
  --nav-w: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body, #root { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-bright); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.tiny { font-size: 11px; }
.small { font-size: 12.5px; }
.big { font-size: 22px; }
.huge { font-size: 34px; letter-spacing: -0.02em; }
.bold { font-weight: 650; }
.upper { text-transform: uppercase; letter-spacing: 0.09em; font-size: 10.5px; font-weight: 650; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

/* --------------------------------------------------------------- app shell */

.titlebar {
  height: 44px;
  -webkit-app-region: drag;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.titlebar .brand { font-weight: 700; letter-spacing: 0.02em; font-size: 13px; }
.titlebar .brand span { color: var(--accent); }
.titlebar .no-drag { -webkit-app-region: no-drag; }

.shell { display: flex; height: calc(100% - 44px); }

.nav {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r);
  color: var(--text-2); font-weight: 550; font-size: 13.5px;
  transition: background 0.12s, color 0.12s;
  text-align: left; width: 100%;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: #fff;
  border-radius: 20px; padding: 1px 7px; font-size: 10.5px; font-weight: 700;
}
.nav-item .badge.warn { background: var(--warn); color: #1a1a00; }
.nav-section { padding: 14px 12px 6px; color: var(--text-3); }

.main { flex: 1; overflow-y: auto; padding: 26px 30px 80px; }
.main-inner { max-width: 1180px; margin: 0 auto; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.page-head p { color: var(--text-2); margin-top: 4px; max-width: 76ch; }

/* -------------------------------------------------------------------- card */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
}
.card.tight { padding: 14px; }
.card.flat { background: var(--bg-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head .sub { color: var(--text-3); font-size: 12px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 1180px) {
  .g-main, .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ button */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--border-bright);
  color: var(--text); font-weight: 600; font-size: 13px;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #43436180; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #7477f5; border-color: #7477f5; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #201a00; }
.btn.danger { background: transparent; border-color: #7f1d1d; color: #fca5a5; }
.btn.danger:hover { background: #7f1d1d33; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.block { width: 100%; }

/* ------------------------------------------------------------------ inputs */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--text-3); }

.input, .select, .textarea {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.12s, background 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); background: var(--surface);
}
.input.mono { font-family: var(--mono); }
.textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
.select { appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input.narrow { width: 92px; }
.input.mid { width: 140px; }

.checkline { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* -------------------------------------------------------------- chip / pill */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--text-2);
  transition: all 0.12s;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: #c7c9ff; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: var(--border-bright); color: var(--text); }
.chip.good { background: #22c55e1f; border-color: #22c55e66; color: #86efac; }
.chip.warn { background: #f59e0b1f; border-color: #f59e0b66; color: #fcd34d; }
.chip.bad { background: #ef44441f; border-color: #ef444466; color: #fca5a5; }

/* ------------------------------------------------------------------- meter */

.meter { height: 7px; border-radius: 20px; background: var(--surface-3); overflow: hidden; position: relative; }
.meter > i { display: block; height: 100%; border-radius: 20px; transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
.meter.tall { height: 11px; }
.meter .pace-marker {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--text-2); opacity: 0.75; border-radius: 2px;
}

/* -------------------------------------------------------------- stat block */

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-3); font-weight: 650; }
.stat .value { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value.sm { font-size: 18px; }
.stat .delta { font-size: 11.5px; font-weight: 600; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); } .delta.flat { color: var(--text-3); }

/* ------------------------------------------------------------ attribute pod */

.attr-pod {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px; position: relative; overflow: hidden;
}
.attr-pod::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c);
}
.attr-pod .name { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); font-weight: 700; }
.attr-pod .lvl { font-family: var(--mono); font-size: 21px; font-weight: 650; color: var(--c); }

/* ------------------------------------------------------------------ habits */

.habit-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.13s; text-align: left; width: 100%;
}
.habit-row:hover { border-color: var(--border-bright); background: var(--surface-2); }
.habit-row.done { background: #22c55e12; border-color: #22c55e40; }
.habit-row.done .habit-label { color: var(--text-2); text-decoration: line-through; text-decoration-color: #22c55e70; }
.habit-row.negative.done { background: #8b5cf612; border-color: #8b5cf640; }
.habit-check {
  width: 21px; height: 21px; border-radius: 6px; flex-shrink: 0;
  border: 2px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.13s;
}
.habit-row.done .habit-check { background: var(--good); border-color: var(--good); color: #04180a; }
.habit-row.negative.done .habit-check { background: var(--mind); border-color: var(--mind); color: #fff; }
.habit-label { font-weight: 560; }

/* ------------------------------------------------------------------- table */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 700; padding: 7px 10px;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 9px 10px; border-bottom: 1px solid #1c1c2a; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #ffffff05; }
.table td.num, .table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------- modal */

.overlay {
  position: fixed; inset: 0; background: #04040acc; backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 32px; z-index: 200;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-bright);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  width: 100%; max-width: 620px; max-height: 86vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 900px; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 300; max-width: 380px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border-bright);
  border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow);
  animation: slideIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  border-left: 3px solid var(--accent);
}
.toast.level { border-left-color: var(--gold); }
.toast.achievement { border-left-color: #a855f7; }
.toast.pr { border-left-color: var(--good); }
.toast.error { border-left-color: var(--bad); }
.toast .t-title { font-weight: 700; font-size: 13.5px; }
.toast .t-body { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- briefing */

.briefing {
  background: linear-gradient(150deg, #1a1a2e 0%, var(--surface) 55%);
  border: 1px solid var(--border-bright); border-radius: var(--r-lg); padding: 22px;
  position: relative; overflow: hidden;
}
.briefing::before {
  content: ''; position: absolute; top: -60px; right: -60px; width: 200px; height: 200px;
  background: radial-gradient(circle, #6366f126, transparent 70%); pointer-events: none;
}
.briefing h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.order {
  display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid #ffffff0d;
}
.order .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; flex-shrink: 0; }
.order .o-text { font-weight: 580; }
.order .o-why { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------ achievements */

.ach {
  display: flex; gap: 12px; padding: 12px; border-radius: var(--r);
  background: var(--bg-2); border: 1px solid var(--border);
}
.ach.locked { opacity: 0.42; }
.ach .icon {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--tc);
  border: 1px solid var(--tc);
}
.ach.locked .icon { border-color: var(--border); color: var(--text-3); }

/* ---------------------------------------------------------------- onboarding */

.ob { height: 100%; display: flex; flex-direction: column; }
.ob-body { flex: 1; overflow-y: auto; padding: 40px 32px; }
.ob-inner { max-width: 720px; margin: 0 auto; }
.ob h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; margin-bottom: 8px; }
.ob .lede { color: var(--text-2); font-size: 15px; margin-bottom: 30px; max-width: 62ch; line-height: 1.6; }
.ob-foot {
  padding: 16px 32px; border-top: 1px solid var(--border); background: var(--bg-2);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.ob-steps { display: flex; gap: 5px; }
.ob-steps i { width: 26px; height: 3px; border-radius: 2px; background: var(--surface-3); transition: background 0.2s; }
.ob-steps i.on { background: var(--accent); }
.ob-steps i.done { background: #4f46e5aa; }

.pick {
  display: flex; gap: 12px; padding: 14px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--bg-2);
  cursor: pointer; transition: all 0.13s; text-align: left; width: 100%;
}
.pick:hover { border-color: var(--border-bright); background: var(--surface-2); }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick .p-title { font-weight: 650; }
.pick .p-desc { font-size: 12.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }

/* ----------------------------------------------------------------- welcome */

.welcome { height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px; }
.welcome-inner { width: 100%; max-width: 560px; }
.save-card {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-2);
  cursor: pointer; transition: all 0.13s; width: 100%; text-align: left;
}
.save-card:hover { border-color: var(--accent); background: var(--surface-2); }
.save-avatar {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent), #a855f7);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
}

/* ------------------------------------------------------------------ charts */

.recharts-cartesian-axis-tick text { fill: var(--text-3); font-size: 11px; font-family: var(--mono); }
.recharts-cartesian-grid line { stroke: #ffffff0a; }
.recharts-tooltip-wrapper { outline: none; }
.chart-tip {
  background: var(--surface-2); border: 1px solid var(--border-bright);
  border-radius: var(--r-sm); padding: 8px 11px; font-size: 12px; box-shadow: var(--shadow);
}
.chart-tip .k { color: var(--text-3); font-size: 11px; }

/* ------------------------------------------------------------------- misc */

.empty {
  padding: 34px 20px; text-align: center; color: var(--text-3);
  border: 1px dashed var(--border); border-radius: var(--r); background: #ffffff03;
}
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.scroll-y { overflow-y: auto; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px;
  border: 1px solid var(--border-bright); border-radius: 4px; background: var(--surface-2);
}

/* ============================================================================
   Self-hosted / mobile
   The desktop build owns its window chrome; the served build does not, and on
   a phone the 232px sidebar and two-column grids have to go.
   ========================================================================== */

/* No OS window controls to leave room for when served in a browser. */
html[data-mode="web"] .titlebar { -webkit-app-region: none; }
html[data-mode="web"] .titlebar .grow + span { margin-right: 0 !important; }

@media (max-width: 860px) {
  :root { --nav-w: 0px; }

  body { overflow: auto; }

  .titlebar {
    height: 52px;
    padding: 0 12px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 60;
    padding-top: env(safe-area-inset-top);
  }
  .titlebar .brand { font-size: 11.5px; }
  .titlebar .row.gap-16 { gap: 10px !important; margin-left: 0 !important; }
  .titlebar .row.gap-16 .dim:first-child,
  .titlebar .row.gap-16 .muted { display: none; }
  .titlebar .grow + span { margin-right: 0 !important; font-size: 10px; }

  .shell { display: block; height: auto; }

  /* Sidebar becomes a fixed bottom tab bar. */
  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: auto;
    height: auto;
    flex-direction: row;
    gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 70;
    -webkit-overflow-scrolling: touch;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav > div { flex: 0 0 auto; }
  .nav-section,
  .nav .grow,
  .nav > .tiny.dim { display: none; }

  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 7px 12px;
    font-size: 10px;
    font-weight: 600;
    min-width: 62px;
    text-align: center;
    box-shadow: none;
    border-radius: var(--r-sm);
  }
  .nav-item.active { box-shadow: none; background: var(--surface-2); color: var(--accent); }
  .nav-item .badge {
    margin-left: 0;
    position: absolute;
    transform: translate(16px, -6px);
    padding: 0 5px;
    font-size: 9px;
  }
  .nav-item { position: relative; }

  .main { padding: 16px 14px 96px; height: auto; overflow: visible; }
  .main-inner { max-width: none; }

  /* Everything goes single column. */
  .grid.g-main, .grid.g4, .grid.g3, .grid.g2 { grid-template-columns: minmax(0, 1fr); }
  .grid.g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { gap: 12px; }

  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 13px; }
  .huge { font-size: 27px; }
  .big { font-size: 19px; }

  .card { padding: 14px; border-radius: var(--r); }
  .card.tight { padding: 12px; }

  /* Full-height sheets read far better than floating boxes on a phone. */
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    max-width: none;
    max-height: 94vh;
    height: 94vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: none;
  }
  .modal-body { padding: 16px; }
  .modal-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .modal-foot .btn { flex: 1 1 auto; }

  .toasts { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); max-width: none; }

  /* Thumb-sized controls. */
  .input, .select, .textarea { padding: 11px 12px; font-size: 16px; } /* 16px stops iOS zooming on focus */
  .btn { padding: 10px 14px; }
  .btn.sm { padding: 8px 11px; }
  .habit-row { padding: 14px 13px; }
  .habit-check { width: 24px; height: 24px; }
  input[type="checkbox"], input[type="radio"] { width: 19px; height: 19px; }

  .input.narrow { width: 78px; }
  .input.mid { width: 118px; }

  .table th, .table td { padding: 8px 7px; font-size: 12.5px; }

  .ob-body { padding: 24px 16px 40px; }
  .ob h1 { font-size: 23px; }
  .ob .lede { font-size: 14px; margin-bottom: 22px; }
  .ob-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 10px; }
  .ob-steps i { width: 16px; }

  .welcome { padding: 24px 16px; }
  .briefing { padding: 16px; }
  .briefing h2 { font-size: 17px; }
}

/* Very narrow phones. */
@media (max-width: 400px) {
  .grid.g6 { grid-template-columns: minmax(0, 1fr); }
  .nav-item { min-width: 56px; padding: 7px 8px; }
  .titlebar .brand { display: none; }
}

/* Landscape phones: keep the tab bar out of the way of a short viewport. */
@media (max-height: 460px) and (max-width: 900px) {
  .modal, .modal.wide { height: 100vh; max-height: 100vh; border-radius: 0; }
}

/* ------------------------------------------------------------ take action */

.fab {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border-radius: 40px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.01em;
  border: none;
  box-shadow: 0 8px 26px -6px #6366f199, 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.14s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 32px -6px #6366f1bb, 0 2px 10px rgba(0, 0, 0, 0.5); }
.fab:active { transform: translateY(0); }

.action-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.action-row:hover { border-color: var(--border-bright); background: var(--surface-2); }

@media (max-width: 860px) {
  /* Clear the bottom tab bar, and drop to a circle to stay out of the way. */
  .fab {
    right: 16px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    padding: 15px;
    border-radius: 50%;
  }
  .fab .fab-label { display: none; }
  .action-row { padding: 13px 12px; }
}
