:root {
  --bg: #F5EFE6;
  --surface: #FFFBF5;
  --surface-2: #EFE6DA;
  --line: #E2D6C6;
  --text: #2A2420;
  --muted: #776B60;
  --accent: #A8553A;
  --accent-soft: #F1DCD0;
  --sage: #5F7A5B;
  --sage-soft: #DDE6D6;
  --warn: #B4492F;
  --sun: #F2C38B;
  --q1: #B4492F; --q1-soft: #F5DAD1;
  --q2: #5F7A5B; --q2-soft: #DDE6D6;
  --q3: #A3782A; --q3-soft: #F2E4C6;
  --q4: #7B7068; --q4-soft: #E9E2DA;
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow: 0 1px 2px rgba(60, 40, 25, .06), 0 6px 20px rgba(60, 40, 25, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1D1916; --surface: #27221E; --surface-2: #322B26; --line: #3D352F;
    --text: #F1E9DF; --muted: #A99C90; --accent: #E08A68; --accent-soft: #4A2E24;
    --sage: #9DB896; --sage-soft: #2F3A2C; --warn: #EE8B6E; --sun: #E9B878;
    --q1: #EE8B6E; --q1-soft: #45291F; --q2: #9DB896; --q2-soft: #2F3A2C;
    --q3: #DDB563; --q3-soft: #41361E; --q4: #B3A89E; --q4-soft: #36302B;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 20px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--accent); }
.brand span { color: var(--text); }
.logo { width: 30px; height: 30px; }
.sync-pill {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.sync-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.sync-pill.ok::before { background: var(--sage); }
.sync-pill.busy::before { background: var(--sun); }
.sync-pill.err::before { background: var(--warn); }

main { flex: 1; padding: 8px 20px calc(110px + env(safe-area-inset-bottom)); outline: none; }

/* Bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(6, 1fr);
  max-width: 560px; margin: 0 auto; padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs button {
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 11px; line-height: 1.15; color: var(--muted); padding: 6px 2px; border-radius: 12px; min-height: 56px; text-align: center;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* Typography */
.hello { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 10px 0 4px; letter-spacing: -.01em; }
.date { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
h2.section { font-family: var(--font-display); font-weight: 600; font-size: 19px; margin: 26px 0 10px; }
.hint { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.dina-note { display: flex; gap: 12px; align-items: flex-start; background: var(--accent-soft); border: 0; box-shadow: none; }
.dina-note .avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--bg); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; }
.dina-note p { margin: 2px 0 0; font-size: 15px; }
.shift-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 13px; margin-right: 6px; }

/* Wake time */
.wake { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wake label { font-weight: 600; }
.wake small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
input[type=time], input[type=date], input[type=text], select, textarea {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; width: 100%;
}
.wake input { width: 130px; font-size: 20px; font-variant-numeric: tabular-nums; text-align: center; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Checklist */
.checks { display: grid; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; min-height: 64px; box-shadow: var(--shadow); transition: background .18s, border-color .18s;
}
.check .box { flex: 0 0 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; transition: all .18s; }
.check .box svg { width: 16px; height: 16px; stroke: var(--bg); stroke-width: 3; fill: none; opacity: 0; }
.check .label { flex: 1; font-weight: 600; }
.check .label small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.check .streak { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.check .streak b { font-size: 18px; color: var(--text); font-family: var(--font-display); }
.check[aria-pressed=true] { border-color: var(--sage); background: var(--sage-soft); }
.check[aria-pressed=true] .box { background: var(--sage); border-color: var(--sage); }
.check[aria-pressed=true] .box svg { opacity: 1; }
.check.negative[aria-pressed=true] { border-color: var(--warn); background: var(--q1-soft); }
.check.negative[aria-pressed=true] .box { background: var(--warn); border-color: var(--warn); }

/* Week strip */
.week { display: grid; grid-template-columns: 70px repeat(7, 1fr); gap: 6px 4px; align-items: center; font-size: 12px; }
.week .h { text-align: center; color: var(--muted); }
.week .h.today { color: var(--accent); font-weight: 600; }
.week .rowlabel { color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--line); }
.dot.on { background: var(--sage); border-color: var(--sage); }
.dot.bad { background: var(--warn); border-color: var(--warn); }
.dot.good { background: var(--sage-soft); border-color: var(--sage); }

/* Add bar */
.add { display: flex; gap: 8px; }
.add input { flex: 1; }
.btn {
  border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--bg); font-weight: 600; padding: 10px 16px; min-height: 44px;
}
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--warn); border: 1px solid var(--line); }
.btn.block { width: 100%; }

/* Garage */
.quad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quad { border-radius: var(--radius); padding: 12px; min-height: 120px; border: 1px solid transparent; }
.quad h3 { margin: 0; font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.quad h3 .n { font-variant-numeric: tabular-nums; font-weight: 500; opacity: .8; }
.quad .sub { font-size: 12px; margin: 2px 0 8px; opacity: .85; }
.quad.q1 { background: var(--q1-soft); color: var(--q1); }
.quad.q2 { background: var(--q2-soft); color: var(--q2); }
.quad.q3 { background: var(--q3-soft); color: var(--q3); }
.quad.q4 { background: var(--q4-soft); color: var(--q4); }
.quad ul, .inbox ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.item {
  width: 100%; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; min-height: 40px;
}
.item .t { flex: 1; overflow-wrap: anywhere; }
.item .age { font-size: 12px; color: var(--muted); white-space: nowrap; }
.item.stale { border-color: var(--warn); }
.item.stale .age { color: var(--warn); font-weight: 600; }
.inbox { margin-top: 12px; border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 12px; }
.inbox h3 { margin: 0 0 8px; font-size: 15px; display: flex; justify-content: space-between; }
.empty { color: var(--muted); font-size: 13px; font-style: normal; padding: 4px 2px; }
.done-toggle { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 12px 0; text-decoration: underline; text-underline-offset: 3px; }

/* Deadlines */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 -20px 12px; padding-left: 20px; padding-right: 20px; scrollbar-width: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 14px; min-height: 36px; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.dl { display: flex; align-items: center; gap: 14px; }
.dl .when { flex: 0 0 64px; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 8px 4px; }
.dl .when b { display: block; font-family: var(--font-display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; }
.dl .when span { font-size: 11px; color: var(--muted); }
.dl.word .when b { font-size: 17px; padding: 4px 0; }
.dl.soon .when { background: var(--accent-soft); }
.dl.soon .when b { color: var(--accent); }
.dl.over .when { background: var(--q1-soft); }
.dl.over .when b { color: var(--warn); }
.dl .info { flex: 1; min-width: 0; }
.dl .info strong { display: block; overflow-wrap: anywhere; }
.dl .meta { font-size: 13px; color: var(--muted); }
.cat { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); margin-right: 6px; color: var(--text); }
.form-grid { display: grid; gap: 10px; }
.form-grid .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* Sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30, 20, 12, .35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 560px; margin: 0 auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px); box-shadow: 0 -10px 40px rgba(0,0,0,.15);
  animation: up .22s ease-out;
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 600; font-size: 19px; overflow-wrap: anywhere; }
.sheet .opts { display: grid; gap: 8px; margin-bottom: 14px; }
.sheet .opt { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; min-height: 48px; }
.sheet .opt i { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 12px; }
.sheet .opt.cur { outline: 2px solid var(--accent); }
.sheet .row { display: flex; gap: 8px; }
.sheet .row .btn { flex: 1; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: all .2s; z-index: 30; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* Settings */
.set-row { display: grid; gap: 6px; }
.set-row + .set-row { margin-top: 14px; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.steps li { margin-bottom: 6px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .hello { font-size: 26px; } .quad-grid { grid-template-columns: 1fr; } }

/* Převalování – otázka se dvěma odpověďmi */
.wakeq { margin-top: 12px; }
.wakeq-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.wakeq .streak { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wakeq .streak b { font-size: 18px; color: var(--text); font-family: var(--font-display); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px 8px; min-height: 48px; font-weight: 600; transition: all .18s; }
.seg-btn.good[aria-pressed=true] { background: var(--sage); border-color: var(--sage); color: var(--bg); }
.seg-btn.bad[aria-pressed=true] { background: var(--warn); border-color: var(--warn); color: var(--bg); }

/* Garáž – přepínač */
.garage-seg { margin: 6px 0 12px; }
.seg-btn.tabish[aria-pressed=true] { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Články */
.art { display: block; width: 100%; text-align: left; }
.art strong { display: block; overflow-wrap: anywhere; }
.art-q { margin: 8px 0 6px; font-family: var(--font-display); font-size: 16px; line-height: 1.4; }
.art-q.muted { font-family: var(--font-body); font-size: 14px; color: var(--muted); }
.art-host { font-size: 12px; color: var(--muted); }
.reading { margin-top: 12px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.reading blockquote { margin: 0 0 10px; font-family: var(--font-display); font-size: 19px; line-height: 1.35; }
.reading-title { margin: 0 0 12px; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tesim { margin-top: 12px; background: var(--sage-soft); border: 0; box-shadow: none; }
.tesim .eyebrow { color: var(--sage); }
.tesim-t { margin: 0; font-family: var(--font-display); font-size: 18px; }
textarea { resize: vertical; min-height: 70px; line-height: 1.4; }

/* Když to nejde */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.tile b { display: block; font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.tile span { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.wins { margin-top: 12px; display: grid; gap: 8px; }
.win { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.win.own { border-color: var(--sun); background: color-mix(in srgb, var(--sun) 18%, var(--surface)); }
.win p { margin: 4px 0; overflow-wrap: anywhere; }
.win-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.win-date { font-size: 12px; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; font-size: 12px; }

/* Články – řádek se zaškrtnutím */
.art { display: flex; gap: 12px; align-items: flex-start; padding: 14px; }
.art-check, .paper-check { background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 8px; }
.art-check { flex: 0 0 44px; height: 44px; justify-content: center; }
.art-check .box, .paper-check .box { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; transition: all .18s; }
.art-check .box svg, .paper-check .box svg { width: 16px; height: 16px; stroke: var(--bg); stroke-width: 3; fill: none; opacity: 0; }
.art-check[aria-pressed=true] .box { background: var(--sage); border-color: var(--sage); }
.art-check[aria-pressed=true] .box svg { opacity: 1; }
.art-body { flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.art.is-read strong { text-decoration: line-through; color: var(--muted); }

/* Ranní noviny */
.paper {
  margin-top: 28px; padding: 18px 18px 14px; border-radius: 6px;
  background: #FBF7EE; color: #231E1A;
  background-image: repeating-linear-gradient(0deg, rgba(60,40,20,.025) 0 1px, transparent 1px 4px);
  box-shadow: 0 1px 2px rgba(60,40,25,.08), 0 12px 28px rgba(60,40,25,.10);
  border: 1px solid #E6DCCB; transform: rotate(-.4deg);
}
.paper-mast { text-align: center; border-bottom: 3px double #231E1A; padding-bottom: 8px; margin-bottom: 12px; }
.paper-mast h2 { margin: 4px 0 2px; font-family: var(--font-display); font-weight: 600; font-size: 34px; letter-spacing: -.01em; line-height: 1; font-variation-settings: 'opsz' 144; }
.paper-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6B5E52; border-bottom: 1px solid #231E1A; padding-bottom: 5px; }
.paper-meta-c { justify-content: center; border-bottom: 0; padding: 4px 0 0; font-style: italic; text-transform: none; letter-spacing: .02em; font-family: var(--font-display); font-size: 13px; }
.paper-headline { margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.paper-lead { margin: 0 0 12px; font-family: var(--font-display); font-size: 16px; line-height: 1.5; text-align: justify; hyphens: auto; }
.paper-lead::first-letter { float: left; font-size: 3.1em; line-height: .85; padding: 4px 6px 0 0; font-weight: 600; color: #A8553A; }
.paper-empty::first-letter { color: inherit; }
.paper-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid #231E1A; padding-top: 10px; clear: both; }
.paper-link { color: #A8553A; font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.paper-check { color: #231E1A; font-weight: 600; min-height: 44px; }
.paper-check .box { border-color: #B9AC9A; }
.paper-src { margin: 6px 0 0; font-size: 11px; color: #6B5E52; text-align: right; font-style: italic; }
@media (prefers-color-scheme: dark) {
  .paper { background-color: #2E2823; color: #EFE6DA; border-color: #3D352F; background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px); }
  .paper-mast, .paper-foot { border-color: #EFE6DA; }
  .paper-meta { color: #B5A797; border-color: #EFE6DA; }
  .paper-check { color: #EFE6DA; }
  .paper-src { color: #B5A797; }
  .paper-lead::first-letter, .paper-link { color: #E08A68; }
}

/* Vděčnost */
.win.grat { border-color: var(--sage); background: var(--sage-soft); }
.win.grat p { margin: 0 0 4px; }
.grat-card { margin-top: 16px; background: var(--sage-soft); border: 0; box-shadow: none; }
.grat-card .eyebrow { color: var(--sage); }
.grat-t { margin: 0 0 12px; font-family: var(--font-display); font-size: 20px; line-height: 1.35; overflow-wrap: anywhere; }
.grat-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.check.yday { box-shadow: none; border-style: dashed; }

/* Kolo štěstí */
.wheel-card { margin-top: 20px; }
.wheel-wrap { position: relative; width: min(260px, 78vw); margin: 4px auto 14px; }
.wheel { width: 100%; height: auto; display: block; will-change: transform; }
.wheel text { fill: #FFFBF5; font-family: var(--font-body); font-weight: 600; font-size: 12.5px; }
.wheel-rim { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.wheel-hub { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.wheel-pointer { position: absolute; top: -4px; left: 50%; width: 22px; height: 18px; transform: translateX(-50%); z-index: 2; fill: var(--text); }
#spin:disabled { opacity: .6; }
.wq { margin: 14px 0 0; }
.wq blockquote { margin: 0 0 8px; font-family: var(--font-display); font-size: 19px; line-height: 1.4; }
.wq figcaption { font-size: 13px; color: var(--muted); }
.wq .tr { font-style: italic; }
