@font-face {
  font-family:WaqtArabic; src:url('./fonts/arabic.woff2') format('woff2'); font-weight:100 900; font-display:swap;
  unicode-range:U+0600-06FF,U+0700-074F,U+0750-077F,U+0870-089F,U+08A0-08FF,U+200C-200F,U+FB50-FDFF,U+FE70-FEFf;
}
@font-face { font-family:WaqtInter; src:url('./fonts/inter.woff2') format('woff2');font-weight:100 900;font-display:swap; }
:root {
  --bg:#f6f5f2; --panel:#fff; --soft:#eeedf1; --line:#e7e5ec; --ink:#211e2b; --muted:#615d70;
  --chosen-accent:#5b4adb; --accent:#5b4adb; --accent-ink:#fff; --tint:#eeebff;
  --rest:#147d68; --rest-ink:#fff; --rest-tint:#e6f4ef; --danger:#9c2344;
  --radius:24px; --shadow:0 14px 50px #2b22490a; color-scheme:light;
  font-family:WaqtInter,"Segoe UI",system-ui,Tahoma,Arial,sans-serif; color:var(--ink); background:var(--bg);
  font-synthesis:none; line-height:1.55;
}
:root[lang="ar"] { font-family:WaqtArabic,WaqtInter,"Segoe UI",Tahoma,Arial,sans-serif; }
:root[data-theme="dark"], :root[data-theme="amoled"] {
  --bg:#15171b; --panel:#1e2026; --soft:#252833; --line:#333542; --ink:#f5f3fb; --muted:#b6b0c5;
  --accent:#c2baff; --accent-ink:#1c1740; --tint:#31284a;
  --rest:#84ddc4; --rest-ink:#09291f; --rest-tint:#173831; --danger:#ff97ac; --shadow:none; color-scheme:dark;
}
:root[data-theme="amoled"] { --bg:#000; --panel:#0c0c11; --soft:#171720; --line:#2a2935; }
@supports (color:color-mix(in srgb, red, white)) {
  :root {
    --accent:color-mix(in srgb,var(--chosen-accent) 65%,#231749);
    --tint:color-mix(in srgb,var(--accent) 9%,var(--panel));
  }
  :root:is([data-theme="dark"],[data-theme="amoled"]) {
    --accent:color-mix(in srgb,var(--chosen-accent) 32%,#f0edff);
    --tint:color-mix(in srgb,var(--accent) 16%,var(--panel));
  }
}
*, *::before, *::after { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; min-width:280px; min-height:100dvh; }
h1,h2,p { margin:0; }
a { color:inherit; text-decoration:none; }
button,input,select { font:inherit; }
button, a, select, input[type="range"], input[type="color"], summary { cursor:pointer; }
button[disabled], input[disabled] { pointer-events:none; opacity:.55; }
input,select { color:var(--ink); }
button { color:inherit; }
:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
h1:focus:not(:focus-visible) { outline:none; }
.skip-link { position:fixed; z-index:20; inset:10px auto auto 10px; transform:translateY(-180%); padding:8px 12px; background:var(--panel); }
.skip-link:focus { transform:none; }
.sr-only { position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
.mobile-brand { display:none; }
.shell { display:grid; grid-template-columns:224px minmax(0,1fr); min-height:100dvh; }
#rail { display:flex; flex-direction:column; gap:40px; position:sticky; top:0; height:100dvh; padding:30px 19px 20px; border-inline-end:1px solid var(--line); background:var(--panel); }
.wordmark { display:flex; min-height:52px; align-items:center; gap:12px; padding-inline:8px; font-size:1.6rem; font-weight:750; line-height:1.05; }
.wordmark small { display:block; font-size:.63rem; letter-spacing:.15em; color:var(--muted); margin-top:6px; }
.brand-icon { display:grid; place-items:center; width:44px; height:44px; color:var(--accent-ink); background:var(--accent); border-radius:14px; }
.brand-icon svg { height:25px; width:25px; }
nav { display:grid; gap:5px; }
nav a { display:flex; min-height:48px; align-items:center; gap:11px; border-radius:12px; padding:8px 12px; color:var(--muted); font-size:1rem; font-weight:600; white-space:nowrap; }
nav a:hover, nav a[aria-current] { background:var(--tint); color:var(--accent); }
.sidebar-bottom { margin-block-start:auto; display:flex; align-items:center; gap:8px; padding:10px 8px; font-size:.83rem; color:var(--muted); }
.status-dot { width:7px;height:7px;border-radius:100%;background:var(--muted);flex:none; }
.status-dot[data-ready] { background:var(--rest); }
main { padding:34px clamp(22px,4vw,58px) 38px; max-width:1470px; width:100%; margin-inline:auto; min-width:0; }
h1 { font-size:clamp(1.8rem,3.7vw,2.75rem); font-weight:740; line-height:1.24; letter-spacing:-.024em; margin-block-end:22px; }
h2 { font-size:1.13rem; font-weight:720; }
.page-heading,.timer-head { display:flex; gap:12px; justify-content:space-between; align-items:center; flex-wrap:wrap; margin-block-end:20px; }
.timer-head h1,.page-heading h1 { margin:0; }
.timer-tools,.action-row,.segmented,.timer-controls,.focus-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.panel { background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); min-width:0; }
.pad { padding:clamp(16px,3vw,28px); margin-block-end:16px; }
.pad > * + * { margin-block-start:13px; }
.panel-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px 12px; }
.muted,small { color:var(--muted); }
small { font-size:.84rem; }
.timer-layout { display:grid; grid-template-columns:minmax(0,1fr) minmax(230px,.49fr); gap:19px; align-items:start; }
.timer-side { display:grid; gap:12px; }
.timer-card { min-height:530px; display:grid; justify-items:center; align-content:start; gap:15px; padding:24px; color:var(--ink); }
.timer-card[data-phase="focus"] { --phase:var(--accent); --phase-ink:var(--accent-ink); --phase-bg:var(--tint); }
.timer-card:not([data-phase="focus"]) { --phase:var(--rest); --phase-ink:var(--rest-ink); --phase-bg:var(--rest-tint); }
.timer-top { display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; }
.phase-pill,.round-tag,.tag { display:inline-flex; align-items:center; justify-content:center; gap:8px; border-radius:99px; padding:5px 11px; background:var(--soft); color:var(--muted); font-size:.9rem; font-weight:650; }
.phase-pill { background:var(--phase-bg); color:var(--phase); }
.phase-pill i { width:7px;height:7px;background:currentColor;border-radius:100%; }
.face { position:relative; display:grid; place-items:center; min-height:286px; width:min(100%,340px); margin-block:8px 2px; }
.time-digits { font-size:clamp(3.3rem,8vw,6.1rem); letter-spacing:-.075em; font-variant-numeric:tabular-nums; font-weight:730; line-height:1; text-indent:-.04em; }
.clock-phase { position:absolute; inset-block-start:68%; color:var(--muted); font-size:1rem; }
.face-circle { aspect-ratio:1; min-height:0; }
.dial { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.dial circle { fill:none; stroke-width:5; }
.dial-track { stroke:var(--soft); }
.dial-progress { stroke:var(--phase); stroke-linecap:round; transform:rotate(-90deg); transform-origin:50% 50%; }
.face-digital .time-digits,.face-minimal .time-digits { font-size:clamp(3.6rem,9vw,7rem); }
.face-bar { align-content:center; gap:30px; }
.face-bar .clock-phase { position:static; }
.time-bar { width:95%; height:10px; background:var(--soft); border-radius:99px; overflow:hidden; direction:ltr; }
.time-bar i { display:block; width:var(--remaining,100%); height:100%; background:var(--phase); border-radius:inherit; }
.flip-face { display:flex; align-items:center; gap:4px; font-variant-numeric:tabular-nums; font-size:clamp(2.1rem,6vw,4.4rem); font-weight:700; }
.flip-digit { display:grid; place-items:center; padding:1px .13em 4px; border-radius:10px; min-width:.68em; border:1px solid var(--line); background:linear-gradient(var(--soft) 48%,var(--line) 49% 50%,var(--soft) 51%); }
.analog-face { position:relative; width:178px; height:178px; border:1px solid var(--line); border-radius:50%; background:var(--phase-bg); }
.analog-face .tick { position:absolute; inset:11px 50% 11px auto; width:2px; transform:rotate(var(--angle)); background:linear-gradient(var(--muted) 8px,transparent 8px); }
.analog-face i { position:absolute; left:calc(50% - 1px); bottom:50%; transform-origin:50% 100%; transform:rotate(var(--angle,0deg)); border-radius:2px; background:var(--phase); }
#minute-hand { width:4px;height:47px; }
#second-hand { width:2px;height:66px; }
.analog-face b { position:absolute; top:calc(50% - 4px); left:calc(50% - 4px); border-radius:50%; width:8px;height:8px;background:var(--phase); }
.face-analog,.face-hourglass { align-content:center; gap:9px; }
.face-analog .time-digits,.face-hourglass .time-digits { font-size:2.6rem; }
.face-analog .clock-phase,.face-hourglass .clock-phase { position:static; color:var(--muted); }
.hourglass-art { display:block; width:118px; height:150px; }
.hourglass-art path,.sand-stream { fill:none;stroke:var(--phase);stroke-width:4;stroke-linecap:round; }
.hourglass-art path[clip-path] { stroke:none; }
.hourglass-art rect { fill:var(--phase); opacity:.75; }
.sand-stream { stroke-dasharray:1 9; stroke-width:3; animation:sand 1s linear infinite; }
@keyframes sand { to{stroke-dashoffset:-10} }
.btn { display:inline-flex; min-height:44px; align-items:center; justify-content:center; gap:7px; padding:7px 12px; font-size:.92rem; line-height:1.3; border:1px solid transparent; border-radius:11px; background:transparent; font-weight:650; text-align:center; }
.btn svg { flex:none; }
.btn:hover { background:var(--soft); }
.btn.primary { background:var(--accent);color:var(--accent-ink); }
.btn.primary:hover { filter:brightness(1.06); }
.btn.secondary { background:var(--soft); }
.btn.quiet { color:var(--muted); }
.btn.danger { color:var(--danger); }
.timer-start.btn { min-height:54px; min-width:152px; padding-inline:22px; background:var(--phase); color:var(--phase-ink); border-radius:15px; font-size:1.08rem; }
.timer-meta,.elapsed { display:flex; justify-content:center; flex-wrap:wrap; gap:4px 14px; color:var(--muted); text-align:center; font-size:.9rem; }
.timer-meta span:empty { display:none; }
.timer-meta time,.elapsed b { color:var(--ink); font-weight:700; margin-inline-start:4px; }
.timer-more { position:relative; }
.timer-more summary { display:grid; place-items:center; width:44px; height:44px; line-height:1; border-radius:11px; background:var(--soft); list-style:none; }
.timer-more[open] > div { position:absolute; z-index:3; inset-inline-end:0; bottom:calc(100% + 8px); min-width:155px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:5px; display:grid; }
.side-plan,.goal-panel { padding:15px; }
.side-plan > * + *, .goal-panel > * + * { margin-block-start:9px; }
.side-plan .panel-head .btn { padding-inline:7px; }
.timeline summary { display:flex; align-items:center; gap:6px; justify-content:space-between; padding:14px 16px; font-weight:700; list-style:none; }
.timeline summary span { color:var(--muted); font-size:.89rem; font-weight:500; }
.timeline summary::before { content:'⌄'; color:var(--accent); }
.timeline:not([open]) summary::before { transform:rotate(-90deg); }
.timeline-body { padding:0 13px 13px; }
.plan-summary { display:grid; grid-template-columns:1fr 1fr; gap:6px; border-radius:10px; background:var(--soft); padding:8px; }
.plan-summary span,.plan-summary strong { display:block; text-align:center; font-size:.9rem; }
.plan-summary span { color:var(--muted); font-size:.84rem; }
.timeline-list,.items,.value-list { margin:10px 0 0; padding:0; list-style:none; }
.timeline-list { max-height:266px; overflow:auto; }
.timeline-list li { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:8px; padding:7px 8px; border-radius:8px; color:var(--muted); font-size:.9rem; }
.timeline-list li.current { color:var(--ink); background:var(--tint); }
.phase-dot { width:8px;height:8px;border-radius:50%; background:var(--rest); }
.phase-dot.focus { background:var(--accent); }
.goal-panel progress { width:100%; height:9px; vertical-align:middle; display:block; accent-color:var(--accent); }
.goal-panel strong { color:var(--accent); }
.field { display:grid; gap:4px; min-width:0; font-size:.9rem; font-weight:600; }
.field > span { color:var(--muted); }
.field input:not([type="range"]),.field select { font-size:1rem; width:100%; min-width:0; min-height:44px; padding:6px 9px; border:1px solid var(--line); border-radius:9px; background:var(--bg); }
.field select { text-overflow:ellipsis; }
.field input[type="color"] { padding:4px 6px; }
.field input[type="range"] { width:100%;accent-color:var(--accent);min-height:36px; }
.attach-grid { display:grid; gap:7px; margin-top:8px; }
summary { min-height:32px; color:var(--ink); }
.assign > summary { font-size:.9rem; color:var(--muted); }
.stat-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(148px,1fr));gap:10px;margin-block:16px; }
.stat { padding:15px; min-height:88px; }
.stat span,.stat strong { display:block; }
.stat span { font-size:.87rem; color:var(--muted); }
.stat strong { font-size:1.37rem; line-height:1.3; margin-top:6px; }
.segmented { background:var(--soft); border-radius:12px; padding:3px; gap:3px; }
.segmented .btn[aria-pressed="true"] { background:var(--panel); color:var(--accent); }
.chart { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); height:200px; gap:5px; border-bottom:1px solid var(--line); }
.chart > div { position:relative; display:grid; grid-template-rows:24px 1fr 44px; align-items:end; justify-items:center; min-width:0; text-align:center; }
.chart i { width:min(65%,40px); height:max(3px,var(--bar)); background:var(--accent); border-radius:6px 6px 0 0; opacity:.84; }
.chart span,.chart small { font-size:.78rem; overflow-wrap:anywhere; align-self:center; }
.heatmap { display:grid; grid-auto-flow:column; grid-template-rows:repeat(7,minmax(8px,17px)); grid-template-columns:repeat(12,minmax(8px,17px)); gap:5px; width:max-content; max-width:100%; }
.heat-cell { display:inline-block; border-radius:4px; background:var(--soft); }
.heat-cell[data-level="1"] { background:color-mix(in srgb,var(--accent) 30%,var(--panel)); }
.heat-cell[data-level="2"] { background:color-mix(in srgb,var(--accent) 55%,var(--panel)); }
.heat-cell[data-level="3"] { background:color-mix(in srgb,var(--accent) 75%,var(--panel)); }
.heat-cell[data-level="4"] { background:var(--accent); }
.heat-cell[data-level="future"] { opacity:.35; }
.legend { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:.82rem; }
.legend i { width:12px;height:12px; }
.value-list li { display:flex;justify-content:space-between;gap:8px; padding:5px 0; }
.two-col { display:grid;grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; align-items:start; }
.entry { display:grid;grid-template-columns:1fr minmax(70px,108px);gap:10px; }
.entry .btn { grid-column:1 / -1; justify-self:start; }
.items li { display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between; padding:10px 0; border-block-start:1px solid var(--line); min-width:0; overflow-wrap:anywhere; }
.item-name { display:inline-flex; align-items:center; gap:8px; }
.item-name i { width:11px;height:11px;border-radius:50%;background:var(--subject); }
.task-name small,.history-items small { display:block; }
.task-checked .task-name strong { color:var(--muted);text-decoration:line-through; }
.complete-tag { background:var(--rest-tint);color:var(--rest); }
.empty { padding:15px 0; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.form-grid + .action-row { margin-block-start:12px; }
.toggle { min-height:44px; position:relative; display:flex; gap:10px; align-items:center; justify-content:space-between; border-block-end:1px solid var(--line); cursor:pointer; padding:5px 0; }
.toggle input { position:absolute; inset-inline-end:0; width:41px; height:25px; opacity:0; }
.switch { display:block; position:relative; flex:none; border-radius:99px; width:41px;height:24px;background:var(--soft);border:1px solid var(--line); }
.switch::after { content:'';position:absolute;width:16px;height:16px;inset-block-start:3px;inset-inline-start:3px;border-radius:50%;background:var(--muted); }
.toggle input:checked + .switch { background:var(--accent); border-color:transparent; }
.toggle input:checked + .switch::after { inset-inline-start:20px;background:var(--accent-ink); }
.toggle input:focus-visible + .switch { outline:3px solid var(--accent);outline-offset:3px; }
.toggle:has(input:disabled) { opacity:.55; }
.swatches { display:flex; gap:5px; }
.swatches button { display:grid; place-items:center; width:44px;height:44px;border:1px solid var(--line);background:var(--panel);border-radius:12px; }
.swatches button::after { content:'';width:22px;height:22px;border-radius:50%;background:var(--swatch); }
.swatches button[aria-pressed="true"] { border:2px solid var(--accent); }
.tone-row,.sound-list > div { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:end; }
.tone-row .btn,.sound-list .btn { min-width:71px; }
.sound-list { display:grid;gap:9px; padding-block:10px; }
dialog { background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:22px;width:min(610px,calc(100% - 28px));max-height:min(90dvh,790px);padding:20px;overflow:auto;box-shadow:0 26px 90px #0f0b2960; }
dialog::backdrop { background:#100b26a0; }
.dialog-head { display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:14px; }
.dialog-head h2 { font-size:1.35rem; }
.dialog-head .btn { width:44px; }
.note { margin-block:12px; padding:10px; background:var(--tint);border-radius:10px;color:var(--ink); }
.note + .muted { margin-block:8px; }
.display-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:8px; }
.display-choice { display:grid;place-items:center;gap:7px;padding:11px 7px;border:1px solid var(--line);border-radius:12px;background:var(--bg); }
.display-choice[aria-pressed="true"] { border-color:var(--accent);color:var(--accent);background:var(--tint); }
.sample { font-weight:700; direction:ltr; font-size:1.1rem; display:grid;place-items:center;height:35px; }
.sample-circle { border:2px solid currentColor;border-radius:50%;width:36px; }
.sample-flip { background:var(--soft);padding-inline:8px;border-radius:5px; }
#announce { position:fixed; z-index:6; bottom:max(18px,env(safe-area-inset-bottom)); inset-inline-end:max(16px,env(safe-area-inset-right)); max-width:calc(100% - 35px); padding:9px 14px; border-radius:11px; color:var(--accent-ink);background:var(--accent);box-shadow:var(--shadow); }
#announce:empty { display:none; }
[data-immersive="true"] .shell { display:block; }
[data-immersive="true"] :is(#rail,.mobile-brand,.timer-head,.timer-side,.timer-top,.timer-meta,.elapsed) { display:none; }
[data-immersive="true"] main { padding:max(10px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left)); }
[data-immersive="true"] .timer-layout { display:block; }
[data-immersive="true"] .timer-card { min-height:calc(100dvh - 34px);align-content:center;background:transparent;border:0;box-shadow:none; }
[data-immersive="true"][data-backdrop="glow"] { background:radial-gradient(ellipse at 50% 40%,var(--tint),var(--bg) 68%); }
[data-immersive="true"][data-backdrop="grid"] { background:radial-gradient(var(--line) 1px,transparent 1px) 0 0 / 19px 19px,var(--bg); }
.focus-clock,.focus-label { color:var(--muted); text-align:center; overflow-wrap:anywhere; }
@media(max-width:1020px) {
  .shell { grid-template-columns:165px minmax(0,1fr); }
  #rail { padding-inline:12px; }
  .timer-layout { grid-template-columns:minmax(0,1fr) minmax(205px,.65fr); gap:13px; }
  main { padding-inline:20px; }
}
@media(max-width:760px) {
  html { scroll-padding-bottom:calc(76px + env(safe-area-inset-bottom)); }
  .shell { display:block; }
  #rail { padding:0; height:auto; position:static; border:0; }
  #rail .wordmark,#rail .sidebar-bottom { display:none; }
  .mobile-brand { display:flex; align-items:center; gap:8px; min-height:56px; padding:calc(env(safe-area-inset-top) + 8px) max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left)); border-bottom:1px solid var(--line); background:var(--panel); font-weight:750;font-size:1.3rem; }
  .mobile-mark { color:var(--accent); }
  nav { position:fixed; z-index:5; inset:auto 0 0; background:var(--panel);border-top:1px solid var(--line); display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px;padding:5px max(7px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(7px,env(safe-area-inset-left)); }
  nav a { flex-direction:column;justify-content:center;gap:2px;min-width:0;min-height:50px;padding:3px 1px;font-size:.79rem; }
  nav a svg { width:18px;height:18px; }
  main { padding:18px max(14px,env(safe-area-inset-right)) calc(79px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left)); }
  h1 { margin-block-end:14px; }
  .timer-head,.page-heading { margin-block-end:10px; }
  .timer-tools { flex-wrap:nowrap;justify-content:flex-start; }
  .timer-tools .btn { font-size:.8rem;padding-inline:7px;min-width:44px; }
  .timer-tools .btn svg { width:17px;height:17px; }
  .timer-layout { grid-template-columns:1fr; }
  .timer-card { min-height:0;padding:14px;gap:12px; }
  .face { min-height:236px;max-width:278px;margin-block:3px; }
  .face-circle { min-height:0; }
  .timer-controls { justify-content:center; }
  .time-digits { font-size:clamp(3.55rem,14vw,5.25rem); }
  #announce { bottom:calc(68px + env(safe-area-inset-bottom)); }
  .two-col { grid-template-columns:1fr;gap:0; }
}
@media(max-width:360px) {
  .timer-head { display:block; }
  .timer-tools { margin-top:4px; }
  .timer-tools .btn { padding-inline:6px; }
  .timer-controls { gap:4px; }
  .timer-start.btn { min-width:124px;padding-inline:10px; }
  .stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .heatmap { gap:3px; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.001s !important; transition-duration:.001s !important; scroll-behavior:auto !important; }
}
@media(prefers-reduced-motion:no-preference) {
  .btn,nav a { transition:background-color .16s,filter .16s; }
}
