/* Factory app base styles. Colours are tokens: change the palette here, not in components.
   Layout: a phone column that widens and scales up on tablets and desktops (like Verbal Dojo). */
:root {
  --bg: #14121c; --panel: #1f1b2e; --line: #34304a; --text: #f1eefb; --muted: #a79fc0;
  --accent: #8b5cf6; --accent-ink: #ffffff; --ok: #34d399; --bad: #f87171; --gold: #fbbf24;
  --radius: 12px; --font: Inter, system-ui, -apple-system, sans-serif;
  --colw: 440px; --z: 1;
}
@media (min-width: 700px) { :root { --colw: min(760px, calc(100vw - 48px)); --z: 1.1; } }
@media (min-width: 1000px) { :root { --colw: min(1080px, calc(100vw - 140px)); --z: 1.15; } }
@media (min-width: 1500px) { :root { --colw: 1200px; --z: 1.25; } }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-tap-highlight-color: transparent; }
body { min-height: 100dvh; }
#app { max-width: calc(var(--colw) / var(--z)); zoom: var(--z); margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); min-height: calc(100dvh / var(--z)); display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; gap: 14px; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.narrow { width: 100%; max-width: 640px; margin: 0 auto; }   /* reading & answering screens: bigger on desktop, not stretched */
.row { display: flex; gap: 10px; align-items: center; } .between { justify-content: space-between; } .grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; gap: 14px; } @media (min-width: 1000px) { .grid2 { grid-template-columns: 1fr 1fr; } }
h1, h2 { margin: 0; line-height: 1.15; } h1 { font-size: 28px; } h2 { font-size: 20px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
button { font: inherit; color: inherit; cursor: pointer; }
.btn { min-height: 48px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-weight: 600; font-size: 16px; }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; }
.big { font-size: 64px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
/* PIN pad */
.dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0 8px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.dots i.on { background: var(--accent); border-color: var(--accent); }
.pin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 12px auto 0; width: 100%; }
.pin button { min-height: 64px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); font-size: 24px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; z-index: 50; }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

/* ---------- Homework Timer ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn.big { min-height: 58px; font-size: 18px; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 24px 16px; }
.hero.during { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 10px 40px rgba(139, 92, 246, .18); }
.hero.done { border-color: var(--ok); }
.chip { display: inline-block; padding: 6px 14px; border-radius: 999px; background: #4c1d95; color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .06em; }
.chip.soft { background: var(--line); color: var(--text); }
.ring-wrap { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 10px 0; }
.ring { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 16; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.big-time { font-size: 56px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.05; }
.encourage { font-size: 18px; font-weight: 600; }
.ok-line { color: var(--ok); font-weight: 600; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.wrap { flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }
.wd b { font-size: 13px; }
.wd.on { color: var(--text); }
.wd.on b { color: #c4b5fd; }
.wd.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.days { display: flex; flex-direction: column; gap: 8px; }
.dayrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.dayrow:first-child { border-top: 0; }
.dayrow.off .times { opacity: .4; }
.times { display: flex; align-items: center; gap: 8px; }
.times { flex: 1; min-width: 260px; }
.times input { flex: 1; min-width: 0; padding: 10px 8px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
.dname { min-width: 96px; }
.celebrate { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px; background: radial-gradient(circle at 50% 40%, #4c1d95, #14121c 70%); color: #fff; animation: fade .3s ease-out; font-size: 20px; }
@media (prefers-reduced-motion: reduce) { .ring-fg { transition: none; } .celebrate { animation: none; } }
.nocomp { display: inline-block; margin: 4px 0 2px; padding: 10px 16px; border-radius: 12px; background: #7f1d1d; color: #fff; font-weight: 800; font-size: 18px; }
.nocomp.big { font-size: 22px; padding: 14px 20px; margin: 10px 0; }
.until { font-size: 20px; margin-top: 6px; }
.mini { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 320px; margin: 8px auto 4px; }
.bar { flex: 1; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 1s linear; }
.mini-left { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn.start { width: 100%; max-width: 420px; min-height: 96px; flex-direction: column; gap: 4px; margin: 10px 0 2px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.btn.start .main { font-size: 22px; font-weight: 800; }
.btn.start .sub { font-size: 14px; font-weight: 600; opacity: .9; }
.btn.on { border-color: var(--accent); background: #4c1d95; color: #fff; }
.linkish { background: none; border: 0; color: #c4b5fd; font-weight: 600; text-decoration: underline; min-height: 44px; padding: 0 8px; cursor: pointer; }
.ago { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ago[hidden] { display: none; }
.wd .tick { font-size: 16px; font-weight: 800; }
.wd.on { background: #14532d; border-color: #166534; color: #fff; }
.wd.on b { color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.field select { font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.daychk { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; cursor: pointer; }
.daychk input { width: 20px; height: 20px; accent-color: var(--accent); }
.steps.small { font-size: 14px; color: var(--muted); }
