/* =============================================================
   styles.css — the look of Kimo Forge (dark theme only).
   Colours come from the approved mockups and live in the
   variables below, so you can change them in one place.
   ============================================================= */

:root {
  --bg: #0B0C0E;          /* page */
  --card: #15171B;        /* cards, inputs */
  --surface: #1D2026;     /* inner tiles */
  --border: #2A2E36;      /* card borders, dividers */
  --text: #F3F4F6;        /* main text */
  --muted: #A3A9B4;       /* labels, secondary */
  --amber: #F5A524;       /* primary buttons, active tab, current item */
  --teal: #2DD4BF;        /* completed sets, gains, streak */
  --teal-bg: #12241F;     /* completed rows, done days */
  --warn-bg: #2A2110;     /* paused, new, warnings */
  --danger: #F87171;
  --radius: 16px;
  --radius-btn: 14px;
  --tabbar-h: 68px;
  --gutter: 16px;
}

/* ---------- Basics ---------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, Roboto, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; border: 0; background: none; padding: 0; }
button:disabled { opacity: 0.4; cursor: default; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; }
b, strong { font-weight: 700; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Text helpers ---------- */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.teal { color: var(--teal); }
.amber { color: var(--amber); }
.bold { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.section-label {
  font-size: 14px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); margin: 6px 0 0;
}
.hint { font-size: 13px; color: var(--muted); }
.warn-text { color: var(--amber); display: flex; gap: 8px; align-items: flex-start; }
.mono { font-family: ui-monospace, "Roboto Mono", "Droid Sans Mono", monospace; }

/* ---------- Layout ---------- */
#app { min-height: 100vh; }
.boot { padding: 40px var(--gutter); color: var(--muted); }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen.with-tabs { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.content {
  flex: 1; padding: 16px var(--gutter) 24px;
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 560px; margin: 0 auto;
}
.center-col { align-items: center; justify-content: center; text-align: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.list-gap { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }

/* Sticky bottom area for main actions (thumb-friendly) */
.footer {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--bg); border-top: 1px solid var(--border);
  padding: 10px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
.footer > * { width: 100%; max-width: 528px; margin: 0 auto; }

/* ---------- Top of the tab screens ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: -4px 0 -6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; letter-spacing: 0.3px; }
.logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--amber); color: var(--bg);
  display: grid; place-items: center; font-weight: 900; font-size: 18px;
}
.date-line { color: var(--muted); font-size: 17px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title-row h1 { font-size: 40px; }
.streak-badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--surface); color: var(--teal); font-weight: 700;
  border-radius: 999px; padding: 8px 14px; font-size: 15px;
}

/* Sub-screen header (back arrow + title) */
.subhead {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 8px 4px; width: 100%; max-width: 560px; margin: 0 auto;
}
.subhead h1 { font-size: 26px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--radius-btn);
  font-weight: 700; font-size: 16px; text-align: center; line-height: 1.2;
  border: 1px solid transparent;
}
.btn-big { min-height: 52px; width: 100%; }
.btn-xl { min-height: 56px; width: 100%; font-size: 19px; }
.btn-primary { background: var(--amber); color: #111; }
.btn-primary:active { filter: brightness(0.9); }
.btn-outline { border-color: var(--amber); color: var(--amber); background: transparent; }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-card { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-card .icon { color: var(--amber); }
.btn-dashed { border: 1px dashed var(--border); color: var(--muted); background: transparent; }
.btn-danger { background: var(--danger); color: #111; }
.btn-danger-ghost { color: var(--danger); background: transparent; border-color: #4a2a2a; }
.btn-side { min-width: 92px; min-height: 52px; }
.link-btn { color: var(--muted); text-decoration: underline; min-height: 44px; font-size: 14px; align-self: center; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 12px; display: inline-grid; place-items: center;
  color: var(--text); flex: none;
}
.icon-btn:active { background: var(--surface); }
.file-btn { cursor: pointer; }
.two-btn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pill-btn {
  min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); display: inline-flex; align-items: center; gap: 8px; font-weight: 600;
}
.pill-btn.on { color: var(--text); }
.pill-btn.on .icon { color: var(--teal); }

/* Segmented buttons (chart views, tabs, phases) */
.seg { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; padding: 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-btn.on { background: var(--amber); border-color: var(--amber); color: #111; }
.seg-big .seg-btn { min-height: 52px; font-size: 17px; }

/* ---------- Cards and tiles ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card.row-between { flex-direction: row; }
.card-btn { text-align: left; width: 100%; color: inherit; }
.card-btn:active { background: var(--surface); }
.card-title { font-size: 19px; font-weight: 700; }
.card-title.big { font-size: 27px; font-weight: 800; }
.card-accent { border-color: var(--amber); }
.warn-card { background: var(--warn-bg); border-color: #4a3a18; }
.warn-card .card-title { color: var(--amber); }
.done-card { background: var(--teal-bg); border-color: #1d4a40; }
.done-card .card-title { color: var(--teal); display: flex; align-items: center; gap: 8px; }
.paused-card { opacity: 0.7; border-style: dashed; }
.last-time { text-align: right; display: flex; flex-direction: column; font-size: 15px; }
.tiles-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tiles-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 6px; color: inherit; min-height: 44px;
}
.tile-sm { padding: 12px; }
.tile-sm b { font-size: 19px; }
.tile-value { font-size: 26px; font-weight: 800; }
.tile-value.xl { font-size: 36px; }
.mini-tile {
  background: var(--surface); border-radius: 12px; padding: 10px 6px; text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.mini-tile b { font-size: 18px; font-weight: 800; white-space: nowrap; }
.mini-tile span { font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.bar > div { height: 100%; background: var(--teal); border-radius: 4px; }
.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 8px; white-space: nowrap; vertical-align: middle; }
.badge-teal { background: var(--teal-bg); color: var(--teal); }
.badge-warn { background: var(--warn-bg); color: var(--amber); }
.badge-amber { background: var(--amber); color: #111; }
.list-line { padding: 8px 0; border-bottom: 1px solid var(--border); }
.list-line:last-child { border-bottom: 0; }
.list-card { padding: 0 16px; gap: 0; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--border); text-align: left; width: 100%;
}
.list-row:last-child { border-bottom: 0; }
.list-row small { display: block; color: var(--muted); font-size: 13px; }
.group-label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin: 14px 0 6px; }
.day-note { background: var(--surface); border-radius: 12px; padding: 10px 12px; color: var(--muted); font-size: 14px; }

/* ---------- Today: 7-day strip ---------- */
.strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.strip-day {
  background: var(--card); border-radius: 12px; min-height: 56px; padding: 6px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; color: var(--muted);
}
.strip-day b { font-size: 16px; color: var(--text); font-weight: 700; }
.strip-day.done b { color: var(--teal); }
.strip-day.today { background: var(--amber); color: #111; }
.strip-day.today b { color: #111; }

/* ---------- Forms ---------- */
.input {
  width: 100%; min-height: 52px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); padding: 12px 14px; font-size: 16px;
}
textarea.input { resize: vertical; min-height: 90px; line-height: 1.45; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.input-xl { font-size: 28px; font-weight: 800; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--muted); font-size: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 6px 0; }
.check-row input { width: 26px; height: 26px; accent-color: var(--teal); flex: none; margin: 0; }
.big-check { font-size: 17px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.switch-row small { display: block; color: var(--muted); font-size: 13px; }
.switch {
  appearance: none; width: 52px; height: 30px; border-radius: 15px; background: var(--border);
  position: relative; flex: none; margin: 0; transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--text); transition: left 0.15s;
}
.switch:checked { background: var(--teal); }
.switch:checked::after { left: 25px; }
input[type="range"] { width: 100%; accent-color: var(--amber); height: 44px; }
input[type="date"] { color-scheme: dark; }
.setting-line { min-height: 56px; }
.select-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  min-height: 56px; padding: 0 16px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--border); font-size: 18px; font-weight: 700;
}
.select-btn .icon { color: var(--muted); }

/* Steppers (− value +) */
.stepper-inline { display: flex; align-items: center; gap: 10px; }
.stepper-inline b { min-width: 64px; text-align: center; font-size: 20px; }
.step-btn {
  width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--card); font-size: 24px; font-weight: 600; display: grid; place-items: center; flex: none;
}
.step-btn:active { background: var(--surface); }

/* ---------- Tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 14px; }
.tab.active { color: var(--amber); font-weight: 700; }

/* ---------- Update bar ---------- */
#update-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 8px var(--gutter); padding-top: calc(8px + env(safe-area-inset-top)); }
#update-btn { width: 100%; min-height: 48px; border-radius: 12px; background: var(--teal); color: #062420; font-weight: 800; }

/* ---------- Workout ---------- */
.wk-head { display: flex; align-items: center; gap: 4px; padding: 8px 6px 6px; max-width: 560px; margin: 0 auto; width: 100%; }
.wk-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; min-height: 48px; justify-content: center; }
.wk-title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wk-title .muted { font-size: 14px; }
.progress { height: 6px; background: var(--border); border-radius: 3px; margin: 0 var(--gutter); overflow: hidden; }
.progress > div { height: 100%; background: var(--amber); border-radius: 3px; transition: width 0.3s; }
.wk-nav { display: flex; justify-content: space-between; padding: 4px 6px 0; max-width: 560px; margin: 0 auto; width: 100%; }
.wk-nav .btn { padding: 0 10px; min-height: 44px; font-size: 15px; }
.wk-body { padding-top: 6px; }
.ex-name { font-size: 30px; }
.target { margin-top: -6px; font-size: 16px; }

.set-head, .set-row {
  display: grid; align-items: center; gap: 6px;
  grid-template-columns: 44px minmax(0, 1fr) 62px 62px 50px;
}
.set-head.cols-1, .set-row.cols-1 { grid-template-columns: 44px minmax(0, 1fr) 84px 50px; }
.set-head { font-size: 12px; font-weight: 700; letter-spacing: 0.6px; color: var(--muted); padding: 0 6px; white-space: nowrap; }
.set-head span:nth-child(n+3) { text-align: center; }
.set-head span:last-child:empty { display: none; }
.set-list { display: flex; flex-direction: column; gap: 8px; }
.set-row {
  background: transparent; border: 1px solid transparent; border-radius: 14px; padding: 6px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.set-row.done { background: var(--teal-bg); }
.set-row.current { border-color: var(--amber); }
.set-row.selected:not(.current) { border-color: var(--border); }
.set-no { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; min-height: 48px; line-height: 1.1; }
.set-no small { font-size: 11px; font-weight: 600; color: var(--muted); }
.set-row.current .set-no { color: var(--amber); }
.last { font-size: 14px; color: var(--muted); text-align: left; min-height: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.last:disabled { opacity: 0.6; }
.num {
  width: 100%; min-width: 0; height: 52px; border-radius: 12px; border: 0;
  background: var(--surface); text-align: center; font-size: 22px; font-weight: 800; padding: 0 4px;
}
.set-row.done .num { background: #0e1a17; }
.tick {
  width: 50px; height: 52px; border-radius: 12px; border: 2px solid var(--border);
  display: grid; place-items: center; color: var(--muted);
}
.set-row.done .tick { background: var(--teal); border-color: var(--teal); color: #062420; }
.stepper-strip { display: flex; gap: 8px; margin: -2px 0 2px; }
.stepper {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px;
}
.stepper span { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.stepper .step-btn { width: 52px; height: 48px; border: 0; background: var(--surface); }
.rest-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border-radius: var(--radius); padding: 10px 12px 10px 16px;
}
.next-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 15px; }
.next-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-line span:last-child { white-space: nowrap; }
.edit-row { display: grid; grid-template-columns: 1fr 64px 64px 44px; gap: 6px; align-items: center; }
.mini-field { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mini-field small { font-size: 11px; color: var(--muted); }
.small-num { height: 44px; font-size: 18px; }

/* ---------- Full-screen timers ---------- */
.fullscreen {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column; gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) var(--gutter) calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.fullscreen > * { width: 100%; max-width: 528px; margin-left: auto; margin-right: auto; }
.rest-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rest-toggles { display: flex; gap: 8px; }
.ring-wrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 8px auto; }
.ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--surface); stroke-width: 14; }
.ring-fg { fill: none; stroke: var(--amber); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-time { font-size: 72px; font-weight: 800; letter-spacing: -2px; font-variant-numeric: tabular-nums; line-height: 1; }
.upnext { gap: 4px; }
.upnext-title { font-size: 19px; font-weight: 700; }
.guided-top { text-align: center; }
.guided-name { font-size: 24px; font-weight: 800; }
.guided-mid { text-align: center; display: flex; flex-direction: column; gap: 14px; margin-top: 40px; }
.guided-phase { font-size: 30px; font-weight: 800; color: var(--muted); }
.guided-phase span { display: block; font-size: 88px; letter-spacing: -2px; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.05; }
.phase-hold .guided-phase { color: var(--amber); }
.phase-relax .guided-phase { color: var(--teal); }
.guided-rep { font-size: 22px; font-weight: 700; }
.guided-bar { height: 10px; background: var(--surface); border-radius: 5px; overflow: hidden; }
.guided-bar div { height: 100%; background: var(--amber); }
.phase-relax .guided-bar div { background: var(--teal); }

/* ---------- Summary ---------- */
.summary-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0 6px; }
.hero-check { width: 76px; height: 76px; border-radius: 50%; background: var(--teal); color: #062420; display: grid; place-items: center; }
.pr-card { border-color: var(--amber); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti i {
  position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; opacity: 0.9;
  animation: fall 2.6s ease-in forwards;
}
.confetti i:nth-child(odd) { background: var(--amber); }
.confetti i:nth-child(even) { background: var(--teal); }
.confetti i:nth-child(3n) { background: var(--text); }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: 0.3; } }

/* ---------- Gym log calendar ---------- */
/* The calendar card reaches a little wider so each day is at least 44 px. */
.calendar { gap: 8px; margin: 0 -10px; padding: 4px; background: transparent; border: 0; }
.calendar > .row-between { padding: 0 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-head span { text-align: center; color: var(--muted); font-size: 13px; }
.cal-cell {
  min-height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 16px; color: var(--text);
}
.cal-cell.trained { background: var(--teal-bg); color: var(--teal); font-weight: 700; }
.cal-cell.today { background: var(--amber); color: #111; font-weight: 800; }
.cal-cell.selected { outline: 2px solid var(--text); outline-offset: -2px; }
.ex-lines { display: flex; flex-direction: column; }

/* ---------- Progress ---------- */
.chart { width: 100%; height: auto; display: block; }
.headline { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.big-pct { font-size: 50px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; }
.from-to { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.from-to b { font-size: 22px; white-space: nowrap; }
.bw-card { flex-direction: row; align-items: center; justify-content: space-between; }
.bw-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.spark { width: 110px; flex: none; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.lg-teal { background: var(--teal); }
.lg-amber { background: var(--amber); margin-left: 8px; }

/* ---------- Rehab ---------- */
.phase-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.phase { border-radius: 12px; padding: 8px 4px; text-align: center; background: var(--card); color: var(--muted); display: flex; flex-direction: column; font-size: 14px; }
.phase b { font-size: 15px; }
.phase.done { background: var(--teal-bg); color: var(--teal); }
.phase.now { background: var(--amber); color: #111; }
.with-banner { padding-bottom: 96px; }
.pain-banner {
  position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 10;
  max-width: 528px; margin: 0 auto;
  background: var(--warn-bg); color: var(--amber); font-weight: 700; border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 10px; border: 1px solid #4a3a18;
}

/* ---------- Library / editors ---------- */
.item-card { gap: 6px; padding: 12px 12px 8px 16px; }
.item-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.cycle-row { display: flex; align-items: center; gap: 4px; min-height: 52px; border-bottom: 1px solid var(--border); }
.cycle-row:last-of-type { border-bottom: 0; }
.cycle-row.due { color: var(--amber); font-weight: 700; }
.notes-area { min-height: 50vh; font-size: 17px; }

/* ---------- Videos ---------- */
.video-card { padding: 0; overflow: hidden; gap: 0; }
.video-box { position: relative; aspect-ratio: 16 / 9; background: var(--surface); display: grid; place-items: center; }
.video-box video { width: 100%; height: 100%; background: #000; }
.play-big { width: 76px; height: 76px; border-radius: 50%; background: var(--amber); color: #111; display: grid; place-items: center; }
.dur { position: absolute; right: 10px; bottom: 10px; background: var(--bg); border-radius: 8px; padding: 2px 8px; font-weight: 700; font-size: 14px; }
.fs-btn { position: absolute; top: 6px; right: 6px; background: rgba(11, 12, 14, 0.7); }
.video-info { padding: 12px 8px 12px 16px; }

/* ---------- Import ---------- */
.import-box { min-height: 180px; font-size: 14px; white-space: pre; overflow-x: auto; }
.help summary { min-height: 44px; display: flex; align-items: center; color: var(--amber); font-weight: 700; cursor: pointer; }
.help pre { background: var(--card); border-radius: 12px; padding: 12px; overflow-x: auto; white-space: pre; }
.note-line { margin: -4px 0 6px; }

/* ---------- Bottom sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity 0.2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0; border-top: 1px solid var(--border);
  padding: 8px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.2s ease-out;
  max-width: 560px; margin: 0 auto;
}
.sheet.tall { min-height: 70vh; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sheet-head h2 { font-size: 20px; font-weight: 800; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-body .input { background: var(--bg); }
.sheet-text { color: var(--muted); }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice {
  min-height: 52px; border-radius: 12px; background: var(--surface); padding: 10px 16px; text-align: left;
  display: flex; flex-direction: column; justify-content: center; font-weight: 600; font-size: 16px;
}
.choice small { color: var(--muted); font-weight: 400; font-size: 13px; }
.choice-primary { background: var(--amber); color: #111; }
.choice-danger { color: var(--danger); }
.choice-ghost { background: transparent; color: var(--muted); align-items: center; }
.choice-current { border: 1px solid var(--amber); }
.choice-done small { color: var(--teal); }
.pick-list { display: flex; flex-direction: column; }
.pick-item {
  min-height: 52px; text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center;
}
.pick-item small { color: var(--muted); font-size: 13px; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); z-index: 120;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all 0.2s;
  background: var(--text); color: var(--bg); font-weight: 600; padding: 12px 18px; border-radius: 12px;
  max-width: calc(100vw - 32px); width: max-content; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Small phones (Galaxy S8 is 360 px wide) */
@media (max-width: 380px) {
  .title-row h1 { font-size: 36px; }
  .streak-badge { padding: 7px 11px; font-size: 14px; }
  .big-pct { font-size: 44px; }
  .mini-tile b { font-size: 16px; }
}
