/* «Є світло?» — flat, drawn look: ink outlines, hard shadows, warm paper. Big type for older eyes. */
:root {
  --bg: #F6F1E6;
  --paper: #FFFDF8;
  --card: #FFFFFF;
  --ink: #1D1B17;
  --ink-2: #4A463E;
  --muted: #77715F;
  --line: #1D1B17;
  --shadow: #1D1B17;
  --chip: #EDE6D6;
  --sun: #FFD23F;
  --sun-2: #FFE68A;
  --sun-ink: #1D1B17;
  --night: #253049;
  --night-2: #34405E;
  --night-ink: #F7F2E6;
  --amber: #FF9F1C;
  --amber-soft: #FFE8C7;
  --green: #2FAE63;
  --green-soft: #DCF3E4;
  --red: #E0484D;
  --red-soft: #FCE1E1;
  --focus: #2E6BFF;
  --r: 20px;
  --r-sm: 14px;
  --bw: 2px;
  --sh: 0 4px 0 var(--shadow);
  --sh-sm: 0 3px 0 var(--shadow);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Unbounded", "Manrope", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121318;
  --paper: #191B22;
  --card: #1D2029;
  --ink: #F3EFE6;
  --ink-2: #D2CDC2;
  --muted: #A29D91;
  --line: #3C4152;
  --shadow: #07080B;
  --chip: #262A35;
  --sun: #FFD23F;
  --sun-2: #8C7420;
  --sun-ink: #1D1B17;
  --night: #2A3554;
  --night-2: #3A4769;
  --night-ink: #F7F2E6;
  --amber: #FFAE42;
  --amber-soft: #3B2C14;
  --green: #45C97B;
  --green-soft: #173525;
  --red: #FF6B6F;
  --red-soft: #3A1B1C;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font: 600 17px/1.45 var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
}

/* ---------- top bar ---------- */
.top {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--sun); border: var(--bw) solid var(--line); box-shadow: var(--sh-sm);
  display: grid; place-items: center; color: var(--sun-ink);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-name { font: 800 19px/1.1 var(--display); letter-spacing: -0.01em; }
.brand-sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.icon-btn {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  background: var(--card); border: var(--bw) solid var(--line); box-shadow: var(--sh-sm);
  display: grid; place-items: center; transition: transform .08s, box-shadow .08s;
}
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active, .btn:active, .chip:active, .row-btn:active, .q-btn:active, .seg button:active {
  transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow);
}

/* ---------- place chips ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 8px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 999px;
  background: var(--card); border: var(--bw) solid var(--line); box-shadow: var(--sh-sm);
  font-weight: 800; font-size: 16px; white-space: nowrap;
}
.chip.on { background: var(--ink); color: var(--paper); }
.chip.add { padding: 0 14px; }
.chip svg { width: 18px; height: 18px; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border: var(--bw) solid var(--line); border-radius: 26px; box-shadow: var(--sh);
  padding: 18px 18px 18px;
  display: grid; grid-template-columns: 108px 1fr; gap: 14px; align-items: center;
  background: var(--sun); color: var(--sun-ink);
}
.hero.off { background: var(--night); color: var(--night-ink); }
.hero.maybe { background: var(--amber); color: var(--sun-ink); }
.hero.unknown { background: var(--card); color: var(--ink); }
.hero .bulb { width: 108px; height: 120px; }
.hero .label {
  font: 800 13px/1.2 var(--font); letter-spacing: .08em; text-transform: uppercase; opacity: .78;
}
.hero h1 { font: 800 27px/1.12 var(--display); margin: 4px 0 10px; letter-spacing: -0.015em; }
.hero .next { border-top: 2px dashed currentColor; padding-top: 10px; opacity: 1; }
.hero .next-lbl { font-size: 16px; font-weight: 700; opacity: .85; }
.hero .next-time { font: 800 40px/1.05 var(--display); letter-spacing: -0.02em; }
.hero .next-in { font-size: 16px; font-weight: 800; margin-top: 2px; }
.hero .place-line { grid-column: 1 / -1; font-size: 15px; font-weight: 700; opacity: .8; margin-top: 2px; }
@media (max-width: 360px) {
  .hero { grid-template-columns: 84px 1fr; }
  .hero .bulb { width: 84px; height: 96px; }
  .hero h1 { font-size: 23px; }
  .hero .next-time { font-size: 34px; }
}

/* ---------- banners ---------- */
.banner {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 12px; padding: 12px 14px; border-radius: var(--r-sm);
  border: var(--bw) solid var(--line); background: var(--amber-soft); font-size: 16px; font-weight: 700;
}
.banner.red { background: var(--red-soft); }
.banner.green { background: var(--green-soft); }
.banner.plain { background: var(--card); }
.banner svg { width: 24px; height: 24px; flex: none; margin-top: 1px; }
.banner b { font-weight: 800; }

/* ---------- day switch ---------- */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 12px;
}
.seg button {
  height: 64px; border-radius: 18px; border: var(--bw) solid var(--line); background: var(--card);
  box-shadow: var(--sh-sm); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; line-height: 1.15;
}
.seg button small { font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg button.on small { color: inherit; opacity: .75; }

/* ---------- day card ---------- */
.card {
  background: var(--card); border: var(--bw) solid var(--line); border-radius: var(--r); box-shadow: var(--sh);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card h2 { font: 800 18px/1.25 var(--display); margin: 0 0 12px; letter-spacing: -0.01em; }

.ruler { position: relative; margin: 6px 0 4px; padding-top: 30px; }
.ruler .bar {
  display: flex; height: 40px; border-radius: 12px; overflow: hidden;
  border: var(--bw) solid var(--line);
}
.ruler .s { flex: 1; background: var(--sun); }
.ruler .s.off { background: var(--night); }
.ruler .s.maybe { background: repeating-linear-gradient(-45deg, var(--amber) 0 5px, var(--amber-soft) 5px 9px); }
.ruler .s.past { filter: saturate(.25) brightness(.95); opacity: .45; }
.ruler .s.hr { box-shadow: inset 1px 0 0 rgba(0,0,0,.12); }
.ruler .now {
  position: absolute; top: 22px; bottom: -6px; width: 0; border-left: 3px solid var(--ink); transform: translateX(-1.5px);
}
.ruler .now span {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); font: 800 13px/1 var(--font); padding: 5px 8px; border-radius: 8px; white-space: nowrap;
}
.ruler .ticks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 13px; color: var(--muted); font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 2px; font-size: 14px; color: var(--ink-2); font-weight: 700; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--line); margin-right: 6px; vertical-align: -2px; }
.legend .l-on { background: var(--sun); }
.legend .l-off { background: var(--night); }
.legend .l-maybe { background: var(--amber); }

.rows { margin-top: 14px; display: grid; gap: 10px; }
.row {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: var(--r-sm); border: var(--bw) solid var(--line); background: var(--paper);
}
.row .ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--night); color: var(--night-ink); border: var(--bw) solid var(--line);
}
.row.maybe .ic { background: var(--amber); color: var(--sun-ink); }
.row .ic svg { width: 26px; height: 26px; }
.row .t { font: 700 21px/1.15 var(--display); letter-spacing: -0.01em; }
.row .t .badge { font-family: var(--font); vertical-align: 4px; }
.row .what { font-size: 15px; color: var(--muted); font-weight: 700; margin-top: 3px; }
.row .dur { font-weight: 800; font-size: 16px; white-space: nowrap; }
.row.past { opacity: .5; }
.row.now { background: var(--sun-2); }
:root[data-theme="dark"] .row.now { background: #3A3216; }
.badge {
  display: inline-block; font: 800 12px/1 var(--font); padding: 4px 7px; border-radius: 6px;
  background: var(--ink); color: var(--paper); margin-left: 8px; vertical-align: 2px; letter-spacing: .02em;
}
.badge.faded { background: var(--chip); color: var(--muted); }
.total { margin-top: 14px; font-size: 17px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.total b { font-weight: 800; }

.empty-day { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; }
.empty-day svg { width: 64px; height: 64px; }
.empty-day h3 { margin: 0 0 4px; font: 800 19px/1.25 var(--display); }
.empty-day p { margin: 0; color: var(--ink-2); font-size: 16px; }

.meta { margin: 14px 4px 0; font-size: 14px; color: var(--muted); font-weight: 600; text-align: center; }

/* ---------- buttons ---------- */
.btn {
  width: 100%; min-height: 58px; padding: 12px 18px; border-radius: 18px;
  border: var(--bw) solid var(--line); background: var(--card); box-shadow: var(--sh-sm);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font: 800 18px/1.2 var(--font); transition: transform .08s, box-shadow .08s; text-decoration: none; color: var(--ink);
}
.btn svg { width: 24px; height: 24px; flex: none; }
.btn.primary { background: var(--sun); color: var(--sun-ink); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn[disabled] { opacity: .5; }
.actions { display: grid; gap: 12px; margin-top: 18px; }
.actions.two { grid-template-columns: 1fr 1fr; }

/* ---------- steps / lists ---------- */
.step-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.step-head h1 { font: 800 23px/1.2 var(--display); margin: 0; letter-spacing: -0.015em; flex: 1; }
.step-sub { margin: -6px 0 16px; color: var(--ink-2); font-size: 17px; }
.dots { display: flex; gap: 6px; margin: 0 0 14px; }
.dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--chip); }
.dots i.on { background: var(--ink); }

.search {
  position: relative; margin-bottom: 14px;
}
.search input {
  width: 100%; height: 60px; border-radius: 18px; border: var(--bw) solid var(--line); background: var(--card);
  box-shadow: var(--sh-sm); padding: 0 16px 0 52px; font-size: 19px; font-weight: 700; outline: none;
}
.search input::placeholder { color: var(--muted); font-weight: 600; }
.search input:focus { box-shadow: 0 3px 0 var(--focus); border-color: var(--focus); }
.search svg { position: absolute; left: 16px; top: 18px; width: 24px; height: 24px; color: var(--muted); }
.list { display: grid; gap: 10px; }
.row-btn {
  width: 100%; min-height: 58px; padding: 12px 16px; border-radius: 16px; border: var(--bw) solid var(--line);
  background: var(--card); box-shadow: var(--sh-sm); text-align: left; display: flex; align-items: center; gap: 12px;
  font-size: 18px; font-weight: 800; transition: transform .08s, box-shadow .08s;
}
.row-btn small { display: block; font-size: 14px; color: var(--muted); font-weight: 700; margin-top: 2px; }
.row-btn .grow { flex: 1; min-width: 0; }
.row-btn svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.row-btn .tag {
  font: 800 12px/1 var(--font); padding: 5px 8px; border-radius: 6px; background: var(--chip); color: var(--ink-2); white-space: nowrap;
}
.row-btn .tag.ok { background: var(--green-soft); color: var(--green); }
.hint { color: var(--muted); font-size: 15px; font-weight: 700; text-align: center; margin: 18px 6px; }
.section-title { font: 800 14px/1 var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 4px 10px; }

.qgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qgrid.many { grid-template-columns: repeat(5, 1fr); }
.q-btn {
  height: 66px; border-radius: 16px; border: var(--bw) solid var(--line); background: var(--card); box-shadow: var(--sh-sm);
  font: 800 22px/1 var(--display); transition: transform .08s, box-shadow .08s;
}
.qgrid.many .q-btn { height: 54px; font-size: 16px; border-radius: 12px; }
.q-btn.sel { background: var(--sun); color: var(--sun-ink); }

/* ---------- settings ---------- */
.set-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 2px dashed var(--chip);
}
.set-row:last-child { border-bottom: 0; }
.set-row .grow { flex: 1; }
.set-row .ttl { font-size: 18px; font-weight: 800; }
.set-row .sub { font-size: 14px; color: var(--muted); font-weight: 700; }
.toggle {
  width: 64px; height: 38px; border-radius: 999px; border: var(--bw) solid var(--line); background: var(--chip);
  position: relative; flex: none; transition: background .15s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: var(--bw) solid var(--line); transition: transform .15s;
}
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(26px); }
.pills { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.pill {
  height: 48px; border-radius: 14px; border: var(--bw) solid var(--line); background: var(--card); font-weight: 800; font-size: 16px;
}
.pill.on { background: var(--ink); color: var(--paper); }

/* ---------- welcome ---------- */
.welcome { text-align: center; padding-top: 18px; }
.welcome .bulb { width: 150px; height: 168px; margin: 0 auto 6px; display: block; }
.welcome h1 { font: 800 30px/1.12 var(--display); margin: 8px 0 12px; letter-spacing: -0.02em; }
.welcome p { font-size: 18px; color: var(--ink-2); margin: 0 auto 8px; max-width: 420px; }
.features { display: grid; gap: 10px; margin: 22px 0 6px; text-align: left; }
.feature {
  display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center;
  background: var(--card); border: var(--bw) solid var(--line); border-radius: 16px; padding: 12px;
}
.feature .ic { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; border: var(--bw) solid var(--line); }
.feature .ic svg { width: 26px; height: 26px; }
.feature b { display: block; font-size: 17px; }
.feature span { font-size: 15px; color: var(--muted); font-weight: 700; }

/* ---------- bulb art ---------- */
.bulb { --bulb-ink: var(--ink); }
.hero .bulb { --bulb-ink: #1D1B17; }
.hero.off .bulb { --bulb-ink: #F7F2E6; }
.bulb .glass { fill: var(--bulb-fill, #FFF6CF); }
.bulb .rays { transform-origin: 60px 52px; animation: rays 2.8s ease-in-out infinite; }
@keyframes rays { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: .8; } }
.bulb .zz { animation: zz 3s ease-in-out infinite; transform-origin: 100px 20px; }
@keyframes zz { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(-4px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .bulb .rays, .bulb .zz { animation: none; } }

/* ---------- toast & loading ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--paper); padding: 14px 18px; border-radius: 16px; font-weight: 800; font-size: 16px;
  max-width: calc(100% - 32px); transition: transform .25s; z-index: 10; text-align: center;
}
#toast.show { transform: translate(-50%, 0); }
.loading { display: grid; place-items: center; min-height: 60vh; }
.loading .bulb { width: 96px; height: 108px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.skeleton { height: 58px; border-radius: 16px; background: var(--chip); animation: pulse 1.2s ease-in-out infinite; }

/* ---------- compact home: one phone screen without scrolling (owner, 2026-10-19) ---------- */
.home .top { margin: 0 0 10px; }
.home .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
.home .brand-mark svg { width: 24px; height: 24px; }
.home .brand-name { font-size: 17px; }
.home .brand-sub { font-size: 12px; }
.home .icon-btn { width: 42px; height: 42px; }
.home .chips { margin-bottom: 4px; padding-bottom: 6px; }
.chip { height: 38px; font-size: 15px; }
.chip.add { padding: 0 14px 0 10px; background: var(--sun); color: var(--sun-ink); }
.home .hero { grid-template-columns: 74px 1fr; padding: 12px 14px; border-radius: 22px; gap: 10px; }
.home .hero .bulb { width: 74px; height: 84px; }
.home .hero .label { font-size: 11px; }
.home .hero h1 { font-size: 22px; margin: 2px 0 6px; }
.home .hero .next { padding-top: 6px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; }
.home .hero .next-lbl { font-size: 15px; font-weight: 700; opacity: .85; }
.home .hero .next-time { font: 800 26px/1.05 var(--display); letter-spacing: -0.02em; }
.home .hero .next-in { font-size: 14px; font-weight: 800; width: 100%; }
.home .hero .place-line { font-size: 13px; margin-top: 0; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home .banner { margin-top: 8px; padding: 8px 12px; font-size: 14px; }
.pill-note { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding: 6px 12px; border-radius: 12px;
  border: var(--bw) solid var(--line); background: var(--card); font-size: 13px; font-weight: 700; line-height: 1.25; }
.pill-note svg { width: 18px; height: 18px; flex: none; }
.home .seg { margin: 10px 0 8px; gap: 8px; }
.home .seg button { height: 46px; flex-direction: row; gap: 6px; font-size: 16px; border-radius: 14px; }
.home .seg button small { font-size: 12px; }
.card.day { padding: 10px 12px 12px; }
.card.day .ruler { padding-top: 24px; margin: 0; }
.card.day .ruler .bar { height: 30px; border-radius: 10px; }
.card.day .ruler .now { top: 18px; }
.card.day .ruler .now span { top: -22px; font-size: 12px; padding: 4px 7px; }
.card.day .ruler .ticks { font-size: 12px; margin-top: 4px; }
.ivs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.iv { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  padding: 7px 10px; border-radius: 12px; border: var(--bw) solid var(--line); background: var(--paper); }
.iv .ic { grid-row: 1 / span 2; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--night); color: var(--night-ink); border: 2px solid var(--line); }
.iv .ic svg { width: 18px; height: 18px; }
.iv.maybe .ic { background: var(--amber); color: var(--sun-ink); }
.iv .tm { font: 800 17px/1.1 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.01em; }
.iv .du { font-size: 12px; font-weight: 800; color: var(--muted); }
.iv.past { opacity: .45; }
.iv.now { background: var(--sun-2); }
.iv.now .du { color: var(--ink); text-transform: uppercase; letter-spacing: .04em; }
:root[data-theme="dark"] .iv.now { background: #3A3216; }
.none-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 16px; }
.none-row svg { width: 22px; height: 22px; color: var(--green); }
.card.day .total { margin-top: 8px; font-size: 14px; }
.card.day .empty-day h3 { font-size: 17px; }
.card.day .empty-day svg { width: 44px; height: 44px; }
.card.day .empty-day { grid-template-columns: 44px 1fr; }
.foot { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; }
.foot .meta { flex: 1; min-width: 0; margin: 0; text-align: left; font-size: 12px; line-height: 1.3; }
.link { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 12px; border-radius: 12px;
  border: var(--bw) solid var(--line); background: var(--card); font-weight: 800; font-size: 14px; box-shadow: var(--sh-sm); }
.link svg { width: 18px; height: 18px; }
.link:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
@media (max-height: 700px) {
  .home .hero .bulb { width: 60px; height: 68px; }
  .home .hero { grid-template-columns: 60px 1fr; }
  .ivs { gap: 6px; }
}
