/* FocusWave — toolkityourlife.com/FocusWave/
   RiseWave's sibling: same type (Fraunces + Manrope), daytime palette. Two colours carry meaning everywhere:
   --focus (cool) for work, --rest (warm, RiseWave's amber) for breaks. */
:root {
  --bg: #0b1416; --panel: #111d20; --panel2: #18292d; --line: rgba(255, 255, 255, .1);
  --ink: #e6efec; --muted: #93a8a5; --focus: #5fe0c4; --rest: #ffb347; --danger: #ff9d9d;
  --display: "Fraunces", Georgia, serif; --text: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tab: 62px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--text); }
body { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 18px); }
[hidden] { display: none !important; }
a { color: var(--focus); }
h1, h2, p, dl, dd, ol, ul { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.vh, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 99; background: var(--focus); color: #04211b; padding: 8px 12px; border-radius: 8px; }
.muted { color: var(--muted); } .small { font-size: .9rem; } .tiny { font-size: .78rem; } .warn { color: var(--rest); }
code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: var(--panel2); padding: 1px 5px; border-radius: 5px; }

/* ---------- frame ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; position: relative; max-width: 640px; margin: 0 auto; }
.acct { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: .86rem; }
.acct-av { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--focus); color: #04211b; font-size: .72rem; overflow: hidden; }
.acct-av img { width: 100%; height: 100%; object-fit: cover; }
.acct-menu { position: absolute; right: 14px; top: 100%; z-index: 30; min-width: 210px; padding: 8px; background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5); }
.acct-menu p { padding: 6px 10px; font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.acct-menu button { width: 100%; text-align: left; padding: 10px; background: none; border: 0; border-radius: 9px; cursor: pointer; }
.acct-menu button:hover { background: rgba(255, 255, 255, .07); }
.view { max-width: 600px; margin: 0 auto; padding: 4px 16px 24px; outline: none; }
.foot { max-width: 600px; margin: 0 auto; padding: 8px 16px 0; color: var(--muted); font-size: .78rem; text-align: center; }
.foot p + p { margin-top: 6px; } .foot a { color: inherit; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: rgba(11, 20, 22, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; max-width: 150px; height: var(--tab); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current] { color: var(--focus); }

/* breaks wear the warm colour: the main button and round dots follow the phase */
body:has(.stage[data-phase=short]) .controls .btn.primary, body:has(.stage[data-phase=long]) .controls .btn.primary { background: var(--rest); border-color: var(--rest); color: #2a1700; }

.mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 10px); z-index: 19; display: flex; align-items: baseline; gap: 10px; padding: 9px 18px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--focus); color: var(--ink); text-decoration: none; font-size: .86rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.mini[data-phase=rest] { border-color: var(--rest); }
.mini b { font-family: var(--display); font-size: 1.1rem; font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + env(safe-area-inset-bottom) + 62px); z-index: 40; max-width: min(92vw, 420px); padding: 11px 16px; border-radius: 12px; background: #1d3338; border: 1px solid var(--line); font-size: .9rem; text-align: center; box-shadow: 0 12px 30px rgba(0, 0, 0, .5); }
.toast.err { border-color: var(--danger); }

/* ---------- focus view ---------- */
.hero { text-align: center; padding: 2px 0 0; }
.brand { font: 600 2rem/1.1 var(--display); letter-spacing: -.02em; }
.brand span { color: var(--focus); }
.tag { color: var(--muted); font-size: .92rem; margin-top: 4px; }

.stage { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin: 6px auto 4px; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 44px; pointer-events: none; }
.phase { font-weight: 700; font-size: .95rem; color: var(--focus); }
.stage[data-phase=short] .phase, .stage[data-phase=long] .phase { color: var(--rest); }
.time { font: 600 clamp(3.2rem, 19vw, 4.9rem)/1.05 var(--display); letter-spacing: -.02em; margin: 2px 0; }
.time i { display: inline-block; width: .6em; text-align: center; font-style: normal; }
.time i.c { width: .3em; position: relative; top: -.06em; }
.time .words { font-size: .62em; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: .88rem; }

.dots { list-style: none; display: flex; justify-content: center; gap: 8px; margin: 2px 0 14px; }
.dots li { width: 22px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .13); }
.dots li.done { background: var(--focus); } .dots li.now { background: linear-gradient(90deg, var(--focus) 50%, rgba(255, 255, 255, .13) 50%); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--muted); font-weight: 600; margin: 14px 0; }
.field input, .field select, .field textarea, .row select { width: 100%; padding: 12px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 500; font-size: 1rem; }
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--focus); }
.field input::placeholder, .field textarea::placeholder { color: #6f8582; }
.goal input { font-size: 1.05rem; }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 520px) { .presets { grid-template-columns: repeat(4, 1fr); } }
.presets button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 11px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left; }
.presets b { font-size: .98rem; } .presets span { color: var(--muted); font-size: .82rem; }
.presets button[aria-checked=true] { border-color: var(--focus); background: rgba(95, 224, 196, .1); }
.presets button[aria-checked=true] span { color: var(--focus); }

.plan { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.field.sm { margin: 12px 0 0; }
.stepper { display: flex; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 46px; height: 46px; background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.stepper button:hover { background: rgba(255, 255, 255, .06); }
.stepper output { flex: 1; text-align: center; font: 600 1.15rem var(--display); color: var(--ink); }
.say { color: var(--muted); font-size: .92rem; margin: 12px 0 14px; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 13px; background: var(--panel2); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: rgba(255, 255, 255, .28); }
.btn.primary { background: var(--focus); border-color: var(--focus); color: #04211b; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { width: 100%; padding: 16px; font-size: 1.08rem; border-radius: 16px; }
.btn.sm { padding: 8px 13px; font-size: .86rem; border-radius: 10px; }
.btn.quiet { background: none; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .6; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--focus); text-decoration: underline; cursor: pointer; font-size: inherit; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; }
.controls .big { grid-column: 1 / -1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row select { width: auto; flex: 1; min-width: 120px; }

.soundline { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.sl-k { color: var(--muted); font-weight: 600; } .sl-v { flex: 1; min-width: 0; } .sl-go { color: var(--focus); font-weight: 700; }
.hint, .note { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }
.note { border-left: 2px solid var(--line); padding-left: 10px; }
.works { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin: 18px 0 0; font-size: .82rem; }
.works a { color: var(--muted); }
.chore-line { margin: 14px 0; text-align: center; color: var(--muted); } .chore-line b { color: var(--ink); }
.volrow { display: flex; align-items: center; gap: 12px; margin: 10px 0; color: var(--muted); font-size: .86rem; font-weight: 600; }
.volrow input { flex: 1; }
input[type=range] { accent-color: var(--focus); min-height: 28px; }
input[type=checkbox] { accent-color: var(--focus); width: 18px; height: 18px; }

.banner { display: block; width: 100%; margin: 0 0 10px; padding: 12px 14px; border-radius: 13px; background: rgba(255, 179, 71, .1); border: 1px solid rgba(255, 179, 71, .45); color: var(--ink); font-size: .9rem; text-align: left; }
button.banner { cursor: pointer; font-weight: 600; }
/* floats over the page: it disappears on the first tap, so it must not move the buttons under that tap */
.banner.tap { position: fixed; z-index: 25; top: 64px; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 24px)); margin: 0; background: #2b2616; box-shadow: 0 14px 34px rgba(0, 0, 0, .55); }
.banner.sync { background: rgba(95, 224, 196, .08); border-color: rgba(95, 224, 196, .4); margin-top: 6px; } .banner.sync .row { margin-top: 10px; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 16px 0; }
.card h2, .page-h { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
.card h2 { font-size: 1.22rem; margin-bottom: 10px; }
.card p + p { margin-top: 10px; }
.page-h { font-size: 1.85rem; margin: 4px 0 2px; }
.lede { color: var(--muted); margin-bottom: 4px; }
.quote { font: 400 1.1rem/1.35 var(--display); margin-bottom: 12px; }
.how p { color: var(--muted); font-size: .93rem; } .how b { color: var(--ink); }

.seg { display: flex; padding: 3px; gap: 3px; background: var(--bg); border: 1px solid var(--line); border-radius: 13px; }
.seg button { flex: 1; padding: 10px 6px; background: none; border: 0; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: .88rem; cursor: pointer; }
.seg button[aria-checked=true] { background: var(--panel2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--focus); }
.seg.sm { display: inline-flex; } .seg.sm button { padding: 7px 12px; font-size: .82rem; flex: none; }
.s-body .seg.sm { flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip { padding: 8px 13px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; font-weight: 600; font-size: .86rem; }
.chip small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.chip:hover, .chip.on { border-color: var(--focus); } .chip.on { background: rgba(95, 224, 196, .1); }
.grp { color: var(--muted); font-size: .82rem; font-weight: 600; margin-top: 14px; }
.slider { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.slider output { color: var(--ink); margin-left: 6px; }
.lr { color: var(--focus); min-width: 3.5em; }
.card .row { margin-top: 12px; }
.layers { display: grid; gap: 8px; }
@media (min-width: 520px) { .layers { grid-template-columns: 1fr 1fr; } }
.layer { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; }
.layer.on { border-color: rgba(95, 224, 196, .5); background: rgba(95, 224, 196, .06); }
.layer label { flex: 1; display: flex; align-items: center; gap: 9px; font-size: .93rem; cursor: pointer; min-height: 30px; }
.layer input[type=range] { width: 42%; max-width: 130px; }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch input { margin-top: 3px; flex: none; }
.switch small { display: block; color: var(--muted); font-size: .84rem; }
.partners { list-style: none; display: grid; gap: 12px; }
.partners span { display: block; color: var(--muted); font-size: .88rem; } .partners em { color: var(--focus); font-style: normal; }
.empty { text-align: center; padding: 36px 10px; color: var(--muted); } .empty .btn { margin-top: 16px; }

/* ---------- stats ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
@media (min-width: 520px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tiles > div { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.tiles dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
.tiles dd { font: 600 1.45rem/1.2 var(--display); margin-top: 2px; }
.tiles p { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.lead { font-size: 1rem; } .lead b { color: var(--focus); }

.chart { position: relative; height: 170px; margin: 30px 0 30px; }
.chart .grid span { position: absolute; left: 46px; right: 0; border-top: 1px solid var(--line); }
.chart .grid em { position: absolute; left: -46px; top: -.7em; width: 40px; text-align: right; font-style: normal; font-size: .7rem; color: var(--muted); }
.cols { position: absolute; left: 46px; right: 0; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 2px; }
.col, .hcol { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; min-width: 0; }
.col .bar, .hcol .bar { width: 100%; max-width: 24px; background: var(--focus); border-radius: 4px 4px 0 0; position: relative; }
.col:hover .bar, .col:focus .bar, .hcol:hover .bar, .hcol:focus .bar { filter: brightness(1.2); }
.col .bar b { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 4px; font-size: .72rem; white-space: nowrap; color: var(--ink); }
.x { position: absolute; top: 100%; margin-top: 6px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.col.today .x { color: var(--ink); font-weight: 700; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); z-index: 3; padding: 6px 10px; border-radius: 9px; background: #1d3338; border: 1px solid var(--line); font-size: .78rem; white-space: nowrap; pointer-events: none; }
.hours { position: relative; height: 84px; display: flex; align-items: flex-end; gap: 2px; margin: 34px 0 26px; border-bottom: 1px solid var(--line); }
.hcol .bar { opacity: .38; } .hcol.best .bar { opacity: 1; }
.hcol .x { left: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: 10px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .78rem; }
.print-only { display: none; }

.sessions { display: grid; gap: 8px; margin-top: 12px; }
.sess { border: 1px solid var(--line); border-radius: 12px; }
.sess summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; cursor: pointer; list-style: none; align-items: baseline; }
.sess summary::-webkit-details-marker { display: none; }
.s-when { color: var(--muted); font-size: .78rem; grid-column: 1 / -1; }
.s-goal { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.s-min { font-family: var(--display); font-weight: 600; }
.pill { justify-self: start; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--line); color: var(--muted); }
.pill.done { color: var(--focus); border-color: rgba(95, 224, 196, .5); }
.s-body { padding: 0 12px 12px; display: grid; gap: 10px; justify-items: start; }
.s-body .field { margin: 0; width: 100%; }
.exports { margin: 14px 0; }

/* ---------- ads ---------- */
.ad { margin: 18px 0; text-align: center; min-height: 0; }
.ad-label { display: block; font-size: .66rem; color: var(--muted); margin-bottom: 4px; }
.ad-ph { border: 1px dashed var(--line); border-radius: 12px; padding: 26px 10px; color: var(--muted); font-size: .82rem; }
body:has(.stage[data-phase=work]) .ad, body:has(.stage[data-phase=short]) .ad, body:has(.stage[data-phase=long]) .ad { display: none; }

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

/* ---------- print (stats) ---------- */
@media print {
  html, body { background: #fff; color: #000; }
  .top, .tabbar, .foot, .ad, .mini, .toast, .btn, .linkbtn, .seg, .sessions, .exports, tyl-nav, .tyl-account { display: none !important; }
  .view { max-width: none; padding: 0; }
  .card, .tiles > div { background: #fff; border-color: #bbb; break-inside: avoid; }
  .tiles dt, .tiles p, .muted, .x, .chart .grid em, .tbl th { color: #444; }
  .col .bar, .hcol .bar { background: #1c7f6b; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .col .bar b, .lead b, .col.today .x { color: #000; }
  .card:has(.sessions) { display: none; }
  .chart .grid span, .tbl th, .tbl td, .hours { border-color: #bbb; }
  .print-only { display: table; margin-top: 18px; } .print-only caption { text-align: left; padding-bottom: 8px; font-weight: 600; }
  body[data-tab]:not([data-tab=stats]) .view::before { content: "Open the Stats tab to print your sessions."; }
}
