/* Light theme is the base; dark overrides follow. Theme is Auto (follows the phone) unless set in Me.
   Palette: warm neutrals with gold for points and ranks; red is for danger only.
   The accent color is chosen in Me and applied by theme.js (default: ink). */
:root {
  --bg: #f7f4f1; --card: #ffffff; --card2: #efebe7; --line: #e8e2dc; --edge: transparent;
  --text: #1c1917; --muted: #68615b;
  --accent: #1c1917; --accent-text: #1c1917; --accent-soft: #ece8e3; --on-accent: #ffffff;
  --gold: #8a5a00; --gold-soft: #fbf1dc;
  --danger: #d93d42; --danger-text: #c62f35; --danger-soft: #fdecec;
  --seg-on: #ffffff;
  --bar: rgba(255, 253, 251, .86);
  --shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 8px 24px rgba(28, 25, 23, .06);
  --r: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111010; --card: #1b1a19; --card2: #272523; --line: #33302d; --edge: #2a2826;
    --text: #f6f3ef; --muted: #a6a09a;
    --accent: #f3ede6; --accent-text: #f3ede6; --accent-soft: #2b2927; --on-accent: #1c1917;
    --gold: #e6c27a; --gold-soft: #2e2616;
    --danger: #d93d42; --danger-text: #ff8a8f; --danger-soft: #2d1719;
    --seg-on: #3b3835;
    --bar: rgba(19, 18, 18, .86);
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111010; --card: #1b1a19; --card2: #272523; --line: #33302d; --edge: #2a2826;
  --text: #f6f3ef; --muted: #a6a09a;
  --accent: #f3ede6; --accent-text: #f3ede6; --accent-soft: #2b2927; --on-accent: #1c1917;
  --gold: #e6c27a; --gold-soft: #2e2616;
  --danger: #d93d42; --danger-text: #ff8a8f; --danger-soft: #2d1719;
  --seg-on: #3b3835;
  --bar: rgba(19, 18, 18, .86);
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); overscroll-behavior-y: none; }
main { max-width: 560px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 24px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
a { color: var(--accent-text); }
h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 14px 0 16px; }
h2 { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 26px 4px 8px; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
p { margin: 6px 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .pad { padding: 28px 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.quote { color: var(--muted); font-style: italic; margin-top: 4px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.ic { width: 1.15em; height: 1.15em; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.huge { width: 56px; height: 56px; color: var(--accent); stroke-width: 1.4; }
.ic.accent, .ic.ok { color: var(--accent); }

/* Cards */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 10px 0; box-shadow: var(--shadow); }
.card.hl { background: var(--accent-soft); box-shadow: none; }
.card.warn { background: var(--accent-soft); box-shadow: none; }
.card.danger, .banner { background: var(--danger-soft); box-shadow: none; }
.banner { padding: 14px 16px; border-radius: var(--r); margin: 10px 0; }
a.card { display: block; color: inherit; text-decoration: none; transition: transform .1s; }
a.card.row { display: flex; }
a.card:active, .tile:active, .person:active { transform: scale(.985); }

/* Buttons */
button, .btn { appearance: none; border: 0; border-radius: 14px; padding: 13px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--on-accent); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .1s, opacity .1s; }
button:active, .btn:active { transform: scale(.97); opacity: .85; }
button.ghost, .btn.ghost { background: var(--card2); color: var(--text); }
.card.hl button.ghost, .card.hl .btn.ghost { background: var(--card); }
button.good { background: var(--accent); color: var(--on-accent); }
button.bad { background: var(--card2); color: var(--danger); }
.card.hl button.bad { background: var(--card); }
button.sm, .btn.sm { padding: 8px 14px; font-size: .88rem; border-radius: 99px; }
button.link { background: none; color: var(--muted); padding: 6px; font-weight: 500; font-size: .9rem; }
button:disabled { opacity: .4; }
button.block, .btn.block { width: 100%; display: flex; }
.iconbtn { background: none; color: var(--muted); padding: 6px; border-radius: 10px; display: inline-flex; text-decoration: none; }
.backlink { text-decoration: none; color: var(--accent-text); display: inline-flex; align-items: center; gap: 2px; font-weight: 500; margin-top: 6px; }
button.sos { background: var(--danger); color: #fff; }
button.yellow { background: var(--card2); color: var(--text); }

/* Forms */
input, textarea, select { width: 100%; font: inherit; color: var(--text); background: var(--card2); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; }
.card.hl input, .card.hl textarea, .card.hl select, .card.danger input { background: var(--card); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; padding: 0; }
input[type=file] { padding: 10px; font-size: .9rem; }
label { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin: 14px 2px 6px; }
label.check { display: flex; gap: 12px; align-items: center; color: var(--text); font-size: 1rem; font-weight: 400; margin: 12px 0; }
form .row > * { flex: 1; min-width: 110px; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
details[open] > summary::after { transform: rotate(45deg); }
details[open] > summary { margin-bottom: 10px; }

/* Small bits */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.chip.good { background: var(--accent-soft); color: var(--accent-text); }
.chip.warn { background: var(--accent-soft); color: var(--accent-text); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.card.hl .chip { background: var(--card); }
.meta { gap: 6px 14px; margin-top: 6px; }
.meta .ic { width: 1em; height: 1em; }

/* Top bar of a dynamic + segmented tabs */
.head { display: flex; align-items: center; gap: 12px; }
.head.top { position: sticky; top: 0; z-index: 4; gap: 8px; margin: -10px -16px 0; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: var(--bar); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); }
.head.top .iconbtn { color: var(--accent-text); } .head.top .iconbtn .ic { width: 26px; height: 26px; }
.tabs { display: flex; margin: 12px 0 14px; background: var(--card2); border-radius: 13px; padding: 3px; }
.tabs a { flex: 1; text-align: center; padding: 8px 2px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 600; }
.tabs a .ic { display: none; }
.tabs a.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.pills { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pills a { padding: 8px 14px; border-radius: 99px; background: var(--card); color: var(--muted); text-decoration: none; white-space: nowrap; font-size: .88rem; font-weight: 600; box-shadow: var(--shadow); }
.pills a.on { background: var(--accent); color: var(--on-accent); }
.actions { display: flex; gap: 8px; margin: 12px 0; }
.actions > * { flex: 1; }
.actions > :first-child { flex: 1.6; }

.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 1.1rem; flex: none; object-fit: cover; }
.avatar.xl { width: 84px; height: 84px; font-size: 2rem; }
.avatar.xxl { width: 112px; height: 112px; font-size: 2.6rem; margin: 0 auto; }
.photo { display: inline-block; position: relative; cursor: pointer; margin: 0; }
.photo .cam { position: absolute; right: 0; bottom: 0; background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; border: 3px solid var(--bg); }
.big { font-size: 2.8rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.num { font-size: 1.7rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.bar { height: 8px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; padding-bottom: 2px; } .list li:first-child { padding-top: 2px; }
.list li a { color: inherit; text-decoration: none; display: block; }
.list li.unread { position: relative; padding-left: 16px; }
.list li.unread::before { content: ""; position: absolute; left: 0; top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.list li.dayhead { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 0; padding: 14px 0 0; }
.list.todo li { display: flex; gap: 10px; align-items: center; } .list.todo li.done { color: var(--muted); text-decoration: line-through; } .list.todo li.done .ic { color: var(--accent); }
.list.todo li a { color: var(--accent-text); font-weight: 500; }
ol.rules { padding-left: 24px; margin: 0; } ol.rules li { padding: 10px 0; border-bottom: 1px solid var(--line); } ol.rules li:last-child { border: 0; } ol.rules li::marker { color: var(--accent-text); font-weight: 700; }
ol.steps { padding-left: 22px; margin: 0; } ol.steps li { padding: 5px 0; }

/* "More" menu: grouped rows, like a phone's settings */
.tiles { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: inherit; text-decoration: none; position: relative; }
.tile + .tile::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; border-top: 1px solid var(--line); }
.tile .ic { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.tile b { font-weight: 500; flex: none; }
.tile .small { flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); opacity: .6; flex: none; }
.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .statgrid .card { margin: 0; } .statgrid .ic { width: 22px; height: 22px; }
.week { display: flex; gap: 6px; margin: 12px 0; }
.week div { flex: 1; text-align: center; font-size: .7rem; color: var(--muted); }
.week i { display: block; height: 8px; border-radius: 99px; background: var(--card2); margin-bottom: 4px; }
.week i.part { background: var(--muted); } .week i.full { background: var(--accent); }

.people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.person { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 10px; text-align: center; color: inherit; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 5px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 4px; min-height: 40vh; padding-top: 8px; }
.msg { max-width: 78%; padding: 9px 14px; border-radius: 20px 20px 20px 6px; background: var(--card); box-shadow: var(--shadow); align-self: flex-start; white-space: pre-wrap; word-wrap: break-word; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-radius: 20px 20px 6px 20px; box-shadow: none; }
.msg time { display: block; font-size: .68rem; opacity: .6; margin-top: 2px; }
.chatbox { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; flex-wrap: nowrap; }
.chatbox input { border-radius: 99px; background: var(--card); }
.chatbox button { flex: none; border-radius: 99px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery img, .gallery video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; display: block; }
.proof img, .proof video { width: 100%; max-height: 360px; object-fit: contain; background: #000; border-radius: 16px; margin-top: 8px; display: block; }

.moods { display: flex; gap: 6px; } .moods label { flex: 1; margin: 0; }
.moods input { display: none; }
.moods span { display: block; text-align: center; font-size: 1.8rem; padding: 8px 0; border-radius: 14px; background: var(--card2); cursor: pointer; border: 2px solid transparent; transition: transform .1s; }
.moods input:checked + span { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.06); }

.wheel { font-size: 1.4rem; font-weight: 700; text-align: center; padding: 30px 10px; border-radius: var(--r); background: var(--card2); min-height: 96px; }
.wheel.spin { animation: pulse .12s infinite alternate; }
.wheel.landed { background: var(--accent); color: var(--on-accent); }
@keyframes pulse { to { opacity: .55; } }

/* Theme picker (segmented) */
.seg { display: flex; background: var(--card2); border-radius: 13px; padding: 3px; }
.seg button { flex: 1; background: none; color: var(--muted); padding: 8px; border-radius: 10px; font-size: .9rem; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Confirmation sheet: slides up from the bottom like a phone action sheet */
dialog.ask { border: 0; border-radius: 24px 24px 0 0; background: var(--card); color: var(--text); padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); width: 100%; max-width: 560px; margin: auto auto 0; animation: sheet .2s ease-out; }
dialog.ask::backdrop { background: rgba(0, 0, 0, .5); }
dialog.ask p { margin: 0 0 18px; font-size: 1.05rem; text-align: center; }
dialog.ask .row { flex-direction: column-reverse; align-items: stretch; }
@keyframes sheet { from { transform: translateY(100%); } }

/* Bottom tab bar */
#nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--bar); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
#nav a { color: var(--muted); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; padding: 2px 18px; font-size: .68rem; font-weight: 600; }
#nav a .ic { width: 25px; height: 25px; }
#nav a.on { color: var(--accent-text); }
#badge { position: absolute; top: -4px; right: 10px; background: var(--danger); color: #fff; font-size: .65rem; border-radius: 99px; padding: 1px 6px; min-width: 18px; text-align: center; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 99px; z-index: 10; max-width: 90vw; font-weight: 500; font-size: .92rem; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); }
#toast.err { background: var(--danger); color: #fff; }

.auth { max-width: 420px; margin: 8vh auto 0; }
.logo { font-size: 2.6rem; font-weight: 800; letter-spacing: -.04em; color: var(--accent-text); }
code.code { font: 700 1.25rem ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .16em; color: var(--accent-text); }

/* ================= Premium pass (from the design review) ================= */

/* A display face gives the app a voice of its own. */
h1, .big, .num, .logo, .wheel { font-family: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif; }
h1 { font-weight: 700; letter-spacing: -.015em; }
.big, .num { font-weight: 700; letter-spacing: -.01em; }
.logo { font-weight: 700; letter-spacing: -.02em; }
.mark { width: 64px; height: 64px; border-radius: 18px; display: block; margin: 0 auto 10px; box-shadow: var(--shadow); }

/* Surfaces: a hairline edge gives dark mode depth. */
.card, .tiles, .person, .group { border: 1px solid var(--edge); }
.card.hl, .card.warn, .card.danger { border-color: transparent; }
.card.warn { background: var(--gold-soft); }
.card.flat { background: none; box-shadow: none; border: 0; padding: 4px 0; }
.tabs a.on, .seg button.on { background: var(--seg-on); }

/* Custom form controls in place of the browser's own. */
select { appearance: none; -webkit-appearance: none; padding-right: 38px; background-repeat: no-repeat; background-position: right 14px center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%238c8494' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); }
input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin: 0; border: 2px solid var(--muted); border-radius: 8px; background: transparent; display: inline-grid; place-content: center; transition: background .12s, border-color .12s; }
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
input[type=checkbox]:disabled { opacity: .55; }
textarea { resize: none; }
input[type=file] { color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; font-size: .88rem; border: 0; border-radius: 99px; padding: 8px 14px; margin-right: 10px; background: var(--accent-soft); color: var(--accent-text); }
input::placeholder, textarea::placeholder { opacity: 1; }
label.check { min-height: 44px; margin: 0; }
form > p:last-child { margin-top: 16px; }

/* Touch targets */
button, .btn { min-height: 46px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
button.sm, .btn.sm { min-height: 38px; }
.head.top button.sm { min-height: 40px; padding-inline: 14px; }
button.link { min-height: 44px; }
.iconbtn { min-width: 40px; min-height: 40px; align-items: center; justify-content: center; margin: -6px -8px -6px 0; }
.head.top .iconbtn { margin: 0; }
.tabs a, .seg button { min-height: 40px; display: flex; align-items: center; justify-content: center; }
.pills a { min-height: 40px; display: inline-flex; align-items: center; }
.tabs a:active, .pills a:active, #nav a:active, .list li a:active { opacity: .6; }
#nav a { touch-action: manipulation; }

/* Button hierarchy and colors */
button.sos, #badge { background: var(--danger); color: #fff; }
button.yellow { background: var(--gold-soft); color: var(--gold); }
button.bad { color: var(--danger-text); }
.chip.bad { color: var(--danger-text); }
#toast.err { background: var(--danger); }
.chip.gold, .chip.warn { background: var(--gold-soft); color: var(--gold); }
.card.hl .chip.gold, .card.hl .chip.warn { background: var(--gold-soft); }
a.chip { text-decoration: none; }
.amt { font-variant-numeric: tabular-nums; } .amt.plus { color: var(--accent-text); } .amt.minus { color: var(--danger-text); }

/* Rows that must never wrap */
.row.nowrap { flex-wrap: nowrap; align-items: flex-start; }
.row.nowrap .chip { margin-top: 2px; }
.actions > * { flex: 1 1 0; white-space: nowrap; padding-inline: 8px; font-size: .95rem; }
.actions > :first-child { flex: 1.25 1 0; }
.actions.even > * { flex: 1 1 0; white-space: normal; font-size: .9rem; }
.head.top .grow > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head.top .grow > b { display: block; }
.card.hl.center .row { flex-wrap: nowrap; margin-top: 12px; }
.card.hl.center .row > * { flex: 1; padding-inline: 6px; }

/* Spacing fixes */
.bar { margin: 14px 0 8px; }
.card.center .chip { margin-top: 6px; }
h3:not(:first-child) { margin-top: 20px; }
.auth .card { margin-top: 24px; }
.msg time { display: inline; margin-left: 8px; opacity: .7; }
.chat { min-height: calc(100dvh - 310px); justify-content: flex-end; }
.list li, .list li.unread { padding-left: 16px; position: relative; }
.card > .list li:not(.unread), ul.list.small li, .list.todo li { padding-left: 0; }

/* Grouped sections (Me) */
.group { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; margin: 10px 0; }
.group > details.card { margin: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
.group > details.card + details.card { border-top: 1px solid var(--line); }
.group summary { gap: 12px; justify-content: flex-start; font-weight: 500; }
.group summary .ic { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.group summary::after { margin-left: auto; }
details.sub { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }
details.sub > summary { font-weight: 500; color: var(--muted); font-size: .9rem; }

.facts > div + div { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.ic.sq { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 8px; }
.statgrid .ic.sq { width: 40px; height: 40px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 48px 24px; }
.empty .ic { width: 52px; height: 52px; padding: 13px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; }
.empty b { color: var(--text); font-size: 1.05rem; }

/* Mood picker: labelled, and reachable by keyboard and screen readers */
.moods input { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; }
.moods label { position: relative; }
.moods span small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.moods input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Focus and motion */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  button:active, .btn:active, a.card:active, .tile:active, .person:active { transform: none; }
}

/* Accent picker */
.swatches { display: flex; gap: 12px; margin-top: 14px; }
.swatches button { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--line); }
.swatches button.on { box-shadow: 0 0 0 2.5px var(--text); }
.card.hl { background: var(--card2); }
.ic.huge, .ic.accent, .ic.ok { color: var(--gold); }
.week i.full, .bar > i { background: var(--gold); }

/* Walkthrough */
dialog.tour { border: 0; padding: calc(16px + env(safe-area-inset-top)) 0 calc(20px + env(safe-area-inset-bottom)); margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--text); flex-direction: column; }
dialog.tour[open] { display: flex; animation: fade .2s; }
dialog.tour .skip { align-self: flex-end; margin-right: 12px; }
dialog.tour .skip[hidden] { display: block !important; visibility: hidden; }
dialog.tour .track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
dialog.tour .track::-webkit-scrollbar { display: none; }
dialog.tour section { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 32px; }
dialog.tour section > * { max-width: 420px; }
dialog.tour section .ic { width: 96px; height: 96px; padding: 26px; border-radius: 30px; background: var(--card); color: var(--gold); box-shadow: var(--shadow); border: 1px solid var(--edge); margin-bottom: 28px; stroke-width: 1.5; }
dialog.tour h1 { margin: 0 0 12px; }
dialog.tour section p { color: var(--muted); font-size: 1.05rem; line-height: 1.5; margin: 0; }
dialog.tour .dots { display: flex; justify-content: center; gap: 7px; margin: 20px 0; }
dialog.tour .dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .2s, background .2s; }
dialog.tour .dots i.on { width: 22px; background: var(--text); }
dialog.tour .row { padding: 0 20px; max-width: 460px; width: 100%; margin: 0 auto; flex-wrap: nowrap; }
dialog.tour .row button { flex: 1; }
dialog.tour .row button.ghost { flex: 0 0 auto; padding-inline: 22px; }

/* Suggestion chips */
.ideas { display: flex; gap: 6px; overflow-x: auto; margin: 8px -16px 0; padding: 0 16px 2px; scrollbar-width: none; }
.ideas::-webkit-scrollbar { display: none; }
.ideas .chip { min-height: 32px; padding: 6px 12px; font-weight: 500; font-size: .8rem; background: var(--card2); color: var(--text); flex: none; }
.card.hl .ideas .chip { background: var(--card); }
form[hidden] { display: none; }
ol.rules li form { margin-top: 8px; }
/* App lock */
dialog.lock { border: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--text); padding: 24px; }
dialog.lock[open] { display: grid; place-items: center; }
dialog.lock form { width: min(300px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
dialog.lock .ic { width: 72px; height: 72px; padding: 20px; border-radius: 24px; background: var(--card); color: var(--gold); border: 1px solid var(--edge); box-shadow: var(--shadow); }
dialog.lock h1 { margin: 6px 0 0; } dialog.lock p { margin: 0; }
dialog.lock input { text-align: center; font-size: 1.6rem; letter-spacing: .5em; background: var(--card); }

.legal h3 { margin-top: 18px; } .legal .card h3:first-child { margin-top: 0; }

.tagline { font-family: ui-serif, "New York", "Iowan Old Style", Georgia, serif; font-style: italic; font-size: 1.15rem; color: var(--muted); margin: 2px 0 0; }

/* Photo editor */
dialog.crop { border: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: var(--bg); color: var(--text); padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom)); }
dialog.crop[open] { display: flex; flex-direction: column; align-items: center; gap: 12px; }
dialog.crop h3 { margin: 0; }
dialog.crop > .row, dialog.crop > input { width: min(420px, 100%); }
dialog.crop > .row:last-child { margin-top: auto; flex-wrap: nowrap; }
dialog.crop > .row:last-child > * { flex: 1; }
dialog.crop .tools { justify-content: center; }
dialog.crop .tools button.on { background: var(--accent); color: var(--on-accent); }
.cropframe { position: relative; overflow: hidden; border-radius: 18px; background: #000; touch-action: none; cursor: grab; margin: auto 0; flex: none; }
.cropframe img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.cropframe.round::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); pointer-events: none; }
input[type=range] { padding: 0; height: 28px; background: none; border: 0; accent-color: var(--accent); }
img.thumb { display: block; width: 120px; max-height: 160px; object-fit: cover; border-radius: 14px; margin-top: 10px; }
/* First-run setup */
dialog.setup section { gap: 0; }
dialog.setup label.btn { margin: 0; color: var(--on-accent); font-size: 1rem; font-weight: 600; cursor: pointer; }
dialog.setup label.btn.ghost { color: var(--text); }
dialog.setup form label { margin-top: 12px; }
dialog.setup .track { overflow-y: auto; }
dialog.setup .row label.btn, dialog.setup .row button { white-space: nowrap; padding-inline: 12px; }

/* Tag picker */
.tagpicker { text-align: left; }
.tagpicker .tagsearch { margin: 8px 0 4px; }
.taggroup { margin-top: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.tag { min-height: 36px; padding: 7px 13px; border-radius: 99px; font-size: .88rem; font-weight: 500; background: var(--card2); color: var(--text); border: 0; display: inline-flex; align-items: center; }
.card.hl .tag, dialog.setup .tag { background: var(--card); }
.tag.on { background: var(--accent); color: var(--on-accent); }
.tags.show .tag { min-height: 30px; padding: 4px 11px; font-size: .82rem; }
.tags.show .tag.on { background: var(--gold-soft); color: var(--gold); }
