@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@700&display=swap');

:root{
  --bg:#ffffff;
  --surface:#fafafa;
  --fg:#111111;
  --muted:#767676;
  --muted-2:#a3a3a3;
  --line:#e6e6e6;
  --line-strong:#111111;
  --danger:#e0221a;
  --danger-bg:#fdece9;
  --radius:10px;
  --radius-sm:6px;
}

/* colour themes for the unfocused state (picked top-right). focus mode below always wins. */
/* soft pastel background, near-black text with a hint of the hue, palette greys for secondary text */
html[data-theme="sky"]  { --bg:#ecf7fd; --surface:#e1f3fc; --line:#d4e0e6; --muted-2:#99a8b0; --muted:#525a5e; --fg:#25282a; --line-strong:#25282a; }
html[data-theme="rose"] { --bg:#f6e1fd; --surface:#f1d1fc; --line:#dfcae6; --muted-2:#a78db0; --muted:#5a4b5e; --fg:#28222a; --line-strong:#28222a; }
html[data-theme="mint"] { --bg:#e8fde9; --surface:#dbfcdd; --line:#d1e6d2; --muted-2:#96b097; --muted:#505e51; --fg:#242a24; --line-strong:#242a24; }
html[data-theme="lilac"]{ --bg:#e1d4fd; --surface:#d6c6fc; --line:#c8bce6; --muted-2:#8b7bb0; --muted:#4b425e; --fg:#221e2a; --line-strong:#221e2a; }

*{ box-sizing:border-box; }

html,body{
  margin:0; padding:0;
  width:100%; height:100%;
  background:var(--bg);
  color:var(--fg);
  font-family:-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:19px;
  font-weight:600;
  line-height:1.45;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  transition:background .5s ease, color .5s ease;
}
body{
  display:flex;
  flex-direction:column;
}

button, input, select, textarea{
  font-family:inherit;
  font-size:17px;
  font-weight:600;
  color:var(--fg);
}

.tabular{ font-variant-numeric:tabular-nums; }

::selection{ background:var(--fg); color:var(--bg); }

/* ===== NAV ===== */
#topnav{
  width:100%;
  flex-shrink:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:28px;
  padding:20px 84px;
  background:var(--bg);
}
.brand{
  display:flex;
  flex-direction:column;
  gap:2px;
  font-size:21px;
  font-weight:800;
  letter-spacing:-0.01em;
  line-height:1.2;
  color:var(--fg);
  flex-shrink:0;
}
.tabs{ display:flex; gap:28px; align-items:center; }
.tab-icon{ display:none; width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.tab{
  background:transparent;
  color:var(--muted);
  border:none;
  border-radius:999px;
  padding:10px 20px;
  cursor:pointer;
  font-size:15px;
  font-weight:700;
  display:flex; align-items:center; gap:8px;
  transition:color .15s, background .15s;
}
.tab:hover{ color:var(--fg); background:var(--surface); }
.tab.active{
  color:var(--bg);
  background:var(--fg);
}
.badge{
  background:var(--muted-2);
  color:var(--bg);
  border-radius:999px;
  min-width:20px;
  height:20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:600;
  padding:0 6px;
}
.tab.active .badge{
  background:var(--bg);
  color:var(--fg);
}
.badge.hidden{ display:none; }

/* ===== MAIN / VIEWS ===== */
#app{
  width:100%;
  flex:1;
  min-height:0;
  padding:22px 48px 28px;
  display:flex;
  flex-direction:column;
}
.view{ display:none; width:100%; flex:1; min-height:0; flex-direction:column; }
.view.active{ display:flex; }
.view-title{ font-size:24px; font-weight:800; margin:0 0 18px 0; letter-spacing:-0.01em; flex-shrink:0; }
.hint{ color:var(--muted); font-size:16px; }
.hidden{ display:none !important; }

/* ===== HOME ===== */
.home-grid{
  display:flex;
  width:100%;
  flex:1;
  min-height:0;
  gap:64px;
  align-items:center;
  justify-content:center;
}
.gauge-col{ flex:1; display:flex; justify-content:center; }
.control-col{
  flex:1;
  max-width:460px;
  display:flex;
  flex-direction:column;
  gap:13px;
}
.mode-row{ display:flex; gap:12px; align-items:flex-end; }
.mode-field{ flex:1; display:flex; flex-direction:column; }
.rounds-field{ width:96px; display:flex; flex-direction:column; }
.rounds-field .big-input{ padding:11px 12px; }
.gauge-wrap{ position:relative; width:100%; max-width:380px; flex-shrink:0; }
.gauge-svg{ width:100%; height:auto; overflow:visible; }
.gauge-track{
  fill:none; stroke:var(--line); stroke-width:10; stroke-linecap:round;
}
.gauge-fill{
  fill:none; stroke:var(--fg); stroke-width:10; stroke-linecap:round;
  stroke-dasharray:408; stroke-dashoffset:0;
  transition:stroke-dashoffset .4s linear, stroke .3s;
}
.gauge-marker{
  fill:var(--bg); stroke:var(--fg); stroke-width:3;
  transition:cx .4s linear, cy .4s linear, stroke .3s;
}
.gauge-readout{
  text-align:center;
  margin-top:18px;
}
.gauge-time{ font-size:56px; font-weight:800; letter-spacing:-0.01em; font-variant-numeric:tabular-nums; }
.gauge-label{ font-size:14px; font-weight:700; color:var(--muted); margin-top:4px; text-transform:uppercase; letter-spacing:.06em; }

.field-label{ font-size:12px; font-weight:700; color:var(--muted); margin-top:8px; text-transform:uppercase; letter-spacing:.06em; }
.big-select, .big-input, .big-textarea{
  width:100%;
  background:var(--bg);
  color:var(--fg);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:12px 14px;
  font-size:18px;
  transition:border-color .15s;
}
.big-textarea{ min-height:96px; resize:vertical; font-family:inherit; }
.big-select:focus, .big-input:focus, .big-textarea:focus{ outline:none; border-color:var(--fg); }

.timer-readout{ text-align:center; margin-top:4px; }
#timerDisplay{ font-size:50px; font-weight:800; letter-spacing:0; font-variant-numeric:tabular-nums; }
.mode-status{
  font-size:13px; font-weight:700; color:var(--muted);
  text-transform:uppercase; letter-spacing:.08em; margin-top:2px;
}

.timer-buttons{ display:flex; gap:10px; }
.btn{
  background:var(--bg);
  color:var(--fg);
  border:2px solid var(--line-strong);
  border-radius:10px;
  padding:14px 20px;
  cursor:pointer;
  font-size:15px;
  font-weight:700;
  flex:none;
  transition:background .15s, color .15s, opacity .15s, transform .1s;
}
.timer-buttons .btn{ flex:1; }
.btn:hover:not(:disabled){ background:var(--fg); color:var(--bg); }
.btn:active:not(:disabled){ transform:scale(.98); }
.btn:disabled{ opacity:.32; cursor:not-allowed; }
.btn-primary{ background:var(--fg); color:var(--bg); }
.btn-primary:hover:not(:disabled){ background:#000; opacity:.85; }
.btn-danger{ border-color:var(--danger); color:var(--danger); }
.btn-danger:hover:not(:disabled){ background:var(--danger); color:var(--bg); }
.btn.full{ width:100%; margin-top:18px; }

.home-stats{ margin-top:8px; font-size:14px; color:var(--muted); line-height:1.7; }
.home-stats b{ color:var(--fg); font-weight:600; }

/* ===== LESSONS LIST ===== */
.lessons-list{
  display:flex; flex-wrap:wrap; align-content:flex-start; gap:20px;
  flex:1; min-height:0; overflow-y:auto;
}
.lesson-card{
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:22px 24px;
  width:300px;
  position:relative;
  cursor:pointer;
  transition:border-color .15s;
}
.lesson-card:hover{ border-color:var(--muted-2); }
.lesson-card.expanded{ border-color:var(--fg); }
.lesson-card .dot{
  width:10px; height:10px; border-radius:50%;
  display:inline-block; margin-right:9px;
}
.lesson-card .lname{ font-size:20px; font-weight:700; }
.lesson-card .lmeta{ color:var(--muted); font-size:14px; margin-top:10px; }
.progress-bar{
  width:100%; height:6px; border-radius:999px; background:var(--line); margin-top:14px;
  position:relative; overflow:hidden;
}
.progress-fill{ height:100%; background:var(--fg); width:0%; border-radius:999px; transition:width .3s; }
.lesson-card .penalty-tag{
  margin-top:12px; font-size:12px; font-weight:600; color:var(--danger);
  display:inline-block; background:var(--danger-bg); padding:4px 9px; border-radius:999px;
}
.lesson-card .del-btn{
  position:absolute; top:16px; right:16px;
  background:none; border:none; color:var(--muted-2);
  cursor:pointer; font-size:16px; line-height:1; padding:4px;
  border-radius:4px;
  transition:color .15s, background .15s;
}
.lesson-card .del-btn:hover{ color:var(--danger); background:var(--danger-bg); }
.expand-hint{ font-size:11px; font-weight:700; color:var(--muted-2); margin-top:14px; text-transform:uppercase; letter-spacing:.06em; }
.lesson-history{
  margin-top:14px; padding-top:14px; border-top:1px solid var(--line);
  display:flex; flex-direction:column; gap:9px; max-height:220px; overflow-y:auto;
}
.history-row{ display:flex; justify-content:space-between; gap:10px; font-size:14px; color:var(--muted); }
.history-row .hdate{ color:var(--fg); font-weight:700; flex-shrink:0; }
.history-row .hfocus{ font-weight:700; flex-shrink:0; }
.history-empty{ font-size:13px; color:var(--muted-2); margin-top:14px; }

/* ===== ADD ===== */
.add-grid{ display:flex; gap:40px; flex:1; min-height:0; }
.add-card{
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:32px;
  display:flex; flex-direction:column; gap:6px;
  min-height:0; overflow-y:auto;
}
.add-card-lesson{ flex:1.5; min-width:0; }
.add-card-motivation{ flex:1; min-width:0; }
.card-title{ font-size:21px; font-weight:800; margin:0 0 8px 0; }
.color-palette{ display:flex; flex-wrap:wrap; gap:10px; margin:8px 0 4px; }
.color-swatch{
  width:28px; height:28px; border-radius:50%;
  cursor:pointer; border:2px solid transparent;
  box-shadow:0 0 0 1px var(--line);
  transition:transform .1s;
}
.color-swatch:hover{ transform:scale(1.1); }
.color-swatch.selected{ border-color:var(--bg); box-shadow:0 0 0 2px var(--fg); }
.unit-row{ display:flex; align-items:flex-end; justify-content:space-between; gap:10px; }
.unit-row .field-label{ margin-top:8px; }
.unit-toggle{ display:flex; gap:4px; margin-bottom:1px; }
.unit-btn{
  background:var(--bg); color:var(--muted);
  border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:5px 10px; cursor:pointer; font-size:12px; font-weight:700;
  transition:all .15s;
}
.unit-btn.active{ color:var(--bg); background:var(--fg); border-color:var(--fg); }

.toggle-row{ display:flex; gap:8px; }
.toggle-btn{
  flex:1; background:var(--bg); color:var(--muted);
  border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:10px; cursor:pointer; font-size:14px; font-weight:600;
  transition:all .15s;
}
.toggle-btn.active{ color:var(--bg); background:var(--fg); border-color:var(--fg); }

.motivation-list{ margin-top:18px; display:flex; flex-direction:column; gap:8px; max-height:240px; overflow-y:auto; }
.motivation-item{
  border:1px solid var(--line); border-radius:var(--radius-sm); padding:10px 14px;
  display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:15px;
}
.motivation-item span{ line-height:1.4; }
.motivation-item button{ background:none; border:none; color:var(--muted-2); cursor:pointer; font-size:16px; flex-shrink:0; }
.motivation-item button:hover{ color:var(--danger); }

/* ===== PENALTIES ===== */
.penalties-list{
  display:flex; flex-direction:column; gap:12px; max-width:620px;
  flex:1; min-height:0; overflow-y:auto;
}
.penalty-row{
  border:1px solid var(--danger); background:var(--danger-bg); border-radius:var(--radius);
  padding:18px 22px;
  display:flex; justify-content:space-between; align-items:center;
}
.penalty-row .lname{ font-size:17px; font-weight:700; }
.penalty-row .pamount{ font-size:16px; font-weight:700; color:var(--danger); }

/* ===== MODALS ===== */
.modal{
  position:fixed; inset:0; background:rgba(17,17,17,.5);
  display:flex; align-items:center; justify-content:center;
  z-index:100;
  backdrop-filter:blur(2px);
}
.modal.hidden{ display:none; }
.modal-box{
  background:var(--bg); border:1px solid var(--line); border-radius:16px;
  padding:48px; max-width:560px; width:90%;
  text-align:center;
  box-shadow:0 20px 60px rgba(0,0,0,.12);
}
.motivation-text{
  font-size:26px; font-weight:600; line-height:1.5; margin-bottom:36px;
  color:var(--fg);
}
.confirm-text{ font-size:18px; margin-bottom:28px; }
.confirm-buttons{ display:flex; gap:10px; }
.confirm-buttons .btn{ flex:1; }

.rating-scale{ display:flex; gap:7px; justify-content:center; margin:24px 0; flex-wrap:wrap; }
.rating-num{
  width:40px; height:40px; border:1px solid var(--line); border-radius:var(--radius-sm);
  background:var(--bg); color:var(--fg); cursor:pointer; font-size:15px; font-weight:600;
  transition:all .15s;
}
.rating-num:hover{ border-color:var(--fg); }
.rating-num.selected{ background:var(--fg); color:var(--bg); border-color:var(--fg); }

.toast{
  position:fixed; bottom:32px; left:50%; transform:translateX(-50%);
  background:var(--fg); color:var(--bg);
  padding:13px 22px; font-size:14px; font-weight:600; z-index:200;
  border-radius:999px;
  box-shadow:0 10px 30px rgba(0,0,0,.18);
  transition:opacity .3s;
}
.toast.hidden{ display:none; }

/* ===== FLOAT (idle pre-focus drift) & FOCUS MODE ===== */
@keyframes drift{
  0%   { transform:translate3d(0,0,0) rotate(0deg); }
  25%  { transform:translate3d(7px,-10px,0) rotate(.7deg); }
  50%  { transform:translate3d(0,-16px,0) rotate(0deg); }
  75%  { transform:translate3d(-7px,-10px,0) rotate(-.7deg); }
  100% { transform:translate3d(0,0,0) rotate(0deg); }
}
.float{
  animation:none;   /* swaying removed */
  animation-delay:var(--fd,0s);
}

/* ===== FOCUS STATE LABEL ===== */
.focus-state{
  text-align:center;
  font-size:34px;
  font-weight:800;
  letter-spacing:.14em;
  color:var(--muted);
  text-transform:uppercase;
  margin-bottom:14px;
  flex-shrink:0;
}
.focus-state span{ display:inline-block; }
.focus-state.focused{
  color:var(--fg);
  font-size:46px;
  font-weight:900;
  font-family:'Orbitron','Segoe UI',sans-serif;
  letter-spacing:.1em;
  animation:shakeIn .55s cubic-bezier(.36,.07,.19,.97) both;
}
.focus-state.break{
  color:#2f8f6f;
}
@keyframes shakeIn{
  0%   { transform:scale(.75); opacity:0; }
  20%  { transform:translateX(-8px) scale(1.08); opacity:1; }
  35%  { transform:translateX(7px) scale(1.03); }
  50%  { transform:translateX(-5px); }
  65%  { transform:translateX(4px); }
  80%  { transform:translateX(-2px); }
  100% { transform:translateX(0) scale(1); }
}

html.focus-mode{
  --bg:#0c0c0c;
  --surface:#1a1a1a;
  --fg:#f5f5f2;
  --muted:#9a9a9a;
  --muted-2:#5a5a5a;
  --line:#2a2a2a;
  --line-strong:#f5f5f2;
  --danger:#ff3b2f;
  --danger-bg:#2a1512;
}
/* focusing: every menu except FOCUS is locked */
html.focus-mode .tab:not([data-view="focus"]){ opacity:.22; cursor:not-allowed; }
html.focus-mode .tab:not([data-view="focus"]):hover{ background:transparent; color:var(--muted); }
.tab{ position:relative; }
.tab-lock{
  display:none; position:absolute; top:-7px; left:50%; transform:translateX(-50%);
  width:15px; height:15px; fill:none; stroke:var(--fg); stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round;
}
html.focus-mode .tab-lock{ display:block; }
/* keep the lock fully visible even though the tab itself is dimmed */
html.focus-mode .tab:not([data-view="focus"]){ opacity:1; color:rgba(245,245,242,.22); }
html.focus-mode .tab:not([data-view="focus"]) .tab-icon{ opacity:.22; }
html.focus-mode .tab:not([data-view="focus"]) .badge{ opacity:.22; }
.tab.nudge{ animation:nudge .4s ease; }
@keyframes nudge{ 0%,100%{ transform:translateX(0); } 25%{ transform:translateX(-6px); } 75%{ transform:translateX(6px); } }
html.focus-mode .float{
  animation:none;
  transform:none;
}

/* ===== FINISH SCREEN ===== */
.finish-modal{
  position:fixed; inset:0; background:var(--bg);
  z-index:200; display:flex; align-items:center; justify-content:center;
}
.finish-modal.hidden{ display:none; }
.confetti-canvas{ position:fixed; inset:0; z-index:201; pointer-events:none; }
.finish-box{ position:relative; z-index:202; text-align:center; max-width:520px; padding:0 32px; }
.finish-title{
  font-size:44px; font-weight:900; letter-spacing:-0.01em;
  margin-bottom:14px; color:var(--fg);
}
.finish-sub{
  font-size:19px; font-weight:600; color:var(--muted);
  margin-bottom:36px;
}

/* ===== THEME PICKER ===== */
.nav-right{ display:flex; align-items:center; gap:14px; flex-shrink:0; }
.theme-picker{
  display:flex; gap:4px; padding:5px; border-radius:999px;
  border:1px solid var(--line); transition:opacity .3s, border-color .3s;
}
.theme-dot{
  width:18px; height:18px; border-radius:50%; padding:0; cursor:pointer;
  background:var(--c1); border:1px solid rgba(0,0,0,.12);
  transition:transform .15s, box-shadow .15s;
}
.theme-dot:hover{ transform:scale(1.15); }
.theme-dot.active{ box-shadow:0 0 0 2px var(--bg), 0 0 0 3.5px var(--fg); }
html.focus-mode .theme-picker{ opacity:0; pointer-events:none; }

/* ===== SOUND BUTTON ===== */
.sound-btn{
  width:46px; height:46px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  background:var(--bg); color:var(--fg);
  border:2px solid var(--line); border-radius:50%;
  cursor:pointer; padding:0;
  transition:border-color .15s, background .15s, color .15s;
}
.sound-btn:hover{ border-color:var(--fg); }
.sound-icon{ width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; overflow:visible; }
.sound-icon .spk{ fill:currentColor; }
.sound-icon .wave{ transition:opacity .2s, transform .2s; transform-origin:12px 12px; }
.sound-icon .mute-x{ opacity:0; transform:scale(.4); transform-origin:18.5px 12px; transition:opacity .2s, transform .2s; }
.sound-btn:not(.muted) .wave-1{ animation:wave 1.8s ease-in-out infinite; }
.sound-btn:not(.muted) .wave-2{ animation:wave 1.8s ease-in-out .25s infinite; }
@keyframes wave{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }
.sound-btn.muted{ color:var(--muted-2); border-color:var(--line); }
.sound-btn.muted .wave{ opacity:0; transform:scale(.6); animation:none; }
.sound-btn.muted .mute-x{ opacity:1; transform:scale(1); }
.sound-btn.pop{ animation:pop .25s ease-out; }
@keyframes pop{ 0%{ transform:scale(1); } 45%{ transform:scale(.86); } 100%{ transform:scale(1); } }
@media (prefers-reduced-motion: reduce){
  .sound-btn .wave, .sound-btn.pop{ animation:none !important; }
}

/* ===== HOME (minimal, one centered column) ===== */
.home{
  flex:1; min-height:0; width:100%;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:18px;
}
.home .focus-state{ margin-bottom:0; position:relative; top:-48px; }
.home .gauge-wrap{ max-width:340px; width:100%; }
.home .gauge-readout{ margin-top:10px; }
.home .gauge-label{ min-height:20px; text-transform:lowercase; letter-spacing:.04em; }
.lesson-pill{
  appearance:none; -webkit-appearance:none;
  background:transparent; color:var(--fg);
  border:1px solid var(--line); border-radius:999px;
  padding:10px 40px 10px 22px; min-width:220px; text-align:center; text-align-last:center;
  font-size:17px; font-weight:700; cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 16px center;
  transition:border-color .15s;
}
.lesson-pill:hover, .lesson-pill:focus{ outline:none; border-color:var(--fg); }
.lesson-pill:disabled{ opacity:.6; cursor:default; }
.lesson-pill option{ color:#111; background:#fff; }
.home .timer-readout{ margin:0; }
.home #timerDisplay{ font-size:22px; font-weight:700; color:var(--muted); letter-spacing:.06em; }
.home .timer-buttons{ width:100%; max-width:340px; justify-content:center; }
.home .timer-buttons .btn{ flex:1; max-width:220px; }
/* desktop: gauge left, controls right. phone: stacked (see media query) */
.home-row{ display:flex; align-items:center; justify-content:center; gap:88px; width:100%; }
.home-row .gauge-wrap{ flex:0 1 380px; max-width:380px; }
.home-controls{ display:flex; flex-direction:column; align-items:stretch; gap:16px; width:300px; }
.home-controls .lesson-pill{ width:100%; }
.home-controls .timer-buttons{ max-width:none; }
.home-controls .timer-buttons .btn{ max-width:none; }
.home-controls .timer-readout{ text-align:center; }
.home-controls #timerDisplay{ font-size:40px; font-weight:800; letter-spacing:0; }

/* grey goal fill sits under the black session fill */
.gauge-goal-fill{
  fill:none; stroke:var(--muted-2); stroke-width:10; stroke-linecap:round;
  transition:stroke-dashoffset .4s linear;
}
html.focus-mode .gauge-goal-fill{ stroke:#5a5a5a; }

/* two markers on the arc */
.marker-g{ cursor:help; transition:transform .4s linear; }
.marker-hit{ fill:transparent; }
.goal-marker{ fill:var(--muted-2); stroke:var(--bg); stroke-width:3; transition:fill .3s; }
.marker-g:hover .goal-marker{ fill:var(--muted); }
.marker-g:hover .gauge-marker{ stroke-width:4; }
html.focus-mode .goal-marker{ fill:#7a7a7a; }

/* goal pie inside the arc: white = nothing yet, black fills as you study */
.pie-base{ fill:#ffffff; }
.pie-fill{ fill:none; stroke:#111111; stroke-width:28; transition:stroke-dasharray .5s ease; }
.pie-ring{ fill:none; stroke:var(--fg); stroke-width:2; }
.goal-left{ fill:var(--fg); font-size:26px; font-weight:800; font-variant-numeric:tabular-nums; }

/* minutes you'll study */
.minutes-pill{
  display:grid; grid-template-columns:52px 1fr 52px; align-items:center;
  border:1px solid var(--line); border-radius:16px; height:64px; overflow:hidden;
  background:var(--bg); transition:border-color .15s, box-shadow .15s;
}
.minutes-pill:focus-within{ border-color:var(--fg); box-shadow:0 0 0 3px rgba(0,0,0,.06); }
.step-btn{
  height:100%; border:none; background:transparent; color:var(--fg);
  font-size:24px; font-weight:500; cursor:pointer; transition:background .15s;
}
.step-btn:hover:not(:disabled){ background:var(--surface); }
.step-btn:active:not(:disabled){ background:var(--line); }
.step-btn:disabled{ color:var(--muted-2); cursor:default; }
.minutes-field{ display:flex; align-items:baseline; justify-content:center; gap:5px; cursor:text; height:100%; align-items:center; }
.minutes-field input{
  width:3.2ch; border:none; background:transparent; outline:none; text-align:right; padding:0;
  font-size:32px; font-weight:900; color:var(--fg); font-variant-numeric:tabular-nums; letter-spacing:-0.02em;
  -moz-appearance:textfield;
}
.minutes-field input::-webkit-outer-spin-button,
.minutes-field input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.minutes-field span{ font-size:14px; font-weight:700; color:var(--muted); }
.minutes-field input:disabled{ color:var(--muted); }

/* pomodoro / short break / long break */
.mode-seg{ display:flex; gap:4px; background:var(--surface); border:1px solid var(--line); border-radius:999px; padding:4px; }
.mode-seg-btn{
  flex:1; border:none; background:transparent; color:var(--muted); cursor:pointer;
  padding:8px 6px; border-radius:999px; font-size:11px; font-weight:800; letter-spacing:.05em; white-space:nowrap;
  transition:background .15s, color .15s;
}
.mode-seg-btn.active{ background:var(--fg); color:var(--bg); }
.mode-seg-btn:disabled:not(.active){ opacity:.4; cursor:default; }
/* breaks don't need a lesson */
#view-focus.break-mode .lesson-pill{ display:none; }

/* ---- polished, very clickable home controls ---- */
.home-controls{ gap:14px; width:320px; }
.mode-seg{ padding:5px; }
.mode-seg-btn{ padding:12px 8px; font-size:13px; letter-spacing:.1em; }
.mode-seg-btn:hover:not(.active):not(:disabled){ color:var(--fg); background:var(--bg); }

.lesson-pill{ height:52px; font-size:17px; border-radius:16px; }
.lesson-pill:hover{ background-color:var(--surface); }

.minutes-pill{ grid-template-columns:64px 1fr 64px; height:84px; border-radius:20px; }
.step-btn{ display:flex; align-items:center; justify-content:center; }
.step-btn::before{
  content:''; position:absolute; width:40px; height:40px; border-radius:50%;
  border:1px solid var(--line); transition:border-color .15s, transform .1s;
}
.step-btn{ position:relative; font-size:22px; font-weight:600; }
.step-btn:hover:not(:disabled){ background:transparent; }
.step-btn:hover:not(:disabled)::before{ border-color:var(--fg); }
.step-btn:active:not(:disabled){ background:transparent; }
.step-btn:active:not(:disabled)::before{ transform:scale(.9); }
.minutes-field input{ font-size:44px; width:3ch; }
.minutes-field span{ font-size:15px; position:relative; top:9px; }

.preset-chips{ display:flex; gap:8px; justify-content:center; }
.chip{
  flex:1; height:38px; border-radius:12px; border:1px solid var(--line);
  background:var(--bg); color:var(--muted); font-size:15px; font-weight:800; cursor:pointer;
  font-variant-numeric:tabular-nums;
  transition:border-color .15s, color .15s, background .15s, transform .1s;
}
.chip:hover:not(:disabled){ border-color:var(--fg); color:var(--fg); }
.chip:active:not(:disabled){ transform:scale(.95); }
.chip.active{ background:var(--fg); color:var(--bg); border-color:var(--fg); }
.chip:disabled{ opacity:.4; cursor:default; }

.home .timer-buttons .btn{ height:58px; font-size:16px; letter-spacing:.12em; border-radius:16px; }
.home .timer-buttons .btn-primary:hover:not(:disabled){ transform:translateY(-1px); box-shadow:0 8px 20px rgba(0,0,0,.18); opacity:1; }
.home .timer-buttons .btn:active:not(:disabled){ transform:scale(.98); box-shadow:none; }

.mode-seg-btn:focus-visible, .chip:focus-visible, .step-btn:focus-visible,
.lesson-pill:focus-visible, .home .btn:focus-visible{ outline:2px solid var(--fg); outline-offset:2px; }
/* the big number under the arc is the session clock now; the small one is redundant */
.home .timer-readout{ display:none; }

/* only show the buttons that make sense right now */
#view-focus:not(.running) #pauseBtn,
#view-focus:not(.running) #stopBtn{ display:none; }
#view-focus.running #startBtn{ display:none; }
#view-focus.running #timerDisplay{ color:var(--fg); }

/* ===== SHARED LAYOUT ===== */
.view-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; flex-shrink:0; }
.view-head .view-title{ margin:0; }
.view-head .btn{ padding:11px 18px; }
.scroll-area{ flex:1; min-height:0; overflow-y:auto; padding-bottom:12px; }
.hint.small{ font-size:13px; margin:6px 0 0; }
.dot{ width:10px; height:10px; border-radius:50%; display:inline-block; margin-right:9px; flex-shrink:0; }
.empty-state{ display:flex; flex-direction:column; align-items:flex-start; gap:6px; }
.lessons-list{ overflow:visible; }
.hof{ color:var(--muted-2); font-weight:600; }

/* ===== TODAY STRIP ===== */
.today-strip{
  display:flex; justify-content:center; gap:12px; flex-wrap:wrap;
  flex-shrink:0; margin-top:14px;
}
.today-item{
  display:flex; flex-direction:column; align-items:center;
  min-width:130px; padding:10px 18px;
  border:1px solid var(--line); border-radius:var(--radius);
  background:var(--bg); color:var(--fg); font:inherit;
}
.today-num{ font-size:20px; font-weight:800; font-variant-numeric:tabular-nums; }
.today-lbl{ font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.today-penalty{ border-color:var(--danger); background:var(--danger-bg); cursor:pointer; }
.today-penalty .today-num, .today-penalty .today-lbl{ color:var(--danger); }
html.focus-mode .today-strip{ opacity:.35; }

/* ===== PENALTY BANNER ===== */
.penalty-banner{
  border:1px solid var(--danger); background:var(--danger-bg);
  border-radius:var(--radius); padding:18px 22px; margin-bottom:20px; max-width:640px;
}
.penalty-banner-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.penalty-banner-title{ font-size:13px; font-weight:800; letter-spacing:.06em; color:var(--danger); }
.penalty-banner-rows{ display:flex; flex-direction:column; gap:6px; margin-bottom:8px; }
.penalty-banner .penalty-row{ border:none; background:none; padding:4px 0; }
.penalty-banner .penalty-row > span:first-child{ display:flex; align-items:center; }

/* ===== MODAL FORM ===== */
.modal-form{ text-align:left; position:relative; display:flex; flex-direction:column; gap:6px; max-height:92vh; overflow-y:auto; padding:36px; }
.modal-close{
  position:absolute; top:14px; right:14px; background:none; border:none;
  font-size:18px; color:var(--muted-2); cursor:pointer; padding:6px; border-radius:6px;
}
.modal-close:hover{ color:var(--fg); background:var(--surface); }

/* ===== FOCUS SLIDER ===== */
.focus-slider-wrap{ margin:22px 0 6px; }
.focus-pct-value{ font-size:56px; font-weight:900; font-variant-numeric:tabular-nums; line-height:1; margin-bottom:16px; }
.focus-slider{
  -webkit-appearance:none; appearance:none; width:100%; height:10px; border-radius:999px;
  background:linear-gradient(to right, var(--fg) 0 var(--pct,70%), var(--line) var(--pct,70%) 100%);
  outline:none; cursor:pointer;
}
.focus-slider::-webkit-slider-thumb{
  -webkit-appearance:none; width:28px; height:28px; border-radius:50%;
  background:var(--bg); border:3px solid var(--fg); cursor:grab;
}
.focus-slider::-moz-range-thumb{
  width:24px; height:24px; border-radius:50%;
  background:var(--bg); border:3px solid var(--fg); cursor:grab;
}
.slider-ends{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin-top:8px; }
.focus-pct-detail{ margin-top:16px; font-size:15px; color:var(--muted); }
.focus-pct-detail b{ color:var(--fg); }

/* ===== STATS ===== */
.range-toggle{ width:auto; }
.range-toggle .toggle-btn{ padding:8px 14px; font-size:13px; white-space:nowrap; flex:none; }
.stat-tiles{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:14px; margin-bottom:16px; }
.stat-tile{ border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; }
.stat-lbl{ font-size:12px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.stat-num{ font-size:30px; font-weight:800; margin-top:4px; font-variant-numeric:tabular-nums; }
.stat-sub{ font-size:13px; color:var(--muted-2); }
.chart-card{ border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; margin-bottom:16px; }
.chart-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.chart-grid .chart-card{ margin-bottom:0; }
.chart-head{ display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.chart-title{ font-size:16px; font-weight:800; margin:0 0 10px; }
.chart-head .chart-title{ margin:0; }
.chart-sub{ font-size:13px; color:var(--muted); margin:-6px 0 8px; }
.chart{ margin-top:10px; }
.chart-svg{ width:100%; height:auto; display:block; overflow:visible; }
.chart-svg .grid{ stroke:var(--line); stroke-width:1; }
.chart-svg .axis{ fill:var(--muted); font-size:12px; font-weight:600; }
.chart-svg .bar-focused{ fill:var(--fg); }
.chart-svg .bar-unfocused{ fill:var(--muted-2); opacity:.55; }
.chart-svg .bar-hour{ fill:var(--muted-2); }
.chart-svg .hit{ cursor:default; }
.chart-svg .hit:hover{ fill:var(--fg); fill-opacity:.04; }
.chart-empty{ color:var(--muted-2); font-size:14px; padding:28px 0; text-align:center; }
.chart-note{ font-size:14px; color:var(--muted); margin-top:8px; }
.chart-note b{ color:var(--fg); }
.legend{ display:flex; gap:16px; font-size:13px; color:var(--muted); }
.legend-item{ display:flex; align-items:center; gap:6px; }
.legend-swatch{ width:12px; height:12px; border-radius:3px; display:inline-block; }
.sw-focused{ background:var(--fg); }
.sw-unfocused{ background:var(--muted-2); opacity:.55; }
.hbar-row{ display:grid; grid-template-columns:130px 1fr 64px; align-items:center; gap:12px; padding:7px 0; }
.hbar-label{ display:flex; align-items:center; font-size:14px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.hbar-track{ height:10px; }
.hbar-fill{ height:100%; border-radius:0 4px 4px 0; }
.hbar-val{ font-size:14px; text-align:right; font-variant-numeric:tabular-nums; }
.chart-tip{
  position:fixed; z-index:300; pointer-events:none;
  background:var(--fg); color:var(--bg); font-size:13px; line-height:1.5;
  padding:8px 12px; border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.18);
  white-space:nowrap;
}

/* ===== SETTINGS ===== */
.settings-grid{ display:grid; grid-template-columns:1fr 1fr; gap:24px; align-items:start; }
.switch-row{ display:flex; justify-content:space-between; align-items:center; gap:16px; padding:10px 0; cursor:pointer; }
.switch-row > span{ display:flex; flex-direction:column; }
.switch-title{ font-size:16px; }
.switch-row .hint{ font-size:13px; }
.switch{
  -webkit-appearance:none; appearance:none; width:48px; height:28px; border-radius:999px;
  background:var(--line); position:relative; cursor:pointer; flex-shrink:0; transition:background .15s;
}
.switch::after{
  content:''; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%;
  background:var(--bg); box-shadow:0 1px 3px rgba(0,0,0,.25); transition:transform .15s;
}
.switch:checked{ background:var(--fg); }
.switch:checked::after{ transform:translateX(20px); }
.section-gap{ margin-top:26px; }
.btn-row{ display:flex; gap:10px; margin-top:10px; }
.btn-row .btn{ flex:1; }

/* ===== STATS v2 (minimal) ===== */
.seg{ display:flex; background:var(--surface); border:1px solid var(--line); border-radius:999px; padding:3px; }
.seg-btn{
  border:none; background:transparent; color:var(--muted);
  padding:7px 16px; border-radius:999px; cursor:pointer;
  font-size:13px; font-weight:800; letter-spacing:.04em;
  transition:background .15s, color .15s;
}
.seg-btn.active{ background:var(--fg); color:var(--bg); }

.st-hero{
  display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap;
  padding:8px 4px 26px;
}
.hero-num{ font-size:64px; font-weight:900; letter-spacing:-0.03em; line-height:1; font-variant-numeric:tabular-nums; }
.hero-sub{ margin-top:10px; font-size:14px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; display:flex; align-items:center; gap:10px; }
.delta{ font-size:13px; padding:3px 9px; border-radius:999px; letter-spacing:0; text-transform:none; }
.delta.up{ color:#1f7a50; background:#e6f4ec; }
.delta.down{ color:var(--danger); background:var(--danger-bg); }
.hero-side{ display:flex; align-items:center; gap:30px; }
.hero-ring{ position:relative; width:84px; height:84px; }
.hero-ring svg{ width:100%; height:100%; transform:rotate(-90deg); }
.ring-track{ fill:none; stroke:var(--line); stroke-width:7; }
.ring-fill{ fill:none; stroke:var(--fg); stroke-width:7; stroke-linecap:round; transition:stroke-dashoffset .6s ease; }
.ring-num{ position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:19px; font-weight:800; font-variant-numeric:tabular-nums; }
.hero-stat{ display:flex; flex-direction:column; align-items:flex-start; }
.hero-stat b{ font-size:26px; font-weight:800; font-variant-numeric:tabular-nums; line-height:1.1; }
.hero-stat span{ font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.08em; }

.st-card{ border:1px solid var(--line); border-radius:14px; padding:18px 20px 16px; margin-bottom:16px; }
.st-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.st-grid .st-card{ margin-bottom:16px; }
.st-label{ font-size:11px; font-weight:800; color:var(--muted); letter-spacing:.12em; margin-bottom:14px; }

.chart-svg .baseline{ stroke:var(--line); stroke-width:1; }
.chart-svg .bar-today{ fill:var(--fg); }
.chart-svg .bar-focused{ fill:var(--fg); opacity:.78; }
.chart-svg .avg-line{ stroke:var(--fg); stroke-width:1.5; stroke-dasharray:4 4; opacity:.55; }
.chart-svg .axis-strong{ fill:var(--fg); font-weight:800; }

.heat-svg{ width:100%; height:auto; display:block; }
.heat{ fill:var(--fg); }
.heat.l0, .heat-key.l0{ fill:var(--line); background:var(--line); }
.heat.l1{ opacity:.22; } .heat.l2{ opacity:.45; } .heat.l3{ opacity:.7; } .heat.l4{ opacity:1; }
.heat.l0{ opacity:1; }
.heat.today{ stroke:var(--fg); stroke-width:1.5; }
.heat.best{ stroke:var(--fg); stroke-width:2; }
.heat-legend{ display:flex; align-items:center; gap:4px; margin-top:12px; font-size:11px; font-weight:700; color:var(--muted); }
.heat-legend span{ margin:0 4px; }
.heat-key{ width:12px; height:12px; border-radius:3px; display:inline-block; background:var(--fg); }
.heat-key.l1{ opacity:.22; } .heat-key.l2{ opacity:.45; } .heat-key.l3{ opacity:.7; }

.best-num{ font-size:34px; font-weight:900; letter-spacing:-0.02em; margin-bottom:14px; font-variant-numeric:tabular-nums; line-height:1; }
.best-num span{ font-size:16px; color:var(--muted); font-weight:700; margin-left:4px; letter-spacing:0; }
.best-num.muted{ color:var(--muted-2); }

.share-bar{ display:flex; gap:2px; height:12px; border-radius:6px; overflow:hidden; margin-bottom:14px; }
.share-seg{ min-width:3px; height:100%; }
.ls-list{ display:flex; flex-direction:column; }
.ls-row{ display:grid; grid-template-columns:auto 1fr auto auto; align-items:center; gap:12px; padding:9px 0; border-top:1px solid var(--line); font-size:15px; }
.ls-row:first-child{ border-top:none; }
.ls-name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ls-pct{ color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.ls-time{ font-weight:800; font-variant-numeric:tabular-nums; min-width:62px; text-align:right; }
.ls-row .dot{ margin-right:0; }

/* ===== FRIENDS ===== */
.friends{ max-width:720px; }
.my-nick{ font-size:15px; font-weight:800; color:var(--muted); }
.fr-add{ display:flex; align-items:center; gap:8px; position:relative; }
.fr-add .big-input{ padding-left:34px; }
.fr-at{ position:absolute; left:14px; font-size:18px; color:var(--muted-2); pointer-events:none; }
.fr-add .btn{ padding:12px 20px; flex-shrink:0; }
.fr-msg{ min-height:22px; font-size:13px; font-weight:700; color:var(--danger); margin:6px 2px 10px; }
.fr-msg.ok{ color:#1f7a50; }
.fr-card{ border:1px solid var(--line); border-radius:14px; padding:18px 20px 12px; margin-bottom:16px; }
.fr-pick .fr-msg{ margin-bottom:0; }
.fr-muted{ opacity:.7; }
.fr-row{ display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-top:1px solid var(--line); }
.fr-row:first-of-type{ border-top:none; }
.fr-name{ font-size:16px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fr-actions{ display:flex; gap:6px; }
.icon-btn{
  width:34px; height:34px; border-radius:50%; border:1px solid var(--line);
  background:var(--bg); color:var(--fg); cursor:pointer; font-size:15px; font-weight:800;
  display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
  transition:background .15s, border-color .15s, color .15s;
}
.icon-btn:hover{ border-color:var(--fg); }
.icon-btn.ok{ background:var(--fg); color:var(--bg); border-color:var(--fg); }
.icon-btn.subtle{ border:none; width:28px; height:28px; color:var(--muted-2); font-size:13px; }
.icon-btn.subtle:hover{ color:var(--danger); background:var(--danger-bg); }

.fr-rank-row, .fr-cols{
  display:grid; grid-template-columns:28px 1fr 64px 48px 74px 28px;
  align-items:center; gap:10px;
}
.fr-rank-row{ padding:10px 0; border-top:1px solid var(--line); }
.fr-rank-row:first-of-type{ border-top:none; }
.fr-rank-row.you .fr-name{ color:var(--fg); }
.fr-rank-row.you{ background:linear-gradient(90deg, var(--surface), transparent); border-radius:8px; }
.fr-pos{ font-size:15px; font-weight:900; color:var(--muted-2); text-align:center; font-variant-numeric:tabular-nums; }
.fr-rank-row:first-of-type .fr-pos{ color:var(--fg); }
.fr-who{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.fr-meter{ height:4px; border-radius:2px; background:var(--line); overflow:hidden; }
.fr-meter span{ display:block; height:100%; background:var(--fg); border-radius:2px; }
.fr-small{ font-size:13px; color:var(--muted); text-align:right; font-variant-numeric:tabular-nums; }
.fr-week{ font-size:17px; font-weight:900; text-align:right; font-variant-numeric:tabular-nums; }
.fr-cols{ padding:6px 0 2px; font-size:10px; font-weight:800; color:var(--muted-2); text-transform:uppercase; letter-spacing:.08em; }
.fr-cols span{ text-align:right; }
.fr-x-space{ width:28px; }

/* ===== MICRO-INTERACTIONS (fx.js) ===== */
:root{ --ease-out:cubic-bezier(.22,1,.36,1); --ease-spring:cubic-bezier(.34,1.56,.64,1); }
.fx-ribbons{ position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; }
.fx-spark{ position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:400; }
#topnav, #app{ position:relative; z-index:1; }
#topnav{ z-index:150; }

/* views ease in */
.view.active{ animation:fxViewIn .45s var(--ease-out) both; }
@keyframes fxViewIn{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }

/* buttons: soft press + lift */
.btn, .chip, .mode-seg-btn, .seg-btn, .step-btn, .tab, .icon-btn, .sound-btn, .lesson-pill{
  transition-timing-function:var(--ease-out) !important;
}
.btn:active:not(:disabled), .chip:active:not(:disabled), .mode-seg-btn:active:not(:disabled),
.seg-btn:active, .tab:active, .icon-btn:active, .sound-btn:active{ transform:scale(.96); }

/* stats entry */
.fx-rise{ animation:fxRise .6s var(--ease-out) both; }
@keyframes fxRise{ from{ opacity:0; transform:translateY(12px); } to{ opacity:1; transform:none; } }
.chart-svg path.fx-grow{ transform-box:fill-box; transform-origin:50% 100%; animation:fxGrow .8s var(--ease-out) both; }
@keyframes fxGrow{ from{ transform:scaleY(0); } to{ transform:scaleY(1); } }
rect.fx-pop{ transform-box:fill-box; transform-origin:center; animation:fxPop .5s var(--ease-spring) both; }
@keyframes fxPop{ from{ opacity:0; transform:scale(.4); } to{ transform:scale(1); } }
.share-seg.fx-wipe{ transform-origin:left center; animation:fxWipe .8s var(--ease-out) both; }
@keyframes fxWipe{ from{ transform:scaleX(0); } to{ transform:scaleX(1); } }

/* home gauge eases instead of ticking linearly */
.gauge-fill, .gauge-goal-fill{ transition:stroke-dashoffset .9s var(--ease-out), stroke .3s; }
.marker-g{ transition:transform .9s var(--ease-out); }

@media (prefers-reduced-motion: reduce){
  .view.active, .fx-rise, .fx-grow, .fx-pop, .fx-wipe{ animation:none !important; }
}

/* ===== AUTH SCREEN ===== */
.auth-screen{
  position:fixed; inset:0; z-index:250; background:var(--bg);
  display:flex; align-items:center; justify-content:center;
  padding:24px; overflow-y:auto;
}
.auth-box{ width:100%; max-width:400px; display:flex; flex-direction:column; align-items:stretch; }
.auth-brand{ font-size:26px; margin-bottom:34px; }
.auth-form{ display:flex; flex-direction:column; gap:6px; }
.auth-form .card-title{ margin-bottom:0; }
.auth-form > .hint{ margin:0 0 10px; }
.auth-msg{ font-size:14px; color:var(--danger); background:var(--danger-bg); padding:10px 12px; border-radius:var(--radius-sm); margin-top:10px; }
.auth-msg.ok{ color:#1f6f52; background:#e7f5ee; }
.auth-links{ display:flex; justify-content:space-between; gap:10px; margin-top:12px; flex-wrap:wrap; }
.link-btn{ background:none; border:none; padding:4px 0; color:var(--muted); font-size:14px; cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
.link-btn:hover{ color:var(--fg); }
.auth-skip{ margin-top:34px; align-self:center; text-decoration:none; }
.google-btn{ display:flex; align-items:center; justify-content:center; gap:10px; margin-top:6px; border-color:var(--line); }
.google-btn:hover:not(:disabled){ background:var(--surface); color:var(--fg); border-color:var(--fg); }
.google-g{ width:18px; height:18px; }
.auth-divider{ display:flex; align-items:center; gap:12px; color:var(--muted-2); font-size:13px; margin:14px 0 4px; }
.auth-divider::before, .auth-divider::after{ content:''; flex:1; height:1px; background:var(--line); }

/* ===== ACCOUNT CARD ===== */
.account-row{ display:flex; align-items:center; gap:14px; margin:6px 0 4px; }
.account-avatar{
  width:44px; height:44px; border-radius:50%; flex-shrink:0;
  background:var(--fg); color:var(--bg);
  display:flex; align-items:center; justify-content:center; font-size:19px; font-weight:800;
}
.account-info{ min-width:0; flex:1; }
.account-top{ margin-bottom:24px; padding:22px 26px; }
.account-top .account-row{ margin:0; }
.account-top .account-avatar{ width:56px; height:56px; font-size:23px; }
.account-actions{ display:flex; gap:8px; flex-shrink:0; }
.account-actions .btn{ padding:10px 16px; font-size:13px; }
.nick-slot{ display:flex; align-items:center; gap:4px; min-height:30px; }
.nick{ font-size:22px; font-weight:900; letter-spacing:-0.01em; }
.nick-edit{ display:flex; align-items:center; gap:6px; position:relative; }
.nick-edit .big-input{ padding:7px 10px 7px 30px; font-size:17px; width:200px; }
.nick-edit .fr-at{ left:11px; font-size:16px; }
.nick-slot + .account-email{ margin-top:2px; }
.nick-slot .fr-msg{ margin:0 0 0 8px; min-height:0; }
.account-email{ font-size:16px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sync-status{ display:flex; align-items:center; gap:7px; font-size:13px; color:var(--muted); }
.sync-dot{ width:8px; height:8px; border-radius:50%; background:var(--muted-2); flex-shrink:0; }
.sync-status.synced .sync-dot{ background:#26a269; }
.sync-status.syncing .sync-dot{ background:var(--fg); animation:wave 1s ease-in-out infinite; }
.sync-status.offline .sync-dot{ background:#e5a50a; }

/* ===== RESPONSIVE: tablet ===== */
@media (max-width: 1100px){
  #topnav{ padding:18px 32px; }
  #app{ padding:18px 28px 24px; }
  .tabs{ gap:10px; }
  .stat-tiles{ grid-template-columns:repeat(2, minmax(0,1fr)); }
}

/* ===== RESPONSIVE: phone — scrolling page + bottom tab bar ===== */
@media (max-width: 760px){
  html,body{ overflow:auto; height:auto; min-height:100%; font-size:17px; }
  body{ padding-bottom:calc(72px + env(safe-area-inset-bottom)); }
  #topnav{ padding:14px 18px 6px; padding-top:calc(14px + env(safe-area-inset-top)); gap:12px; }
  .sound-btn{ width:40px; height:40px; }
  .nav-right{ gap:10px; }
  .home-row{ flex-direction:column; gap:18px; }
  .home .focus-state{ top:-8px; }
  .home-row .gauge-wrap{ flex:none; width:100%; max-width:300px; }
  .home-controls{ width:100%; max-width:320px; }
  .home-controls #timerDisplay{ font-size:24px; }
  .tab-lock{ top:0; left:calc(50% - 20px); transform:none; width:13px; height:13px; }
  .brand{ flex-shrink:1; min-width:0; font-size:15px; }
  .theme-picker{ gap:5px; }
  .theme-dot{ width:16px; height:16px; }
  .sound-icon{ width:21px; height:21px; }
  .brand{ flex-direction:row; flex-wrap:wrap; gap:0 6px; font-size:16px; }
  .tabs{
    position:fixed; left:0; right:0; bottom:0; z-index:150;
    justify-content:space-around; gap:0;
    background:var(--bg); border-top:1px solid var(--line);
    padding:6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tab{ flex-direction:column; gap:2px; padding:6px 4px; font-size:10px; letter-spacing:.04em; flex:1; border-radius:10px; position:relative; animation:none; }
  .tab .tab-icon{ display:block; }
  .tab.active{ background:transparent; color:var(--fg); }
  .tab:not(.active){ color:var(--muted-2); }
  .tab .badge{ position:absolute; top:2px; right:calc(50% - 22px); min-width:16px; height:16px; font-size:10px; padding:0 4px; background:var(--danger); color:#fff; }

  #app{ padding:8px 18px 18px; flex:none; }
  .view{ flex:none; }
  .scroll-area{ overflow:visible; }
  .view-title{ font-size:21px; }
  .focus-state{ font-size:24px; margin-bottom:6px; }
  .focus-state.focused{ font-size:30px; }
  .home-grid{ flex-direction:column; gap:14px; }
  .gauge-wrap{ max-width:260px; }
  .gauge-time{ font-size:40px; }
  .gauge-readout{ margin-top:8px; }
  .control-col{ max-width:none; width:100%; }
  #timerDisplay{ font-size:38px; }
  .toggle-btn{ padding:10px 4px; font-size:13px; }
  .today-strip{ display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .today-item{ min-width:0; padding:10px 8px; }
  .today-num{ font-size:18px; white-space:nowrap; }
  .today-lbl{ font-size:10px; white-space:nowrap; }

  .lesson-card{ width:100%; }
  .stat-tiles{ gap:10px; }
  .stat-tile{ padding:12px 14px; }
  .stat-num{ font-size:24px; }
  .chart-grid, .settings-grid, .st-grid{ grid-template-columns:1fr; }
  .st-grid{ gap:0; }
  .hero-num{ font-size:52px; }
  .st-hero{ gap:18px; padding-bottom:18px; }
  .hero-side{ width:100%; justify-content:space-between; gap:12px; }
  .hero-ring{ width:72px; height:72px; }
  .st-card{ padding:16px; }
  .fr-card{ padding:14px 14px 8px; }
  .account-top{ padding:18px; }
  .account-top .account-row{ flex-wrap:wrap; }
  .account-actions{ width:100%; }
  .account-actions .btn{ flex:1; }
  .nick-edit .big-input{ width:150px; }
  .fr-rank-row, .fr-cols{ grid-template-columns:22px 1fr 52px 34px 60px 24px; gap:6px; }
  .fr-week{ font-size:15px; }
  .fr-small{ font-size:12px; }
  .chart-card{ padding:14px; }
  .hbar-row{ grid-template-columns:1fr auto; row-gap:6px; }
  .hbar-track{ grid-column:1 / -1; grid-row:2; }
  .tab.active .badge{ background:var(--danger); color:#fff; }
  .add-card{ padding:22px; }

  .modal{ align-items:flex-end; }
  .modal-box{ width:100%; max-width:none; border-radius:18px 18px 0 0; padding:28px 22px calc(28px + env(safe-area-inset-bottom)); }
  .modal-form{ max-height:88vh; }
  .motivation-text{ font-size:21px; }
  .finish-title{ font-size:32px; }
}

/* privacy links */
.auth-privacy{ align-self:center; margin-top:10px; font-size:12px; text-decoration:none; color:var(--muted-2); }
.settings-privacy{ display:block; text-align:center; margin-top:14px; font-size:12px; color:var(--muted-2); text-decoration:none; }

/* friends tab: a small green dot when a friend/group request is waiting */
#friendsBadge, .tab.active #friendsBadge, html.focus-mode #friendsBadge{
  min-width:0; width:9px; height:9px; padding:0; font-size:0; border-radius:50%;
  background:#22c55e !important; box-shadow:0 0 0 2px var(--bg); opacity:1 !important;
}
.req-dot{ display:inline-block; width:8px; height:8px; border-radius:50%; background:#22c55e; margin-right:8px; vertical-align:middle; }

/* ===== FRIENDS v2: boards, groups, friend stats ===== */
.fr-board-head{ display:flex; justify-content:flex-end; margin:4px 0 12px; }
.fr-rank-row.clickable{ cursor:pointer; border-radius:10px; transition:background .2s var(--ease-out); }
.fr-rank-row.clickable:hover{ background:var(--surface); }
.fr-requests{ border-color:#22c55e; }
.fr-tag{ font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:2px 7px; margin-right:8px; vertical-align:middle; }
.fr-groups-head{ display:flex; justify-content:space-between; align-items:center; margin:22px 0 10px; }
.fr-groups-head .st-label{ margin:0; }
.fr-new-group{ padding:8px 14px; font-size:12px; border-width:1px; }
.fr-add-plain .big-input{ padding-left:14px; }
.fr-group-top{ display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.fr-group-name{ font-size:18px; font-weight:800; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fr-group-count{ font-size:12px; font-weight:800; color:var(--muted); border:1px solid var(--line); border-radius:999px; padding:2px 9px; }
.fr-invited{ font-size:13px; color:var(--muted); margin:8px 0 2px; }
.fr-invited span{ color:var(--muted-2); }
.fr-invite{ margin-top:10px; }
.fr-invite-select{ width:100%; height:44px; font-size:14px; }

.fs-box{ max-width:880px; width:94%; max-height:90vh; overflow-y:auto; text-align:left; padding:28px 28px 20px; position:relative; }
.fs-head{ padding-right:44px; }
.fs-body{ margin-top:4px; }
@media (max-width: 760px){
  .fs-box{ width:100%; max-height:92vh; padding:22px 16px 16px; }
}

/* layer order: nav 150 < modals 300 < finish 320 < auth 330 < toast 350 < sparks 400 < tooltip 500 */
.modal{ z-index:300; }
.finish-modal{ z-index:320; }
.confetti-canvas{ z-index:321; }
.finish-box{ z-index:322; }
.auth-screen{ z-index:330; }
.toast{ z-index:350; }
.chart-tip{ z-index:500; }
