/* =====================================================================
   Bookshelf app — cozy espresso & candlelight (from the original mockup)
   ===================================================================== */

:root,
:root[data-theme="dark"] {
  --bg:          #1c1410;
  --bg2:         #231a12;
  --bg3:         #2a2018;
  --card:        #2e2318;
  --card2:       #352a1e;
  --card-hover:  #3d3022;
  --border:      #4a3828;
  --border2:     #5a4535;
  --accent:      #d4845a;
  --accent-ink:  #ffffff;
  --gold:        #e8b86d;
  --sage:        #8fad7c;
  --text:        #f0e6d3;
  --text2:       #d1b893;
  --text3:       #a88b6b;   /* raised from the mockup for readable contrast */
  --text4:       #7d6248;   /* decorative only */
  --reading-c:   #8fad7c;
  --read-c:      #d4845a;
  --unread-c:    #93a6b8;
  --danger:      #e07a6a;
  --progress-bg: #3d2e20;
  --nav-bg:      #1c1410ee;
  --scrim:       #000000a0;
  --shadow:      0 10px 40px #00000066;
  --shadow-sm:   0 3px 14px #00000044;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg:          #fdf6ec;
  --bg2:         #f7ede0;
  --bg3:         #f0e4d0;
  --card:        #fffaf4;
  --card2:       #fbf0e0;
  --card-hover:  #f8ead4;
  --border:      #e4cfb4;
  --border2:     #d4bc9a;
  --accent:      #a8552d;
  --accent-ink:  #ffffff;
  --gold:        #a8711c;
  --sage:        #4f7040;
  --text:        #2a1f14;
  --text2:       #5e4429;
  --text3:       #7f6146;
  --text4:       #b49673;
  --reading-c:   #4f7040;
  --read-c:      #a8552d;
  --unread-c:    #566a7d;
  --danger:      #b4432f;
  --progress-bg: #ead8bf;
  --nav-bg:      #fdf6ecee;
  --scrim:       #2a1f1466;
  --shadow:      0 10px 40px #4a30181a;
  --shadow-sm:   0 3px 14px #4a301814;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[x-cloak] { display: none !important; }

html, body { background: var(--bg); }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 0%, #d4845a10 0%, transparent 55%),
    radial-gradient(ellipse at 90% 30%, #e8b86d0a 0%, transparent 50%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding-bottom: 110px; }

/* ── Top bar ───────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--nav-bg); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: 'Lora', serif; font-style: italic; font-weight: 600; font-size: 1.02rem; color: var(--text2); display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card2); border: 1px solid var(--border);
  font-size: 1rem; transition: background .2s;
}
.icon-btn:hover { background: var(--card-hover); }

/* ── Hero: the user's named bookshelf ──────────────────────────────── */
.hero { padding: 26px 16px 18px; border-bottom: 1px solid var(--border); background: var(--bg2); position: relative; overflow: hidden; }
.hero-greeting { font-family: 'Lora', serif; font-style: italic; color: var(--text3); font-size: .92rem; }
.hero-title {
  font-family: 'Lora', serif; font-weight: 700;
  font-size: clamp(2rem, 8vw, 2.9rem); line-height: 1.05; letter-spacing: -0.015em;
  margin: 0; color: var(--text);
}
.hero-title { margin-bottom: 18px; }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-badges { display: flex; align-items: center; flex-shrink: 0; padding: 4px 4px 4px 8px; background: none; border: 0; border-radius: 24px; }
.top-badges:hover .top-badge { transform: translateY(-2px); }
.top-badge {
  position: relative; width: 32px; height: 32px; margin-left: -8px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem;
  background: var(--card2); border: 2px solid var(--border2); box-shadow: var(--shadow-sm);
  transition: transform .2s;
}
.top-badge:nth-child(1) { z-index: 5; } .top-badge:nth-child(2) { z-index: 4; } .top-badge:nth-child(3) { z-index: 3; }
.top-badge:nth-child(4) { z-index: 2; } .top-badge:nth-child(5) { z-index: 1; }
.top-badge.challenge { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--card2)); }
@media (max-width: 380px) { .top-badge:nth-child(n+4) { display: none; } }
.hero-greeting.hero-under { margin-top: 10px; text-align: center; }
.pill-n { margin-left: 5px; opacity: .6; font-variant-numeric: tabular-nums; font-weight: 600; }
.pill.on .pill-n { opacity: .8; }
.hero-candle { position: absolute; right: 18px; top: 18px; font-size: 2rem; opacity: .35; animation: flicker 3.2s ease-in-out infinite; }
@keyframes flicker { 0%,100% { opacity: .3; transform: scale(1); } 50% { opacity: .45; transform: scale(1.06); } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); }
.stat { padding: 10px 6px; text-align: center; border: 0; background: none; transition: background .2s; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat:hover { background: var(--card-hover); }
.stat-num { font-family: 'Lora', serif; font-weight: 700; font-size: 1.45rem; line-height: 1.1; }
.stat-lbl { font-size: .74rem; color: var(--text3); font-weight: 600; }
.c-read { color: var(--read-c); } .c-reading { color: var(--reading-c); } .c-unread { color: var(--unread-c); } .c-wish { color: var(--gold); }

/* ── Filters ───────────────────────────────────────────────────────── */
.filters { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 10px; }
.search { position: relative; }
.search input {
  width: 100%; padding: 11px 14px 11px 40px;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 14px;
  outline: none; transition: border-color .2s;
}
.search input:focus { border-color: var(--accent); }
.search input::placeholder { color: var(--text3); }
.search::before { content: '🔍'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: .95rem; opacity: .8; }
.pill-row {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 7px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
.pill-row::-webkit-scrollbar { height: 6px; }
.pill-row::-webkit-scrollbar-track { background: transparent; }
.pill-row::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.pill-row::-webkit-scrollbar-thumb:hover { background: var(--text4); }
.pill {
  flex-shrink: 0; min-height: 36px; padding: 6px 14px;
  border-radius: 20px; border: 1.5px solid var(--border); background: var(--card);
  color: var(--text2); font-size: .84rem; font-weight: 700; white-space: nowrap;
  transition: border-color .2s, background .2s, color .2s;
}
.pill:hover { border-color: var(--accent); }
.pill.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pill.cat.on { background: var(--card2); color: var(--text); border-color: var(--pill, var(--accent)); box-shadow: inset 0 0 0 1px var(--pill, var(--accent)); }

/* ── Sections ──────────────────────────────────────────────────────── */
.sec-head { padding: 18px 16px 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec-title { font-family: 'Lora', serif; font-size: 1.08rem; font-weight: 700; font-style: italic; color: var(--text2); }
.sec-count { font-size: .8rem; color: var(--text3); font-weight: 600; }

/* Currently reading: a horizontal shelf */
.reading-shelf { display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.reading-shelf::-webkit-scrollbar { display: none; }
.r-card {
  flex-shrink: 0; width: 136px; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .2s;
}
.r-card:hover { transform: translateY(-3px); }
.r-card .cover { height: 176px; }
.r-body { padding: 9px 10px 11px; }
.prog { margin-top: 8px; }
.prog-bg { background: var(--progress-bg); border-radius: 4px; height: 6px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--reading-c), #b5d4a0); transition: width .4s; }
.prog-txt { font-size: .72rem; color: var(--text3); margin-top: 4px; font-weight: 600; }

/* Book grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; padding: 4px 16px; }
.b-card {
  text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .2s, background .2s;
}
.b-card:hover { transform: translateY(-3px); background: var(--card-hover); }
.b-card .cover { aspect-ratio: 2 / 3; }
.b-info { padding: 8px 9px 10px; }
.t-title { font-family: 'Lora', serif; font-weight: 600; font-size: .82rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.t-author { font-size: .74rem; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 7px; }
.badge { font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--border); color: var(--text3); background: var(--bg3); white-space: nowrap; }
.badge.reading { color: var(--reading-c); border-color: color-mix(in srgb, var(--reading-c) 45%, transparent); background: color-mix(in srgb, var(--reading-c) 12%, transparent); }
.badge.read    { color: var(--read-c);    border-color: color-mix(in srgb, var(--read-c) 45%, transparent);    background: color-mix(in srgb, var(--read-c) 12%, transparent); }
.badge.want    { color: var(--gold);      border-color: color-mix(in srgb, var(--gold) 45%, transparent);      background: color-mix(in srgb, var(--gold) 12%, transparent); }
.fmt { font-size: .8rem; }
.stars { color: var(--gold); font-size: .74rem; letter-spacing: -1px; }

/* Covers and placeholders */
.cover { width: 100%; background: var(--bg3); position: relative; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 10px; background: linear-gradient(160deg, var(--ph, #6a4a32), color-mix(in srgb, var(--ph, #6a4a32) 55%, #000));
}
.cover-ph span { font-family: 'Lora', serif; font-style: italic; font-weight: 600; font-size: .82rem; line-height: 1.25; color: #fff6e8; text-shadow: 0 1px 2px #0006; }

.more { display: flex; justify-content: center; padding: 18px 16px; }

/* Empty state */
.empty { margin: 26px 16px; padding: 34px 22px; text-align: center; border: 1.5px dashed var(--border2); border-radius: 18px; background: var(--card); }
.empty .big { font-size: 2.4rem; }
.empty h2 { font-family: 'Lora', serif; font-size: 1.3rem; margin: 8px 0 6px; }
.empty p { color: var(--text3); max-width: 34ch; margin: 0 auto 16px; }

/* ── Buttons & fields ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 14px; border: 1.5px solid transparent;
  font-weight: 800; font-size: .95rem; transition: filter .2s, background .2s;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--card2); border-color: var(--border2); color: var(--text); }
.btn.ghost:hover { background: var(--card-hover); }
.btn.danger { background: none; border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.link { background: none; border: 0; color: var(--accent); font-weight: 700; padding: 4px 2px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: .84rem; font-weight: 700; color: var(--text2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 13px;
  background: var(--card); border: 1.5px solid var(--border2); border-radius: 12px; outline: none;
  transition: border-color .2s;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text3); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
.hint { font-size: .78rem; color: var(--text3); }
.error { color: var(--danger); font-size: .86rem; font-weight: 600; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1px solid var(--border2); border-radius: 13px; padding: 4px; }
.seg button { flex: 1 1 auto; min-height: 38px; padding: 6px 10px; border-radius: 9px; border: 0; background: none; color: var(--text2); font-weight: 700; font-size: .84rem; white-space: nowrap; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px; padding: 5px 11px; border-radius: 18px;
  background: var(--card); border: 1.5px solid var(--border2); color: var(--text2);
  font-size: .82rem; font-weight: 700;
}
.chip.on { border-color: var(--chip, var(--accent)); color: var(--text); background: color-mix(in srgb, var(--chip, var(--accent)) 18%, var(--card)); }
.chip-static { cursor: default; }
.chip-group + .chip-group { margin-top: 12px; }
.chip-group-title { font-size: .78rem; color: var(--text3); font-weight: 700; margin-bottom: 6px; }

/* Stars input */
/* Stars you can tap in halves: the left half of a star gives 3.5, the right half 4 */
.star-input { display: flex; gap: 8px; }
.star-cell { position: relative; display: inline-block; font-size: 2rem; line-height: 1; width: 1em; height: 1em; }
.star-bg { color: var(--border2); }
.star-fill { position: absolute; inset: 0; overflow: hidden; color: var(--gold); white-space: nowrap; transition: width .15s; }
.star-half { position: absolute; top: -6px; bottom: -6px; width: 50%; padding: 0; margin: 0; background: none; border: 0; z-index: 2; cursor: pointer; }
.star-half.left { left: 0; }
.star-half.right { right: 0; }
.star-cell:hover .star-bg, .star-cell:hover .star-fill { transform: scale(1.12); transition: transform .15s; }
.star-input.waiting .star-cell { opacity: .5; }
.star-input.waiting .star-half { cursor: not-allowed; }

/* Scanning a pile */
.pile-opts { margin-top: 12px; }
.pile-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.pile-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center;
            padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); position: relative; }
.pile-row .cover { width: 38px; height: 57px; font-size: .5rem; }
.pile-row strong { display: block; font-family: 'Lora', serif; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pile-row small { display: block; font-size: .78rem; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pile-row .pile-note { color: var(--accent); }
.pile-row.looking { opacity: .65; }
.pile-row.have { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.pile-row.error { border-color: color-mix(in srgb, #c2452f 45%, var(--border)); }
.pile-row.saved { opacity: .6; }
.pile-tick { color: var(--gold); font-size: 1.1rem; }

/* ── FAB & bottom nav ──────────────────────────────────────────────── */
.fab {
  position: fixed; right: max(18px, calc(50% - 362px)); bottom: 86px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--accent), #b0603a); color: #fff; font-size: 1.7rem;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .2s;
}
.fab:hover { transform: scale(1.07) rotate(8deg); }
.bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
  background: var(--nav-bg); backdrop-filter: blur(18px); border-top: 1px solid var(--border);
  padding: 6px 0 calc(10px + env(safe-area-inset-bottom));
}
.bnav-inner { max-width: 760px; margin: 0 auto; display: flex; }
.bnav button {
  flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: var(--text3); font-weight: 700; font-size: .74rem;
}
.bnav button span { font-size: 1.25rem; line-height: 1.2; }
.bnav button.on { color: var(--accent); }

/* ── Bottom sheets ─────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 100; background: var(--scrim); backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border2); border-bottom: 0;
  border-radius: 24px 24px 0 0; padding: 12px 18px 40px; box-shadow: var(--shadow);
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border2); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.sheet-title { font-family: 'Lora', serif; font-size: 1.3rem; font-weight: 700; }
.sheet-enter { transition: transform .32s cubic-bezier(.3,.8,.3,1), opacity .25s; }
.sheet-from { transform: translateY(40px); opacity: 0; }
.sheet-to { transform: translateY(0); opacity: 1; }

.divider { text-align: center; color: var(--text4); letter-spacing: .4em; margin: 16px 0 6px; font-size: .8rem; }

/* Search results */
.results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.result {
  display: flex; gap: 12px; align-items: center; text-align: left; width: 100%;
  padding: 8px; border-radius: 12px; background: var(--card); border: 1px solid var(--border);
  transition: background .2s;
}
.result:hover { background: var(--card-hover); }
.result .cover { width: 48px; height: 72px; flex-shrink: 0; border-radius: 6px; }
.result .cover-ph span { font-size: .55rem; }
.result-meta { font-size: .78rem; color: var(--text3); }

/* Book header inside sheets */
.book-top { display: flex; gap: 14px; margin-bottom: 16px; }
.book-top .cover { width: 104px; height: 156px; flex-shrink: 0; border-radius: 10px; border: 2px solid var(--border2); box-shadow: var(--shadow); }
.book-top h2 { font-family: 'Lora', serif; font-size: 1.25rem; line-height: 1.2; }
.book-top .by { color: var(--text2); font-weight: 600; margin: 3px 0 6px; }
.book-top .meta { color: var(--text3); font-size: .82rem; }
.notice { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--sage) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--sage) 40%, transparent); font-size: .86rem; margin-bottom: 14px; }
.section { margin-top: 18px; }
.section > .label { display: block; margin-bottom: 8px; }

.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin: 22px 0 14px; }
.tabs button { flex: 1; min-height: 44px; background: none; border: 0; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; color: var(--text3); font-weight: 800; font-size: .88rem; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.note { padding: 11px 13px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); margin-top: 8px; }
.note.quote { border-left: 3px solid var(--gold); font-family: 'Lora', serif; font-style: italic; }
.note-meta { display: flex; justify-content: space-between; align-items: center; font-size: .74rem; color: var(--text3); margin-top: 6px; font-family: 'Nunito', sans-serif; font-style: normal; }
.desc { color: var(--text2); white-space: pre-line; font-size: .92rem; max-width: 65ch; }

/* Scanner */
.scanner { border-radius: 14px; overflow: hidden; border: 1px solid var(--border2); background: #000; min-height: 220px; }

/* Auth */
.auth { max-width: 420px; margin: 0 auto; padding: 48px 20px; position: relative; z-index: 1; }
.auth-title { font-family: 'Lora', serif; font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin-bottom: 6px; }
.auth-sub { color: var(--text3); margin-bottom: 26px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 250;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px;
  font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}


/* ── Reading Trail ─────────────────────────────────────────────────── */
.trail-head { padding: 24px 16px 10px; }
.trail-title { font-family: 'Lora', serif; font-weight: 700; font-size: clamp(1.8rem, 7vw, 2.4rem); line-height: 1.1; }
.trail-next { margin-top: 8px; font-family: 'Lora', serif; font-style: italic; color: var(--text2); font-size: 1.02rem; }
.trail-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 10px; color: var(--text3); font-size: .9rem; }
.trail-stats strong { color: var(--text); font-family: 'Lora', serif; font-size: 1.15rem; }
.trail-map {
  display: block; width: 100%; max-width: 460px; margin: 6px auto 0;
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 60%),
    linear-gradient(180deg, var(--bg2), color-mix(in srgb, var(--sage) 9%, var(--bg)) 55%, var(--bg2));
  border-block: 1px solid var(--border);
}
@media (min-width: 500px) { .trail-map { border: 1px solid var(--border); border-radius: 22px; } }
.scenery { opacity: .55; }
.path-bed    { fill: none; stroke: color-mix(in srgb, var(--border) 70%, var(--bg3)); stroke-width: 30; stroke-linecap: round; }
.path-stones { fill: none; stroke: var(--border2); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1 13; }
.path-walked { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; opacity: .9; }
.stop circle { fill: var(--card); stroke: var(--border2); stroke-width: 3; }
.stop .stop-emoji { font-size: 26px; opacity: .45; }
.stop .stop-name { font-family: 'Lora', serif; font-weight: 700; font-size: 15px; fill: var(--text3); }
.stop .stop-blurb { font-size: 11.5px; fill: var(--text4); }
.stop.reached circle { stroke: var(--gold); fill: var(--card2); }
.stop.reached .stop-emoji { opacity: 1; }
.stop.reached .stop-name { fill: var(--text); }
.stop.reached .stop-blurb { fill: var(--text3); font-style: italic; }
.lantern-glow { fill: var(--gold); opacity: .28; transform-box: fill-box; transform-origin: center; animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .22; transform: scale(1); } 50% { opacity: .4; transform: scale(1.25); } }
.trail-rules { text-align: center; padding: 12px 24px 0; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 4px 16px 16px; }
.badge-tile { text-align: center; padding: 14px 8px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
.badge-emoji { font-size: 2rem; line-height: 1.1; }
.badge-title { font-family: 'Lora', serif; font-weight: 600; font-size: .82rem; line-height: 1.25; margin-top: 6px; }
.badge-date { font-size: .7rem; color: var(--text3); margin-top: 3px; }
.badge-tile.challenge { border: 1.5px solid var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--card)); }
.badge-kind { font-size: .68rem; font-weight: 800; color: var(--gold); margin-top: 3px; }

/* Trail themes: each trail tints the map and path */
.trail-map { --tint: var(--gold); --walk: var(--gold); }
.trail-map.theme-enchanted_forest { --tint: #6f9a5a; --walk: #b9d67a; }
.trail-map.theme-seaside_town     { --tint: #5a9ac0; --walk: #e8c26a; }
.trail-map.theme-haunted_hollow   { --tint: #8a62b0; --walk: #ec8a3c; }
.trail-map.theme-winter_village   { --tint: #8ab8d8; --walk: #9fd0f0; }
.trail-map.theme-autumn_harvest   { --tint: #c8803a; --walk: #f0a650; }
.trail-map.theme-sky_isles        { --tint: #9a8ad8; --walk: #ffd76a; }
:root[data-theme="light"] .trail-map.theme-enchanted_forest { --walk: #5f8a32; }
:root[data-theme="light"] .trail-map.theme-seaside_town     { --walk: #c0902a; }
:root[data-theme="light"] .trail-map.theme-haunted_hollow   { --walk: #c8641c; }
:root[data-theme="light"] .trail-map.theme-winter_village   { --walk: #3f88b8; }
:root[data-theme="light"] .trail-map.theme-autumn_harvest   { --walk: #b8641c; }
:root[data-theme="light"] .trail-map.theme-sky_isles        { --walk: #7a62c8; }
.trail-map:not(.theme-cozy_village) {
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--tint) 22%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--tint) 10%, var(--bg2)), color-mix(in srgb, var(--tint) 18%, var(--bg)) 55%, color-mix(in srgb, var(--tint) 8%, var(--bg2)));
}
.trail-map:not(.theme-cozy_village) .path-bed { stroke: color-mix(in srgb, var(--tint) 30%, var(--border)); }
.trail-map .path-walked { stroke: var(--walk); }
.trail-map .stop.reached circle { stroke: var(--walk); }
.trail-map .lantern-glow { fill: var(--walk); }

.trail-option {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--border);
  transition: background .2s;
}
.trail-option:hover:not(:disabled) { background: var(--card-hover); }
.trail-option.active { border-color: var(--gold); }
.trail-option.locked { opacity: .6; cursor: not-allowed; }

/* ── Challenges ────────────────────────────────────────────────────── */
.ch-card { margin: 12px 16px; padding: 14px 16px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); }
.ch-card.past { opacity: .8; box-shadow: none; }
.ch-top { display: flex; gap: 12px; align-items: center; }
.ch-emoji { width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem; background: var(--card2); border: 1px solid var(--border2); }
.ch-title { font-family: 'Lora', serif; font-size: 1.08rem; line-height: 1.2; }

/* ── Bingo card: a printed paper card, the same in light and dark mode ── */
.bingo-card {
  --paper: #fbf3e2; --ink: #3b2a1a; --line: #e2cfab; --dauber: #d4845a; --gold: #e0a83a;
  max-width: 440px; margin: 14px auto 4px; padding: 10px 10px 12px;
  background: var(--paper); color: var(--ink);
  border: 3px solid #ead8b4; border-radius: 18px;
  box-shadow: 0 6px 24px #0000002e, inset 0 0 0 1px #fff8;
  background-image: radial-gradient(#d9c4a00f 1px, transparent 1px); background-size: 6px 6px;
}
.bc-head { display: grid; gap: 4px; margin-bottom: 6px; text-align: center; }
.bc-head span {
  font-family: 'Lora', serif; font-weight: 700; font-size: 1.7rem; line-height: 1.15;
  color: #fff; border-radius: 10px; padding: 2px 0; text-shadow: 0 1px 0 #0003;
}
.bc-head span:nth-child(5n+1) { background: #c0563a; }
.bc-head span:nth-child(5n+2) { background: #d49a2a; }
.bc-head span:nth-child(5n+3) { background: #5a8a4a; }
.bc-head span:nth-child(5n+4) { background: #4a7aa8; }
.bc-head span:nth-child(5n+5) { background: #8a5aa8; }
.bc-grid { display: grid; gap: 4px; }
.bc-cell {
  position: relative; aspect-ratio: 1; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 4px; border-radius: 8px; border: 1.5px solid var(--line); background: #fffaf1; color: var(--ink);
  text-align: center; transition: transform .15s, box-shadow .15s;
}
.bc-cell:hover { transform: translateY(-1px); box-shadow: 0 2px 6px #0002; }
.bc-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.bc-emoji { position: relative; font-size: 1.35rem; line-height: 1; }
.bc-label {
  position: relative; font-weight: 800; font-size: .74rem; line-height: 1.15;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.size-5 .bc-head span { font-size: 1.4rem; }
.size-5 .bc-emoji { font-size: 1.05rem; }
.size-5 .bc-label { font-size: .58rem; -webkit-line-clamp: 2; }
.size-4 .bc-label { font-size: .66rem; }
@media (min-width: 480px) { .size-5 .bc-label { font-size: .64rem; } }

/* The little rubber stamp on a finished square (top-right corner) */
.bc-stamp {
  --ink: #c0442e;
  position: absolute; top: 4%; right: 4%; width: 36%; max-width: 34px; aspect-ratio: 1;
  display: grid; place-items: center; border-radius: 50%;
  border: 2px dashed var(--ink); box-shadow: 0 0 0 1.5px #fffaf1, 0 0 0 3px color-mix(in srgb, var(--ink) 55%, transparent);
  background: color-mix(in srgb, var(--ink) 10%, #fffaf1);
  transform: rotate(var(--tilt, -8deg)); opacity: .92;
  animation: thunk .45s cubic-bezier(.3, 1.6, .5, 1) both;
}
.bc-stamp span {
  font-size: clamp(.55rem, 2.6vw, .95rem); line-height: 1;
  filter: grayscale(1) sepia(1) saturate(5) hue-rotate(-28deg) brightness(.85);   /* inked look */
}
@keyframes thunk {
  0%   { transform: scale(2.2) rotate(calc(var(--tilt, -8deg) - 25deg)); opacity: 0; }
  60%  { transform: scale(.9) rotate(var(--tilt, -8deg)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--tilt, -8deg)); opacity: .92; }
}
.bc-cell.line .bc-stamp { --ink: #c08a1e; }
.bc-cell.line .bc-stamp span { filter: grayscale(1) sepia(1) saturate(6) hue-rotate(5deg) brightness(.9); }
.size-3 .bc-stamp { width: 30%; max-width: 40px; }
.size-4 .bc-stamp { width: 30%; top: 3%; right: 3%; }
.size-5 .bc-stamp { width: 30%; top: 2%; right: 2%; border-width: 1.5px; }
.size-5 .bc-stamp span { font-size: clamp(.5rem, 2.1vw, .78rem); }
.size-4 .bc-cell.done, .size-5 .bc-cell.done { padding-top: 22%; justify-content: flex-start; }
.size-4 .bc-cell.done .bc-emoji, .size-5 .bc-cell.done .bc-emoji { margin-right: 22%; }
.size-3 .bc-stamp span { font-size: 1.05rem; }
.bc-cell.done { background: #fff6e4; }
.bc-cell.done .bc-cover { opacity: .38; }
.bc-cell.done { border-color: color-mix(in srgb, #c0442e 40%, var(--line)); }
.bc-cell.line { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset; }
.bc-cell.free { background: repeating-linear-gradient(45deg, #f6dd96, #f6dd96 6px, #f3d585 6px, #f3d585 12px); border-color: #e3bf5e; }
.bc-cell.free .bc-label { font-family: 'Lora', serif; font-size: .9rem; letter-spacing: .04em; }

/* Building a card */
.bingo-card.building .bc-cell.editing { box-shadow: 0 0 0 3px var(--dauber) inset; transform: scale(1.04); z-index: 1; }
.deal-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0 4px; }
.deal {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-height: 64px;
  border-radius: 12px; border: 1.5px solid var(--border2); background: var(--card); color: var(--text2);
  font-weight: 800; font-size: .74rem; line-height: 1.15; text-align: center;
}
.deal span { font-size: 1.3rem; }
.deal.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 14%, var(--card)); }
.square-editor { margin: 4px 0 16px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.square-editor .tabs button { font-size: .76rem; padding: 0 2px; }

/* ── Badge earned moment ───────────────────────────────────────────── */
.badge-scrim { align-items: center; z-index: 150; }
.badge-moment {
  width: min(320px, calc(100% - 40px)); text-align: center; padding: 30px 24px 24px;
  background: var(--bg2); border: 1px solid var(--gold); border-radius: 26px; box-shadow: 0 0 60px color-mix(in srgb, var(--gold) 30%, transparent);
}
.badge-moment .bm-emoji { font-size: 4rem; line-height: 1; margin-bottom: 10px; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.badge-moment h2 { font-family: 'Lora', serif; font-size: 1.4rem; margin: 4px 0 18px; }

@media (min-width: 640px) {
  .scrim { align-items: center; }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--border2); max-height: 88vh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Covers: the title card always sits underneath; a real cover covers it.
   A link that fails (or is a 1-pixel "no cover") just disappears.
   ===================================================================== */
.cover img { position: absolute; inset: 0; z-index: 1; }
.cover img.broken { display: none; }
.cover-ph { gap: 4px; }
.cover-ph::before {   /* a little bookbinding stripe */
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 7%;
  background: linear-gradient(90deg, #0003, #0000); border-right: 1px solid #fff2;
}
.cover-ph::after {
  content: '✦'; position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  color: #fff6e855; font-size: .9rem;
}
.cover-ph small {
  font-size: .64rem; font-weight: 700; color: #fff6e8bb; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-ph span { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.result .cover-ph small, .books-list .cover-ph small, .books-list .cover-ph::after { display: none; }
.result .cover-ph, .books-list .cover-ph { padding: 5px; }
.books-list .cover-ph span { font-size: .5rem; -webkit-line-clamp: 4; }

/* =====================================================================
   Three ways to show books: list, gallery, gallery with summary
   ===================================================================== */
.sec-tools { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--border); border-radius: 11px; }
.view-toggle button {
  width: 34px; height: 30px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 8px; color: var(--text3); transition: background .2s, color .2s;
}
.view-toggle button svg { width: 17px; height: 17px; fill: currentColor; }
.view-toggle button:hover { color: var(--text); }
.view-toggle button.on { background: var(--accent); color: var(--accent-ink); }

.bk {
  text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm); transition: transform .2s, background .2s;
}
.bk:hover { transform: translateY(-2px); background: var(--card-hover); }
.bk-open { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; }
.b-extras { display: inline-flex; align-items: center; gap: 4px; }
.fav { font-size: .7rem; }
.t-series { font-size: .74rem; color: var(--text3); font-style: italic; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blurb {
  font-size: .84rem; line-height: 1.5; color: var(--text2); margin-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.blurb.none { color: var(--text3); font-style: italic; font-size: .8rem; }
.blurb.own::before { content: '✍️ '; }

/* Gallery */
.books-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 12px; padding: 4px 16px; }
.books-gallery .cover { aspect-ratio: 2 / 3; }
.books-gallery .bk-info { padding: 8px 9px 10px; }

/* List */
.books-list { display: flex; flex-direction: column; gap: 7px; padding: 4px 16px; }
.books-list :is(button.bk, .bk-open) { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; }
.books-list .cover { width: 46px; height: 69px; flex-shrink: 0; border-radius: 6px; }
.books-list .bk-info {
  flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center;
}
.books-list .bk-info > :not(.b-foot) { grid-column: 1; }
.books-list .b-foot { grid-column: 2; grid-row: 1 / span 3; flex-direction: column; align-items: flex-end; margin: 0; gap: 4px; }
.books-list .t-title { font-size: .9rem; -webkit-line-clamp: 1; }
.books-list .bk:hover { transform: none; }

/* Gallery with summary */
.books-summary { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 4px 16px; }
@media (min-width: 680px) { .books-summary { grid-template-columns: 1fr 1fr; } }
.books-summary :is(button.bk, .bk-open) { display: flex; align-items: flex-start; gap: 14px; padding: 12px; }
.books-summary .cover { width: 92px; aspect-ratio: 2 / 3; flex-shrink: 0; border-radius: 8px; box-shadow: var(--shadow-sm); }
.books-summary .bk-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.books-summary .t-title { font-size: .98rem; }
.books-summary .b-foot { margin-top: 10px; justify-content: flex-start; gap: 8px; }

/* Where to buy (wishlists) */
.buy { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; }
.buy.flush-buy { padding: 0; }   /* the book screen's own "Where to buy" row */
.books-list .buy { padding-left: 66px; margin-top: -2px; }
.books-summary .buy { padding-left: 118px; margin-top: -4px; }
.books-gallery .buy { padding: 0 8px 9px; gap: 4px; }
.buy a {
  --c: var(--accent);
  font-size: .74rem; font-weight: 800; padding: 4px 10px; border-radius: 14px; text-decoration: none;
  color: color-mix(in srgb, var(--c) 70%, var(--text)); border: 1.5px solid color-mix(in srgb, var(--c) 50%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent); transition: background .2s;
}
.buy a:hover { background: color-mix(in srgb, var(--c) 24%, transparent); }
.books-gallery .buy a { font-size: .66rem; padding: 2px 7px; }
.buy a.store-amazon { --c: #e3962b; }
.buy a.store-bn { --c: #4f9a72; }
.buy a.store-bookshop { --c: #7d8fdb; }
.buy a.store-audible { --c: #ef8a2c; }
.buy a.store-librofm { --c: #d9675a; }

/* =====================================================================
   Lists
   ===================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 22px 16px 14px; }
.page-title { font-family: 'Lora', serif; font-weight: 700; font-size: clamp(1.6rem, 6.5vw, 2.2rem); line-height: 1.1; overflow-wrap: anywhere; }
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 4px 16px 20px; }
.list-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-sm); transition: transform .2s, background .2s;
}
.list-card:hover { transform: translateY(-3px); background: var(--card-hover); }
.list-card.wish { background: linear-gradient(165deg, color-mix(in srgb, var(--gold) 12%, var(--card)), var(--card) 60%); }
.fan {
  position: relative; width: 100%; height: 112px; margin-bottom: 8px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 120%, color-mix(in srgb, var(--accent) 22%, var(--bg3)), var(--bg3));
  display: grid; place-items: center;
}
.fan img {
  position: absolute; top: 16px; left: 50%; width: 58px; height: 87px; object-fit: cover; border-radius: 5px;
  box-shadow: 0 5px 14px #0006; transform: translateX(calc(-50% + var(--o, 0) * 38px)) rotate(calc(var(--o, 0) * 9deg));
  transition: transform .3s;
}
.list-card:hover .fan img { transform: translateX(calc(-50% + var(--o, 0) * 44px)) rotate(calc(var(--o, 0) * 13deg)) translateY(-3px); }
.fan-emoji {
  position: absolute; right: 7px; bottom: 7px; z-index: 5; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.05rem; background: var(--card); box-shadow: var(--shadow-sm);
}
.fan.n0 .fan-emoji { position: static; width: auto; height: auto; background: none; box-shadow: none; font-size: 2.6rem; }
.list-name { font-family: 'Lora', serif; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.list-meta { font-size: .74rem; color: var(--text3); font-weight: 600; }
.list-tag {
  display: inline-block; margin-top: 5px; font-size: .68rem; font-weight: 800; padding: 2px 8px; border-radius: 9px;
  color: var(--text2); background: var(--bg3); border: 1px solid var(--border);
}
.list-card .list-tag + .list-tag { margin-top: 3px; }
.list-tag.smart { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.list-tag.public { color: var(--sage); border-color: color-mix(in srgb, var(--sage) 45%, transparent); }
.list-card.new {
  justify-content: center; align-items: center; text-align: center; gap: 4px; min-height: 200px;
  background: none; border: 1.5px dashed var(--border2); box-shadow: none; color: var(--text2); font-weight: 800;
}
.list-card.new .plus { font-size: 1.8rem; color: var(--accent); line-height: 1; }
.list-card.new .hint { font-weight: 600; max-width: 18ch; }

.back { background: none; border: 0; color: var(--accent); font-weight: 800; padding: 14px 16px 0; }
.ld-head { display: flex; gap: 14px; align-items: flex-start; padding: 10px 16px 4px; }
.ld-emoji {
  flex-shrink: 0; width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 2.1rem;
  background: var(--card2); border: 1px solid var(--border2); box-shadow: var(--shadow-sm);
}
.ld-head.wish .ld-emoji { background: color-mix(in srgb, var(--gold) 16%, var(--card2)); border-color: color-mix(in srgb, var(--gold) 45%, var(--border2)); }
.ld-desc { color: var(--text2); font-size: .9rem; margin-top: 4px; }
.ld-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.ld-tags .list-tag { margin-top: 4px; }
.ld-actions { display: flex; gap: 8px; align-items: center; padding: 14px 16px 2px; }
.ld-actions .btn { flex: 1; min-height: 44px; padding: 8px 12px; font-size: .9rem; }
.ld-actions .icon-btn { flex-shrink: 0; width: 44px; height: 44px; }
.list-detail .empty p { margin-bottom: 14px; }

/* List editor */
.name-row { display: flex; gap: 8px; align-items: center; }
.emoji-now {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem;
  background: var(--card); border: 1.5px solid var(--border2);
}
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 5px; }
.emoji-grid button {
  height: 40px; border-radius: 10px; font-size: 1.2rem; background: var(--card); border: 1.5px solid var(--border);
  transition: transform .15s, border-color .15s;
}
.emoji-grid button:hover { transform: scale(1.08); }
.emoji-grid button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }

/* Book picker */
.result.picked { border-color: color-mix(in srgb, var(--sage) 60%, transparent); background: color-mix(in srgb, var(--sage) 10%, var(--card)); }
.tick {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  border: 1.5px solid var(--border2); color: var(--text3);
}
.result.picked .tick { background: var(--sage); border-color: var(--sage); color: #fff; }

/* Share & export */
.share-box { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); font-size: .9rem; color: var(--text2); }
.share-box.public { border-color: color-mix(in srgb, var(--sage) 45%, transparent); background: color-mix(in srgb, var(--sage) 8%, var(--card)); }
.share-box strong { color: var(--text); }
.link-row { display: flex; gap: 8px; margin-top: 10px; }
.link-row .input { font-size: .84rem; }
a.btn { text-decoration: none; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.export-grid button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px;
  border-radius: 14px; background: var(--card); border: 1px solid var(--border); transition: background .2s, transform .2s;
}
.export-grid button:hover { background: var(--card-hover); transform: translateY(-2px); }
.export-grid span { font-size: 1.4rem; }
.export-grid strong { font-size: .88rem; }
.export-grid small { font-size: .72rem; color: var(--text3); line-height: 1.3; }
@media (max-width: 420px) { .export-grid { grid-template-columns: 1fr; } .export-grid button { flex-direction: row; align-items: center; gap: 10px; } .export-grid small { display: none; } }

/* Your own summary */
.summary-own { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.summary-own .label { display: block; margin-bottom: 4px; }
.summary-own .desc { margin-bottom: 4px; }

/* Five tabs now: keep labels from crowding on small phones */
@media (max-width: 360px) { .bnav button { font-size: .68rem; } }
.has-links .t-series { white-space: normal; }
.ld-actions .btn { white-space: nowrap; }

/* Back to top: a little round button bottom-left (the add button lives bottom-right) */
.to-top {
  position: fixed; left: max(18px, calc(50% - 362px)); bottom: 92px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card2); border: 1.5px solid var(--border2); color: var(--text2);
  box-shadow: var(--shadow-sm); transition: transform .2s, color .2s;
}
.to-top svg { width: 20px; height: 20px; fill: currentColor; }
.to-top:hover { transform: translateY(-3px); color: var(--accent); }
/* Your lists as filters: a softer pill so they read as a separate row */
.pill.list-pill { border-style: dashed; }
.pill.list-pill.on { border-style: solid; }

/* =====================================================================
   Profile pictures
   ===================================================================== */
.avatar {
  flex-shrink: 0; position: relative; display: grid; place-items: center; overflow: hidden; border-radius: 50%;
  width: 32px; height: 32px; background: var(--card2); border: 2px solid var(--border2); color: #fff6e8;
  font-family: 'Lora', serif; font-weight: 700; box-shadow: var(--shadow-sm);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar > span { line-height: 1; font-size: 1rem; }
.avatar.sm > span { font-size: .95rem; }
.avatar.xl { width: 84px; height: 84px; border-width: 3px; border-color: var(--gold); }
.avatar.xl > span { font-size: 2.6rem; }
.brand-btn { background: none; border: 0; padding: 0; min-width: 0; text-align: left; }
.brand-btn:hover .avatar { transform: scale(1.06); }
.brand-btn .avatar { transition: transform .2s; }
.you-pic { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.you-name { font-family: 'Lora', serif; font-weight: 700; font-size: 1.2rem; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 8px; }
.avatar-pick {
  aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; display: grid; place-items: center;
  box-shadow: var(--shadow-sm); transition: transform .15s, border-color .15s;
}
.avatar-pick span { font-size: clamp(1.4rem, 7vw, 2rem); line-height: 1; filter: drop-shadow(0 2px 2px #0003); }
.avatar-pick:hover { transform: translateY(-2px) rotate(-4deg); }
.avatar-pick.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent); }
.upload-btn { position: relative; cursor: pointer; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-btn.busy { opacity: .6; }
.upload-btn:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Search + Filters button */
.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row .search { flex: 1; min-width: 0; }
.filter-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0 14px;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; color: var(--text2); font-weight: 800; font-size: .88rem;
  transition: border-color .2s, color .2s;
}
.filter-btn svg { width: 18px; height: 18px; fill: currentColor; }
.filter-btn:hover, .filter-btn.on { border-color: var(--accent); color: var(--text); }
.filter-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-size: .72rem;
}
@media (max-width: 420px) { .filter-btn > span:not(.filter-count) { display: none; } .filter-btn { padding: 0 12px; } }

/* Filter pop-up: a bottom sheet on phones, a centered window on bigger screens */
.filter-sheet { display: flex; flex-direction: column; padding-bottom: 0; }
.filter-body { overflow-y: auto; padding-bottom: 8px; }
.filter-foot {
  position: sticky; bottom: 0; display: flex; gap: 10px; padding: 14px 0 calc(18px + env(safe-area-inset-bottom));
  background: var(--bg2); border-top: 1px solid var(--border);
}
.filter-foot .btn { flex: 1; }
.filter-foot .btn.ghost { flex: 0 0 auto; }
@media (min-width: 700px) {
  .filter-scrim { align-items: center; }
  .filter-sheet { border-radius: 22px; border-bottom: 1px solid var(--border2); max-height: 82vh; }
  .filter-sheet .sheet-handle { display: none; }
}

/* =====================================================================
   Discover
   ===================================================================== */
.disc-actions { display: flex; gap: 8px; flex-shrink: 0; }
.genre-row { padding: 0 16px 7px; }
.disc-section { margin-bottom: 4px; }
.disc-sub { font-size: .78rem; color: var(--text3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-shelf {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 16px 12px; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
  scrollbar-width: thin; scrollbar-color: var(--border2) transparent;
}
.disc-shelf::-webkit-scrollbar { height: 6px; }
.disc-shelf::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.disc-card {
  flex-shrink: 0; width: 124px; text-align: left; background: none; border: 0; padding: 0; scroll-snap-align: start;
}
.disc-card .cover {
  aspect-ratio: 2 / 3; border-radius: 10px; box-shadow: var(--shadow-sm); transition: transform .25s, box-shadow .25s;
}
.disc-card:hover .cover { transform: translateY(-4px) rotate(-1.5deg); box-shadow: var(--shadow); }
.disc-info { padding: 7px 2px 0; }
.disc-meta { font-size: .72rem; color: var(--gold); font-weight: 700; margin-top: 2px; }
.disc-flag {
  position: absolute; z-index: 2; left: 6px; bottom: 6px; font-size: .66rem; font-weight: 800; padding: 2px 7px; border-radius: 8px;
  background: var(--sage); color: #fff;
}
.disc-flag.own { background: var(--card2); color: var(--text2); border: 1px solid var(--border2); }
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 16px 12px; padding: 6px 16px; }
.disc-grid .disc-card { width: auto; }
.genre-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px 10px; }
.genre-tools .seg { flex: 1 1 260px; }
.disc-credit { text-align: center; padding: 0 16px 10px; }

/* Loading shimmer */
.skel { background: linear-gradient(100deg, var(--card) 30%, var(--card2) 50%, var(--card) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; border-radius: 10px; }
.skel-line { display: block; width: 210px; height: 18px; }
.skel-card { flex-shrink: 0; width: 124px; aspect-ratio: 2 / 3; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* Surprise me */
.surprise-scrim { align-items: center; padding: 16px; }
.surprise {
  width: 100%; max-width: 360px; text-align: center; padding: 22px 22px 20px; border-radius: 24px;
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 18%, var(--bg2)), var(--bg2) 65%);
  border: 1px solid var(--border2); box-shadow: var(--shadow);
}
.surprise h2 { font-family: 'Lora', serif; font-size: 1.3rem; line-height: 1.2; margin-top: 14px; }
.surprise .by { color: var(--text2); font-weight: 600; margin: 3px 0 2px; }
.surprise-cover { position: relative; width: 150px; margin: 10px auto 0; }
.surprise-cover .cover { aspect-ratio: 2 / 3; border-radius: 12px; box-shadow: 0 14px 36px #0007; animation: pop .5s cubic-bezier(.3,1.5,.5,1) both; }
.sparkle { position: absolute; font-size: 1.2rem; animation: twinkle 1.6s ease-in-out infinite; }
.sparkle.s1 { left: -18px; top: 10px; } .sparkle.s2 { right: -20px; top: 40%; animation-delay: .4s; } .sparkle.s3 { left: -8px; bottom: 6px; animation-delay: .8s; font-size: .9rem; }
@keyframes pop { from { transform: scale(.6) rotate(-8deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes twinkle { 0%, 100% { opacity: .3; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* Six tabs now */
@media (max-width: 440px) { .bnav button { font-size: .66rem; } .bnav button span { font-size: 1.15rem; } }

/* =====================================================================
   Friends & groups
   ===================================================================== */
.bnav button { position: relative; }
.nav-dot {
  position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-style: normal; font-size: .64rem; font-weight: 800; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--bg);
}
.avatar.xs { width: 22px; height: 22px; border-width: 1.5px; box-shadow: none; }
.avatar.xs > span { font-size: .7rem; }
.avatar.lg { width: 60px; height: 60px; border-width: 2.5px; }
.avatar.lg > span { font-size: 1.8rem; }
.card { margin: 0 16px 12px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.card-title { font-family: 'Lora', serif; font-size: 1.02rem; font-weight: 700; margin-bottom: 6px; }
.me-card { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--card)), var(--card) 55%); }
.me-top { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.code-chip {
  display: inline-flex; align-items: baseline; gap: 6px; margin-top: 4px; padding: 3px 10px; border-radius: 10px;
  background: var(--bg3); border: 1px dashed var(--border2); color: var(--text3); font-size: .74rem; font-weight: 700;
}
.code-chip strong { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: .92rem; color: var(--gold); letter-spacing: .06em; }
.me-counts { display: flex; gap: 6px; }
.me-counts > * { flex: 1; padding: 8px; border-radius: 12px; background: var(--bg3); border: 0; color: var(--text3); font-size: .8rem; text-align: center; }
.me-counts strong { display: block; font-family: 'Lora', serif; font-size: 1.25rem; color: var(--text); }
.me-counts.static { margin-top: 12px; }
.person-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; }
.person-row + .person-row { border-top: 1px solid var(--border); }
.person { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; text-align: left; padding: 0; }
.person-text { min-width: 0; display: flex; flex-direction: column; }
.person-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-text small { font-size: .74rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.btn.sm { min-height: 34px; padding: 4px 12px; font-size: .8rem; border-radius: 10px; }
.danger-text { color: var(--danger) !important; }
.code-input { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: .05em; text-transform: uppercase; }
.code-input::placeholder { text-transform: none; letter-spacing: 0; font-family: 'Nunito', system-ui, sans-serif; }
.group-list { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.group-card {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; margin-top: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; transition: background .2s;
}
.group-list .group-card { margin-top: 0; }
.group-card:hover { background: var(--card-hover); }
.group-card.waiting { opacity: .75; border-style: dashed; }
.group-emoji { flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.4rem; background: var(--card2); border: 1px solid var(--border2); }
.group-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.group-text strong { font-family: 'Lora', serif; font-size: .98rem; }
.group-text small { font-size: .76rem; color: var(--text3); }
.unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; font-size: .72rem; font-weight: 800; background: var(--accent); color: var(--accent-ink); }
.chev { color: var(--text4); font-size: 1.3rem; }
.join-row { margin-top: 4px; }
.group-tabs { margin: 14px 16px 12px; }
.tab-dot { font-style: normal; font-size: .66rem; padding: 0 6px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); margin-left: 3px; }
.group-pane { padding: 0 16px 10px; }
.group-pane > .card { margin: 0 0 12px; }
.thread-card {
  width: 100%; display: block; text-align: left; margin-top: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--border); position: relative; transition: background .2s;
}
.thread-card:hover { background: var(--card-hover); }
.thread-card.new::after { content: ''; position: absolute; top: 14px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.thread-title { font-family: 'Lora', serif; font-weight: 700; padding-right: 16px; }
.thread-last { font-size: .84rem; color: var(--text2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thread-meta { font-size: .72rem; color: var(--text3); margin-top: 6px; }
.invite-card { text-align: center; }
.invite-code {
  margin: 8px auto 12px; font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 1.5rem; font-weight: 700;
  letter-spacing: .14em; color: var(--gold);
}
.role-tag { font-size: .7rem; font-weight: 800; color: var(--gold); white-space: nowrap; }
.list-tag.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.list-stats { font-size: .72rem; font-weight: 700; color: var(--gold); margin-top: 2px; }
.big-stats { font-size: .86rem; margin: 10px 0 0; }
.list-owner { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--text3); font-weight: 700; margin-top: 3px; }
.list-owner.as-link { background: none; border: 0; padding: 0; }
.list-owner.as-link:hover span:last-child { color: var(--accent); text-decoration: underline; }
.list-rate { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.list-rate .label { display: block; margin-bottom: 2px; }

/* Profile */
.bio { color: var(--text2); font-size: .9rem; margin-bottom: 4px; }
.pop-menu {
  position: absolute; right: 48px; top: 44px; z-index: 5; min-width: 150px; padding: 6px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--border2); box-shadow: var(--shadow);
}
.pop-menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; background: none; border: 0; font-weight: 700; font-size: .88rem; }
.pop-menu button:hover { background: var(--card-hover); }
.private-note { text-align: center; padding: 26px 10px 10px; }
.private-note .big { font-size: 2.2rem; }
.mini-shelf { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.mini-book { flex-shrink: 0; width: 84px; }
.mini-book .cover { aspect-ratio: 2 / 3; border-radius: 8px; box-shadow: var(--shadow-sm); }
.mini-book .cover-ph span { font-size: .6rem; }
.mini-book .cover-ph small, .mini-book .cover-ph::after { display: none; }
.mini-book .t-title { font-size: .74rem; margin-top: 5px; }

/* QR */
.qr-card { max-width: 330px; }
.qr-who { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Lora', serif; }
.qr-box { width: 220px; margin: 14px auto 0; padding: 10px; border-radius: 16px; background: #fff; }
.qr-box:empty { display: none; }
.qr-box svg { display: block; width: 100%; height: auto; }
.scanner-box { width: 100%; min-height: 240px; border-radius: 14px; overflow: hidden; background: #000; }

/* Conversations */
.thread-sheet { display: flex; flex-direction: column; }
.thread-tools { display: flex; gap: 14px; margin: -6px 0 6px; }
.posts { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 12px; }
.post-inner { display: flex; gap: 10px; align-items: flex-start; }
.post-avatar { flex-shrink: 0; background: none; border: 0; padding: 0; }
.post-body { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 4px 16px 16px 16px; background: var(--card); border: 1px solid var(--border); }
.post.mine .post-body { background: color-mix(in srgb, var(--accent) 12%, var(--card)); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.post-head { display: flex; align-items: baseline; gap: 8px; font-size: .8rem; }
.post-head span { color: var(--text3); font-size: .72rem; }
.post-body p { white-space: pre-line; overflow-wrap: anywhere; font-size: .92rem; margin-top: 2px; }
.post-tools { display: flex; gap: 12px; margin-top: 2px; }
.post-tools .link { font-size: .72rem; color: var(--text3); padding: 2px 0; }
.post.hidden { padding: 6px 12px; border-radius: 12px; background: var(--bg3); }
.reply-bar {
  position: sticky; bottom: -40px; display: flex; gap: 8px; align-items: flex-end;
  margin: 0 -18px -40px; padding: 10px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--bg2); border-top: 1px solid var(--border);
}
.reply-bar textarea.input { min-height: 46px; max-height: 140px; resize: none; }
.reply-bar .btn { flex-shrink: 0; }
.added-by { display: flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--text3); margin-top: 3px; }

/* Import: where to get your file */
.import-guide { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.import-guide details { border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 0 12px; }
.import-guide summary { cursor: pointer; padding: 10px 0; font-weight: 800; font-size: .9rem; }
.import-guide details[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.import-guide p { font-size: .84rem; color: var(--text2); padding-bottom: 10px; }

/* =====================================================================
   Discover: search, collections, more like this
   ===================================================================== */
.disc-search { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 8px; }
.seg-sm button { min-height: 32px; font-size: .8rem; padding: 4px 8px; }
.seg-sm { align-self: flex-start; }
.disc-badge {
  position: absolute; z-index: 2; top: 6px; left: 6px; font-size: .64rem; font-weight: 800; padding: 2px 7px; border-radius: 8px;
  background: color-mix(in srgb, #000 55%, transparent); color: #ffe7a8; backdrop-filter: blur(4px);
}
.coll-rows { padding: 2px 0 6px; }
.coll-label { padding: 6px 16px 6px; font-family: 'Lora', serif; font-style: italic; font-weight: 700; color: var(--text2); font-size: .95rem; }
.coll-row { padding: 0 16px 8px; }
.coll-chip {
  flex-shrink: 0; display: flex; align-items: center; gap: 9px; padding: 8px 14px 8px 10px; border-radius: 14px; text-align: left;
  background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 14%, var(--card)), var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--border));
  transition: transform .2s;
}
.coll-chip:hover { transform: translateY(-2px); }
.coll-chip > span:first-child { font-size: 1.4rem; }
.coll-chip strong { display: block; font-size: .84rem; white-space: nowrap; }
.coll-chip small { display: block; font-size: .7rem; color: var(--text3); }
.coll-head { display: flex; align-items: center; gap: 12px; padding: 4px 16px 10px; }
.coll-emoji { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.7rem; background: var(--card2); border: 1px solid var(--border2); flex-shrink: 0; }
.disc-shelf.flush { padding: 4px 0 8px; scroll-padding-inline: 0; }
.disc-shelf.flush .disc-card { width: 104px; }

/* Read together */
.together .label { display: block; }
.buddy-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.buddy-row .person { flex: 0 1 auto; }
.buddy-prog { flex: 1; min-width: 60px; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .86rem; color: var(--text2); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; margin-top: 12px; }
.summary-strip > div { padding: 8px 6px; border-radius: 12px; background: var(--bg3); text-align: center; }
.summary-strip strong { display: block; font-family: 'Lora', serif; font-size: 1.15rem; color: var(--gold); }
.summary-strip small { font-size: .68rem; color: var(--text3); font-weight: 700; }
.fav-line { margin-top: 8px; }
.mini-cover { width: 48px; height: 72px; flex-shrink: 0; border-radius: 6px; }
.mini-cover .cover-ph span { font-size: .5rem; }
.mini-cover .cover-ph small, .mini-cover .cover-ph::after, .feed-cover .cover-ph::after { display: none; }
.buddy-invite, .together-book { display: flex; gap: 12px; padding: 10px 0; align-items: flex-start; }
.buddy-invite + .buddy-invite, .together-book + .together-book, .buddy-invite + .together-book { border-top: 1px solid var(--border); }
.buddy-invite p { font-size: .88rem; }
.race { margin-top: 6px; display: flex; flex-direction: column; gap: 5px; }
.race-row { display: grid; grid-template-columns: 54px 1fr 36px; align-items: center; gap: 8px; font-size: .74rem; }
.race-name { color: var(--text2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.race-pct { color: var(--text3); text-align: right; }
.prog-fill.buddy { background: linear-gradient(90deg, var(--gold), #f3d48e); }

/* Activity feed */
.feed { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.feed-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.feed-text { flex: 1; min-width: 0; }
.feed-text p { font-size: .88rem; line-height: 1.4; }
.feed-text small { font-size: .72rem; color: var(--text3); }
.feed-cover { width: 40px; height: 60px; flex-shrink: 0; border-radius: 5px; border: 0; padding: 0; }
.feed-cover .cover-ph span { font-size: .45rem; }
.feed.compact { padding: 0; gap: 4px; }
.feed.compact .feed-item { padding: 6px 10px; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.feed-icon { width: 30px; text-align: center; font-size: 1.1rem; flex-shrink: 0; }

/* =====================================================================
   Profile page (full screen) and Get to know me
   ===================================================================== */
.profile-scrim { align-items: stretch; background: var(--bg); backdrop-filter: none; overflow-y: auto; }
.profile-page { width: 100%; max-width: 760px; margin: 0 auto; min-height: 100%; background: var(--bg); padding-bottom: 40px; }
.profile-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--nav-bg); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border);
}
.profile-body { padding: 18px 16px 0; }
.profile-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.profile-tabs { margin: 18px 0 12px; }
.profile-tabs button { font-size: .8rem; padding: 0 2px; }
.mini-book { background: none; border: 0; padding: 0; text-align: left; }
.act-item { padding: 10px 4px !important; }
.gtk { display: flex; flex-direction: column; gap: 10px; }
.gtk-intro {
  font-family: 'Lora', serif; font-size: 1.02rem; line-height: 1.6; color: var(--text); white-space: pre-line;
  padding: 14px 16px; border-radius: 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 12%, var(--card)), var(--card));
  border: 1px solid var(--border);
}
.gtk-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.gtk-card > span { font-size: 1.4rem; line-height: 1.2; }
.gtk-card small { display: block; font-size: .74rem; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: .04em; }
.gtk-card p { font-size: .95rem; margin-top: 2px; }
.their-take { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.their-take .label { display: block; margin-bottom: 6px; }

/* Account settings */
.account-list { display: flex; flex-direction: column; gap: 6px; }
.account-list details { border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 0 12px; }
.account-list summary { cursor: pointer; padding: 12px 0; font-weight: 800; font-size: .92rem; list-style: none; }
.account-list summary::-webkit-details-marker { display: none; }
.account-list summary::after { content: '›'; float: right; color: var(--text4); transition: transform .2s; }
.account-list details[open] summary::after { transform: rotate(90deg); }
.account-list details[open] { padding-bottom: 12px; }
.account-list .danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.account-list .danger-zone summary { color: var(--danger); }

/* Admin */
.report-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.report-top .list-tag { margin-top: 0; }
.report-top small { margin-left: auto; }
.report-title { font-family: 'Lora', serif; font-weight: 700; margin-top: 8px; }
.report-body { margin-top: 4px; padding: 8px 10px; border-radius: 10px; background: var(--bg3); font-size: .88rem; white-space: pre-line; overflow-wrap: anywhere; }
.report-reason { margin-top: 6px; font-style: italic; color: var(--text2); font-size: .88rem; }
.admin-person .person-text small { white-space: normal; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.admin-stats > div { padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.admin-stats strong { display: block; font-family: 'Lora', serif; font-size: 1.6rem; color: var(--gold); }
.admin-stats small { color: var(--text3); font-weight: 700; font-size: .78rem; }

/* =====================================================================
   Premium
   ===================================================================== */
.premium-tag {
  display: inline-block; font-size: .66rem; font-weight: 800; padding: 2px 8px; border-radius: 9px; white-space: nowrap;
  color: #7a4f0a; background: linear-gradient(135deg, #ffe7a8, #f3c35f); box-shadow: 0 1px 4px #0003;
}
.trail-option { position: relative; }
.trail-option .premium-tag { position: absolute; top: 8px; right: 10px; }
.premium-row {
  width: 100%; display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; text-align: left; border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, #f3c35f 22%, var(--card)), var(--card)); border: 1px solid color-mix(in srgb, #f3c35f 45%, var(--border));
}
.premium-row > span:first-child { font-size: 1.5rem; }
.premium-row > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.premium-row small { font-size: .76rem; color: var(--text3); }
.paywall { background: radial-gradient(ellipse at 50% -10%, color-mix(in srgb, #f3c35f 22%, var(--bg2)), var(--bg2) 55%); }
.pw-hero { text-align: center; margin-bottom: 12px; }
.pw-glow { font-size: 2.6rem; animation: twinkle 2.4s ease-in-out infinite; }
.pw-hero h2 { font-family: 'Lora', serif; font-size: 1.8rem; }
.pw-price { font-size: 1rem; color: var(--text2); }
.pw-price strong { font-family: 'Lora', serif; font-size: 1.6rem; color: var(--gold); }
.notice.beta { background: color-mix(in srgb, #f3c35f 16%, var(--card)); border-color: color-mix(in srgb, #f3c35f 45%, transparent); }
.pw-perks { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.pw-perk { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.pw-perk > span { font-size: 1.4rem; }
.pw-perk strong { display: block; font-size: .92rem; }
.pw-perk small { display: block; font-size: .78rem; color: var(--text3); line-height: 1.4; }
.pw-free { margin-top: 12px; font-size: .82rem; color: var(--text2); line-height: 1.5; padding: 10px 12px; border-radius: 12px; border: 1px dashed var(--border2); }

/* =====================================================================
   THEMES (Premium palettes). data-theme = dark|light, data-palette = colors.
   Candlelight and Morning Tea are the dark/light defaults at the top of this file.
   ===================================================================== */
:root[data-palette="forest_cabin"] {
  --bg: #121812; --bg2: #172017; --bg3: #1d281d; --card: #1f2a1f; --card2: #263326; --card-hover: #2d3c2d;
  --border: #344534; --border2: #415641; --accent: #8fbf6a; --accent-ink: #10180f; --gold: #d9b56a; --sage: #9cc48a;
  --text: #e8eedd; --text2: #c3d0b0; --text3: #93a684; --text4: #63755a;
  --reading-c: #9cc48a; --read-c: #d9a05a; --unread-c: #9fb3c8; --danger: #e88a7a; --progress-bg: #2a372a; --nav-bg: #121812ee;
}
:root[data-palette="rainy_day"] {
  --bg: #13181f; --bg2: #171d26; --bg3: #1c2430; --card: #1f2732; --card2: #26303d; --card-hover: #2d3846;
  --border: #354253; --border2: #435266; --accent: #7fa8d8; --accent-ink: #0f1620; --gold: #e0c27a; --sage: #8fb8a0;
  --text: #e6ecf3; --text2: #bcc8d6; --text3: #8d9cb0; --text4: #5f6d80;
  --reading-c: #8fb8a0; --read-c: #c9b8e8; --unread-c: #9fb3c8; --danger: #e88a7a; --progress-bg: #263140; --nav-bg: #13181fee;
}
:root[data-palette="starlit"] {
  --bg: #120f24; --bg2: #17132d; --bg3: #1d1838; --card: #211c3d; --card2: #29234a; --card-hover: #312a57;
  --border: #3b3363; --border2: #4a4078; --accent: #b49cf0; --accent-ink: #150f2a; --gold: #f0cf6a; --sage: #8fc9a8;
  --text: #ece8fa; --text2: #c8c0e6; --text3: #9a90c0; --text4: #6a6190;
  --reading-c: #8fc9a8; --read-c: #f0a8c8; --unread-c: #9fb3d8; --danger: #f08a8a; --progress-bg: #2b2550; --nav-bg: #120f24ee;
}
:root[data-palette="cherry_blossom"] {
  --bg: #fff4f6; --bg2: #fdebef; --bg3: #f9e0e6; --card: #fffafb; --card2: #fdf0f3; --card-hover: #fbe6ec;
  --border: #f0cdd7; --border2: #e3b3c2; --accent: #c2557a; --accent-ink: #ffffff; --gold: #9a6a1c; --sage: #4f7a50;
  --text: #3a1f28; --text2: #6a3f4e; --text3: #8f6372; --text4: #c098a6;
  --reading-c: #4f7a50; --read-c: #c2557a; --unread-c: #5a6a8a; --danger: #b4432f; --progress-bg: #f5d6df; --nav-bg: #fff4f6ee;
  --scrim: #3a1f2866; --shadow: 0 10px 40px #5a20381a; --shadow-sm: 0 3px 14px #5a203814;
}
:root[data-palette="sea_glass"] {
  --bg: #eef7f4; --bg2: #e4f1ec; --bg3: #d8eae3; --card: #f8fcfb; --card2: #ebf5f1; --card-hover: #e0efe9;
  --border: #c5ded5; --border2: #a8cbbf; --accent: #2a8276; --accent-ink: #ffffff; --gold: #9a6a20; --sage: #3f7a52;
  --text: #16302b; --text2: #33554d; --text3: #5a7a72; --text4: #93b0a8;
  --reading-c: #3f7a52; --read-c: #2a8276; --unread-c: #4f6a86; --danger: #b4432f; --progress-bg: #cfe5dd; --nav-bg: #eef7f4ee;
  --scrim: #16302b66; --shadow: 0 10px 40px #16302b1a; --shadow-sm: 0 3px 14px #16302b14;
}
:root[data-palette="old_paper"] {
  --bg: #efe4cb; --bg2: #e8dbbd; --bg3: #e0d0ad; --card: #f8f0dc; --card2: #f1e6cc; --card-hover: #ebdcbb;
  --border: #d6c39b; --border2: #c4ad80; --accent: #7a4422; --accent-ink: #ffffff; --gold: #8a6a1c; --sage: #4f6a34;
  --text: #2a1d10; --text2: #4e3820; --text3: #6e5636; --text4: #a48c66;
  --reading-c: #4f6a34; --read-c: #7a4422; --unread-c: #4a5a6a; --danger: #9a3a26; --progress-bg: #e0cfa8; --nav-bg: #efe4cbee;
  --scrim: #2a1d1066; --shadow: 0 10px 40px #2a1d101f; --shadow-sm: 0 3px 14px #2a1d1018;
}
html, body { transition: background-color .35s ease; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.topbar-right { display: flex; gap: 8px; flex-shrink: 0; }

/* Theme & stamps sheet */
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.theme-card {
  display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 10px; text-align: left; border-radius: 16px;
  background: var(--card); border: 2px solid var(--border); transition: border-color .2s, transform .15s;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.theme-card small { font-size: .72rem; color: var(--text3); line-height: 1.3; }
.theme-swatch { position: relative; display: block; height: 64px; border-radius: 11px; background: var(--a); overflow: hidden; border: 1px solid #0002; }
.theme-swatch i { position: absolute; display: block; }
.theme-swatch .ts-card { left: 10px; right: 34px; top: 12px; bottom: 12px; border-radius: 7px; background: var(--b); }
.theme-swatch .ts-bar { left: 18px; width: 46%; top: 22px; height: 6px; border-radius: 3px; background: var(--d); }
.theme-swatch .ts-dot { right: 10px; bottom: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--c); }
.theme-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 800; font-size: .88rem; }
.lock { font-size: .8rem; }
.stamp-sets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.stamp-set { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; background: var(--card); border: 2px solid var(--border); text-align: left; }
.stamp-set.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.stamp-preview { display: flex; gap: 2px; font-size: 1.25rem; }
.stamp-preview span { display: inline-block; transform: rotate(var(--tilt)); }

/* You menu */
.you-menu { display: flex; flex-direction: column; border-radius: 16px; background: var(--card); border: 1px solid var(--border); overflow: hidden; }
.you-menu > button {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--border); color: var(--text);
}
.you-menu > button:last-child { border-bottom: 0; }
.you-menu > button:hover { background: var(--card-hover); }
.you-menu > button > span:first-child { font-size: 1.3rem; width: 28px; text-align: center; }
.you-menu > button > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.you-menu strong { font-size: .92rem; }
.you-menu small { font-size: .75rem; color: var(--text3); }
.you-menu .chev, .yir-banner .chev { color: var(--text3); font-size: 1.3rem; }
.install-help { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--bg3); font-size: .84rem; color: var(--text2); line-height: 1.5; }

/* Feedback */
.fb-kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.fb-kind {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px;
  background: var(--card); border: 2px solid var(--border); color: var(--text2);
}
.fb-kind span { font-size: 1.5rem; }
.fb-kind small { font-size: .68rem; font-weight: 800; text-align: center; line-height: 1.2; }
.fb-kind.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.fb-attach { margin: -4px 0 12px; font-size: .76rem; }
.fb-thanks { text-align: center; padding: 10px 0 4px; }
.fb-thanks-emoji { font-size: 3rem; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
.fb-thanks h3 { font-family: 'Lora', serif; font-size: 1.4rem; margin: 6px 0; }
.fb-mine-toggle { display: block; margin: 18px auto 0; }
.fb-mine { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.fb-mine-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); }
.fb-mine-row p { flex: 1; font-size: .84rem; color: var(--text2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fb-status { flex-shrink: 0; font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 9px; background: var(--bg3); color: var(--text3); }
.fb-status.fixed { background: color-mix(in srgb, var(--sage) 22%, var(--card)); color: var(--sage); }
.fb-status.planned { background: color-mix(in srgb, var(--gold) 20%, var(--card)); color: var(--gold); }
.fb-card.fresh { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.fb-message { white-space: pre-wrap; }
.fb-actions { display: flex; gap: 8px; margin-top: 10px; }
.fb-actions select { flex: 0 0 120px; }
.input.sm { min-height: 38px; padding: 6px 10px; font-size: .84rem; }
.err-msg { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .84rem; word-break: break-word; }
.err-detail { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--bg3); font-size: .72rem; line-height: 1.45; overflow-x: auto; white-space: pre-wrap; word-break: break-all; color: var(--text2); }

/* Welcome tour */
.onboard {
  position: fixed; inset: 0; z-index: 140; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--gold) 20%, var(--bg)), var(--bg) 60%);
}
.onboard-inner { max-width: 460px; margin: 0 auto; padding: 18px 20px 40px; min-height: 100%; display: flex; flex-direction: column; }
.ob-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 26px; height: 5px; border-radius: 3px; background: var(--border2); transition: background .3s; }
.ob-dots i.on { background: var(--accent); }
.ob-step { display: flex; flex-direction: column; animation: obIn .35s ease; }
@keyframes obIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ob-hero { font-size: 4rem; text-align: center; margin: 22px 0 8px; animation: obSway 3s ease-in-out infinite; }
.ob-hero.glow { filter: drop-shadow(0 0 22px color-mix(in srgb, var(--gold) 70%, transparent)); }
@keyframes obSway { 0%, 100% { transform: rotate(-2deg) scale(1); } 50% { transform: rotate(2deg) scale(1.04); } }
.ob-title { font-family: 'Lora', serif; font-size: 1.7rem; text-align: center; line-height: 1.25; }
.ob-sub { text-align: center; color: var(--text2); margin: 8px 0 18px; line-height: 1.5; }
.ob-input { font-family: 'Lora', serif; font-size: 1.2rem; text-align: center; }
.ob-next { margin-top: 22px; }
.ob-later { display: block; margin: 14px auto 0; }
.ob-choices { display: flex; flex-direction: column; gap: 10px; }
.ob-choice {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; border-radius: 18px;
  background: var(--card); border: 1.5px solid var(--border2); color: var(--text); transition: transform .15s, border-color .2s;
}
.ob-choice:hover { transform: translateY(-2px); border-color: var(--accent); }
.ob-choice > span:first-child { font-size: 1.8rem; }
.ob-choice > span:last-child { display: flex; flex-direction: column; }
.ob-choice small { color: var(--text3); font-size: .8rem; }
.ob-goals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ob-goal { display: flex; flex-direction: column; align-items: center; padding: 12px 4px; border-radius: 16px; background: var(--card); border: 2px solid var(--border); color: var(--text); }
.ob-goal strong { font-family: 'Lora', serif; font-size: 1.6rem; color: var(--gold); }
.ob-goal small { font-size: .66rem; font-weight: 800; color: var(--text3); text-align: center; }
.ob-goal.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.ob-custom { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .86rem; color: var(--text2); }
.ob-custom .input { width: 96px; flex: 0 0 auto; }
.ob-tips { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.ob-tips li { display: flex; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); font-size: .88rem; line-height: 1.45; color: var(--text2); }
.ob-tips li > span:first-child { font-size: 1.4rem; }
.ob-tips strong { color: var(--text); }

/* Year in Review */
.yir-banner {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 32px); margin: 4px 16px 14px; padding: 12px 14px; text-align: left;
  border-radius: 18px; color: var(--text); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border));
  background: linear-gradient(120deg, color-mix(in srgb, var(--gold) 20%, var(--card)), color-mix(in srgb, var(--accent) 14%, var(--card)));
}
.yir-banner > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.yir-banner small { font-size: .76rem; color: var(--text3); }
.yir-banner-emoji { font-size: 1.6rem; }
.yir {
  position: fixed; inset: 0; z-index: 150; color: var(--text);
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--gold) 22%, var(--bg3)), var(--bg) 70%);
}
.yir-inner { position: relative; max-width: 480px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; padding: 12px 16px 24px; }
.yir-bars { display: flex; gap: 4px; }
.yir-bars i { flex: 1; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--text) 22%, transparent); overflow: hidden; position: relative; }
.yir-bars i.done { background: var(--text); }
.yir-bars i.on::after { content: ''; position: absolute; inset: 0; background: var(--text); animation: barfill .5s ease forwards; transform-origin: left; }
@keyframes barfill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.yir-top { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.yir-year { background: var(--card); color: var(--text); border: 1px solid var(--border2); border-radius: 10px; padding: 6px 10px; font-weight: 800; }
.yir-loading { margin: auto; text-align: center; color: var(--text2); }
.yir-stage { flex: 1; display: flex; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.yir-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10px 6px; animation: yirIn .45s cubic-bezier(.2, .9, .3, 1); }
@keyframes yirIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.yir-kicker { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; color: var(--text3); }
.yir-big-title { font-family: 'Lora', serif; font-size: 2.1rem; line-height: 1.2; margin-top: 10px; }
.yir-title { font-family: 'Lora', serif; font-size: 1.6rem; line-height: 1.25; margin-top: 6px; }
.yir-text { color: var(--text2); line-height: 1.55; margin-top: 14px; max-width: 340px; }
.yir-hint { margin-top: 28px; color: var(--text3); font-weight: 700; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.yir-number { font-family: 'Lora', serif; font-weight: 700; font-size: 7rem; line-height: 1; color: var(--gold); text-shadow: 0 0 40px color-mix(in srgb, var(--gold) 45%, transparent); animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.yir-number.sm { font-size: 4.2rem; margin-top: 8px; }
.yir-emoji { font-size: 4.2rem; margin: 8px 0; animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.yir-emoji.big { font-size: 5.6rem; }
.yir-pair { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.yir-pair > div { min-width: 120px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--card) 85%, transparent); border: 1px solid var(--border); }
.yir-pair strong { display: block; font-family: 'Lora', serif; font-size: 1.6rem; color: var(--gold); }
.yir-pair small { font-size: .78rem; color: var(--text3); font-weight: 700; }
.yir-covers { position: relative; width: 260px; height: 190px; margin-bottom: 26px; display: flex; justify-content: center; }
.yir-covers img {
  position: absolute; top: 20px; width: 84px; height: 126px; object-fit: cover; border-radius: 6px; box-shadow: var(--shadow-sm);
  transform: rotate(var(--r)); opacity: 0; animation: coverIn .5s ease forwards; animation-delay: var(--d);
}
.yir-covers img:nth-child(1) { left: 88px; z-index: 5; top: 6px; }
.yir-covers img:nth-child(2) { left: 26px; z-index: 4; }
.yir-covers img:nth-child(3) { left: 150px; z-index: 4; }
.yir-covers img:nth-child(4) { left: -18px; z-index: 3; top: 40px; }
.yir-covers img:nth-child(5) { left: 194px; z-index: 3; top: 40px; }
.yir-covers img:nth-child(n+6) { display: none; }
@keyframes coverIn { from { opacity: 0; transform: translateY(30px) rotate(0); } to { opacity: 1; transform: rotate(var(--r)); } }
.yir-shelf { display: flex; align-items: flex-end; gap: 6px; width: 100%; height: 220px; margin-top: 22px; padding: 0 4px 0; border-bottom: 6px solid color-mix(in srgb, var(--gold) 50%, var(--border2)); border-radius: 0 0 4px 4px; }
.yir-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; position: relative; }
.yir-col i { display: block; width: 100%; border-radius: 4px 4px 1px 1px; background: color-mix(in srgb, var(--accent) 70%, var(--card)); animation: grow .7s cubic-bezier(.2, .9, .3, 1); transform-origin: bottom; }
.yir-col i.top { background: var(--gold); box-shadow: 0 0 16px color-mix(in srgb, var(--gold) 50%, transparent); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.yir-col small { position: absolute; bottom: -28px; font-size: .72rem; font-weight: 800; color: var(--text3); }
.yir-col-n { font-size: .74rem; font-weight: 800; color: var(--text2); }
.yir-shelf + .yir-text { margin-top: 40px; }
.yir-bars-h { width: 100%; max-width: 340px; margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.yir-bars-h > div { display: grid; grid-template-columns: 110px 1fr 24px; align-items: center; gap: 8px; font-size: .82rem; text-align: left; }
.yir-bars-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); font-weight: 700; }
.yir-bars-h i { display: block; height: 12px; border-radius: 6px; background: var(--chip, var(--accent)); animation: growX .7s ease; transform-origin: left; }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.yir-podium { list-style: none; width: 100%; max-width: 340px; margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.yir-podium li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); text-align: left; }
.yir-podium strong { flex: 1; font-family: 'Lora', serif; }
.yir-podium small { color: var(--text3); font-weight: 700; }
.yir-medal { font-size: 1.6rem; }
.yir-facts { width: 100%; max-width: 360px; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.yir-facts > div { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--border); text-align: left; }
.yir-facts > div > span:first-child { font-size: 1.6rem; }
.yir-facts > div > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.yir-facts small { font-size: .72rem; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; }
.yir-facts strong { font-family: 'Lora', serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yir-facts em { font-style: normal; font-size: .8rem; color: var(--gold); font-weight: 700; }
.yir-cover-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.yir-mini { width: 62px; height: 93px; border-radius: 5px; overflow: hidden; box-shadow: var(--shadow-sm); }
.yir-mini img { width: 100%; height: 100%; object-fit: cover; }
.yir-mini span { display: grid; place-items: center; width: 100%; height: 100%; padding: 4px; font-size: .55rem; color: #fff; background: var(--ph); font-weight: 700; }
.yir-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 320px; margin-top: 14px; font-size: 2rem; }
.yir-badges span { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) backwards; animation-delay: var(--d); }
.yir-vs { display: flex; align-items: center; gap: 18px; margin-top: 18px; }
.yir-vs > div { display: flex; flex-direction: column; align-items: center; padding: 14px 20px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); }
.yir-vs > div.now { border-color: var(--gold); box-shadow: 0 0 24px color-mix(in srgb, var(--gold) 30%, transparent); }
.yir-vs strong { font-family: 'Lora', serif; font-size: 2.6rem; color: var(--gold); line-height: 1.1; }
.yir-vs small { font-weight: 800; color: var(--text3); }
.yir-vs > span { font-size: 1.6rem; color: var(--text3); }
.yir-share { margin-top: 26px; padding-left: 26px; padding-right: 26px; }
@media (prefers-reduced-motion: reduce) {
  .yir-card, .yir-number, .yir-emoji, .yir-col i, .yir-bars-h i, .yir-covers img, .yir-badges span, .ob-step, .ob-hero { animation: none !important; opacity: 1 !important; }
}

.admin-tabs { overflow-x: auto; scrollbar-width: none; }
.admin-tabs button { flex: 0 0 auto; padding: 0 12px; white-space: nowrap; }
.scrim.scrim-top { z-index: 200; }   /* Premium shows above everything, even Year in Review */

/* =====================================================================
   WICK (the candle mascot), the Today card and home-screen widgets
   ===================================================================== */
.wick { display: block; width: 100%; height: 100%; overflow: visible; }
.wick .wick-flame { animation: wickDance 2.8s ease-in-out infinite; }
.wick-party .wick-flame { animation: wickHop .9s ease-in-out infinite; }
.wick-flickering .wick-flame { animation: wickFlicker 1.1s ease-in-out infinite; }
.wick-sleepy .wick-flame { animation: wickBreathe 4s ease-in-out infinite; }
.wick .wick-sparkle { animation: wickTwinkle 2s ease-in-out infinite; }
@keyframes wickTwinkle { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.wick .wick-z { animation: wickZ 3s ease-in-out infinite; }
.wick .wick-confetti { animation: wickConfetti 1.8s ease-in-out infinite; }
@keyframes wickDance { 0%, 100% { translate: 0 0; rotate: -2deg; } 50% { translate: 0 -1.5px; rotate: 2deg; } }
@keyframes wickHop { 0%, 100% { translate: 0 0; } 40% { translate: 0 -6px; } 60% { translate: 0 -6px; rotate: 3deg; } }
@keyframes wickFlicker { 0%, 100% { opacity: 1; rotate: -4deg; } 30% { opacity: .75; rotate: 3deg; } 60% { opacity: .95; rotate: -1deg; } }
@keyframes wickBreathe { 0%, 100% { opacity: .85; } 50% { opacity: 1; translate: 0 -1px; } }
@keyframes wickZ { 0% { opacity: 0; translate: 0 4px; } 40%, 70% { opacity: 1; } 100% { opacity: 0; translate: 4px -6px; } }
@keyframes wickConfetti { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }

.today-card {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 10px 14px 10px 8px; text-align: left;
  border-radius: 16px; background: var(--card); border: 1px solid var(--border); color: var(--text); transition: transform .15s, border-color .2s;
}
.today-card:hover { transform: translateY(-1px); border-color: var(--border2); }
.today-card.mood-flickering { border-color: color-mix(in srgb, #e9783a 55%, var(--border)); background: color-mix(in srgb, #e9783a 8%, var(--card)); }
.today-card.mood-party, .today-card.mood-glowing { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.today-wick { flex: 0 0 58px; height: 68px; }
.today-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.today-text strong { font-size: .92rem; line-height: 1.35; }
.today-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .74rem; color: var(--text3); font-weight: 700; }
.today-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Widget previews (sized like Android home-screen widgets) */
.wd-stage { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 22px;
  background: linear-gradient(160deg, #3b5a7a, #6a5a8a 55%, #b5788a); }
.wd-wall { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wd {
  position: relative; border-radius: 22px; padding: 10px; color: #2a1f14; overflow: hidden;
  background: linear-gradient(160deg, #fffaf2, #f7ead4); box-shadow: 0 6px 20px #0003;
}
:root[data-theme="dark"] .wd { color: #f0e6d3; background: linear-gradient(160deg, #2e2318, #1c1410); }
.wd.mood-flickering { background: linear-gradient(160deg, #fff1e4, #f9d9bd); }
:root[data-theme="dark"] .wd.mood-flickering { background: linear-gradient(160deg, #3a2414, #22140c); }
.wd-small { height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.wd-small .wd-wick { width: 84px; height: 98px; }
.wd-streak { font-family: 'Lora', serif; font-size: 1.15rem; }
.wd-medium { height: 140px; display: flex; align-items: center; gap: 10px; padding: 12px 16px 12px 8px; }
.wd-small-book { align-items: flex-start !important; justify-content: flex-end !important; padding: 16px; }
.wd-big { font-family: 'Lora', serif; font-size: 2.4rem; font-weight: 700; color: #d4845a; line-height: 1; margin-bottom: auto; }
.wd-small-book .wd-book { font-size: .8rem; font-weight: 800; opacity: .85; width: 100%; }
.wd-small-book .wd-bar { width: 100%; }
.wd-medium .wd-wick { flex: 0 0 84px; height: 100px; }
.wd-body { flex: 1; min-width: 0; }
.wd-msg { font-weight: 800; font-size: .84rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wd-book { display: block; margin-top: 6px; font-size: .72rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wd-bar { height: 6px; margin-top: 4px; border-radius: 3px; background: #0001; overflow: hidden; }
:root[data-theme="dark"] .wd-bar { background: #fff2; }
.wd-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #f7913f, #ffc857); }
.wd-large { padding: 14px; }
.wd-large-top { display: flex; align-items: center; gap: 10px; }
.wd-large .wd-wick { flex: 0 0 84px; height: 98px; }
.wd-sub { display: block; margin-top: 4px; font-size: .74rem; opacity: .75; font-weight: 700; }
.wd-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.wd-tiles > div { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border-radius: 14px; background: #ffffff8c; min-width: 0; }
:root[data-theme="dark"] .wd-tiles > div { background: #ffffff10; }
.wd-tiles span { font-size: 1.1rem; }
.wd-tiles strong { font-family: 'Lora', serif; font-size: 1.05rem; }
.wd-tiles small { font-size: .66rem; opacity: .75; font-weight: 700; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wd-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 8px; }
.wd-moods > div { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.wd-moods > div > span { width: 100%; aspect-ratio: 120 / 140; }
.wd-moods small { font-size: .64rem; font-weight: 800; color: var(--text3); line-height: 1.2; }


/* Badges earned together */
.bm-about { font-size: .84rem; color: var(--text2); margin: -10px 0 10px; }
.bm-source, .act-source { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 10px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2); }
.act-source { margin-top: 4px; padding: 1px 8px; font-size: .68rem; }
.bm-burst { display: flex; justify-content: center; gap: 4px; font-size: 2.4rem; margin-bottom: 4px; }
.bm-burst span { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1) backwards; animation-delay: var(--d); }
.bm-list { list-style: none; display: flex; flex-direction: column; gap: 8px; text-align: left; max-height: 46vh; overflow-y: auto; margin: -6px 0 0; }
.bm-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border);
  animation: obIn .4s ease backwards; animation-delay: var(--d); }
.bm-li-emoji { font-size: 1.6rem; }
.bm-li-text { display: flex; flex-direction: column; min-width: 0; }
.bm-li-text strong { font-size: .9rem; }
.bm-li-text small { font-size: .72rem; color: var(--text3); font-weight: 700; }
.act-badges { list-style: none; display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px; }
.act-badges li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .8rem; }
.act-badges li > span { font-size: 1rem; }
.act-badges small { font-size: .66rem; font-weight: 800; color: var(--text3); padding: 0 6px; border-radius: 8px; background: var(--bg3); }
@media (prefers-reduced-motion: reduce) { .wick *, .bm-burst span, .bm-list li { animation: none !important; } }

/* Select books → mark as read before the app */
.select-btn { min-height: 32px; padding: 4px 12px; border-radius: 10px; font-size: .8rem; font-weight: 800;
  background: var(--card); border: 1px solid var(--border2); color: var(--text2); }
.select-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick-hint { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -4px 16px 10px; padding: 8px 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--card)); font-size: .82rem; color: var(--text2); font-weight: 700; }
.books.picking .bk { position: relative; transition: transform .12s; }
.books.picking .bk .cover { transition: opacity .15s; }
.books.picking .bk:not(.picked) .cover { opacity: .8; }
.books.picking .bk.picked { box-shadow: 0 0 0 3px var(--accent); transform: scale(.97); }
.pick-check {
  position: absolute; top: 8px; left: 8px; z-index: 3; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .85rem; font-weight: 900; color: var(--accent-ink); background: #0006; border: 2px solid #fff; box-shadow: 0 1px 4px #0005;
}
.bk.picked .pick-check { background: var(--accent); }
.pick-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 78px; z-index: 60; width: min(560px, calc(100% - 24px));
  padding: 12px 14px; border-radius: 18px; background: var(--bg2); border: 1px solid var(--border2); box-shadow: var(--shadow);
}
.pick-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pick-when { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.pick-when .input { width: auto; flex: 1; min-width: 150px; }
.books.picking { padding-bottom: 150px; }

/* Finished when? */
.finish-ask { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--border2); }
.finish-ask .label { display: block; margin-bottom: 8px; }
.finish-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.finish-opts .btn { flex: 1 1 140px; }
.finish-date { margin: 10px 0 8px; align-items: center; }
.finish-ask .hint { font-size: .76rem; margin-bottom: 6px; }
.finish-line { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: .8rem; }

/* =====================================================================
   FRIENDLIER LAYOUT: 5 tabs, Home/Play switches, You page, quick log…
   ===================================================================== */
.subnav {
  position: sticky; top: 56px; z-index: 40; display: flex; gap: 6px; padding: 8px 16px;
  background: var(--nav-bg); backdrop-filter: blur(18px); border-bottom: 1px solid var(--border);
}
.subnav button {
  flex: 1; min-height: 38px; border-radius: 12px; border: 1px solid var(--border); background: var(--card);
  color: var(--text2); font-weight: 800; font-size: .86rem;
}
.subnav button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Streak chip in the header */
.streak-chip {
  display: flex; align-items: center; gap: 2px; height: 38px; padding: 0 12px 0 4px; border-radius: 19px; flex-shrink: 0;
  background: var(--card2); border: 1px solid var(--border); color: var(--text); font-weight: 800; font-size: .95rem;
}
.streak-chip.mood-flickering { border-color: color-mix(in srgb, #e9783a 60%, var(--border)); animation: chipNudge 2.4s ease-in-out infinite; }
.streak-chip.mood-glowing, .streak-chip.mood-party { border-color: color-mix(in srgb, var(--gold) 55%, var(--border)); }
.streak-wick { width: 26px; height: 32px; margin-bottom: 2px; }
@keyframes chipNudge { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-4deg); } 96% { transform: rotate(4deg); } }

/* Bottom nav: You shows your picture */
.nav-avatar { display: grid; place-items: center; height: 1.5rem; }
.avatar.xs { width: 24px; height: 24px; border-width: 1.5px; }
.avatar.xs > span { font-size: .8rem; }
.bnav button.on .avatar.xs { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Home */
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.reading-row { display: flex; gap: 10px; overflow-x: auto; padding: 0 16px 6px; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; scrollbar-width: none; }
.rr-card {
  flex: 0 0 min(270px, 78vw); display: flex; gap: 10px; padding: 8px; border-radius: 14px; scroll-snap-align: start;
  background: var(--card); border: 1px solid var(--border);
}
.rr-cover { flex: 0 0 46px; height: 69px; border-radius: 5px; overflow: hidden; padding: 0; border: 0; }
.rr-cover .cover-ph span { font-size: .45rem; }
.rr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 5px; }
.rr-title { text-align: left; background: none; border: 0; padding: 0; color: var(--text); font-family: 'Lora', serif; font-weight: 600; font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rr-foot small { font-size: .72rem; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-log { flex-shrink: 0; padding: 4px 10px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .76rem; }
.seg-status button { flex: 1 1 0; padding: 6px 4px; font-size: .8rem; }
.fab { transition: transform .25s, opacity .25s; }
.fab.tucked { transform: translateY(90px) scale(.6); opacity: 0; pointer-events: none; }

/* You page */
.you-page { padding: 20px 16px 30px; }
.you-card { display: flex; align-items: center; gap: 16px; }
.you-card-text { min-width: 0; }
.you-card .you-name { font-size: 1.5rem; line-height: 1.2; }
.you-bio { margin-top: 4px; color: var(--text2); font-size: .88rem; }
.you-actions { margin: 14px 0 4px; }
.menu-label { margin: 20px 0 8px; font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--text3); }
.you-page .account-list { margin-top: 4px; }

/* Friends */
.empty-feed { display: flex; align-items: center; gap: 12px; }
.empty-wick { flex: 0 0 56px; height: 66px; }

/* Wick's tips */
.wick-tip {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  margin: 0 16px 14px; padding: 10px 12px; border-radius: 16px;
  background: color-mix(in srgb, var(--gold) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--border));
}
.tip-wick { grid-row: 1 / 3; width: 44px; height: 52px; }
.wick-tip p { font-size: .84rem; line-height: 1.45; color: var(--text2); }
.wick-tip .link { justify-self: end; font-size: .8rem; }

/* Quick log */
.ql-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ql-cover { flex: 0 0 56px; height: 84px; border-radius: 6px; overflow: hidden; }
.ql-wick { flex: 0 0 60px; height: 70px; }
.ql-label { display: block; text-align: center; font-weight: 800; color: var(--text2); margin-bottom: 8px; }
.ql-row { display: flex; align-items: center; justify-content: center; gap: 12px; }
.ql-step { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border2); background: var(--card); color: var(--text); font-size: 1.4rem; font-weight: 800; }
.ql-input {
  width: 150px; text-align: center; font-family: 'Lora', serif; font-size: 2.6rem; font-weight: 700; color: var(--gold);
  background: var(--card); border: 1.5px solid var(--border2); border-radius: 16px; padding: 4px 8px; outline: none;
}
.ql-input:focus { border-color: var(--accent); }
.ql-of { text-align: center; color: var(--text3); font-size: .84rem; font-weight: 700; margin-top: 8px; }
.ql-modes { margin-bottom: 10px; }
.ql-unit { font-family: 'Lora', serif; font-size: 1.1rem; color: var(--text3); }
.ql-chips { display: flex; justify-content: center; gap: 8px; margin: 4px 0 14px; }
.ql-chips .chip { min-width: 64px; font-size: .95rem; }

/* Finished a book */
.finish-scrim { align-items: center; z-index: 145; }
.finish-card {
  position: relative; width: min(360px, calc(100% - 32px)); text-align: center; padding: 22px 20px 20px; overflow: hidden;
  background: var(--bg2); border: 1px solid var(--gold); border-radius: 26px; box-shadow: 0 0 70px color-mix(in srgb, var(--gold) 35%, transparent);
}
.fm-wick { display: block; width: 96px; height: 112px; margin: 0 auto 4px; }
.fm-title { font-family: 'Lora', serif; font-size: 1.45rem; line-height: 1.25; margin-top: 2px; }
.fm-count { margin-top: 6px; color: var(--gold); font-weight: 800; font-size: .9rem; }
.fm-stars { justify-content: center; margin: 4px 0 10px; }
.fm-stars .star-cell { font-size: 2.1rem; }
.fm-thoughts { min-height: 60px !important; margin-bottom: 12px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 12px; border-radius: 2px; opacity: 0;
  animation: confettiFall 2.4s ease-in var(--d) 2 forwards; transform: rotate(var(--r)); }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(0) rotate(var(--r)); } 100% { opacity: 0; transform: translateY(420px) rotate(calc(var(--r) + 540deg)); } }

/* "Are you sure?" */
.confirm-scrim { align-items: center; z-index: 190; }
.confirm-card { width: min(340px, calc(100% - 32px)); text-align: center; padding: 20px; border-radius: 22px; background: var(--bg2); border: 1px solid var(--border2); box-shadow: var(--shadow); }
.cf-wick { display: block; width: 58px; height: 68px; margin: 0 auto 6px; }
.confirm-card h2 { font-size: 1.02rem; line-height: 1.4; font-weight: 800; }
.confirm-card .hint { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { .confetti, .streak-chip { animation: none !important; } .confetti i { display: none; } }

/* Sort menu, Discover summary */
.sort-pick select {
  min-height: 32px; padding: 4px 26px 4px 10px; border-radius: 10px; font-size: .8rem; font-weight: 800; color: var(--text2);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a88b6b' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 9px center / 9px;
  border: 1px solid var(--border2); appearance: none; -webkit-appearance: none;
}
.sec-tools { flex-wrap: wrap; justify-content: flex-end; }
.add-summary { margin: 4px 0 14px; }
.add-summary .label { display: block; margin-bottom: 4px; }
.add-summary p { font-size: .9rem; line-height: 1.6; color: var(--text2); white-space: pre-line; }
.add-summary p.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.trail-option.locked { cursor: pointer; }

.lib-tools { display: flex; align-items: center; gap: 8px; padding: 0 16px 12px; }
.lib-tools .view-toggle { margin-left: auto; }

.trail-list { padding: 4px 16px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; scroll-margin-top: 110px; }

/* Add a book: the essentials up top, everything else tucked away */
.more-opts { margin: 6px 0 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--card); }
.more-opts > div { padding: 2px 14px 10px; }
.more-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; text-align: left; background: none; border: 0; color: var(--text); }
.more-toggle span:first-child { font-weight: 800; font-size: .9rem; }
.more-toggle small { flex: 1; min-width: 0; color: var(--text3); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.more-toggle .chev { color: var(--text3); }
.sheet-footer {
  position: sticky; bottom: -40px; z-index: 5; margin: 14px -18px 0; padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg2) 0%, transparent), var(--bg2) 28%);
}
.sheet-footer .error { margin-bottom: 8px; }

/* =====================================================================
   ROUND 3: inbox, search, undo, help, comfort, computer layout
   ===================================================================== */
.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.top-actions .icon-btn { width: 38px; height: 38px; font-size: 1rem; }
.bell { position: relative; }
.bell-dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-style: normal;
  font-size: .66rem; font-weight: 900; line-height: 18px; text-align: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--bg); }
.topbar-left { flex: 1; }

.toast.has-action { display: flex; align-items: center; gap: 14px; padding-right: 10px; }
.toast-action { flex-shrink: 0; padding: 5px 12px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 900; font-size: .85rem; }

.btn.ghost-danger { background: none; border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border)); color: var(--danger); }
.book-tabs { position: sticky; top: -12px; z-index: 4; background: var(--bg2); margin-top: 14px; }
.book-tabs button { font-size: .86rem; }

.skel-book { aspect-ratio: 2 / 3.3; border-radius: 12px; }
.lib-skeleton .sec-head { padding-top: 18px; }
.oops { text-align: center; padding: 30px 24px; }
.oops-wick { display: block; width: 90px; height: 105px; margin: 0 auto 8px; }
.oops h2 { font-family: 'Lora', serif; font-size: 1.3rem; }
.oops p { color: var(--text2); margin: 8px 0 16px; }

.inbox-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 10px 10px 20px; }
.inbox-empty > span { width: 76px; height: 90px; }
.inbox-item { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 12px; margin-bottom: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--border); text-align: left; color: var(--text); }
.inbox-item.as-button { align-items: center; }
.inbox-icon { font-size: 1.5rem; line-height: 1.2; }
.inbox-text { flex: 1; min-width: 0; }
.inbox-text p { font-size: .9rem; }
.inbox-text .req-actions { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.search-scrim { align-items: flex-start; }
.search-sheet { border-radius: 0 0 24px 24px; max-height: 88vh; padding-top: calc(12px + env(safe-area-inset-top)); }
.search-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.search-top .search { flex: 1; }
.search-hint { text-align: center; padding: 14px 6px; }
.search-sec { margin: 6px 0 14px; }
.search-sec .label { display: block; margin-bottom: 6px; }
.search-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--text); text-align: left; }
.search-row:hover { background: var(--card); }
.search-row .mini-cover { width: 36px; height: 54px; border-radius: 4px; overflow: hidden; }
.search-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.search-text strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-text small { color: var(--text3); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-add { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 900; }

.help-hello { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 12px; border-radius: 16px;
  background: color-mix(in srgb, var(--gold) 12%, var(--card)); }
.help-hello > span { flex: 0 0 48px; height: 56px; }
.help-hello p { color: var(--text2); font-size: .9rem; }
.faq { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; list-style: none; padding: 13px 26px 13px 2px; font-weight: 800; font-size: .92rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '▾'; position: absolute; right: 4px; color: var(--text3); transition: transform .2s; }
.faq[open] summary::after { transform: rotate(180deg); }
.faq p { padding: 0 2px 14px; color: var(--text2); font-size: .88rem; line-height: 1.6; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.toggle-row > span { flex: 1; display: flex; flex-direction: column; }
.toggle-row small { color: var(--text3); font-size: .78rem; }
.toggle-row input { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--border2); position: relative; transition: background .2s; flex-shrink: 0; }
.toggle-row input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px #0004; }
.toggle-row input:checked { background: var(--accent); }
.toggle-row input:checked::after { transform: translateX(18px); }

/* Comfort: text size and less motion */
:root[data-text="small"] { font-size: 14.5px; }
:root[data-text="large"] { font-size: 18px; }
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}
:root[data-motion="reduce"] .confetti { display: none; }

/* ── On a computer or tablet: nav on the left, books stay visible next to the open book ── */
@media (min-width: 1000px) {
  body { padding-left: 96px; }
  .app { max-width: 1120px; }
  .bnav { top: 0; bottom: 0; right: auto; width: 96px; padding: 74px 0 20px; border-top: 0; border-right: 1px solid var(--border); }
  .bnav-inner { flex-direction: column; gap: 6px; height: 100%; }
  .bnav button { flex: 0 0 auto; min-height: 68px; font-size: .78rem; }
  .bnav button span { font-size: 1.45rem; }
  .bnav .nav-dot { left: calc(50% + 10px); }
  .books-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
  .fab { right: 32px; bottom: 32px; }
  .to-top { bottom: 32px; }
  .pick-bar { bottom: 24px; }
  .toast { bottom: 32px; }
  /* Sheets slide in from the right as a side panel, so your shelf stays in view */
  .scrim:has(> .sheet:not(.search-sheet)) { align-items: stretch; justify-content: flex-end; background: #00000030; backdrop-filter: none; }
  .scrim > .sheet:not(.search-sheet) { max-width: 480px; max-height: none; height: 100vh; border-radius: 24px 0 0 24px; border: 0; border-left: 1px solid var(--border2); }
  .scrim > .sheet:not(.search-sheet) .sheet-handle { display: none; }
  .scrim > .sheet:not(.search-sheet).sheet-from { transform: translateX(60px); }
  .scrim > .sheet:not(.search-sheet).sheet-to { transform: translateX(0); }
  .search-scrim { align-items: flex-start; justify-content: center; padding-top: 60px; }
  .search-sheet { max-width: 640px; border-radius: 24px; }
  .reading-row { flex-wrap: wrap; overflow: visible; }
  .rr-card { flex: 0 0 300px; }
}

/* Completed challenges, folded away */
.ch-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.past-acc { margin: 18px 16px 10px; border-radius: 18px; border: 1px solid var(--border); background: var(--bg2); overflow: hidden; }
.past-acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 800; }
.past-acc summary::-webkit-details-marker { display: none; }
.past-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; font-size: .78rem;
  background: var(--gold); color: #2a1f14; }
.past-sub { flex: 1; text-align: right; font-weight: 700; }
.past-acc .chev { color: var(--text3); transition: transform .2s; }
.past-acc[open] .chev { transform: rotate(180deg); }
.past-acc .ch-card { margin: 0 10px 10px; }
.ch-card.past.won { border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }

/* ── Print view: a certificate on "paper" ─────────────────────────── */
.print-view { position: fixed; inset: 0; z-index: 160; overflow-y: auto; background: #d9cfc0; padding-bottom: 40px; }
.print-controls { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px; background: var(--nav-bg); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); color: var(--text); }
.print-opts { display: flex; gap: 14px; font-size: .82rem; }
.print-name-row { display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 14px auto 0; padding: 0 16px; color: #3a2a1a; font-weight: 800; font-size: .86rem; }
.print-name-row .input { max-width: 220px; background: #fffaf2; color: #2a1f14; border-color: #c9b08a; }
.print-area { max-width: 760px; margin: 14px auto 0; padding: 0 12px; }
.cert {
  position: relative; background: #fffdf7; color: #2a1f14; border-radius: 6px; padding: 38px 40px 30px; text-align: center;
  box-shadow: 0 10px 30px #0003; border: 10px double #d4845a; outline: 3px dashed #e8b86d; outline-offset: -22px;
  font-family: 'Nunito', sans-serif;
}
.cert-corner { position: absolute; font-size: 1.7rem; }
.cert-corner.tl { top: 14px; left: 18px; } .cert-corner.tr { top: 14px; right: 18px; }
.cert-corner.bl { bottom: 14px; left: 18px; } .cert-corner.br { bottom: 14px; right: 18px; }
.cert-wick { display: block; width: 90px; height: 105px; margin: 0 auto; }
.cert-kicker { margin-top: 4px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: #a8552d; font-size: .9rem; }
.cert-title { font-family: 'Lora', serif; font-size: 2.6rem; line-height: 1.1; margin: 4px 0 14px; color: #2a1f14; }
.cert-line { font-size: 1.05rem; color: #5e4429; }
.cert-name { font-family: 'Lora', serif; font-style: italic; font-size: 2.1rem; font-weight: 700; color: #2a1f14;
  border-bottom: 2px solid #e4cfb4; display: inline-block; min-width: 60%; padding: 0 16px 2px; margin: 4px 0 10px; }
.cert-challenge { font-family: 'Lora', serif; font-size: 1.5rem; font-weight: 700; color: #a8552d; margin: 6px 0 16px; }
.cert-stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.cert-stats > div { min-width: 110px; padding: 10px 14px; border-radius: 14px; background: #fdf3e2; border: 2px solid #f0dcbc; }
.cert-stats strong { display: block; font-family: 'Lora', serif; font-size: 1.4rem; color: #a8711c; }
.cert-stats small { font-weight: 800; color: #7f6146; font-size: .78rem; }
.cert-sub { font-weight: 900; letter-spacing: .1em; text-transform: uppercase; font-size: .78rem; color: #a8552d; margin: 6px 0 8px; }
.cert-books ol { list-style: none; columns: 2; column-gap: 26px; text-align: left; padding: 0; margin: 0 0 12px; }
.cert-books li { break-inside: avoid; display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dotted #e4cfb4; font-size: .92rem; }
.cert-books.covers li img { width: 26px; height: 39px; object-fit: cover; border-radius: 3px; flex-shrink: 0; }
.cb-check { color: #4f7040; font-weight: 900; }
.cb-title { flex: 1; min-width: 0; }
.cb-stars { color: #a8711c; font-size: .8rem; white-space: nowrap; }
.cert-todo .todo-boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; font-size: 1.4rem; color: #c4ad80; margin-bottom: 12px; }
.cert-bingo { display: grid; gap: 4px; max-width: 520px; margin: 0 auto 16px; }
.cb-cell { position: relative; aspect-ratio: 1; border: 2px solid #e4cfb4; border-radius: 8px; padding: 4px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; background: #fffaf2; overflow: hidden; }
.cb-cell.done { background: #fdf0db; border-color: #e8b86d; }
.cb-label { font-size: .62rem; font-weight: 800; color: #5e4429; line-height: 1.15; }
.cb-book { font-size: .55rem; color: #7f6146; font-style: italic; line-height: 1.1; margin-top: 2px; }
.cb-stamp { position: absolute; top: 2px; right: 4px; font-size: 1.1rem; transform: rotate(12deg); }
.cert-sign { display: flex; gap: 40px; justify-content: center; margin-top: 24px; }
.cert-sign > div { flex: 0 1 240px; display: flex; flex-direction: column; gap: 4px; }
.cert-sign span { display: block; border-bottom: 2px solid #5e4429; height: 34px; }
.cert-sign small { font-weight: 800; color: #7f6146; }
.cert-foot { margin-top: 18px; font-size: .78rem; color: #a48c66; }
/* Ink saver: no fills, thinner borders */
.print-area.ink .cert { border: 3px solid #555; outline: 1px dashed #999; box-shadow: none; }
.print-area.ink .cert-stats > div, .print-area.ink .cb-cell, .print-area.ink .cb-cell.done { background: none; border-color: #999; }
.print-area.ink .cert-wick, .print-area.ink .cert-corner { filter: grayscale(1); }
@media (max-width: 560px) { .print-opts { gap: 8px; font-size: .74rem; } }

@media print {
  @page { size: letter portrait; margin: 0.4in; }
  html.printing, html.printing body { background: #fff !important; padding: 0 !important; min-height: 0 !important; }
  html.printing .print-area { height: auto !important; overflow: visible !important; }
  html.printing .paper { position: static; transform: none !important; margin: 0 auto; }
  html.printing .print-fit-note { display: none !important; }
  html.printing .app, html.printing .bnav, html.printing .fab, html.printing .to-top, html.printing .toast, html.printing .scrim,
  html.printing .print-controls, html.printing .print-name-row, html.printing .onboard, html.printing .yir { display: none !important; }
  html.printing .print-view { position: static; overflow: visible; background: #fff; padding: 0; }
  html.printing .print-area { max-width: none; margin: 0; padding: 0; }
  html.printing .cert { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html.printing .wick * { animation: none !important; }
}

/* The page itself: laid out at printed size (7.4in), shrunk to fit one page, scaled to fit the screen */
.print-area { position: relative; overflow: hidden; }
.print-fit-note { text-align: center; font-size: .78rem; font-weight: 800; color: #5e4429; margin: 0 0 8px; }
.paper { width: 710px; zoom: var(--fit, 1); position: relative; left: 50%; transform: translateX(-50%) scale(var(--screen, 1)); transform-origin: top center; }
.paper .cert { padding: 26px 34px 20px; font-size: 15px; break-inside: avoid; page-break-inside: avoid; }
.paper .cert-wick { width: 70px; height: 82px; }
.paper .cert-title { font-size: 2.2rem; margin: 2px 0 8px; }
.paper .cert-name { font-size: 1.9rem; }
.paper .cert-challenge { margin: 4px 0 12px; }
.paper .cert-stats { margin-bottom: 12px; }
.paper .cert-books li { padding: 3px 0; font-size: .86rem; }
.paper .cert-sign { margin-top: 16px; }
.paper .cert-foot { margin-top: 8px; }
/* Lots of books: more columns, smaller type */
.cert.dense .cert-books ol { columns: 3; column-gap: 18px; }
.cert.dense .cert-books li { font-size: .74rem; padding: 2px 0; gap: 5px; }
.cert.dense .cb-stars { font-size: .62rem; }
.cert.denser .cert-books ol { columns: 4; column-gap: 14px; }
.cert.denser .cert-books li { font-size: .64rem; padding: 1px 0; }
.cert.denser .cb-stars { display: none; }
.cert.dense .cert-books.covers li img { width: 18px; height: 27px; }

/* Sign-up agreements and the confirm-your-email bar */
.agree { display: grid; gap: 8px; margin: 4px 0 14px; font-size: .88rem; color: var(--text2); }
.agree .check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.agree input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent, #d4845a); flex: none; }
.agree a { color: inherit; text-decoration: underline; }
.verify-bar { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between;
  margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; font-size: .86rem;
  background: color-mix(in srgb, #f3c35f 14%, var(--card)); border: 1px solid color-mix(in srgb, #f3c35f 40%, transparent); }
.verify-bar strong { word-break: break-all; }

/* Paused books, "read yesterday", your copy's length */
.badge.paused { color: var(--text2); border-style: dashed; }
.ql-yday { display: flex; gap: 8px; align-items: center; font-size: .84rem; color: var(--text2); margin: 0 0 10px; cursor: pointer; }
.ql-yday input { width: 18px; height: 18px; accent-color: var(--accent); }
.length-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-top: 10px; }
.length-edit { margin-top: 10px; }

/* Welcome tour: privacy step */
.ob-choice.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.ob-toggle { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 14px 0 4px; font-size: .9rem; color: var(--text2); cursor: pointer; }
.ob-toggle input { width: 20px; height: 20px; accent-color: var(--accent); }

.pw-legal { text-align: center; margin-top: 8px; font-size: .76rem; }
.pw-links { display: flex; justify-content: center; gap: 18px; margin-top: 8px; font-size: .82rem; }
.pw-links a { color: var(--text3); }

.ql-end { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; font-size: .9rem;
  background: color-mix(in srgb, var(--gold) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); }
.ql-end p { margin: 0 0 10px; }
.ql-end .row { gap: 8px; }
.ql-end .btn { flex: 1 1 0; }

.verify-actions { display: inline-flex; gap: 14px; }

/* "Your lantern walked" moment */
.walk-scrim { align-items: center; z-index: 148; }
.walk-card { width: min(380px, calc(100% - 32px)); padding: 22px 20px 18px; text-align: center;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.walk-trail { margin: 0; }
.walk-title { font-family: 'Lora', serif; font-size: 1.3rem; margin: 4px 0 6px; }
.walk-path { position: relative; height: 96px; margin: 8px 22px 6px; }
.walk-line, .walk-done { position: absolute; top: 46px; height: 6px; border-radius: 6px; }
.walk-line { left: 0; right: 0; background: repeating-linear-gradient(90deg, var(--border2) 0 10px, transparent 10px 16px); }
.walk-done { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 60%, transparent), var(--gold));
  transition: width 1.6s cubic-bezier(.45, .05, .3, 1); }
.walk-stop { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 30px; width: 0; }
.walk-stop-emoji { font-size: 1.5rem; line-height: 1; filter: grayscale(.4); opacity: .75; transition: transform .4s, filter .4s, opacity .4s; transition-delay: 1.3s; }
.walk-stop small { position: absolute; top: 62px; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: .66rem; color: var(--text3); }
.walk-stop.first small { transform: translateX(-14px); }
.walk-stop.last small { transform: translateX(calc(-100% + 14px)); }
.walk-stop.reached small { color: var(--text); font-weight: 700; }
.walk-stop.reached .walk-stop-emoji { filter: none; opacity: 1; transform: scale(1.35); }
.walk-lantern { position: absolute; top: 34px; transform: translateX(-50%); font-size: 1.45rem; line-height: 1;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--gold) 70%, transparent));
  transition: left 1.6s cubic-bezier(.45, .05, .3, 1); animation: walkBob .4s ease-in-out infinite alternate; }
@keyframes walkBob { from { margin-top: 0; } to { margin-top: -4px; } }
.walk-gain { margin: 4px 0 2px; font-size: .95rem; }
.walk-actions { margin-top: 14px; gap: 8px; }
.walk-actions .btn { flex: 1 1 0; }
@media (prefers-reduced-motion: reduce) {
  .walk-done, .walk-lantern, .walk-stop-emoji { transition: none; animation: none; }
}

/* Mini trail on Home */
.mini-trail { display: block; width: 100%; margin-top: 10px; padding: 10px 14px 12px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px; color: inherit; font: inherit; }
.mini-trail:hover { border-color: var(--border2); }
.mt-head { display: flex; justify-content: space-between; gap: 8px; font-size: .82rem; font-weight: 700; }
.mt-next { color: var(--text3); font-weight: 600; text-align: right; }
.mt-path { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.mt-from, .mt-to { font-size: 1.1rem; line-height: 1; }
.mt-bar { position: relative; flex: 1; height: 6px; border-radius: 6px; background: repeating-linear-gradient(90deg, var(--border2) 0 8px, transparent 8px 13px); }
.mt-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--gold); transition: width .8s ease; }
.mt-token { position: absolute; top: 50%; transform: translate(-50%, -55%); font-size: 1rem; transition: left .8s ease; }

.auth-brand { font-family: 'Lora', serif; font-weight: 700; letter-spacing: .04em; color: var(--gold); margin: 0 0 4px; font-size: 1.05rem; }

/* Admin: gifted Premium */
.admin-person-actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.premium-text { color: var(--gold); font-weight: 700; }
.admin-person.ended { opacity: .65; }
.gift-choices { margin-top: 6px; }
