@font-face {
  font-family: "Jakarta";
  src: url("fonts/jakarta.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@property --depth { syntax: '<number>'; inherits: false; initial-value: 0; }
:root {
  --right: #19c37d;
  --left: #ff4f6d;
  --up: #ffaa1f;
  --down: #8b7cf6;
  --tap3: #38b6ff;
  --ink: #1d1832;
  --ink-2: #4b4566;
  --ink-3: #8a84a3;
  --card: #fffdfb;
  --spring: cubic-bezier(.2, 1.35, .35, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: "Jakarta", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: #1d1442;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 112%, #ffb37a 0%, #f2776e 22%, rgba(160, 64, 150, .0) 60%),
    linear-gradient(180deg, #160f38 0%, #2a1a5e 38%, #5a2a85 70%, #a3477f 100%);
}
/* Soft glows are pre-blurred radial gradients (no live filter: blur on huge moving layers), so the drift is a cheap
   compositor transform. */
.blob { position: absolute; border-radius: 50%; opacity: .55; will-change: transform; background: radial-gradient(closest-side, var(--bc) 0%, var(--bc) 42%, color-mix(in srgb, var(--bc) 55%, transparent) 68%, transparent 100%); }
.b1 { --bc: #4b3bbd; width: 82vmax; height: 82vmax; left: -36vmax; top: -31vmax; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { --bc: #c04f9a; width: 72vmax; height: 72vmax; right: -34vmax; top: calc(18vh - 6vmax); opacity: .38; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { --bc: #ff9a62; width: 92vmax; height: 62vmax; left: -21vmax; bottom: -36vmax; opacity: .5; animation: drift3 18s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-6vmax, 8vmax) scale(.92); } }
@keyframes drift3 { to { transform: translate(6vmax, -4vmax) scale(1.1); } }
.stars {
  position: absolute; inset: 0 0 55% 0; opacity: .7;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 46% 26%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 81% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 6%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 40%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 72% 42%, #fff 50%, transparent 51%);
  animation: twinkle 5s ease-in-out infinite alternate;
  mask-image: linear-gradient(#000, transparent);
}
@keyframes twinkle { from { opacity: .35; } to { opacity: .8; } }
.tint { position: absolute; inset: 0; opacity: 0; transition: opacity .25s; will-change: opacity; background: radial-gradient(90% 70% at 50% 50%, var(--tint, transparent), transparent 70%); }

/* ---------- layout ---------- */
.app {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column;
  padding: calc(10px + var(--safe-t)) 0 calc(6px + var(--safe-b));
  max-width: 520px; margin: 0 auto;
}
.topbar { display: flex; align-items: center; gap: 12px; padding: 4px 20px 10px; }
.logo { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 6px 18px rgba(10, 4, 40, .45); }
.brand { flex: 1; min-width: 0; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, .7); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.counter {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; height: 46px; padding: 0 10px; border-radius: 16px;
  background: rgba(58, 40, 112, .55); border: 1px solid rgba(255, 255, 255, .18);
}
.counter span { font-size: 18px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.counter small { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-top: 2px; }
.counter.bump span { animation: bump .45s var(--spring); }
/* Install pill (header, next to the cards-left badge) */
.install-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 13px 0 10px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; color: #2a1650; letter-spacing: -.005em;
  background: linear-gradient(135deg, #ffe08a, #ffb37a 55%, #ff8fa3); border: 0;
  box-shadow: 0 6px 18px rgba(255, 140, 90, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
  animation: popIn .5s var(--spring) both; -webkit-tap-highlight-color: transparent;
}
.install-btn[hidden] { display: none; }
.install-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.install-btn:active { transform: scale(.95); }
.install-btn[data-mode="help"] {
  height: 30px; padding: 0 11px 0 8px; font-size: 12px; color: #fff; font-weight: 650;
  background: rgba(58, 40, 112, .55); border: 1px solid rgba(255, 255, 255, .22); box-shadow: none;
}
.install-btn[data-mode="help"] svg { width: 14px; height: 14px; }
.install-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.install-wrap[hidden] { display: none; }
.install-backdrop { position: absolute; inset: 0; background: rgba(8, 3, 28, .66); animation: fadeIn .25s both; }
.install-sheet {
  position: relative; width: 100%; max-width: 520px; color: #24123f; text-align: center;
  background: linear-gradient(180deg, #fffaf3, #fff); border-radius: 26px 26px 0 0;
  padding: 10px 22px calc(18px + var(--safe-b)); box-shadow: 0 -18px 50px rgba(10, 4, 40, .4);
  animation: sheetUp .38s var(--ease-out) both;
}
.install-sheet .grabber { width: 40px; height: 5px; border-radius: 5px; background: rgba(36, 18, 63, .15); margin: 0 auto 12px; }
.install-icon { border-radius: 16px; box-shadow: 0 8px 22px rgba(255, 120, 80, .3); }
.install-sheet h3 { margin: 10px 0 4px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.install-sub { margin: 0 0 14px; font-size: 13.5px; color: rgba(36, 18, 63, .65); }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; }
.install-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: #f6f0ff; font-size: 14px; line-height: 1.35; }
.install-steps .ico { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: #fff; color: #6b4de6; box-shadow: 0 2px 8px rgba(80, 50, 160, .12); font-size: 18px; }
.install-steps .ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-note { margin: 12px 4px 14px; font-size: 12.5px; color: rgba(36, 18, 63, .6); }
.install-done { width: 100%; height: 48px; border: 0; border-radius: 16px; font: inherit; font-size: 15px; font-weight: 750; color: #fff; cursor: pointer; background: linear-gradient(135deg, #7b5cff, #ff6f91); box-shadow: 0 8px 20px rgba(123, 92, 255, .35); }
@media (max-width: 380px) { .install-btn[data-mode="prompt"] span { display: none; } .install-btn[data-mode="prompt"] { padding: 0 9px; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.progress { height: 4px; margin: 0 20px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.progress-fill { height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #ffd27a, #ff8c5a, #ff5f8f); transform: translateX(-100%); transition: transform .6s var(--ease-out); box-shadow: 0 0 12px rgba(255, 170, 110, .7); }

.demo-banner {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; max-width: calc(100% - 32px);
  padding: 4px 12px 4px 4px; border-radius: 999px; font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .86);
  background: rgba(58, 40, 112, .6); border: 1px solid rgba(255, 255, 255, .18);
  animation: popIn .6s .2s var(--spring) both;
}
.demo-banner b {
  flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px;
  color: #2a1640; background: linear-gradient(90deg, #ffd27a, #ff8c5a);
}
.demo-banner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill {
  cursor: pointer;
  align-self: center; margin-top: 8px; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 170, 31, .2); color: #ffe2a8; border: 1px solid rgba(255, 190, 80, .35);
}

.stage { position: relative; flex: 1; min-height: 0; margin: 14px 16px 6px; }
.stack { position: absolute; inset: 0 0 26px 0; }

/* ---------- card ---------- */
.card {
  --accent: #7c6cf2;
  --depth: 0;
  position: absolute; inset: 0;
  border-radius: 30px;
  background:
    radial-gradient(130% 55% at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%),
    radial-gradient(90% 45% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    linear-gradient(180deg, #fffefd, #fbf7f3);
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 30px 60px -18px rgba(14, 6, 48, .55),
    0 12px 24px -12px rgba(14, 6, 48, .35);
  transform-origin: 50% 85%;
  transform: translate3d(0, calc(var(--depth) * 15px), 0) scale(calc(1 - var(--depth) * .05));
  transition: transform .5s var(--spring), opacity .35s, filter .35s;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  overflow: hidden;
  display: flex; flex-direction: column;
  padding: 44px 24px 62px;
  cursor: grab;
}
.card.dragging { transition: none; cursor: grabbing; }
/* Own GPU layers for what moves: the top card (and its stamp/glow overlays, which fade with opacity only) and the two
   cards that rise behind it. Decorative loops inside cards animate transform/opacity only (compositor). */
.card[data-depth="0"], .card[data-depth="1"], .card[data-depth="2"], .card.flying { will-change: transform; }
.card[data-depth="0"] .card-wash, .card[data-depth="0"] .card-ring { will-change: opacity; }
.card[data-depth="0"] .stamp { will-change: opacity, scale; }
.card[data-depth="1"] { filter: brightness(.94) saturate(.9); }
.card[data-depth="2"] { filter: brightness(.86) saturate(.8); }
.card[data-depth="3"] { opacity: 0; }
/* Only the top card shows edge hints / stamps / glow. Back cards stay fully opaque (no wash-out), just dimmed. */
.card:not([data-depth="0"]) .stamp,
.card:not([data-depth="0"]) .card-wash,
.card:not([data-depth="0"]) .card-ring,
.card:not([data-depth="0"]) .tap-ripple { opacity: 0 !important; }
.card:not([data-depth="0"]) .hint { opacity: 0; }
.card .hint { transition: opacity .35s .1s, transform .2s var(--spring); }
.card[data-depth="0"] .hint { will-change: transform; }
.card.enter { animation: cardIn .6s var(--spring) both; }
@keyframes cardIn { from { transform: translate3d(0, 60px, 0) scale(.85); opacity: 0; } }

.card-wash { position: absolute; inset: 0; pointer-events: none; opacity: 0; border-radius: inherit; }
.card-ring { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; opacity: 0; box-shadow: inset 0 0 0 3px var(--glow, transparent); }

.ribbon {
  position: absolute; top: 20px; right: -44px; width: 160px; transform: rotate(45deg);
  text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .22em; padding: 5px 0 5px .22em;
  color: #fff; background: linear-gradient(90deg, #ff7a59, #ff4f8b);
  box-shadow: 0 4px 12px rgba(255, 79, 139, .35);
  z-index: 3;
}
.card-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 48px; height: 48px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-size: 25px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 30%, #fff), color-mix(in srgb, var(--accent) 60%, #fff));
  box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .7);
}
.who { min-width: 0; flex: 1; }
.bot { font-weight: 800; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { font-size: 12.5px; color: var(--ink-3); font-weight: 500; margin-top: 1px; }
.chips { display: flex; gap: 6px; margin: 18px 0 10px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, #fff); color: color-mix(in srgb, var(--accent) 55%, #1d1832); /* >= 4.5:1 on the tinted chip for every bot accent (axe color-contrast) */
}
.chip.prio-high { background: #ffe8ec; color: #b01c3e; }
.chip.prio-high { position: relative; }
.chip.prio-high::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(212, 42, 79, .18); }
.chip.prio-high::after { content: ""; position: absolute; left: 10px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: rgba(212, 42, 79, .3); pointer-events: none; opacity: 0; }
.card[data-depth="0"]:not(.dragging) .chip.prio-high::after { animation: pulse 1.8s ease-out infinite; } /* only the resting top card pulses */
.chip.prio-normal { background: #eef0f7; color: #56607a; }
.chip.prio-low { background: #eaf6f0; color: #1d6e4c; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 70%, 100% { transform: scale(2.7); opacity: 0; } }
.card h2 { margin: 2px 0 10px; font-size: 25px; line-height: 1.18; font-weight: 800; letter-spacing: -.025em; color: var(--ink); text-wrap: balance; }
.card .body {
  margin: 0; font-size: 16px; line-height: 1.5; color: var(--ink-2); font-weight: 500;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; overflow: hidden;
}
.options { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 7px; }
.options li {
  display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 650;
  padding: 9px 12px; border-radius: 14px; background: rgba(29, 24, 50, .04); color: var(--ink);
}
.options .arrow { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 14px; flex: none; }
.spacer { flex: 1; min-height: 8px; }
.peek {
  position: relative; margin: 18px 0 0; padding: 12px 14px 12px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 6%, rgba(29, 24, 50, .035));
  border: 1px solid color-mix(in srgb, var(--accent) 14%, transparent);
  font-size: 13.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-line;
  max-height: 9.6em; overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 62%, transparent 98%); mask-image: linear-gradient(#000 62%, transparent 98%);
}
.peek::before { content: "DETAILS"; display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; color: color-mix(in srgb, var(--accent) 70%, #1d1832); margin-bottom: 4px; }
.tap-hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.tap-hint .dots { display: inline-flex; gap: 3px; }
.tap-hint .dots i { width: 6px; height: 6px; border-radius: 50%; background: #cfc9e2; transition: background .15s, transform .2s var(--spring); }
.tap-hint .dots i.on { background: var(--tap3); transform: scale(1.4); }
.tap-hint b { color: var(--ink-2); }

/* edge hints */
.hint {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .02em;
  padding: 6px 11px; border-radius: 999px;
  color: color-mix(in srgb, var(--c) 80%, #1d1832);
  background: color-mix(in srgb, var(--c) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  opacity: .78; transition: transform .2s var(--spring), opacity .2s;
  max-width: 44%; white-space: nowrap;
}
.hint span { overflow: hidden; text-overflow: ellipsis; }
.hint svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hint-up { --c: var(--up); top: 10px; left: 50%; transform: translateX(-50%); }
.hint-down { --c: var(--down); bottom: 14px; left: 50%; transform: translateX(-50%); max-width: 34%; }
.hint-left { --c: var(--left); bottom: 14px; left: 14px; max-width: 30%; }
.hint-right { --c: var(--right); bottom: 14px; right: 14px; max-width: 30%; }
.hint.active { opacity: 1; color: #fff; background: var(--c); border-color: transparent; box-shadow: 0 6px 18px -4px var(--c); }
.hint-up.active, .hint-down.active { transform: translateX(-50%) scale(1.12); }
.hint-left.active, .hint-right.active { transform: scale(1.12); }

/* stamps */
.stamp {
  position: absolute; z-index: 4; pointer-events: none;
  font-weight: 900; font-size: var(--fs, 44px); letter-spacing: .06em; text-transform: uppercase; line-height: 1;
  padding: 8px 14px 6px; border: 5px solid currentColor; border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  opacity: 0; white-space: nowrap; max-width: 86%; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .6);
  box-shadow: 0 8px 24px -8px currentColor;
}
.stamp-right { max-width: 74%; color: var(--right); top: 56px; left: 22px; rotate: -14deg; transform-origin: left center; }
.stamp-left { max-width: 74%; color: var(--left); top: 56px; right: 22px; rotate: 14deg; transform-origin: right center; }
.stamp-up { color: var(--up); bottom: 96px; left: 50%; translate: -50% 0; rotate: -6deg; }
.stamp-down { color: var(--down); top: 120px; left: 50%; translate: -50% 0; rotate: 5deg; }
.stamp-tap3 { color: var(--tap3); top: 42%; left: 50%; translate: -50% -50%; rotate: -8deg; }

/* built-in feedback card */
.card[data-builtin] {
  background:
    radial-gradient(120% 50% at 0% 0%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 62%),
    radial-gradient(90% 55% at 100% 105%, rgba(255, 196, 120, .28), transparent 70%),
    linear-gradient(180deg, #fffefd, #fff6f0);
}
.chip.chip-soft { background: #fff1e3; color: #8a4a0e; }
.fb-ideas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.fb-ideas span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: #fff; border: 1px solid color-mix(in srgb, var(--accent) 18%, #eee6f2);
  box-shadow: 0 6px 14px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  animation: floaty 3.6s ease-in-out calc(var(--i) * -.9s) infinite;
}
.fb-ideas b { font-size: 15px; font-weight: 400; }
@keyframes floaty { 50% { transform: translateY(-3px); } }
.fb-sun { position: relative; flex: 1 1 auto; min-height: 70px; max-height: 190px; margin: 6px -24px -10px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(transparent, #000 35%); mask-image: linear-gradient(transparent, #000 35%); }
.fb-sun i:first-child {
  position: absolute; left: 50%; bottom: -70px; width: 150px; height: 150px; margin-left: -75px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff3cf, #ffc56b 45%, #ff8c5a 100%);
  box-shadow: 0 0 50px 14px rgba(255, 170, 90, .35); opacity: .9;
}
.fb-sun i:last-child {
  position: absolute; left: 50%; bottom: -170px; width: 340px; height: 340px; margin-left: -170px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 170, 90, .16) 0 6deg, transparent 6deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 28%, transparent 66%); mask-image: radial-gradient(circle, #000 28%, transparent 66%);
  animation: spin 60s linear infinite;
}
.card[data-builtin] .spacer { flex: 0 0 4px; min-height: 4px; }
.card[data-builtin] .fb-sun { margin-bottom: 10px; }
.card[data-builtin] .tap-hint { position: relative; z-index: 1; }
.card[data-builtin] .hint-left { max-width: 44%; }
.card[data-builtin] .hint-down { max-width: 22%; }
.act.act-left span { max-width: 96px; }
.card[data-builtin] .fb-sun + .spacer { display: none; }

/* skeleton */
.card.skeleton { cursor: default; }
.sk { border-radius: 10px; background: linear-gradient(90deg, #eee9f3 0%, #f8f5fb 40%, #eee9f3 80%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- action bar ---------- */
.actions { display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 4px 14px 6px; }
.act {
  --c: #fff;
  position: relative; border: 0; padding: 0; cursor: pointer;
  width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 24px -8px rgba(10, 4, 40, .6), inset 0 -2px 0 rgba(0, 0, 0, .05);
  transition: transform .25s var(--spring), box-shadow .2s, opacity .2s;
  margin-bottom: 18px;
}
.act.big { width: 64px; height: 64px; }
.act svg { width: 22px; height: 22px; fill: none; stroke: var(--c); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.act.big svg { width: 28px; height: 28px; stroke-width: 3.2; }
.act span {
  position: absolute; top: calc(100% + 5px); left: 50%; transform: translateX(-50%);
  font-size: 10.5px; font-weight: 700; color: rgba(255, 255, 255, .82); white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis;
}
.act:active { transform: scale(.88); }
.act[data-g] { will-change: transform; }
.actions.live .act { transition: none; }
.act:hover:not(:disabled) { transform: translateY(-2px); }
.act:disabled { opacity: .4; cursor: default; }
.act-left { --c: var(--left); }
.act-right { --c: var(--right); }
.act-up { --c: var(--up); }
.act-down { --c: var(--down); }
.act-tap3 { --c: var(--tap3); }
.act-undo { --c: #b08b2e; width: 42px; height: 42px; }
.act-tap3 { width: 42px; height: 42px; }
.act-undo svg, .act-tap3 svg { width: 19px; height: 19px; }
.act.flash { animation: flash .5s var(--spring); }
@keyframes flash { 30% { transform: scale(1.18); box-shadow: 0 0 0 8px color-mix(in srgb, var(--c) 30%, transparent), 0 10px 24px -8px rgba(10, 4, 40, .6); } }

.safety { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .62); padding: 2px 16px 4px; text-align: center; }
.safety svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; flex: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; top: calc(74px + var(--safe-t)); z-index: 30;
  transform: translate(-50%, -16px) scale(.96); opacity: 0; pointer-events: none;
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  background: rgba(22, 14, 50, .94); color: #fff; border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5);
  transition: transform .35s var(--spring), opacity .25s;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.long { white-space: normal; width: max-content; max-width: min(88vw, 420px); border-radius: 18px; line-height: 1.35; text-align: left; }
.toast i { font-style: normal; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--c, #fff); box-shadow: 0 0 10px var(--c, #fff); }

/* ---------- sheet ---------- */
.sheet-wrap {
  /* Sized to the visible area: --kb = keyboard overlap when the browser overlays it (set from visualViewport). */
  position: fixed; left: 0; right: 0; top: 0; bottom: var(--kb, 0px); z-index: 40;
}
.sheet-backdrop { position: absolute; inset: 0; background: rgba(12, 6, 34, .64); animation: fadeIn .3s both; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: min(88%, calc(var(--vvh, 100dvh) - 8px)); max-height: min(88svh, 88%, calc(var(--vvh, 100dvh) - 8px));
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #fffefc, #f7f3fb);
  color: var(--ink); border-radius: 28px 28px 0 0;
  padding: 10px 0 calc(12px + var(--safe-b));
  transition: max-height .25s var(--ease-out), border-radius .25s;
  box-shadow: 0 -20px 60px rgba(10, 4, 40, .45);
  animation: sheetUp .5s var(--spring) both;
}
.sheet-wrap.closing .sheet { animation: sheetDown .28s ease-in both; }
.sheet-wrap.closing .sheet-backdrop { animation: fadeOut .28s both; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.grabber { width: 42px; height: 5px; border-radius: 5px; background: #d8d2e6; margin: 0 auto 14px; flex: none; }
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1 1 auto; padding: 0 22px 8px; -webkit-overflow-scrolling: touch; }
/* Sticky composer: text box, photo button and Save never scroll away. */
.sheet-compose {
  flex: none; padding: 2px 22px 0; position: relative;
  background: linear-gradient(180deg, rgba(250, 247, 252, .96), #f7f3fb 40%);
  box-shadow: 0 -14px 18px -16px rgba(29, 24, 50, .35);
}
.sheet-bot { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 14.5px; }
.sheet-bot .avatar { width: 38px; height: 38px; border-radius: 13px; font-size: 20px; }
.sheet-bot small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.sheet h3 { font-size: 21px; line-height: 1.22; letter-spacing: -.02em; margin: 14px 0 8px; }
.sheet-body { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; line-height: 1.5; }
.sheet-details { white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: var(--ink-2); background: rgba(29, 24, 50, .045); border-radius: 16px; padding: 12px 14px; }
.sheet-details:empty { display: none; }
.sheet-quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.qbtn {
  border: 0; cursor: pointer; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 80%, #1d1832);
  border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  transition: background .2s, color .2s, transform .25s var(--spring), box-shadow .2s;
}
.qbtn:active { transform: scale(.95); }
.qbtn.on { background: var(--c); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -6px var(--c); }
.sheet-label { display: block; font-size: 12.5px; font-weight: 750; color: var(--ink-2); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.sheet-wrap[data-mode="left"] .sheet-label { color: color-mix(in srgb, var(--left) 85%, #1d1832); }
.sheet-wrap[data-mode="left"] textarea:focus { border-color: var(--left); box-shadow: 0 0 0 4px color-mix(in srgb, var(--left) 18%, transparent); }
.sheet-wrap[data-mode="left"] .primary-btn { background: linear-gradient(135deg, #ff6b81, #ff8c5a); box-shadow: 0 10px 24px -8px rgba(255, 79, 109, .65); }

/* photos */
.photo-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; min-height: 52px; }
.photo-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px 0 12px; cursor: pointer;
  border-radius: 14px; border: 1.5px dashed color-mix(in srgb, var(--tap3) 55%, #cfc9e2);
  background: color-mix(in srgb, var(--tap3) 8%, #fff); color: color-mix(in srgb, var(--tap3) 70%, #1d1832);
  font-size: 13.5px; font-weight: 750; transition: transform .25s var(--spring), background .2s, opacity .2s;
}
.photo-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.photo-btn:active { transform: scale(.94); }
.photo-btn.compact { padding: 0 10px; height: 52px; flex-direction: column; justify-content: center; gap: 1px; font-size: 11px; width: 52px; }
.photo-btn.compact svg { width: 19px; height: 19px; }
.photo-btn:disabled { opacity: .45; cursor: default; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; overflow-y: visible; padding: 6px 4px 4px 2px; margin: -6px 0 -4px; scrollbar-width: none; flex: 1; min-width: 0; }
.thumbs::-webkit-scrollbar { display: none; }
.thumb {
  position: relative; flex: none; width: 52px; height: 52px; border-radius: 14px;
  background: #eee9f3 center / cover no-repeat;
  box-shadow: 0 6px 14px -8px rgba(29, 24, 50, .55), inset 0 0 0 1px rgba(29, 24, 50, .08);
  animation: thumbIn .45s var(--spring) both;
}
.thumb.loading { background-image: linear-gradient(90deg, #eee9f3 0%, #f8f5fb 40%, #eee9f3 80%) !important; background-size: 200% 100%; animation: thumbIn .45s var(--spring) both, shimmer 1.1s linear infinite; }
.thumb.ready { animation: thumbReady .35s var(--ease-out) both; }
.thumb.leaving { animation: thumbOut .22s ease-in both; }
.thumb-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; padding: 0; cursor: pointer;
  display: grid; place-items: center; background: #2a2340; color: #fff; font-size: 15px; font-weight: 700; line-height: 1;
  box-shadow: 0 3px 8px rgba(29, 24, 50, .35);
}
.thumb-x span { margin-top: -2px; }
.thumb-x::before { content: ""; position: absolute; inset: -10px; } /* bigger touch target */
@keyframes thumbIn { from { transform: scale(.4); opacity: 0; } }
@keyframes thumbReady { from { filter: blur(6px) saturate(.4); } }
@keyframes thumbOut { to { transform: scale(.3); opacity: 0; } }

/* keyboard open: collapse the context, keep the composer pinned right above the keyboard */
.sheet-wrap.kb .sheet { max-height: calc(var(--vvh, 100dvh) - 6px); max-height: calc(100% - 6px); border-radius: 22px 22px 0 0; padding-bottom: 8px; animation: none; }
.sheet-wrap.kb .grabber { margin-bottom: 8px; }
.sheet-wrap.kb .sheet h3 { font-size: 17px; margin: 8px 0 4px; }
.sheet-wrap.kb .sheet-body { font-size: 13.5px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-bottom: 6px; }
.sheet-wrap.kb .sheet-details { font-size: 13px; padding: 8px 12px; }
.sheet-wrap.kb .sheet-quick, .sheet-wrap.kb .sheet-note { display: none; }
.sheet-wrap.kb .sheet-label { margin-top: 8px; }
.sheet-wrap.kb .photo-row { margin-top: 8px; }
.sheet-wrap.kb .sheet-buttons { margin-top: 8px; }
.sheet-wrap.kb .ghost-btn, .sheet-wrap.kb .primary-btn { height: 46px; }
@media (max-height: 420px) {
  .sheet-wrap.kb .sheet-label { display: none; }
  .sheet-wrap.kb textarea { min-height: 3.2em; }
}
textarea {
  width: 100%; resize: none; font: inherit; font-size: 16px; line-height: 1.45; color: var(--ink);
  border: 1.5px solid #ddd6ea; border-radius: 16px; padding: 12px 14px; background: #fff; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea:focus { border-color: var(--tap3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tap3) 20%, transparent); }
.sheet-buttons { display: flex; gap: 10px; margin-top: 12px; flex: none; }
.ghost-btn, .primary-btn { flex: 1; border: 0; cursor: pointer; height: 50px; border-radius: 16px; font-weight: 800; font-size: 15px; transition: transform .2s var(--spring), opacity .2s; }
.ghost-btn { background: rgba(29, 24, 50, .07); color: var(--ink-2); }
.primary-btn { background: linear-gradient(135deg, #38b6ff, #6a7dff); color: #fff; box-shadow: 0 10px 24px -8px rgba(56, 120, 255, .7); }
.primary-btn:disabled { opacity: .45; box-shadow: none; }
.ghost-btn:active, .primary-btn:active { transform: scale(.96); }
.sheet-note { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 10px 0 0; font-weight: 600; }

/* ---------- cleared ---------- */
.cleared {
  position: absolute; inset: 0 0 18px; overflow-y: auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; padding: 6px 6px 10px;
  animation: fadeIn .6s both;
}
.sunrise { position: relative; width: 100%; height: 130px; margin: 0 auto 4px; overflow: hidden; flex: none;
  -webkit-mask-image: radial-gradient(ellipse 55% 120% at 50% 100%, #000 55%, transparent 100%); mask-image: radial-gradient(ellipse 55% 120% at 50% 100%, #000 55%, transparent 100%); }
.sunrise .sun {
  position: absolute; left: 50%; bottom: -46px; width: 120px; height: 120px; margin-left: -60px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #fff6d1, #ffcf6e 45%, #ff8d5c 100%);
  box-shadow: 0 0 60px 20px rgba(255, 190, 100, .55);
  animation: rise 1.6s var(--ease-out) both;
}
.sunrise .rays {
  position: absolute; left: 50%; bottom: -150px; width: 320px; height: 320px; margin-left: -160px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 220, 150, .22) 0 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 30%, transparent 68%);
  animation: rise 1.6s var(--ease-out) both, spin 40s linear infinite;
}
.sunrise .horizon { position: absolute; left: 10%; right: 10%; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, rgba(255, 230, 190, .9), transparent); }
@keyframes rise { from { transform: translateY(90px); opacity: 0; } }
@keyframes spin { to { rotate: 360deg; } }
.cleared h2 { margin: 6px 0 4px; font-size: 32px; font-weight: 800; letter-spacing: -.03em; animation: popIn .7s .25s var(--spring) both; }
.cleared-sub { margin: 0 0 14px; color: rgba(255, 255, 255, .78); font-weight: 500; font-size: 15px; animation: popIn .7s .35s var(--spring) both; }
@keyframes popIn { from { transform: translateY(14px) scale(.95); opacity: 0; } }
.summary-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.summary-chips .s {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 750;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
  animation: popIn .6s var(--spring) both;
}
.summary-chips .s b { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; background: var(--c); color: #fff; font-size: 12px; padding: 0 6px; }
.summary-list { list-style: none; margin: 0 0 16px; padding: 0; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; text-align: left; }
.summary-list li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px;
  background: rgba(58, 36, 108, .62); border: 1px solid rgba(255, 255, 255, .12);
  animation: popIn .6s var(--spring) both;
}
.summary-list .e { font-size: 20px; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); flex: none; }
.summary-list .t { flex: 1; min-width: 0; }
.summary-list .t div { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-list .t small { font-size: 12px; color: rgba(255, 255, 255, .66); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-list .a { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: var(--c); color: #fff; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.cleared .ghost-btn { flex: none; width: auto; padding: 0 22px; height: 46px; background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .2); }
.app.is-cleared .actions .act:not(.act-undo) { opacity: .3; pointer-events: none; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; contain: strict; }

.tap-ripple {
  position: absolute; z-index: 5; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--tap3) 35%, transparent), transparent 70%);
  border: 2px solid color-mix(in srgb, var(--tap3) 50%, transparent);
  animation: ripple .5s ease-out forwards;
}
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

@media (max-height: 700px) {
  .card { padding: 40px 20px 56px; }
  .card h2 { font-size: 21px; }
  .card .body { font-size: 14.5px; -webkit-line-clamp: 4; }
  .options li { padding: 6px 10px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .blob, .stars, .sunrise .sun, .sunrise .rays,
  .cleared, .cleared h2, .cleared-sub, .summary-chips .s, .summary-list li { animation: none !important; }
  /* Card fly-off and spring-back: a quick fade / short slide, not the full spring. */
  .card.rm-short {
    transition-property: transform, opacity !important;
    transition-duration: 180ms !important;
    transition-timing-function: ease-out, linear !important;
  }
}

/* swipe down to dismiss: grabber is a touch-friendly drag handle; no transitions fight the finger mid-drag */
.sheet .grabber, .install-sheet .grabber { position: relative; touch-action: none; cursor: grab; }
.sheet .grabber::before, .install-sheet .grabber::before { content: ''; position: absolute; left: -60px; right: -60px; top: -12px; bottom: -12px; }
.sheet-wrap.dragging .sheet, .install-wrap.dragging .install-sheet { transition: none; will-change: transform; user-select: none; }
.sheet-wrap.dragging .grabber, .install-wrap.dragging .grabber { cursor: grabbing; }

/* toast action (Undo) */
.toast.show.has-action { pointer-events: auto; display: inline-flex; align-items: center; }
.toast-act { margin-left: 12px; padding: 6px 12px; border: 0; border-radius: 999px; font: inherit; font-weight: 800; color: #1b1440; background: #ffd666; cursor: pointer; min-height: 32px; }
/* age / expiry chips */
.chip.chip-stale { background: #fff1d6; color: #9a5b00; }
.chip.chip-due { background: #ffe8ec; color: #b01c3e; }

/* ---------- settings + history panels (2026-10-19) ---------- */
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; cursor: pointer; padding: 0;
  background: rgba(58, 40, 112, .55); border: 1px solid rgba(255, 255, 255, .18); color: #fff;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.icon-btn:active { transform: scale(.94); }
.panel-wrap { position: fixed; inset: 0; z-index: 55; display: flex; align-items: flex-end; justify-content: center; }
.panel-backdrop { position: absolute; inset: 0; background: rgba(8, 3, 28, .66); animation: fadeIn .25s both; }
.panel {
  --p-bg: linear-gradient(180deg, #2a1d5c, #1f1648); --p-ink: #fff; --p-ink-2: rgba(255, 255, 255, .72); --p-ink-3: rgba(255, 255, 255, .5);
  --p-row: rgba(255, 255, 255, .07); --p-line: rgba(255, 255, 255, .1);
  position: relative; width: 100%; max-width: 520px; color: var(--p-ink); background: var(--p-bg);
  border-radius: 26px 26px 0 0; padding: 10px 18px calc(18px + var(--safe-b)); box-shadow: 0 -18px 50px rgba(10, 4, 40, .5);
  border-top: 1px solid rgba(255, 255, 255, .12); animation: sheetUp .38s var(--ease-out) both; max-height: 88svh; display: flex; flex-direction: column;
}
.panel-tall { height: 88svh; }
.panel .grabber { background: var(--p-line); margin-bottom: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 6px; }
.panel-head h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.panel-x { width: 34px; height: 34px; border-radius: 12px; border: 0; cursor: pointer; background: var(--p-row); color: var(--p-ink-2); font-size: 14px; }
.panel-sub { margin: 0 4px 10px; font-size: 13px; color: var(--p-ink-3); }
.panel-note { margin: 12px 4px 0; font-size: 12.5px; color: var(--p-ink-3); line-height: 1.45; }
.set-list { display: grid; gap: 8px; }
.set-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 16px; border: 0; cursor: pointer;
  background: var(--p-row); color: var(--p-ink); font: inherit;
}
.set-ico { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #7b5cff, #ff6f91); color: #fff; }
.set-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-txt { flex: 1; min-width: 0; }
.set-txt b { display: block; font-size: 15px; font-weight: 750; }
.set-txt small { display: block; font-size: 12.5px; color: var(--p-ink-3); margin-top: 1px; }
.set-chev { font-size: 22px; color: var(--p-ink-3); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; border-radius: 999px; background: var(--p-line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s var(--spring); }
.switch:checked { background: var(--right); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; cursor: default; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--p-line); }
.seg button { border: 0; background: none; color: var(--p-ink-2); padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; }
.seg button[aria-checked="true"] { background: #fff; color: #2a1650; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.hist-list { list-style: none; margin: 0; padding: 0 2px 8px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; display: grid; gap: 8px; align-content: start; -webkit-overflow-scrolling: touch; }
.hist-row { padding: 12px 14px; border-radius: 16px; background: var(--p-row); }
.hist-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--p-ink-3); font-weight: 600; }
.hist-src { color: var(--p-ink-2); font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-top time { flex: none; font-variant-numeric: tabular-nums; }
.hist-title { margin: 4px 0 8px; font-size: 15px; font-weight: 700; line-height: 1.3; }
.hist-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-meta span { font-size: 12px; font-weight: 750; padding: 3px 9px; border-radius: 999px; }
.hist-choice { background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--p-ink)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.hist-undone { background: var(--p-line); color: var(--p-ink-2); }
.hist-sample, .hist-photos { background: var(--p-line); color: var(--p-ink-3); }
.hist-row.undone .hist-title, .hist-row.undone .hist-choice { opacity: .55; }
.hist-row.undone .hist-choice { text-decoration: line-through; }
.hist-text { margin: 8px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--p-ink-2); white-space: pre-wrap; padding-left: 10px; border-left: 3px solid var(--tap3); }

/* ---------- light theme (Settings → Theme; dark stays the default) ---------- */
html[data-theme="light"] body { background: #f6e9f2; color: var(--ink); }
html[data-theme="light"] .sky { background: radial-gradient(120% 60% at 50% 112%, #ffd2a8 0%, #ffb0a0 25%, rgba(255, 190, 200, 0) 60%), linear-gradient(180deg, #e9e3ff 0%, #f3e6f7 45%, #fde3e4 75%, #ffd9c4 100%); }
html[data-theme="light"] .blob { opacity: .22; }
html[data-theme="light"] .stars { display: none; }
html[data-theme="light"] .brand p, html[data-theme="light"] .safety { color: var(--ink-2); }
html[data-theme="light"] .counter, html[data-theme="light"] .icon-btn, html[data-theme="light"] .install-btn[data-mode="help"] { background: rgba(255, 255, 255, .7); border-color: rgba(29, 24, 50, .12); color: var(--ink); }
html[data-theme="light"] .progress { background: rgba(29, 24, 50, .1); }
html[data-theme="light"] .cleared, html[data-theme="light"] .status-pill { color: var(--ink); }
html[data-theme="light"] .panel { --p-bg: linear-gradient(180deg, #fffaf3, #fff); --p-ink: #24123f; --p-ink-2: rgba(36, 18, 63, .72); --p-ink-3: rgba(36, 18, 63, .55); --p-row: #f6f0ff; --p-line: rgba(36, 18, 63, .1); border-top: 0; box-shadow: 0 -18px 50px rgba(10, 4, 40, .25); }
html[data-theme="light"] .panel-backdrop { background: rgba(36, 18, 63, .35); }
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .install-btn[data-mode="help"] span { display: none; }
  .install-btn[data-mode="help"] { padding: 0 8px; }
}

/* ---------- insights (2026-10-21) ---------- */
.ins-scroll { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; padding: 0 2px 8px; -webkit-overflow-scrolling: touch; contain: content; }
.ins-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.ins-tile { background: var(--p-row); border-radius: 14px; padding: 10px 6px; text-align: center; }
.ins-tile b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ins-tile small { display: block; font-size: 10.5px; line-height: 1.2; color: var(--p-ink-3); font-weight: 650; margin-top: 2px; }
.ins-tile.ok b { color: var(--right); }
.ins-tile.warn b { color: var(--left); }
.ins-sec { margin: 0 0 16px; }
.ins-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 4px 8px; }
.ins-sec-head h4 { margin: 0; font-size: 15px; font-weight: 800; }
.ins-sec-head small { font-size: 11.5px; color: var(--p-ink-3); text-align: right; }
.ins-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ins-row { padding: 10px 12px; border-radius: 14px; background: var(--p-row); cursor: pointer; border-left: 3px solid transparent; }
.ins-row:active { transform: scale(.99); }
.ins-row.is-overdue { border-left-color: var(--left); }
.ins-row.is-soon { border-left-color: var(--up); }
.ins-row-top { display: flex; gap: 10px; align-items: center; }
.ins-emoji { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.ins-row-main { flex: 1; min-width: 0; }
.ins-row-title { font-size: 13.5px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ins-row-meta { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 11.5px; color: var(--p-ink-3); margin-top: 2px; }
.ins-src { font-weight: 700; color: var(--p-ink-2); }
.ins-due.soon { color: var(--up); font-weight: 700; }
.ins-due.over { color: var(--left); font-weight: 750; }
.ins-row-nums { flex: none; text-align: right; }
.ins-row-nums b { display: block; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ins-row-nums small { display: block; font-size: 10px; color: var(--p-ink-3); white-space: nowrap; }
.ins-row-bars { display: grid; grid-template-columns: 1fr 98px; gap: 10px; align-items: center; margin-top: 8px; }
.ins-bar { height: 6px; border-radius: 999px; background: var(--p-line); overflow: hidden; }
.ins-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--down), var(--left)); }
.ins-strip { width: 98px; height: 8px; display: block; }
.s-on { fill: var(--down); background: var(--down); }
.s-hot { fill: var(--left); background: var(--left); }
.s-off { fill: var(--p-line); background: var(--p-line); }
.s-na { fill: none; stroke: var(--p-line); stroke-width: .8; background: transparent; outline: 1px solid var(--p-line); }
.ins-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--p-ink-3); margin: 6px 4px 0; flex-wrap: wrap; }
.ins-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.ins-detail { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--p-ink-2); }
.ins-detail p { margin: 4px 0; white-space: pre-wrap; }
.ins-state { font-weight: 700; color: var(--p-ink); }
.ins-chart { width: 100%; height: auto; display: block; background: var(--p-row); border-radius: 14px; padding: 8px 4px 2px; }
.ins-axis { stroke: var(--p-line); stroke-width: 1; }
.ins-hatch { stroke: var(--p-line); stroke-width: 2; }
.ins-zero { fill: var(--p-line); }
.ins-tick { fill: var(--p-ink-3); font-size: 9px; font-weight: 650; font-family: inherit; }
.ins-keys { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 4px 0; font-size: 11.5px; color: var(--p-ink-2); }
.ins-keys span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
.ins-keys .k-na::before { background: repeating-linear-gradient(45deg, var(--p-line) 0 2px, transparent 2px 4px); outline: 1px solid var(--p-line); }
.ins-bots { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 8px; background: var(--p-row); border-radius: 14px; }
.ins-bots li { display: grid; grid-template-columns: 118px 1fr 24px; gap: 8px; align-items: center; font-size: 12.5px; }
.ins-bot-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-bot-bar { height: 10px; border-radius: 999px; background: var(--p-line); overflow: hidden; }
.ins-bot-bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); }
.ins-bots b { text-align: right; font-variant-numeric: tabular-nums; }
.ins-empty { margin: 0; padding: 14px; border-radius: 14px; background: var(--p-row); font-size: 13px; color: var(--p-ink-3); text-align: center; }
.ins-note { margin: 8px 4px 0; font-size: 11.5px; color: var(--p-ink-3); line-height: 1.4; }

/* 'More (N)' divider after the top 5 (scripts/assemble.js aboveFold) */
.card-divider { cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; --accent: #7c6cf2;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%), var(--card-bg, rgba(255,255,255,.06));
  border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); }
.card-divider .divider-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px; }
.card-divider .divider-emoji { font-size: 44px; }
.card-divider h2 { margin: 0; color: #fff; }
.card-divider .body { color: rgba(255,255,255,.82); max-width: 260px; }
.card-divider:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* ---------- batch 2: due line + staleness (2026-10-22) ---------- */
.due-line { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin: 2px 0 8px; padding: 6px 12px; border-radius: 12px; font-weight: 800; font-size: 15px; letter-spacing: .1px; }
.due-line .due-ico { font-size: 15px; }
.due-line.due-over { background: #d42a4f; color: #fff; }
.due-line.due-today { background: #ffd666; color: #4a2c00; }
.due-line.due-soon { background: #fff1d6; color: #9a5b00; }
.due-line.due-later { background: #ece8ff; color: #3a2870; }
.chip.chip-relevant { background: #3a2870; color: #fff; }
.sheet-due { margin: 0 0 10px; }
/* voice: read aloud + answer by voice */
.sheet-voice { margin: 12px 0 4px; }
.voice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.vbtn { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid rgba(124,108,242,.45); background: rgba(124,108,242,.12); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.voice-hint { margin: 6px 0 0; font-size: 13px; opacity: .75; }
.voice-confirm { padding: 12px; border-radius: 14px; background: rgba(124,108,242,.12); }
.voice-confirm p { margin: 0 0 6px; }
.voice-actions { display: flex; gap: 8px; justify-content: flex-end; }
/* app tiles row (Main Menu, Lantern Isle, Recap) */
.app-tiles { display: flex; gap: 8px; padding: 0 20px 10px; overflow-x: auto; scrollbar-width: none; }
.app-tile { flex: 1 1 0; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 12px; border-radius: 14px; background: rgba(58, 40, 112, .55); border: 1px solid rgba(255, 255, 255, .18); color: #fff; font: inherit; font-size: 13.5px; font-weight: 750; text-decoration: none; cursor: pointer; white-space: nowrap; }
.app-tile:active { transform: scale(.96); }
.app-tile-ico { font-size: 16px; }
/* weekly recap */
.recap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recap-row { padding: 10px 12px; border-radius: 14px; background: var(--p-row); }
.recap-row b { display: block; font-size: 14px; }
.recap-row small { display: block; font-size: 12px; color: var(--p-ink-3); margin-top: 2px; }
.recap-row.recap-top { border-left: 3px solid var(--up); }
html[data-theme="light"] .app-tile { background: rgba(255, 255, 255, .7); border-color: rgba(29, 24, 50, .12); color: var(--ink); }

/* ---------- first-run tutorial (practice only) ---------- */
.tour-wrap { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); background: rgba(12, 8, 30, .82);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: #fff; touch-action: none; animation: tourIn .22s var(--ease-out); }
.tour-wrap.tour-out { opacity: 0; transition: opacity .2s; }
@keyframes tourIn { from { opacity: 0; } }
.tour-head { margin: 0; font-weight: 700; letter-spacing: .02em; opacity: .9; }
.tour-card { width: min(340px, 86vw); min-height: 300px; border-radius: 28px; background: var(--card); color: var(--ink); padding: 22px 22px 26px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; cursor: grab; user-select: none; -webkit-user-select: none;
  border: 3px dashed var(--tc, var(--tap3)); box-shadow: 0 18px 50px rgba(0,0,0,.35); will-change: transform; touch-action: none; }
.tour-badge { align-self: stretch; padding: 6px 10px; border-radius: 999px; background: #ffe7a3; color: #5a3d00; font-weight: 800; font-size: 13px; letter-spacing: .06em; }
.tour-icon { font-size: 56px; line-height: 1.1; color: var(--tc); font-weight: 800; margin-top: 8px; }
.tour-title { margin: 0; font-size: 22px; }
.tour-say { margin: 0; color: var(--ink-2); font-size: 16px; }
.tour-note { margin: auto 0 0; color: var(--ink-3); font-size: 13px; }
.tour-dots { display: flex; gap: 8px; } .tour-dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.3); } .tour-dots i.on { background: #fff; }
.tour-live { margin: 0; min-height: 1.3em; font-size: 14px; opacity: .9; text-align: center; }
.tour-skip { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 10px 18px; font: inherit; }
.tour-shake { animation: tourShake .3s; }
@keyframes tourShake { 25% { translate: -8px 0; } 75% { translate: 8px 0; } }
@media (prefers-reduced-motion: reduce) { .tour-wrap, .tour-shake { animation: none !important; } }

/* ---------- due chip + overdue card (pass 2) ---------- */
.chip.chip-due-over { background: #b01c3e; color: #fff; }
.chip.chip-due-today { background: #ffd666; color: #4a2c00; }
.chip.chip-due-soon { background: #fff1d6; color: #9a5b00; }
.card.card-overdue { outline: 3px solid #ff4d6d; outline-offset: -3px; }
.card.card-overdue::before { content: ''; position: absolute; left: 0; top: 22px; bottom: 22px; width: 6px; border-radius: 0 6px 6px 0; background: #ff4d6d; z-index: 2; }
.card.card-due-today { outline: 2px solid #ffd666; outline-offset: -2px; }
@media (prefers-reduced-motion: no-preference) { .card.card-overdue .due-line.due-over { animation: dueThrob 2.4s ease-in-out 2; } }
@keyframes dueThrob { 50% { filter: brightness(1.18); } }
