:root {
  --paper: transparent;
  --card: rgba(255, 255, 255, 0.64);
  --ink: #2a2433;
  --muted: #7c7488;
  --line: rgba(140, 118, 190, 0.14);
  --fill: rgba(255, 255, 255, 0.42);
  --blue: #8b6cff;
  --shop: #e39b4a;
  --todo: #5ecf7a;
  --event: #8b6cff;
  --note: #b07cff;
  --danger: #e25b6a;
  --radius: 20px;
  --tab-h: 78px;
  --safe-t: 0px;
  --safe-r: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: 0px;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --glass: blur(22px) saturate(160%);
  --shadow: 0 10px 30px rgba(139, 108, 255, 0.08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  min-height: 100%;
  background: #ffffff;
}
html::before,
html::after {
  content: "";
  position: fixed;
  inset: -35% -25%;
  z-index: 0;
  pointer-events: none;
}
html::before {
  background:
    radial-gradient(42% 38% at 18% 22%, rgba(176, 138, 255, 0.48), transparent 72%),
    radial-gradient(38% 34% at 86% 16%, rgba(186, 247, 168, 0.44), transparent 70%),
    radial-gradient(46% 40% at 78% 82%, rgba(206, 178, 255, 0.36), transparent 72%),
    radial-gradient(36% 36% at 14% 84%, rgba(168, 236, 190, 0.32), transparent 68%),
    linear-gradient(165deg, #ffffff 0%, #f6f1ff 48%, #f3fbf1 100%);
  animation: aurora 22s ease-in-out infinite;
}
html::after {
  background:
    radial-gradient(30% 28% at 50% 50%, rgba(255, 255, 255, 0.5), transparent 70%),
    radial-gradient(24% 22% at 70% 30%, rgba(201, 255, 186, 0.22), transparent 70%);
  animation: aurora-soft 28s ease-in-out infinite reverse;
  mix-blend-mode: screen;
}
@keyframes aurora {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  33% { transform: translate3d(3.5%, -2.5%, 0) scale(1.07) rotate(2deg); }
  66% { transform: translate3d(-3%, 3%, 0) scale(1.04) rotate(-1.5deg); }
}
@keyframes aurora-soft {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.7; }
  50% { transform: translate3d(-4%, 2%, 0) scale(1.12); opacity: 1; }
}

body {
  margin: 0;
  min-height: 100%;
  position: relative;
  z-index: 1;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.app { min-height: 100vh; position: relative; z-index: 1; }
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) calc(16px + var(--safe-r)) calc(var(--tab-h) + var(--safe-b) + 16px) calc(16px + var(--safe-l));
}
body.is-fullscreen .page { padding-top: calc(8px + var(--safe-t)); }
body.is-inactive { opacity: 0.9; }

.display {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.masthead h1 .name,
.display .name { font-style: normal; font-weight: 700; }

.wordmark, .kicker, .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.masthead { margin: 4px 0 24px; }
.masthead .wordmark { margin-bottom: 8px; }
.masthead h1 { margin: 0; font-size: 32px; }
.lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 40ch;
}
.people { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); backdrop-filter: var(--glass);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px 4px 4px;
  font-size: 12px; font-weight: 500;
  box-shadow: var(--shadow);
}
.avatar, .avatar.b {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700;
}
.avatar { background: linear-gradient(135deg, #8b6cff, #b07cff); }
.avatar.b { background: linear-gradient(135deg, #5ecf7a, #b6f0a8); }

.section { margin: 0 0 24px; }
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin: 0 2px 10px;
}
.section-head h2 {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.more {
  border: 0; background: none; color: var(--blue);
  font-weight: 600; font-size: 13px; padding: 0 0 2px;
}

.next-card, .note-card, .todo-mini, .home-tile, .row, .card, .shop-mini, .set-row, .settings-link {
  width: 100%; border: 0; text-align: left; background: var(--card);
}
.next-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  display: grid; grid-template-columns: 52px 1fr; gap: 12px; align-items: center;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.next-date {
  background: linear-gradient(160deg, rgba(176, 138, 255, 0.22), rgba(186, 247, 168, 0.22));
  color: var(--blue); border-radius: 16px;
  min-height: 52px; display: grid; place-items: center; text-align: center;
}
.next-date b { display: block; font-size: 20px; font-weight: 700; line-height: 1; }
.next-date span { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.next-card h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; }
.next-card p { margin: 0; color: var(--muted); font-size: 12px; }

.shop-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shop-mini {
  padding: 0; border-radius: 18px; overflow: hidden;
  color: inherit; border: 1px solid var(--line);
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.shop-mini .pic { aspect-ratio: 1; background: var(--fill); }
.shop-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shop-mini .cap { padding: 10px; }
.shop-mini .cap b {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; font-size: 12px; font-weight: 600; line-height: 1.3;
}
.shop-mini .cap span {
  display: block; margin-top: 4px;
  color: var(--ink); font-size: 14px; font-weight: 700;
}

.todo-list, .note-list, .rows, .set-list {
  display: grid; gap: 0;
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.todo-mini, .note-card, .row, .set-row {
  border-radius: 0; padding: 13px 14px;
  display: flex; gap: 12px; align-items: flex-start;
  background: transparent; box-shadow: none;
  border-bottom: 1px solid var(--line);
}
.todo-mini:last-child, .note-card:last-child, .row:last-child, .set-row:last-child { border-bottom: 0; }
.todo-mini b, .note-card b, .row b, .set-row b {
  display: block; font-size: 14px; font-weight: 600;
}
.todo-mini span, .note-card span, .row span, .set-row span {
  color: var(--muted); font-size: 12px;
}
.dot, .check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(140, 118, 190, 0.35); flex: 0 0 18px; margin-top: 1px; background: rgba(255, 255, 255, 0.8);
}
.row.done { opacity: 0.42; }
.row.done .check { background: var(--todo); border-color: var(--todo); }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-tile {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; min-height: 108px;
  display: flex; flex-direction: column; justify-content: space-between;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.home-tile .mark {
  width: 32px; height: 32px; border-radius: 12px;
  display: grid; place-items: center;
}
.home-tile.shopping .mark { background: rgba(227, 155, 74, 0.16); color: var(--shop); }
.home-tile.todos .mark { background: rgba(94, 207, 122, 0.16); color: var(--todo); }
.home-tile.events .mark { background: rgba(139, 108, 255, 0.16); color: var(--event); }
.home-tile.notes .mark { background: rgba(176, 124, 255, 0.16); color: var(--note); }
.home-tile b { display: block; font-size: 15px; font-weight: 700; }
.home-tile span { color: var(--muted); font-size: 12px; margin-top: 3px; }

.head { margin: 4px 0 16px; }
.head .wordmark { margin-bottom: 8px; }
.head-row {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
}
.head h1 { margin: 0; font-size: 30px; }
.head .sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.filters {
  display: flex; background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex: 0 0 auto;
  backdrop-filter: var(--glass);
}
.filter {
  border: 0; background: transparent; color: var(--muted);
  border-radius: 999px; padding: 6px 11px; font-size: 12px; font-weight: 600;
}
.filter.on { background: rgba(255, 255, 255, 0.92); color: var(--ink); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card {
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden; padding: 0;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.card:active, .row:active, .home-tile:active, .next-card:active, .set-row:active, .shop-mini:active {
  transform: scale(0.985); opacity: 0.88;
}
.photo { position: relative; aspect-ratio: 1; background: var(--fill); }
.photo img, .pic img, .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-empty {
  width: 100%; height: 100%; min-height: 64px;
  background: linear-gradient(160deg, rgba(176, 138, 255, 0.16), rgba(186, 247, 168, 0.18));
}
.photo .pic-empty { position: absolute; inset: 0; min-height: 0; }
.link-preview {
  display: grid; grid-template-columns: 68px 1fr; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; margin: 0 0 12px;
  backdrop-filter: var(--glass);
}
.link-preview img, .link-preview .pic-empty { width: 68px; height: 68px; border-radius: 12px; object-fit: cover; }
.link-preview b { display: block; font-size: 14px; font-weight: 700; }
.link-preview span { color: var(--muted); font-size: 12px; }
.card.done .photo img { filter: grayscale(0.18) brightness(1.05); }
.badges { position: absolute; top: 8px; left: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  background: rgba(42, 36, 51, 0.55); color: #fff;
  border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 600;
}
.badge.ok { background: var(--todo); }
.body { padding: 10px; }
.body .title {
  margin: 0;
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.body .link, .meta { margin: 0; font-size: 11px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.body .shop { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.price-line {
  margin: 5px 0 0; color: var(--ink);
  font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.price-line.muted { color: var(--muted); font-size: 11px; font-weight: 500; }
.item-price {
  margin: 8px 0 8px;
  font-size: 32px; font-weight: 700;
  letter-spacing: -0.04em; line-height: 1;
}
.item-price.muted { color: var(--muted); font-size: 16px; }
.sum-bar {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 12px 14px; margin: 16px 0 68px;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.sum-bar span { color: var(--muted); font-size: 11px; font-weight: 600; }
.sum-bar b { font-size: 18px; font-weight: 700; }
.sum-note { text-align: center; color: var(--muted); font-size: 12px; margin: -52px 0 68px; }

.row.event .when {
  min-width: 42px;
  background: linear-gradient(160deg, rgba(176, 138, 255, 0.2), rgba(186, 247, 168, 0.2));
  color: var(--blue);
  border-radius: 12px; padding: 6px 4px; text-align: center; flex: 0 0 42px;
}
.row.event .when b { display: block; font-size: 16px; font-weight: 700; }
.row.event .when span { font-size: 9px; font-weight: 600; text-transform: uppercase; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 5;
  width: 52px; height: 52px; border-radius: 18px; border: 0;
  background: linear-gradient(145deg, #8b6cff, #6d8cff);
  color: #fff; font-size: 30px; font-weight: 400; line-height: 1;
  box-shadow: 0 10px 24px rgba(139, 108, 255, 0.32);
}
.fab.shopping { background: linear-gradient(145deg, #e39b4a, #f0c07a); box-shadow: 0 10px 24px rgba(227, 155, 74, 0.28); }
.fab.todos { background: linear-gradient(145deg, #5ecf7a, #b6f0a8); box-shadow: 0 10px 24px rgba(94, 207, 122, 0.28); }
.fab.events { background: linear-gradient(145deg, #8b6cff, #b07cff); }
.fab.notes { background: linear-gradient(145deg, #b07cff, #8b6cff); box-shadow: 0 10px 24px rgba(176, 124, 255, 0.28); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(24px) saturate(160%);
  border-top: 1px solid rgba(255, 255, 255, 0.55);
  padding: 7px 4px calc(9px + var(--safe-b));
}
.tab {
  border: 0; background: none; color: var(--muted);
  display: grid; gap: 2px; place-items: center;
  padding: 4px 0 2px; font-size: 10px; font-weight: 600;
}
.tab svg { width: 21px; height: 21px; }
.tab.on { color: var(--blue); }

.sheet {
  position: fixed; inset: 0; background: rgba(42, 36, 51, 0.28);
  display: flex; align-items: flex-end; z-index: 12;
}
.sheet-card {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(28px) saturate(160%);
  width: 100%; max-height: 92vh; overflow: auto;
  border-radius: 24px 24px 0 0; padding: 8px 16px calc(22px + var(--safe-b));
  border-top: 1px solid rgba(255, 255, 255, 0.7);
}
.grab {
  width: 36px; height: 4px; border-radius: 99px; background: rgba(140, 118, 190, 0.28);
  margin: 6px auto 14px;
}
.sheet-card h2 { margin: 0 0 6px; font-size: 24px; }
.sheet-lead { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.cover {
  border-radius: 18px; overflow: hidden; aspect-ratio: 16 / 10;
  background: var(--fill); margin-bottom: 14px; border: 1px solid var(--line);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stack { margin: 0 0 12px; }
.field, .area {
  width: 100%; margin: 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}
.field:focus, .area:focus {
  outline: none; border-color: rgba(139, 108, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(139, 108, 255, 0.14);
}
.area { min-height: 108px; resize: vertical; }
.label {
  display: block; margin: 0 0 6px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.actions { display: flex; gap: 8px; margin-top: 8px; }
.btn {
  flex: 1; border: 0; border-radius: 14px; padding: 12px;
  font-weight: 600; background: rgba(255, 255, 255, 0.55); color: var(--ink);
}
.btn.primary, .btn.shop, .btn.todo, .btn.event, .btn.note {
  background: linear-gradient(145deg, #8b6cff, #7a8cff); color: #fff;
}
.btn.danger { background: rgba(226, 91, 106, 0.12); color: var(--danger); }
.btn.ghost { background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line); }

.empty {
  text-align: center; padding: 44px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.empty .wordmark { margin-bottom: 8px; }
.empty h3 { margin: 0 0 6px; font-size: 22px; }
.empty p { margin: 0 auto; color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 32ch; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: rgba(42, 36, 51, 0.9); color: #fff; border-radius: 999px;
  padding: 9px 14px; font-size: 12px; font-weight: 600; z-index: 20;
  white-space: nowrap;
}
.error-box { text-align: center; padding: 56px 24px; }
.error-box .wordmark { margin-bottom: 12px; }
.error-box h1 { margin: 0 0 8px; font-size: 26px; }
.error-box p { color: var(--muted); margin: 0 auto; max-width: 32ch; line-height: 1.45; }

.hidden { display: none !important; }
.busy { opacity: 0.55; pointer-events: none; }

.settings-link {
  border: 1px solid var(--line); border-radius: 16px; text-align: left;
  color: var(--blue); padding: 13px 14px; font-weight: 600; margin: 0 0 10px; font-size: 14px;
  backdrop-filter: var(--glass); box-shadow: var(--shadow);
}
.set-block { margin: 0 0 20px; }
.set-block .eyebrow { margin: 0 2px 6px; }
.set-note { color: var(--muted); font-size: 12px; line-height: 1.5; padding: 4px 2px 0; }

.foot-link {
  display: block; width: 100%; border: 0; background: none;
  color: var(--muted); text-align: center; padding: 8px;
  font-size: 12px; font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  html::before, html::after { animation: none; }
}
html:has(body.low-end)::before,
html:has(body.low-end)::after { animation: none; }
.low-end .card, .low-end .home-tile, .low-end .tabbar, .low-end .sheet-card,
.low-end .sum-bar, .low-end .chip, .low-end .next-card, .low-end .shop-mini,
.low-end .todo-list, .low-end .note-list, .low-end .rows, .low-end .set-list {
  backdrop-filter: none;
}
