:root {
  --bg: #f7f4ec; --surface: #ffffff; --text: #1d2a25; --muted: #66736d; --line: #e4ded0;
  --accent: #1f6b54; --accent-ink: #ffffff; --gold: #b8892e; --ok-bg: #e5f2ea; --bad-bg: #f8e3e0; --hl: #b8892e;
  --heat0: #ebe6d9; --heat1: #2f8a6c; --frozen: #8fb7d9; --rest: #d8cfb8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1c18; --surface: #152822; --text: #f3eddb; --muted: #a3ab9f; --line: #24392f;
    --accent: #c9a95c; --accent-ink: #0e1c18; --gold: #c9a95c; --ok-bg: #1c3a2e; --bad-bg: #3d2320; --hl: #e6c578;
    --heat0: #1d322a; --heat1: #c9a95c; --frozen: #46708f; --rest: #3a4a3f;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1c18; --surface: #152822; --text: #f3eddb; --muted: #a3ab9f; --line: #24392f;
  --accent: #c9a95c; --accent-ink: #0e1c18; --gold: #c9a95c; --ok-bg: #1c3a2e; --bad-bg: #3d2320; --hl: #e6c578;
  --heat0: #1d322a; --heat1: #c9a95c; --frozen: #46708f; --rest: #3a4a3f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; padding-bottom: 76px; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; } h2 { font-size: 1.15rem; margin: .2em 0 .4em; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; max-width: 760px; margin: 0 auto; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); } .brand span { color: var(--gold); }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.narrow { max-width: 420px; margin: 24px auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
label.check, .p-opt { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); min-height: 44px; }
input.num { width: 5em; } fieldset { border: 1px solid var(--line); border-radius: 10px; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.btn { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); min-height: 44px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.big { font-size: 1.4rem; width: 64px; height: 64px; }
.link { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; text-decoration: none; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .hidden { display: none !important; }
.note { padding: 10px 14px; border-radius: 10px; margin: 10px 0; } .note.ok { background: var(--ok-bg); } .note.bad { background: var(--bad-bg); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--ok-bg); }
.bar { height: 8px; border-radius: 999px; background: var(--heat0); overflow: hidden; margin: 8px 0; }
.bar > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.hero { display: flex; justify-content: space-between; align-items: center; }
.streak { display: flex; flex-direction: column; align-items: center; padding: 8px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); filter: grayscale(1); opacity: .75; }
.streak.lit { filter: none; opacity: 1; } .streak b { font-size: 1.4rem; line-height: 1; } .streak .flame { font-size: 1.4rem; }
.task-group { margin-top: 18px; }
.task { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 8px 0; color: var(--text); text-decoration: none; }
.task div { display: flex; flex-direction: column; } .task .go { font-size: 1.3rem; color: var(--accent); }
.task.done { opacity: .6; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; padding: 8px 0; font-size: .75rem; color: var(--muted); text-decoration: none; }
.tabs a span { font-size: 1.2rem; } .tabs a.on { color: var(--accent); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.stat b { font-size: 1.3rem; } .stat span { font-size: .8rem; color: var(--muted); }
.heat { display: flex; gap: 3px; overflow-x: auto; } .heat .col { display: flex; flex-direction: column; gap: 3px; }
.heat i, .legend i { display: inline-block; width: 18px; height: 18px; border-radius: 4px; background: var(--heat0); }
.legend i { width: 12px; height: 12px; vertical-align: middle; margin-left: 8px; }
i.met { background: var(--heat1); } i.frozen { background: var(--frozen); } i.rest { background: var(--rest); } i.future { opacity: .3; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; } th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.card table { display: block; overflow-x: auto; }
/* Player */
.p-head { display: flex; gap: 12px; align-items: center; } .p-title { display: flex; flex-direction: column; }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin: 12px 0; min-height: 46vh; display: flex; flex-direction: column; justify-content: space-between; }
.p-row { display: flex; justify-content: space-between; gap: 8px; }
.p-arabic { font-family: "P2J Quran", serif; font-size: clamp(1.7rem, 6.5vw, 2.8rem); line-height: 2.1; text-align: center; margin: 12px 0; }
.p-arabic .w { border-radius: 6px; transition: color .15s, background .15s; }
.p-arabic .w.on { color: var(--hl); background: color-mix(in srgb, var(--hl) 14%, transparent); }
.p-arabic .marker { color: var(--gold); }
.p-tr { text-align: center; font-size: clamp(.95rem, 3.8vw, 1.15rem); color: var(--muted); }
.p-controls { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.p-controls select { min-height: 44px; } .p-status { text-align: center; min-height: 1.5em; }
