/* Hearth — landscape touch dashboard. 1rem = 1/160 of screen width
   (16px at 2560, 12px at 1920), so the layout is identical at any resolution. */

:root {
  --ground: #E9EDE7;
  --surface: #FBFCF9;
  --surface-2: #F2F5F0;
  --ink: #1F2A27;
  --ink-2: #4C5955;
  --muted: #7A8682;
  --line: #D5DCD4;
  --accent: #F2B13B;      /* marigold: now / today only */
  --accent-ink: #5A3D00;
  --ok: #3E8E7E;
  --danger: #C2493A;
  --radius-lg: 1.75rem;
  --radius: 1.1rem;
  --radius-sm: .7rem;
  --tap: 4.5rem;          /* minimum touch target, ~72px @2560 */
  --rail: 8.5rem;
  --font: "SamsungOne", "Samsung Sans", "TizenSans", "Tizen Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  --ground: #121816;
  --surface: #1B2321;
  --surface-2: #222B29;
  --ink: #E6ECE8;
  --ink-2: #B9C4BF;
  --muted: #84918C;
  --line: #2E3936;
  --accent-ink: #2A1C00;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(100vw / 160); height: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: 1.75rem; line-height: 1.35;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea { -webkit-user-select: text; user-select: text; }
button { cursor: pointer; }
:focus-visible { outline: .3rem solid var(--accent); outline-offset: .2rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.ico { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wglyph { display: inline-block; width: 1.4em; height: 1.4em; flex: none; }
.wglyph svg { width: 100%; height: 100%; display: block; }

/* ---------- shell ---------- */
#app { display: grid; grid-template-columns: var(--rail) 1fr; height: 100vh; }
#rail {
  display: flex; flex-direction: column; align-items: stretch; gap: .5rem;
  padding: 1.5rem .9rem; background: var(--ink); color: #C9D3CF;
}
:root[data-theme="dark"] #rail { background: #0B100F; }
.rail-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  min-height: 7.2rem; border: 0; border-radius: var(--radius); background: transparent; color: inherit;
  font-size: 1.25rem; letter-spacing: .01em;
}
.rail-btn .ico { width: 2.6rem; height: 2.6rem; stroke-width: 1.7; }
.rail-btn.on { background: rgba(255,255,255,.1); color: #fff; }
.rail-btn.on .ico { color: var(--accent); }
.rail-btn:active { background: rgba(255,255,255,.16); }
.rail-spacer { flex: 1; }
.rail-status { text-align: center; font-size: 1.1rem; color: #8FA09A; padding: .5rem 0; }
.rail-status .dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; background: var(--ok); margin-right: .3rem; vertical-align: middle; }
.rail-status.offline .dot { background: var(--danger); }

#view { overflow: hidden; height: 100vh; outline: none; }
.page { height: 100vh; display: flex; flex-direction: column; padding: 2.4rem 2.8rem 2.4rem; gap: 1.8rem; }
.page-head { display: flex; align-items: center; gap: 1.2rem; min-height: var(--tap); }
.page-head h1 { margin: 0; font-size: 3.2rem; font-weight: 700; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); font-size: 1.8rem; }
.page-head .grow { flex: 1; }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { width: .5rem; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 1rem; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .7rem;
  min-height: var(--tap); padding: 0 2rem; border-radius: 999px; border: .15rem solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 1.65rem; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 3.6rem; padding: 0 1.4rem; font-size: 1.45rem; }
.icon-btn {
  width: var(--tap); height: var(--tap); border-radius: 50%; border: .15rem solid var(--line);
  background: var(--surface); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn .ico { width: 2.2rem; height: 2.2rem; }
.icon-btn:active { transform: scale(.94); }
.seg { display: inline-flex; padding: .35rem; border-radius: 999px; background: var(--surface-2); border: .15rem solid var(--line); }
.seg button { min-height: 3.8rem; padding: 0 1.6rem; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: 1.5rem; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 .1rem .3rem rgba(31,42,39,.12); }
.chip {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 3.8rem; padding: 0 1.3rem; border-radius: 999px;
  border: .15rem solid var(--line); background: var(--surface); font-size: 1.45rem; font-weight: 600; color: var(--ink-2);
}
.chip .sw { width: 1.2rem; height: 1.2rem; border-radius: 50%; }
.chip.on { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.chip.off { opacity: .45; }
.avatar {
  width: 4.4rem; height: 4.4rem; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.9rem;
}
.field { display: flex; flex-direction: column; gap: .6rem; }
.field > span { font-size: 1.4rem; color: var(--muted); font-weight: 600; }
.input, select.input, textarea.input {
  min-height: var(--tap); padding: 0 1.4rem; border-radius: var(--radius); border: .15rem solid var(--line);
  background: var(--surface); font-size: 1.7rem; width: 100%;
}
textarea.input { padding: 1rem 1.4rem; min-height: 10rem; resize: none; }
.input:focus { outline: none; border-color: var(--ink); }
.row { display: flex; align-items: center; gap: 1rem; }
.wrap { flex-wrap: wrap; }
.empty { color: var(--muted); padding: 1.6rem 0; }

/* checkbox circle */
.check {
  width: 3.6rem; height: 3.6rem; border-radius: 50%; border: .22rem solid var(--muted); flex: none;
  display: inline-flex; align-items: center; justify-content: center; background: transparent; padding: 0;
}
.check .ico { width: 2.2rem; height: 2.2rem; stroke-width: 2.6; color: #fff; opacity: 0; }
.check.on { background: var(--ok); border-color: var(--ok); }
.check.on .ico { opacity: 1; }

/* ---------- HOME ---------- */
.home { display: grid; grid-template-rows: auto auto 1fr; gap: 2rem; padding: 2.4rem 2.8rem; height: 100vh; }
.home-top { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2rem; }
.clock { display: flex; align-items: baseline; gap: 1rem; line-height: .9; }
.clock .t { font-size: 10.5rem; font-weight: 300; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.clock .ap { font-size: 3rem; font-weight: 600; color: var(--muted); }
.today-line { margin-top: 1rem; font-size: 2.6rem; font-weight: 600; letter-spacing: -.01em; }
.today-line .fam { color: var(--muted); font-weight: 400; }

.wx { display: flex; align-items: stretch; gap: 2.2rem; }
.wx-now { display: flex; align-items: center; gap: 1.2rem; }
.wx-now .wglyph { width: 7rem; height: 7rem; }
.wx-now .temp { font-size: 6.4rem; font-weight: 300; letter-spacing: -.04em; line-height: 1; }
.wx-now .desc { font-size: 1.6rem; color: var(--ink-2); }
.wx-days { display: flex; gap: .4rem; padding-left: 2.2rem; border-left: .15rem solid var(--line); }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: .2rem; width: 6.2rem; font-size: 1.45rem; }
.wx-day .wglyph { width: 3.6rem; height: 3.6rem; }
.wx-day .hi { font-weight: 700; font-size: 1.7rem; }
.wx-day .lo { color: var(--muted); }
.wx-day .pop { color: #4C8BE6; font-size: 1.25rem; min-height: 1.6rem; }
.wx-day.today > span:first-child { font-weight: 700; color: var(--ink); }
.wx-empty { align-self: center; }

/* the day ribbon: 6am–10pm, one lane per person */
.ribbon { background: var(--surface); border-radius: var(--radius-lg); padding: 1.4rem 2rem 1.2rem; position: relative; }
.ribbon-scale { position: relative; height: 2.2rem; margin-left: 10rem; font-size: 1.3rem; color: var(--muted); }
.ribbon-scale span { position: absolute; transform: translateX(-50%); top: 0; }
.ribbon-lanes { position: relative; }
.ribbon-lane { display: flex; align-items: center; height: 3.4rem; }
.ribbon-lane .who { width: 10rem; flex: none; display: flex; align-items: center; gap: .7rem; font-size: 1.5rem; font-weight: 600; color: var(--ink-2); }
.ribbon-lane .who i { width: 1.1rem; height: 1.1rem; border-radius: 50%; display: inline-block; }
.ribbon-track { position: relative; flex: 1; height: 2.4rem; border-radius: .6rem; background: var(--surface-2); }
.ribbon-seg {
  position: absolute; top: 0; bottom: 0; border-radius: .6rem; padding: 0 .7rem; overflow: hidden;
  font-size: 1.2rem; font-weight: 600; line-height: 2.4rem; color: #fff; white-space: nowrap; text-overflow: ellipsis; min-width: .8rem;
}
.ribbon-seg.past { opacity: .38; }
.ribbon-now { position: absolute; top: -2.4rem; bottom: -.4rem; width: .35rem; margin-left: -.175rem; background: var(--accent); border-radius: 1rem; pointer-events: none; }
.ribbon-now::before { content: ''; position: absolute; top: -.2rem; left: 50%; width: 1.3rem; height: 1.3rem; margin-left: -.65rem; border-radius: 50%; background: var(--accent); }
.ribbon-lanes .grid { position: absolute; top: 0; bottom: 0; left: 10rem; right: 0; pointer-events: none; }
.ribbon-lanes .grid span { position: absolute; top: 0; bottom: 0; width: .1rem; background: var(--line); opacity: .7; }

.home-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 2rem; min-height: 0; }
.panel { background: var(--surface); border-radius: var(--radius-lg); padding: 1.8rem 2rem; display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; min-height: 4rem; }
.panel-head h2 { margin: 0; font-size: 2.1rem; font-weight: 700; letter-spacing: -.01em; flex: 1; }
.panel-head .more { font-size: 1.45rem; color: var(--muted); font-weight: 600; border: 0; background: none; min-height: var(--tap); padding: 0 .5rem; }

.agenda-item { display: flex; gap: 1.4rem; padding: 1.15rem 0; border-top: .12rem solid var(--line); align-items: flex-start; }
.agenda-item:first-child { border-top: 0; }
.agenda-item .when { width: 9.5rem; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); font-size: 1.6rem; padding-top: .1rem; }
.agenda-item .bar { width: .6rem; align-self: stretch; border-radius: 1rem; flex: none; }
.agenda-item .what { flex: 1; min-width: 0; }
.agenda-item .title { font-weight: 600; font-size: 1.85rem; line-height: 1.25; }
.agenda-item .meta { color: var(--muted); font-size: 1.4rem; margin-top: .2rem; }
.agenda-item.now .when { color: var(--accent-ink); }
.agenda-item.now .when::before { content: 'Now'; display: block; font-size: 1.15rem; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .7rem; width: max-content; margin-bottom: .2rem; }
.agenda-item.past { opacity: .45; }
.agenda-daylabel { font-size: 1.4rem; font-weight: 700; color: var(--muted); padding: 1.2rem 0 .2rem; }

.dinner { display: flex; flex-direction: column; gap: .4rem; padding-bottom: 1.4rem; margin-bottom: 1.2rem; border-bottom: .12rem solid var(--line); }
.dinner .label { font-size: 1.4rem; color: var(--muted); font-weight: 600; }
.dinner .dish { font-size: 3rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.dinner .dish.none { color: var(--muted); font-weight: 400; font-size: 2.2rem; }

.chore-mini { display: flex; align-items: center; gap: 1rem; padding: .6rem 0; }
.chore-mini .name { width: 7rem; font-weight: 600; font-size: 1.6rem; }
.progress { flex: 1; height: 1.4rem; border-radius: 1rem; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 1rem; }
.chore-mini .count { width: 5rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 1.5rem; }

/* ---------- task rows (shared) ---------- */
.task { display: flex; align-items: center; gap: 1.2rem; min-height: 5.6rem; padding: .4rem 0; border-top: .12rem solid var(--line); }
.task:first-child { border-top: 0; }
.task .t { flex: 1; font-size: 1.8rem; min-width: 0; }
.task .due { font-size: 1.35rem; color: var(--muted); }
.task.done .t { color: var(--muted); text-decoration: line-through; text-decoration-thickness: .12rem; }
.task.pressing { background: var(--surface-2); }
.quick-add { display: flex; gap: .8rem; margin-top: .8rem; }
.quick-add .input { flex: 1; }
.quick-chips { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .8rem; }

/* ---------- CALENDAR ---------- */
.cal-filters { display: flex; gap: .8rem; flex-wrap: wrap; }
.week { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 1rem; }
.day-col { background: var(--surface); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.day-col .dh { padding: 1.2rem 1.3rem .8rem; display: flex; align-items: baseline; gap: .7rem; }
.day-col .dh .dn { font-size: 3rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.day-col .dh .dw { font-size: 1.5rem; color: var(--muted); font-weight: 600; }
.day-col.today .dh .dn { background: var(--accent); color: var(--accent-ink); border-radius: .8rem; padding: .2rem .7rem; }
.day-col.past { opacity: .62; }
.day-col .evs { flex: 1; padding: 0 .9rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.ev {
  border-radius: var(--radius-sm); padding: .7rem .9rem; border-left: .55rem solid; background: var(--surface-2);
  font-size: 1.45rem; line-height: 1.25; text-align: left; width: 100%; border-top: 0; border-right: 0; border-bottom: 0;
}
.ev .et { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev .em { color: var(--ink-2); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.ev.allday { color: #fff; border-left-width: 0; }
.ev.allday .em { color: rgba(255,255,255,.85); }
.add-slot { margin-top: auto; border: .15rem dashed var(--line); border-radius: var(--radius-sm); min-height: 4rem; background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; }

.month { flex: 1; min-height: 0; display: grid; grid-template-rows: auto 1fr; gap: .6rem; }
.month-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: .6rem; font-size: 1.4rem; color: var(--muted); font-weight: 700; padding: 0 1rem; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: .6rem; min-height: 0; }
.mday { background: var(--surface); border-radius: var(--radius); padding: .7rem .8rem; display: flex; flex-direction: column; gap: .3rem; overflow: hidden; border: 0; text-align: left; }
.mday.other { opacity: .4; }
.mday .n { font-weight: 700; font-size: 1.6rem; }
.mday.today .n { background: var(--accent); color: var(--accent-ink); border-radius: .6rem; padding: 0 .5rem; align-self: flex-start; }
.mday .mev { font-size: 1.2rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: .4rem; align-items: center; }
.mday .mev i { width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.mday .more { font-size: 1.15rem; color: var(--muted); }

.agenda-list { flex: 1; min-height: 0; background: var(--surface); border-radius: var(--radius-lg); padding: .8rem 2rem; }

/* ---------- TASKS ---------- */
.lists { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(36rem, 1fr); gap: 1.6rem; overflow-x: auto; }
.list-col { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem 1.8rem; display: flex; flex-direction: column; min-height: 0; }
.list-col h2 { margin: 0; font-size: 2.2rem; display: flex; align-items: center; gap: .8rem; }
.list-col .acct { font-size: 1.25rem; color: var(--muted); font-weight: 600; }
.list-col .items { flex: 1; min-height: 0; margin-top: .6rem; }
.list-col.groceries { background: var(--ink); color: #F4F7F3; }
.list-col.groceries .task { border-color: rgba(255,255,255,.12); }
.list-col.groceries .check { border-color: rgba(255,255,255,.55); }
.list-col.groceries .input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.list-col.groceries .chip { background: transparent; color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.25); }
.list-col.groceries .btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.list-col.groceries .muted, .list-col.groceries .task.done .t { color: rgba(255,255,255,.5); }
:root[data-theme="dark"] .list-col.groceries { background: #24352F; color: #EEF3EF; box-shadow: inset 0 0 0 .15rem #3A4D46; }
.list-col.groceries .input::placeholder { color: rgba(255,255,255,.55); }
.list-col.groceries .check.on { background: var(--accent); border-color: var(--accent); }
.list-col.groceries .check.on .ico { color: var(--accent-ink); }

/* ---------- MEALS ---------- */
.meals { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 34rem; gap: 2rem; }
.meal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1rem; min-height: 0; }
.meal-day { background: var(--surface); border-radius: var(--radius-lg); padding: 1.3rem; display: flex; flex-direction: column; gap: .8rem; }
.meal-day .dh { display: flex; align-items: baseline; gap: .6rem; }
.meal-day .dh b { font-size: 2.6rem; letter-spacing: -.02em; }
.meal-day .dh span { color: var(--muted); font-weight: 600; font-size: 1.45rem; }
.meal-day.today .dh b { background: var(--accent); color: var(--accent-ink); border-radius: .7rem; padding: 0 .6rem; }
.meal-slot { flex: 1; border-radius: var(--radius); border: .15rem dashed var(--line); background: none; text-align: left; padding: 1rem; display: flex; flex-direction: column; gap: .3rem; min-height: 8rem; }
.meal-slot .sl { font-size: 1.2rem; color: var(--muted); font-weight: 700; }
.meal-slot .mt { font-size: 1.85rem; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.meal-slot.filled { border-style: solid; border-color: transparent; background: var(--surface-2); }
.meal-slot.empty .mt { color: var(--muted); font-weight: 400; font-size: 1.6rem; }
.meal-slot.half { min-height: 6rem; }
.meal-add {
  min-height: 4.4rem; border-radius: var(--radius); border: .15rem dashed var(--line); background: none;
  color: var(--muted); font-weight: 600; font-size: 1.45rem; display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.meal-add .ico { width: 1.8rem; height: 1.8rem; }
.dinner .lunch-line { font-size: 1.7rem; color: var(--ink-2); font-weight: 600; margin-top: .4rem; }
.recipes { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem 1.8rem; display: flex; flex-direction: column; min-height: 0; }
.recipe { padding: 1.1rem 0; border-top: .12rem solid var(--line); display: flex; align-items: center; gap: 1rem; }
.recipe:first-child { border-top: 0; }
.recipe .rn { flex: 1; font-weight: 600; }
.recipe .ri { font-size: 1.3rem; color: var(--muted); font-weight: 400; display: block; }

/* ---------- CHORES ---------- */
.chores { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr) 30rem; gap: 1.4rem; }
.kid { background: var(--surface); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.kid-head { padding: 1.6rem 1.6rem 1.2rem; display: flex; align-items: center; gap: 1.1rem; }
.kid-head .nm { font-size: 2.3rem; font-weight: 700; flex: 1; }
.kid-stats { display: flex; gap: 1.2rem; padding: 0 1.6rem 1.2rem; font-size: 1.4rem; color: var(--ink-2); }
.kid-stats b { font-size: 2rem; color: var(--ink); margin-right: .3rem; font-variant-numeric: tabular-nums; }
.kid-stats .ico { width: 1.6rem; height: 1.6rem; vertical-align: -.25rem; }
.kid .bar { height: .7rem; background: var(--surface-2); margin: 0 1.6rem 1rem; border-radius: 1rem; overflow: hidden; }
.kid .bar i { display: block; height: 100%; border-radius: 1rem; transition: width .3s; }
.kid .list { flex: 1; min-height: 0; padding: 0 1.2rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
.chore {
  display: flex; align-items: center; gap: 1rem; min-height: 6.4rem; padding: .8rem 1rem; border-radius: var(--radius);
  background: var(--surface-2); border: 0; text-align: left; width: 100%;
}
.chore .ct { flex: 1; font-size: 1.75rem; font-weight: 600; line-height: 1.2; }
.chore .pts { font-size: 1.3rem; font-weight: 700; color: var(--ink-2); background: var(--surface); border-radius: 999px; padding: .2rem .8rem; }
.chore .check { width: 4.2rem; height: 4.2rem; }
.chore.done .ct { color: var(--muted); text-decoration: line-through; }
.chore.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.04); } }
.all-done { text-align: center; padding: 1rem; font-weight: 700; color: var(--ok); font-size: 1.6rem; }
.rewards { background: var(--surface); border-radius: var(--radius-lg); padding: 1.6rem 1.8rem; display: flex; flex-direction: column; min-height: 0; }
.reward { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; border-top: .12rem solid var(--line); }
.reward:first-of-type { border-top: 0; }
.reward .rt { flex: 1; font-weight: 600; font-size: 1.6rem; }
.reward .cost { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-ink); background: var(--accent); border-radius: 999px; padding: .2rem .9rem; font-size: 1.4rem; }

/* ---------- PHOTOS / FRAME ---------- */
.frame { position: fixed; inset: 0; z-index: 50; background: #000; color: #fff; overflow: hidden; }
.frame .slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.6s ease; transform: scale(1.04); }
.frame .slide.on { opacity: 1; animation: drift 24s linear forwards; }
@keyframes drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.1) translate(-1%, -1%); } }
.frame .overlay { position: absolute; left: 4rem; bottom: 3.6rem; right: 4rem; display: flex; align-items: flex-end; justify-content: space-between; text-shadow: 0 .2rem 2rem rgba(0,0,0,.45); }
.frame .ft { font-size: 9rem; font-weight: 300; letter-spacing: -.045em; line-height: .9; font-variant-numeric: tabular-nums; }
.frame .fd { font-size: 2.4rem; font-weight: 600; margin-top: .8rem; }
.frame .next { text-align: right; font-size: 2rem; max-width: 60rem; }
.frame .next b { display: block; font-size: 2.6rem; }
.frame.night .slide { opacity: 0 !important; }
.frame.night { background: #000; }
.frame.night .overlay { left: 0; right: 0; top: 0; bottom: 0; align-items: center; justify-content: center; flex-direction: column; color: #6E5A33; text-shadow: none; }
.frame.night .ft { font-size: 16rem; color: #8A6B2F; }
.frame.night .fd { color: #5E4D2C; }
.frame.night .next { display: none; }
.frame .hint { position: absolute; top: 2rem; right: 2.6rem; font-size: 1.3rem; opacity: .55; }

.photo-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 40rem; gap: 2rem; }
.photo-stage { border-radius: var(--radius-lg); overflow: hidden; position: relative; background: #000 center/cover no-repeat; }
.photo-stage .nav { position: absolute; top: 50%; transform: translateY(-50%); }
.photo-stage .nav.l { left: 1.6rem; } .photo-stage .nav.r { right: 1.6rem; }
.photo-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; align-content: start; }
.photo-thumbs button { aspect-ratio: 16 / 10; border: 0; border-radius: var(--radius-sm); background: center/cover no-repeat; padding: 0; }
.photo-thumbs button.on { outline: .35rem solid var(--accent); }

/* ---------- WEB PAGES ---------- */
.web-tabs { display: flex; gap: .8rem; flex-wrap: wrap; }
.web-stage { flex: 1; min-height: 0; border-radius: var(--radius-lg); overflow: hidden; background: #fff; position: relative; }
.web-stage iframe { border: 0; width: 100%; height: 100%; display: block; background: #fff; transform-origin: 0 0; }
.web-detect b { display: inline-flex; align-items: center; gap: .4rem; font-size: 1.5rem; }
.web-detect p { margin: .4rem 0 0; font-size: 1.4rem; line-height: 1.4; }

/* full-screen Pages: the web view takes the whole screen */
body.immersive #app { grid-template-columns: 0 1fr; }
body.immersive #rail { visibility: hidden; padding: 0; overflow: hidden; }
body.immersive .web-page { padding: 0; gap: 0; }
body.immersive .web-page .page-head,
body.immersive .web-page .web-tabs { display: none; }
body.immersive .web-stage { border-radius: 0; }
.web-pill { display: none; }
body.immersive .web-pill {
  position: fixed; right: 1.6rem; bottom: 1.6rem; z-index: 40; display: flex; align-items: center; gap: .4rem;
  padding: .5rem; border-radius: 999px; background: rgba(31,42,39,.82); color: #fff;
  box-shadow: 0 .4rem 1.6rem rgba(0,0,0,.25); transition: opacity .4s;
}
body.immersive .web-pill.dim { opacity: .28; }
.pill-title { padding: 0 .8rem; font-weight: 600; font-size: 1.45rem; max-width: 30rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-btn {
  min-width: 4.8rem; height: 4.8rem; border-radius: 999px; border: 0; background: rgba(255,255,255,.12); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: 0 1rem; font-weight: 600; font-size: 1.45rem;
}
.pill-btn .ico { width: 2.2rem; height: 2.2rem; }
.pill-btn.exit { background: var(--accent); color: var(--accent-ink); }
.web-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4rem; background: var(--surface); text-align: center; padding: 4rem; }
.web-fallback h2 { margin: 0; font-size: 2.6rem; }
.web-fallback p { margin: 0; color: var(--muted); max-width: 60rem; }

/* ---------- SETTINGS ---------- */
.settings { flex: 1; min-height: 0; display: grid; grid-template-columns: 24rem 1fr; gap: 2rem; }
.set-nav { display: flex; flex-direction: column; gap: .5rem; }
.set-nav button { min-height: 5.4rem; text-align: left; padding: 0 1.4rem; border: 0; border-radius: var(--radius); background: transparent; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: .9rem; }
.set-nav button.on { background: var(--surface); color: var(--ink); }
.set-body { background: var(--surface); border-radius: var(--radius-lg); padding: 2.2rem 2.6rem; }
.set-body h2 { margin: 0 0 .4rem; font-size: 2.4rem; }
.set-body h3 { margin: 2.4rem 0 1rem; font-size: 1.9rem; }
.set-body p { margin: .4rem 0 1.2rem; color: var(--ink-2); max-width: 90rem; }
.set-row { display: flex; align-items: center; gap: 1.2rem; padding: 1.1rem 0; border-top: .12rem solid var(--line); }
.set-row:first-of-type { border-top: 0; }
.set-row .lbl { flex: 1; min-width: 0; }
.set-row .lbl small { display: block; color: var(--muted); font-size: 1.35rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.toggle { width: 7.2rem; height: 4.2rem; border-radius: 999px; background: var(--line); border: 0; position: relative; flex: none; padding: 0; }
.toggle::after { content: ''; position: absolute; top: .45rem; left: .45rem; width: 3.3rem; height: 3.3rem; border-radius: 50%; background: #fff; transition: left .18s; box-shadow: 0 .1rem .3rem rgba(0,0,0,.2); }
.toggle.on { background: var(--ok); }
.toggle.on::after { left: 3.45rem; }
.swatches { display: flex; gap: .6rem; }
.swatches button { width: 3.8rem; height: 3.8rem; border-radius: 50%; border: .3rem solid transparent; padding: 0; }
.swatches button.on { border-color: var(--ink); }
.acct-card { border: .15rem solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.6rem; margin-bottom: 1.2rem; }
.acct-card .row { justify-content: space-between; }
.badge { display: inline-block; font-size: 1.2rem; font-weight: 700; padding: .15rem .8rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); vertical-align: middle; margin-left: .6rem; }
.pair { display: grid; grid-template-columns: 24rem 1fr; gap: 2.4rem; align-items: center; }
.qr { width: 24rem; height: 24rem; background: #fff; border-radius: var(--radius); padding: .6rem; }
.qr svg { width: 100%; height: 100%; display: block; }
.code-big { font-size: 3.4rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; }

/* ---------- sheets, toasts, pin ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15,22,20,.45); display: flex; align-items: center; justify-content: center; animation: fade .18s ease; }
.sheet-backdrop.out { opacity: 0; transition: opacity .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 64rem; max-height: 86vh; background: var(--surface); border-radius: 2.2rem; padding: 2.2rem 2.6rem; display: flex; flex-direction: column; gap: 1.4rem; animation: rise .22s ease; }
.sheet.wide { width: 96rem; }
@keyframes rise { from { transform: translateY(2rem); opacity: .4; } }
.sheet-head { display: flex; align-items: center; gap: 1rem; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 2.5rem; }
.sheet-body { overflow-y: auto; display: flex; flex-direction: column; gap: 1.4rem; min-height: 0; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 1rem; padding-top: .4rem; }
#toasts { position: fixed; bottom: 3rem; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: .8rem; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 1.2rem 2.2rem; border-radius: 999px; font-weight: 600; animation: rise .2s ease; transition: opacity .4s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; }
.pin-dots { display: flex; justify-content: center; gap: 1.4rem; padding: 1rem 0; }
.pin-dots span { width: 1.8rem; height: 1.8rem; border-radius: 50%; border: .2rem solid var(--muted); }
.pin-dots span.on { background: var(--ink); border-color: var(--ink); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-1rem); } 75% { transform: translateX(1rem); } }
.pin-pad { display: grid; grid-template-columns: repeat(3, 8rem); gap: 1rem; justify-content: center; }
.pin-key { height: 7rem; border-radius: 1.4rem; border: .15rem solid var(--line); background: var(--surface-2); font-size: 2.6rem; font-weight: 600; }
.pin-key:active { background: var(--line); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
