:root {
  --paper: #f6f1e7;
  --paper-2: #efe7d6;
  --card: #fffdf8;
  --ink: #1f2a44;
  --ink-2: #4a5470;
  --line: #ddd2bd;
  --stamp: #c2412d;
  --ok: #2f7a4f;
  --ok-bg: #e3f1e6;
  --warn: #9a5b00;
  --warn-bg: #fbecd2;
  --bad: #b3261e;
  --bad-bg: #f9dedb;
  --focus: #2b59d9;
  --scale: 1;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(31,42,68,.06), 0 8px 24px -12px rgba(31,42,68,.25);
  --body-font: "Atkinson Hyperlegible", "Noto Sans Devanagari", system-ui, sans-serif;
  --display-font: "Fraunces", "Noto Sans Devanagari", Georgia, serif;
}
html.contrast {
  --paper: #ffffff; --paper-2: #ffffff; --card: #ffffff;
  --ink: #000000; --ink-2: #000000; --line: #000000;
  --stamp: #a10000; --ok: #005a1e; --warn: #6b3a00; --bad: #8a0000;
  --shadow: none;
}
html.easy { --body-font: "Lexend", "Noto Sans Devanagari", system-ui, sans-serif; --display-font: "Lexend", "Noto Sans Devanagari", sans-serif; }
html.easy body { letter-spacing: .02em; word-spacing: .08em; line-height: 1.7; }
html.calm *, html.calm *::before, html.calm *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

* { box-sizing: border-box; }
html { font-size: calc(17px * var(--scale)); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body-font); line-height: 1.55;
  background-image: radial-gradient(rgba(31,42,68,.035) 1px, transparent 1px);
  background-size: 18px 18px;
  min-height: 100vh; display: flex; flex-direction: column;
}
h1, h2, h3 { font-family: var(--display-font); line-height: 1.15; margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px); background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 28px; height: 34px; border-radius: 5px; background: var(--ink); position: relative; transform: rotate(-4deg); }
.brand-mark::after { content: ""; position: absolute; inset: 9px 6px auto; height: 14px; background:
  linear-gradient(var(--paper) 0 0) top/100% 2.5px no-repeat,
  linear-gradient(var(--paper) 0 0) center/100% 2.5px no-repeat,
  linear-gradient(var(--paper) 0 0) bottom left/60% 2.5px no-repeat; }
.brand-name { font-family: var(--display-font); font-weight: 800; font-size: 1.35rem; letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 700; color: var(--ink-2); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.icon-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--ink); background: var(--card); cursor: pointer; font-weight: 700; }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn.ghost { border-color: transparent; background: transparent; min-width: 44px; justify-content: center; }

/* Comfort panel */
.panel {
  position: fixed; right: clamp(8px, 3vw, 32px); top: 72px; z-index: 30; width: min(360px, calc(100vw - 16px));
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  animation: drop .18s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel h2 { font-size: 1.2rem; }
.field { border: 0; padding: 0; margin: 14px 0; }
.field legend { font-weight: 700; margin-bottom: 8px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg label { flex: 1; min-width: 70px; }
.seg input { position: absolute; opacity: 0; }
.seg label { display: flex; justify-content: center; align-items: center; min-height: 44px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 700; position: relative; }
.seg label:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.toggles { display: grid; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 700; }
.toggle input { width: 22px; height: 22px; accent-color: var(--ink); }
.fine { font-size: .85rem; color: var(--ink-2); margin: 12px 0 0; }

main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px) 64px; outline: none; }
.foot { border-top: 1px solid var(--line); padding: 18px clamp(16px, 4vw, 40px); font-size: .85rem; color: var(--ink-2); text-align: center; }
.foot p { max-width: 720px; margin: 0 auto; }

/* Home */
.hero { display: grid; gap: 18px; max-width: 760px; margin-bottom: 32px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--stamp); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; }
.kicker::before { content: ""; width: 22px; height: 2px; background: currentColor; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.02em; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, color-mix(in srgb, var(--stamp) 28%, transparent) 62%); }
.hero p { font-size: 1.15rem; color: var(--ink-2); margin: 0; max-width: 60ch; }
.search { position: relative; margin-top: 8px; }
.search label { display: block; font-weight: 700; margin-bottom: 8px; }
.search input { width: 100%; min-height: 58px; padding: 0 18px 0 52px; border-radius: 14px; border: 2px solid var(--ink); background: var(--card); font-size: 1.1rem; box-shadow: var(--shadow); }
.search svg { position: absolute; left: 18px; bottom: 18px; width: 22px; height: 22px; }
.section-title { font-size: 1.1rem; font-family: var(--body-font); font-weight: 700; margin: 0 0 14px; color: var(--ink-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; list-style: none; padding: 0; margin: 0; }
.task-card {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; text-decoration: none;
  background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; min-height: 132px;
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s; position: relative; height: 100%;
}
.task-card:hover { transform: translateY(-2px); border-color: var(--ink); }
.task-card h3 { font-size: 1.15rem; margin-bottom: 4px; }
.task-card .meta { font-size: .88rem; color: var(--ink-2); }
.tile-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--paper-2); display: grid; place-items: center; }
.tile-icon svg { width: 26px; height: 26px; stroke: var(--ink); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mini-bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: .82rem; font-weight: 700; color: var(--ink-2); }
.mini-bar .track { flex: 1; height: 6px; border-radius: 6px; background: var(--paper-2); overflow: hidden; }
.mini-bar .fill { height: 100%; background: var(--ok); border-radius: 6px; }
.empty { padding: 24px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); }

/* Task page */
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; margin-bottom: 18px; min-height: 44px; }
.task-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.task-head h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; letter-spacing: -.015em; }
.task-head .sub { color: var(--ink-2); margin-top: 6px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } .side { position: static; } main.has-dock { padding-bottom: 120px; } }
.dock { display: none; }
@media (max-width: 880px) {
  .dock { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 25; align-items: center; gap: 12px;
    background: var(--ink); color: var(--paper); border-radius: 16px; padding: 10px 10px 10px 16px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); }
  .dock .dtxt { flex: 1; font-weight: 700; line-height: 1.2; }
  .dock .dtxt small { display: block; font-weight: 400; opacity: .8; }
  .dock .btn { background: var(--paper); color: var(--ink); border-color: var(--paper); min-height: 48px; }
  .dock.is-ready { background: var(--ok); }
}
@media (max-width: 520px) {
  .topbar { gap: 8px; } .brand-name { font-size: 1.15rem; }
  .nav a { padding: 8px 10px; font-size: .9rem; white-space: nowrap; }
  #a11yBtn [data-i18n] { display: none; } #a11yBtn { padding: 8px 12px; }
}

.group { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; overflow: hidden; box-shadow: var(--shadow); }
.group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; background: var(--paper-2); border-bottom: 1.5px solid var(--line); }
.group-head h2 { font-size: 1.05rem; font-family: var(--body-font); font-weight: 700; }
.pill { font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1.5px solid currentColor; white-space: nowrap; }
.pill.all { color: var(--ink); } .pill.one { color: var(--stamp); } .pill.optional { color: var(--ink-2); border-style: dashed; }
.items { list-style: none; margin: 0; padding: 0; }
.item { border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item label { display: grid; grid-template-columns: 30px 1fr auto; gap: 14px; padding: 16px 18px; cursor: pointer; align-items: start; }
.item input { appearance: none; width: 28px; height: 28px; margin: 0; border: 2px solid var(--ink); border-radius: 8px; display: grid; place-items: center; background: var(--card); cursor: pointer; }
.group[data-type="one"] .item input { border-radius: 50%; }
.item input::after { content: ""; width: 12px; height: 7px; border: solid var(--paper); border-width: 0 0 3px 3px; transform: rotate(-45deg) translate(1px,-1px) scale(0); transition: transform .15s; }
.item input:checked { background: var(--ok); border-color: var(--ok); }
.item input:checked::after { transform: rotate(-45deg) translate(1px,-1px) scale(1); }
.item .name { font-weight: 700; display: block; }
.item .why { color: var(--ink-2); font-size: .92rem; display: block; margin-top: 2px; }
.item .qty { font-size: .8rem; font-weight: 700; color: var(--ink-2); text-align: right; white-space: nowrap; }
.item:has(input:checked) .name { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--ok) 70%, transparent); }
.group.dimmed .item:not(:has(input:checked)) { opacity: .5; }

.side { position: sticky; top: 84px; display: grid; gap: 16px; }
.ready-card { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; }
.ready-top { display: flex; align-items: center; gap: 16px; }
.ring { width: 84px; height: 84px; flex: none; }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: var(--paper-2); }
.ring .fg { stroke: var(--ok); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset .4s ease; }
.ring text { font: 700 20px var(--body-font); fill: var(--ink); }
.ready-label { font-weight: 700; font-size: 1.1rem; }
.ready-sub { color: var(--ink-2); font-size: .9rem; }
.stamp {
  position: absolute; right: 14px; top: 12px; font-family: var(--display-font); font-weight: 800; text-transform: uppercase; letter-spacing: .1em;
  color: var(--stamp); border: 3px solid var(--stamp); border-radius: 8px; padding: 2px 10px; font-size: 1rem;
  transform: rotate(-12deg) scale(2.2); opacity: 0; pointer-events: none;
}
.ready-card.is-ready .stamp { animation: stamp .45s cubic-bezier(.2,1.6,.4,1) forwards; }
.ready-card.is-ready { border-color: var(--ok); }
@keyframes stamp { to { opacity: .92; transform: rotate(-12deg) scale(1); } }
.bag { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.bag div { background: var(--paper-2); border-radius: 10px; padding: 10px 6px; text-align: center; }
.bag b { display: block; font-size: 1.5rem; font-family: var(--display-font); }
.bag span { font-size: .78rem; color: var(--ink-2); font-weight: 700; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.full { width: 100%; margin-top: 16px; }
.btn.light { background: var(--card); color: var(--ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.warn { background: var(--card); color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: .92rem; }
.hint { font-size: .85rem; color: var(--ink-2); text-align: center; margin: 8px 0 0; }

.info { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px; }
.info h2 { font-size: 1rem; font-family: var(--body-font); font-weight: 700; margin-bottom: 10px; }
.facts { display: grid; gap: 8px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.facts dt { color: var(--ink-2); } .facts dd { margin: 0; font-weight: 700; text-align: right; }
.tipbox { background: var(--warn-bg); border-left: 4px solid var(--warn); border-radius: 10px; padding: 12px 14px; font-size: .95rem; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--card); }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; border-left: 2px dotted var(--line); }
.portal { font-weight: 700; }

/* Door check */
.dc { position: fixed; inset: 0; z-index: 40; background: var(--ink); color: var(--paper); display: grid; grid-template-rows: auto 1fr auto; padding: clamp(16px, 4vw, 36px); }
.dc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 640px; width: 100%; margin: 0 auto; }
.dc-top h2 { font-size: 1.2rem; }
.dc .icon-btn { background: transparent; color: var(--paper); border-color: var(--paper); }
.dc-dots { display: flex; gap: 6px; max-width: 640px; width: 100%; margin: 14px auto 0; }
.dc-dots i { flex: 1; height: 5px; border-radius: 4px; background: rgba(246,241,231,.2); }
.dc-dots i.done { background: #7fd39a; } .dc-dots i.miss { background: #ff8a7a; } .dc-dots i.now { background: var(--paper); }
.dc-stage { display: grid; place-items: center; }
.dc-card { width: min(560px, 100%); background: var(--card); color: var(--ink); border-radius: 22px; padding: clamp(24px, 5vw, 40px); text-align: center; animation: deal .25s ease-out; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
@keyframes deal { from { opacity: 0; transform: translateY(18px) rotate(1.5deg); } }
.dc-card .count { font-weight: 700; color: var(--ink-2); font-size: .9rem; }
.dc-card h3 { font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 10px 0; }
.dc-card .qtyline { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 6px 0 12px; }
.dc-card .qtyline span { background: var(--paper-2); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: .9rem; }
.dc-card p { color: var(--ink-2); margin: 0; }
.dc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 560px; width: 100%; margin: 0 auto; }
.dc-actions .btn { min-height: 64px; font-size: 1.1rem; border-radius: 16px; }
.dc-actions .btn.light { background: transparent; color: var(--paper); border-color: var(--paper); }
.dc-result ul { text-align: left; margin: 14px 0 0; padding-left: 20px; }
.dc-result .big { font-size: 4rem; line-height: 1; }

/* Locker */
.locker-head { max-width: 680px; margin-bottom: 26px; }
.locker-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
.locker-head p { color: var(--ink-2); font-size: 1.1rem; }
.add-form { display: grid; grid-template-columns: 1fr 200px auto; gap: 12px; align-items: end; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; }
.add-form label { display: grid; gap: 6px; font-weight: 700; font-size: .92rem; }
.add-form input { min-height: 48px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 0 12px; background: var(--card); }
@media (max-width: 640px) { .add-form { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.doc { display: grid; grid-template-columns: 8px 1fr auto auto; gap: 16px; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px 16px 14px 0; overflow: hidden; }
.doc .bar { align-self: stretch; }
.doc.bad .bar { background: var(--bad); } .doc.warn .bar { background: var(--warn); } .doc.ok .bar { background: var(--ok); }
.doc .dname { font-weight: 700; } .doc .ddate { color: var(--ink-2); font-size: .88rem; }
.badge { font-size: .8rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.doc.bad .badge { background: var(--bad-bg); color: var(--bad); } .doc.warn .badge { background: var(--warn-bg); color: var(--warn); } .doc.ok .badge { background: var(--ok-bg); color: var(--ok); }
.days { font-family: var(--display-font); font-weight: 800; font-size: 1.4rem; text-align: right; }
.days small { display: block; font-family: var(--body-font); font-size: .72rem; color: var(--ink-2); font-weight: 700; }
.rm { border: 0; background: transparent; cursor: pointer; min-width: 44px; min-height: 44px; border-radius: 10px; color: var(--ink-2); }
@media (max-width: 560px) { .doc { grid-template-columns: 8px 1fr auto; } .doc .badge { display: none; } }

@media print {
  .topbar, .foot, .side .btn, .tools, .back, .panel, .side .ready-card .stamp { display: none !important; }
  body { background: #fff; } .layout { grid-template-columns: 1fr; } .group, .info, .ready-card { box-shadow: none; break-inside: avoid; }
}
