/* Sanctuary design system tokens, shared with MochiStream (sanctuary-frontend theme/Color.kt + theme/Theme.kt) */
:root {
  color-scheme: dark;
  /* Surfaces */
  --eclipse: #0b0a10;
  --midnight: #15131c;
  --onyx: #1b1924;
  --slate: #221f2c;
  --graphite: #2e2a38;
  --smoke: #3a3645;
  /* Primary */
  --champagne: #d7b673;
  --champagne-soft: #eed9b0;
  --champagne-deep: #463620;
  /* Text */
  --pearl: #ede8f2;
  --mist: #a29daf;
  --whisper: #6e6979;
  /* Accents */
  --lavender: #b8a8c9;
  --jade: #8fb69e;
  --coral: #e89a92;
  --amber: #e0a868;
  --online: #7bc79a;

  /* Material roles */
  --bg: var(--eclipse);
  --surface: var(--midnight);
  --surface-container: var(--onyx);
  --surface-container-high: var(--slate);
  --surface-container-highest: var(--smoke);
  --outline: var(--graphite);
  --outline-variant: var(--slate);
  --text: var(--pearl);
  --muted: var(--mist);
  --subtle: var(--whisper);
  --accent: var(--champagne);
  --on-accent: var(--eclipse);
  --active-tint: color-mix(in srgb, var(--champagne-deep) 35%, transparent);

  /* Dimens */
  --gutter: 20px;
  --corner-lg: 20px;
  --corner-md: 14px;
  --corner-sm: 8px;
  --card-gradient: linear-gradient(180deg, var(--surface-container), var(--surface));
  --luxe-gradient: linear-gradient(135deg, color-mix(in srgb, var(--champagne-deep) 55%, transparent), color-mix(in srgb, var(--slate) 55%, transparent));

  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --page-pad: clamp(20px, 4.1vw, 64px);
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 20px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .4; }
input, textarea { color: var(--text); }
::selection { background: color-mix(in srgb, var(--champagne) 40%, transparent); color: var(--pearl); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }

/* Logo: Mochi's champagne tile, with book spines in place of the letter */
.logo { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-mark { width: 40px; height: 40px; display: inline-grid; place-items: center; background: var(--champagne); color: var(--eclipse); border-radius: 12px; flex-shrink: 0; }
.logo-mark svg { width: 24px; height: 24px; }
.logo-word { font-size: 17px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; color: var(--pearl); }
.logo-word span { font-weight: 300; color: var(--mist); }

/* Nav links (Library dropdown + mobile drawer) */
.nav-caption { padding: 0 14px; color: var(--mist); letter-spacing: .6px; font-weight: 500; font-size: 12px; margin: 8px 0 10px; text-transform: uppercase; }
.nav-caption-second { margin-top: 32px; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 500; letter-spacing: .4px; padding: 12px 14px; color: var(--mist); border-radius: var(--corner-md); white-space: nowrap; transition: background .18s, color .18s; }
.nav-link svg { width: 22px; height: 22px; stroke-width: 1.75; }
.nav-link:hover { color: var(--pearl); background: var(--surface-container); }
.nav-link.active { color: var(--champagne); background: var(--active-tint); }
.nav-link > span:not([data-icon]):not(.nav-count) { overflow: hidden; text-overflow: ellipsis; }
button.nav-link { width: 100%; border: 0; background: transparent; text-align: left; }
.nav-count { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--surface-container-high); color: var(--mist); font-size: 10px; font-weight: 600; letter-spacing: 0; }

/* Workspace + top bar */
.workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: relative; z-index: 6; height: 92px; display: flex; align-items: center; padding: 0 var(--page-pad); gap: 12px; }
.topbar > .logo { margin-right: clamp(8px, 2vw, 28px); }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; border: 0; border-radius: 12px; background: transparent; color: var(--pearl); transition: background .18s, color .18s; }
.icon-button:hover { background: var(--surface-container); color: var(--champagne); }
.icon-button [data-icon] { display: grid; place-items: center; }
.menu-button { display: none; margin-left: -8px; }
.top-link { height: 46px; display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 0 16px; border: 1px solid transparent; background: transparent; color: var(--mist); border-radius: 12px; font-size: 14px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: background .18s, color .18s, border-color .18s; }
.top-link [data-icon] { display: grid; place-items: center; }
.top-link svg { width: 19px; height: 19px; }
.top-link:hover { color: var(--pearl); background: var(--surface-container); }
.top-link.active { color: var(--champagne); background: var(--active-tint); }
.top-link .caret svg { width: 15px; height: 15px; transform: rotate(90deg); transition: transform .18s; }
.top-link[aria-expanded="true"] { color: var(--pearl); background: var(--surface-container); border-color: var(--outline-variant); }
.top-link[aria-expanded="true"] .caret svg { transform: rotate(-90deg); }
/* Account (Sanctuary sign-in): the profile picture, or initials on champagne, as on auth.sk96.uk */
.account-menu { position: relative; }
.account-button { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; transition: box-shadow .18s; }
.account-button:hover, .account-button[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--champagne); }
.avatar { position: relative; width: 36px; height: 36px; flex-shrink: 0; display: inline-grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--champagne-deep); color: var(--champagne-soft); font-size: 13px; font-weight: 600; letter-spacing: .5px; user-select: none; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-panel { min-width: 260px; }
.account-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 12px; margin-bottom: 2px; border-bottom: 1px solid var(--outline); }
.account-head > div { min-width: 0; display: flex; flex-direction: column; }
.account-head strong { font-weight: 500; color: var(--pearl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-head small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 240px; display: flex; flex-direction: column; gap: 4px; background: var(--slate); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 6px; }
.library-panel .nav-link { padding: 10px 12px; border-radius: 10px; color: var(--pearl); }
.library-panel .nav-link svg { width: 20px; height: 20px; color: var(--mist); }
.library-panel .nav-link:hover { background: var(--surface-container-highest); }
.library-panel .nav-link.active, .library-panel .nav-link.active svg { color: var(--champagne); }

/* Mobile drawer */
.drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(300px, 84vw); background: var(--surface); border-right: 1px solid var(--outline-variant); box-shadow: 20px 0 60px rgba(0,0,0,.5); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); transform: translateX(-100%); visibility: hidden; transition: transform .26s ease, visibility 0s linear .26s; }
.drawer.open { transform: none; visibility: visible; transition: transform .26s ease; }
.drawer-head { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 20px; }
.drawer-scroll { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; flex: 1; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 59; background: rgba(11,10,16,.6); backdrop-filter: blur(4px); }
body.drawer-open { overflow: hidden; }
.section-tabs { display: flex; gap: 2px; padding: 4px; flex-shrink: 0; background: var(--surface-container); border: 1px solid var(--outline-variant); border-radius: 12px; }
.section-tab { height: 36px; display: inline-flex; align-items: center; padding: 0 14px; border: 0; background: transparent; border-radius: 9px; color: var(--mist); font-size: 14px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: background .18s, color .18s; }
.section-tab:hover { color: var(--pearl); }
.section-tab.active { color: var(--champagne); background: var(--active-tint); }
.search-box { position: relative; flex: 0 1 430px; min-width: 0; height: 46px; background: var(--surface-container); border: 1px solid var(--outline-variant); display: flex; align-items: center; gap: 12px; padding: 0 16px; border-radius: 12px; color: var(--mist); transition: border-color .2s; }
.search-box:focus-within { border-color: var(--champagne); }
.search-box svg { width: 18px; height: 18px; flex-shrink: 0; }
.search-box input { background: none; border: 0; outline: none; min-width: 0; width: 100%; font-size: 14px; }
.search-box input::placeholder { color: var(--whisper); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box input { -webkit-appearance: none; appearance: none; }
.search-box kbd { font-family: var(--font); font-size: 11px; color: var(--mist); border: 1px solid var(--outline); min-width: 22px; text-align: center; padding: 1px 4px; border-radius: 6px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.install-button { height: 40px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--champagne); color: var(--on-accent); border-radius: 999px; font-size: 14px; font-weight: 600; letter-spacing: .4px; transition: background .2s; }
.install-button:hover { background: var(--champagne-soft); }
.install-button svg { width: 18px; height: 18px; }
.install-button [data-icon] { display: grid; place-items: center; }
.offline-banner { margin: 0 var(--page-pad) 8px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--corner-md); background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent); color: var(--amber); font-size: 13px; font-weight: 500; }
.offline-banner [data-icon] { display: grid; }

.main { width: 100%; flex: 1; padding: 8px var(--page-pad) 72px; }
.home-view { display: flex; flex-direction: column; gap: 40px; }


/* Spotlight (FeaturedWatchCard): the book's banner art behind, its cover sharp on the right */
.hero { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: end; margin: -100px calc(-1 * var(--page-pad)) 0; min-height: clamp(520px, 74vh, 760px); background: var(--bg); }
.hero-slide { position: absolute; inset: 0; display: flex; align-items: flex-end; isolation: isolate; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s linear .8s; }
.hero-slide.active { opacity: 1; visibility: visible; z-index: 1; transition: opacity .8s ease; }
.hero-image { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); object-fit: cover; z-index: -3; filter: blur(48px) saturate(1.25); opacity: .55; transform: scale(1.1); }
.hero-wash { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(11,10,16,.92) 0%, rgba(11,10,16,.6) 38%, rgba(11,10,16,.15) 70%, transparent 100%), linear-gradient(0deg, var(--bg) 0%, rgba(11,10,16,.5) 22%, transparent 48%), linear-gradient(180deg, rgba(11,10,16,.8) 0%, transparent 26%); }
.hero-cover { position: absolute; right: calc(var(--page-pad) + 2vw); bottom: clamp(80px, 13vh, 132px); z-index: -2; width: clamp(240px, 30vw, 420px); aspect-ratio: 1; border-radius: 22px; object-fit: cover; box-shadow: 0 40px 90px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.08); }
.hero-content { position: relative; z-index: 2; width: min(720px, 56%); padding: 0 var(--page-pad) clamp(56px, 10vh, 112px); }
.hero-label { color: var(--champagne); letter-spacing: 1.5px; font-weight: 500; font-size: 10px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hero h1 { font-size: clamp(38px, 5vw, 68px); font-weight: 300; line-height: 1.08; letter-spacing: -1px; margin: 0 0 14px; text-wrap: balance; color: #fff; overflow-wrap: anywhere; }
.hero-artist { display: inline-block; font-size: 18px; font-weight: 500; color: var(--champagne-soft); margin-bottom: 14px; }
.hero-artist:hover { text-decoration: underline; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: rgba(255,255,255,.78); font-size: 13px; font-weight: 500; letter-spacing: .4px; margin-bottom: 26px; }
.hero-dots { position: absolute; left: calc(var(--page-pad) - 7px); bottom: clamp(16px, 3.4vh, 34px); z-index: 3; display: flex; align-items: center; }
.hero-dot { width: 10px; height: 10px; padding: 0; box-sizing: content-box; border: 7px solid transparent; background: rgba(255,255,255,.35); background-clip: padding-box; border-radius: 999px; transition: width .35s ease, background-color .35s ease; }
.hero-dot:hover { background-color: rgba(255,255,255,.6); }
.hero-dot.active { width: 32px; background-color: var(--champagne); }
.hero-arrow { position: absolute; bottom: clamp(16px, 3.4vh, 34px); z-index: 3; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255,255,255,.2); background: rgba(11,10,16,.35); color: var(--pearl); backdrop-filter: blur(12px); transition: background .18s, color .18s; }
.hero-arrow:hover { background: rgba(11,10,16,.6); color: var(--champagne); }
.hero-prev { right: calc(var(--page-pad) + 54px); }
.hero-prev svg { transform: rotate(180deg); }
.hero-next { right: var(--page-pad); }

/* Buttons (PillButton / GhostButton) */
.btn { border: 1px solid transparent; border-radius: 999px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 22px; font-size: 14px; font-weight: 600; letter-spacing: .4px; transition: background .18s, border-color .18s, color .18s; white-space: nowrap; }
.btn-primary { color: var(--on-accent); background: var(--champagne); }
.btn-primary:hover { background: var(--champagne-soft); }
.btn-secondary { color: var(--pearl); background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); backdrop-filter: blur(12px); }
.btn-secondary:hover { background: rgba(255,255,255,.18); }
.btn-secondary.active { color: var(--champagne); border-color: color-mix(in srgb, var(--champagne) 55%, transparent); }
.btn-outline { border-color: var(--outline); background: transparent; color: var(--mist); font-weight: 500; padding: 10px 18px; }
.btn-outline:hover { color: var(--pearl); border-color: var(--smoke); }
.btn-compact { padding: 7px 14px; font-size: 13px; gap: 6px; }
.btn-icon { width: 46px; height: 46px; padding: 0; }
.btn-danger { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 40%, transparent); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--coral) 12%, transparent); }
.hero-buttons, .detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Shelves */
.media-section { min-width: 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; gap: 14px; }
.eyebrow { color: var(--champagne); font-size: 12px; letter-spacing: 2px; font-weight: 500; line-height: 1.5; text-transform: uppercase; }
.section-heading h2 { font-size: 20px; line-height: 26px; font-weight: 600; margin: 4px 0 0; }
.rail-controls { display: flex; align-items: center; gap: 8px; }
.rail-controls button { color: var(--pearl); border: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--surface-container); font-size: 20px; line-height: 1; }
.rail-controls button:hover { color: var(--champagne); background: var(--surface-container-high); }
.rail { --rail-cards: 7; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--rail-cards) - 1) * 14px) / var(--rail-cards)); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { min-width: 0; scroll-snap-align: start; }
.section-link { padding: 8px 14px; font-size: 13px; }

/* Cards */
.card { position: relative; display: block; min-width: 0; padding: 10px; margin: -10px; border-radius: 18px; transition: background .2s; }
.card:hover { background: var(--surface-container); }
.cover { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface-container-high); box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--whisper); background: var(--luxe-gradient); }
.card.artist .cover { border-radius: 50%; }
.card h3 { margin: 10px 0 2px; font-weight: 500; font-size: 14px; line-height: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--pearl); }
.card p { color: var(--mist); font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.artist h3, .card.artist p { text-align: center; }
/* Sits on the cover's bottom corner: below it are the card's padding and two lines of text. */
.card-play { position: absolute; right: 18px; bottom: 72px; z-index: 2; width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--champagne); color: var(--on-accent); box-shadow: 0 10px 24px rgba(0,0,0,.45); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s, background .2s; }
.card-play svg { fill: currentColor; margin-left: 2px; }
.card-play.playing svg { margin-left: 0; }
.card-play:hover { background: var(--champagne-soft); }
.card:hover .card-play, .card:focus-within .card-play, .card-play.playing { opacity: 1; transform: none; }

/* Page headings */
.page-heading { margin: 20px 0 32px; }
.page-heading h1 { font-size: clamp(30px,4vw,44px); font-weight: 300; line-height: 1.18; margin: 6px 0 8px; letter-spacing: -.5px; }
.page-heading p { color: var(--muted); font-size: 14px; margin: 0; }
.page-heading.with-actions { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.filter-control { height: 44px; background: var(--surface-container); border: 1px solid var(--outline-variant); border-radius: 12px; color: var(--pearl); padding: 0 12px; font-size: 14px; outline: none; transition: border-color .18s; }
.filter-control:hover { border-color: var(--outline); }
.filter-control:focus { border-color: var(--champagne); }
input.filter-control { width: 100%; }
select.filter-control { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a29daf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.filter-control option { background: var(--slate); color: var(--pearl); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-bottom: 22px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; background: transparent; border: 1px solid var(--outline); color: var(--mist); border-radius: 999px; padding: 7px 15px; font-size: 13px; font-weight: 500; letter-spacing: .4px; white-space: nowrap; transition: color .18s, border-color .18s, background .18s; }
.chip:hover { color: var(--pearl); border-color: var(--smoke); }
.chip.active { background: var(--active-tint); border-color: var(--champagne); color: var(--champagne); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 28px 18px; }

.search-section { margin-bottom: 40px; }

/* Album, artist and playlist headers (detail page pattern) */
.detail-view { position: relative; margin: -8px calc(-1 * var(--page-pad)) 0; }
.detail-backdrop { position: absolute; top: -92px; left: 0; right: 0; height: 520px; pointer-events: none; overflow: hidden; z-index: -1; }
.detail-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .5; filter: blur(60px) saturate(1.3); transform: scale(1.2); }
.detail-wash { position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 0%, rgba(11,10,16,.55) 45%, rgba(11,10,16,.2) 100%); }
.detail-top { padding: 12px var(--page-pad) 32px; }
.back-link { color: var(--mist); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; letter-spacing: .4px; border: 0; background: none; padding: 0; }
.back-link svg { transform: rotate(180deg); }
.back-link:hover { color: var(--champagne); }
.detail-main { display: flex; align-items: end; gap: clamp(24px,4vw,48px); margin-top: 32px; }
.detail-cover { position: relative; flex: 0 0 232px; width: 232px; aspect-ratio: 1; border-radius: var(--corner-lg); overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.5); background: var(--surface-container-high); }
.detail-cover > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.detail-cover.round { border-radius: 50%; }
.detail-info { flex: 1; min-width: 0; padding-bottom: 2px; }
.detail-info .eyebrow span { color: var(--whisper); margin: 0 5px; }
.detail-info h1 { font-size: clamp(32px,4.6vw,60px); font-weight: 300; line-height: 1.1; letter-spacing: -.8px; margin: 10px 0; max-width: 900px; text-wrap: balance; overflow-wrap: anywhere; }
.detail-info h1.editable { cursor: pointer; }
.detail-desc { color: var(--mist); font-size: 14px; margin: 0 0 10px; max-width: 720px; }
.detail-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; font-weight: 500; letter-spacing: .2px; color: var(--pearl); margin: 12px 0 22px; }
.detail-stats a:hover { color: var(--champagne); text-decoration: underline; }
.detail-stats .dot { color: var(--whisper); }
.detail-stats small { font-size: 14px; font-weight: 400; color: var(--mist); }
.detail-body { padding: 8px var(--page-pad) 0; display: flex; flex-direction: column; gap: 40px; }
.progress-track { height: 4px; background: var(--graphite); border-radius: 4px; overflow: hidden; }
.progress-track span { height: 100%; display: block; border-radius: 4px; background: var(--champagne); }

/* Loading + empty */
.page-loading,.initial-loading { min-height: 380px; display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 12px; color: var(--mist); text-align: center; font-size: 14px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--graphite); border-top-color: var(--champagne); animation: spin .85s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { margin: 48px 0; min-height: 265px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px solid var(--outline-variant); background: var(--card-gradient); border-radius: 22px; }
.empty-state.compact { margin: 8px 0; min-height: 200px; }
.empty-symbol { color: var(--champagne); }
.empty-state h2 { font-size: 20px; font-weight: 600; margin: 14px 0 4px; }
.empty-state p { color: var(--mist); font-size: 14px; max-width: 420px; line-height: 20px; }
.empty-state .btn { margin-top: 12px; }

/* Popover menu (dialog surface, like the Library panel) */
.menu-popover { position: fixed; z-index: 80; min-width: 230px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: var(--slate); border: 1px solid var(--outline); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.55); padding: 6px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--pearl); text-align: left; font-size: 14px; padding: 9px 12px; border-radius: 10px; white-space: nowrap; }
.menu-item svg { width: 18px; height: 18px; color: var(--mist); flex-shrink: 0; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-container-highest); outline: none; }
.menu-item.danger, .menu-item.danger svg { color: var(--coral); }
.menu-sep { height: 1px; background: var(--outline); margin: 4px 6px; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--outline); min-width: 0; }
.menu-head img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.menu-head div { min-width: 0; }
.menu-head strong, .menu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.menu-head small { color: var(--mist); font-size: 12px; }

/* Dialogs (Mochi's party dialog surface) */
.app-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border-radius: 22px; background: var(--surface); color: var(--text); border: 1px solid var(--outline-variant); box-shadow: 0 20px 90px rgba(0,0,0,.6); overflow: auto; }
.app-dialog[open] { animation: rise .25s ease-out; }
.app-dialog::backdrop { background: rgba(11,10,16,.85); backdrop-filter: blur(9px); }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.app-dialog h2 { margin: 6px 0 8px; font-size: 22px; font-weight: 600; line-height: 1.25; padding-right: 32px; }
.dialog-lede { margin: 0 0 20px; color: var(--mist); line-height: 21px; }
.dialog-form { display: flex; flex-direction: column; gap: 14px; }
.dialog-field { display: flex; flex-direction: column; gap: 8px; }
.dialog-field > span { font-size: 12px; color: var(--mist); letter-spacing: .4px; }
textarea.filter-control { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.dialog-actions { margin-top: 10px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.pick-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.pick { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--pearl); text-align: left; padding: 8px 10px; border-radius: 12px; }
.pick:hover { background: var(--surface-container); }
.pick .pick-art { position: relative; width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--surface-container-high); }
.pick .pick-art img { width: 100%; height: 100%; object-fit: cover; }
.pick > span:not(.pick-art) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .pick-check { color: var(--champagne); }
.pick.selected { background: var(--active-tint); }
.pick.selected strong { color: var(--champagne); }
.pick-new { color: var(--champagne); }
.pick-new .pick-art { display: grid; place-items: center; color: var(--champagne); background: var(--active-tint); }

/* Toast */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 18px; color: var(--pearl); background: var(--slate); border: 1px solid color-mix(in srgb, var(--jade) 35%, transparent); border-radius: var(--corner-md); box-shadow: 0 14px 40px rgba(0,0,0,.5); font-size: 14px; font-weight: 500; max-width: 390px; opacity: 0; transform: translateY(24px); pointer-events: none; z-index: 90; transition: .23s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: color-mix(in srgb, var(--champagne) 45%, transparent); }


/* ---- Books ------------------------------------------------------------------------------------- */
/* Covers are portrait (2:3). A book without one gets a cover set in type, like a cloth binding. */
.cover.book { aspect-ratio: 2 / 3; border-radius: 10px; }
.cover.book img { position: relative; z-index: 1; }
.typeset { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; padding: 16% 12% 14%; background: linear-gradient(160deg, var(--champagne-deep), #2a2236 60%, var(--slate)); border: 1px solid rgba(255,255,255,.06); border-radius: inherit; font-family: var(--serif); text-align: center; }
.typeset::before { content: ''; position: absolute; inset: 6%; border: 1px solid color-mix(in srgb, var(--champagne) 35%, transparent); border-radius: 4px; pointer-events: none; }
.typeset strong { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; color: var(--champagne-soft); font-size: clamp(13px, 1.15vw, 18px); font-weight: 500; line-height: 1.22; overflow-wrap: anywhere; }
.typeset small { color: var(--mist); font-family: var(--font); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-cover .typeset strong, .hero-cover-wrap .typeset strong { font-size: 24px; }
.card.book h3 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 18px; }
.cover-progress { position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px; height: 4px; border-radius: 4px; overflow: hidden; background: rgba(11,10,16,.65); }
.cover-progress span { display: block; height: 100%; border-radius: 4px; background: var(--champagne); }
.cover-badge { position: absolute; z-index: 2; top: 8px; right: 8px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--jade); color: var(--eclipse); box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.cover-badge svg { width: 13px; height: 13px; stroke-width: 3; }
.rail.books { --rail-cards: 8; }
.grid.books { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 20px; }
.rail-loading { min-height: 260px; display: grid; place-items: center; }
.rail-note { color: var(--mist); font-size: 13px; padding: 24px 0; }
.load-more { display: flex; justify-content: center; margin-top: 36px; }
.load-more .btn .spinner { width: 16px; height: 16px; border-width: 2px; }

/* Continue reading: the cover, where you are, and how far */
.continue-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, calc((100% - 2 * 14px) / 3)); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.continue-grid::-webkit-scrollbar { display: none; }
.continue-card { position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; padding: 14px; scroll-snap-align: start; border-radius: 18px; border: 1px solid var(--outline-variant); background: var(--card-gradient); transition: background .2s, border-color .2s; }
.continue-card:hover { background: var(--surface-container); border-color: var(--outline); }
.continue-card .cover { width: 72px; flex-shrink: 0; box-shadow: 0 8px 20px rgba(0,0,0,.35); }
.continue-card .typeset strong { font-size: 10px; -webkit-line-clamp: 4; }
.continue-card .typeset small { display: none; }
.continue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.continue-text strong { font-weight: 500; font-size: 15px; color: var(--pearl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-text small { color: var(--mist); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-text .progress-track { margin-top: 10px; }
.continue-text .progress-label { color: var(--champagne); font-size: 12px; font-weight: 500; letter-spacing: .4px; margin-top: 6px; }
.progress-track { height: 4px; background: var(--graphite); border-radius: 4px; overflow: hidden; }
.progress-track span { height: 100%; display: block; border-radius: 4px; background: var(--champagne); }

/* Sources are categories: each has a block on Home and its own page in Browse */
.source-block { display: flex; flex-direction: column; gap: 32px; padding-top: 28px; border-top: 1px solid var(--outline-variant); }
.source-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.source-head h2 { margin: 4px 0 4px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 300; letter-spacing: -.3px; }
.source-head p { margin: 0; color: var(--mist); max-width: 620px; }
.source-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.source-tab { display: flex; flex-direction: column; gap: 2px; min-width: 200px; padding: 14px 18px; border-radius: 16px; border: 1px solid var(--outline-variant); background: var(--card-gradient); transition: border-color .18s, background .18s; }
.source-tab strong { font-weight: 600; color: var(--pearl); }
.source-tab small { color: var(--mist); font-size: 12px; }
.source-tab:hover { border-color: var(--outline); background: var(--surface-container); }
.source-tab.active { border-color: var(--champagne); background: var(--active-tint); }
.source-tab.active strong { color: var(--champagne); }
.search-section { margin-bottom: 44px; }
.search-section .section-heading p { margin: 2px 0 0; color: var(--mist); font-size: 13px; }

/* Spotlight for books: the banner art behind, the cover in front */
.hero-image.banner { inset: 0; width: 100%; height: 100%; filter: saturate(1.05); opacity: .62; transform: none; }
.hero-cover-wrap { position: absolute; right: calc(var(--page-pad) + 4vw); bottom: clamp(80px, 13vh, 132px); z-index: -2; width: clamp(190px, 19vw, 290px); aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--surface-container-high); box-shadow: 0 40px 90px rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.08); }
.hero-cover-wrap img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-blurb { color: rgba(255,255,255,.82); font-size: 16px; line-height: 1.5; margin: 0 0 24px; max-width: 560px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* A book's page */
.detail-cover.book { aspect-ratio: 2 / 3; flex-basis: 220px; width: 220px; border-radius: 14px; }
.detail-cover.book > img { position: relative; z-index: 1; }
.detail-subtitle { color: var(--mist); font-size: 18px; font-weight: 300; margin: -2px 0 10px; }
.book-body { display: grid; grid-template-columns: minmax(0, 760px) 300px; justify-content: start; gap: 56px; align-items: start; }
.book-about p { color: var(--pearl); font-size: 15px; line-height: 1.65; margin: 0 0 14px; max-width: 760px; }
.book-about .note { color: var(--whisper); font-size: 12px; }
.book-facts { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 18px; border: 1px solid var(--outline-variant); background: var(--card-gradient); }
.book-facts div { display: flex; flex-direction: column; gap: 2px; }
.book-facts dt { color: var(--mist); font-size: 11px; font-weight: 500; letter-spacing: .8px; text-transform: uppercase; }
.book-facts dd { margin: 0; color: var(--pearl); }
.book-facts a { color: var(--champagne); }
.book-facts a:hover { text-decoration: underline; }
.subject-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.subject-chips .chip { font-size: 12px; padding: 5px 12px; }
.detail-progress { max-width: 420px; margin: -8px 0 22px; }
.detail-progress small { display: block; margin-top: 8px; color: var(--mist); font-size: 13px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; border-color: color-mix(in srgb, currentColor 30%, transparent); border-top-color: currentColor; }

/* Range inputs (reader position) */
.seek-bar { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer; --fill: 0%; }
.seek-bar::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--seek-fill, var(--champagne)) var(--fill), var(--seek-track, var(--graphite)) var(--fill)); }
.seek-bar::-moz-range-track { height: 4px; border-radius: 4px; background: var(--seek-track, var(--graphite)); }
.seek-bar::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--seek-fill, var(--champagne)); }
.seek-bar::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border: 0; border-radius: 50%; background: var(--seek-fill, var(--champagne)); }
.seek-bar::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--seek-fill, var(--champagne)); }

/* ---- Reader ------------------------------------------------------------------------------------ */
/* Three page colours: Night (the app's own eclipse), Sepia and Paper. The bars fade away while reading
   and come back with a tap in the middle of the page, as in an ereader. */
.reader { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--r-bg); color: var(--r-fg); transition: background .3s, color .3s;
  --r-bg: var(--eclipse); --r-fg: #e7e2ec; --r-muted: var(--mist); --r-line: var(--slate); --r-panel: var(--midnight); --r-accent: var(--champagne); --r-hover: rgba(255,255,255,.06); color-scheme: dark; }
.reader[data-theme="sepia"] { --r-bg: #f4ead8; --r-fg: #4b3b29; --r-muted: #8d7759; --r-line: #e4d5ba; --r-panel: #efe3cc; --r-accent: #8f6420; --r-hover: rgba(75,59,41,.08); color-scheme: light; }
.reader[data-theme="paper"] { --r-bg: #fbfaf6; --r-fg: #1e1c24; --r-muted: #75707d; --r-line: #ebe7df; --r-panel: #f4f1ea; --r-accent: #8f6420; --r-hover: rgba(30,28,36,.06); color-scheme: light; }
body.reading { overflow: hidden; }
body.reading .app-shell { visibility: hidden; }
.reader-bar { position: relative; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--r-bg); transition: opacity .25s ease, transform .25s ease, background .3s; }
.reader-top { height: calc(60px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); border-bottom: 1px solid transparent; }
.reader-bottom { height: calc(56px + env(safe-area-inset-bottom)); padding: 0 20px env(safe-area-inset-bottom); gap: 16px; --seek-fill: var(--r-accent); --seek-track: var(--r-line); }
.reader.chrome-hidden .reader-top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.reader.chrome-hidden .reader-bottom { opacity: 0; transform: translateY(8px); pointer-events: none; }
.reader .icon-button { color: var(--r-fg); }
.reader .icon-button:hover, .reader .icon-button[aria-expanded="true"] { background: var(--r-hover); color: var(--r-accent); }
.reader-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.3; }
.reader-title strong { max-width: 100%; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title small { max-width: 100%; color: var(--r-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-where { width: 200px; flex-shrink: 0; color: var(--r-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-percent { width: 48px; flex-shrink: 0; text-align: right; color: var(--r-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.reader-stage { position: relative; min-height: 0; display: flex; justify-content: center; overflow: hidden; }
.reader-page { position: relative; width: min(100%, var(--page-width, 1280px)); height: 100%; }
.reader-page iframe { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
.reader[data-layout="scroll"] .reader-stage { overflow-y: auto; overscroll-behavior: contain; }
.reader[data-layout="scroll"] .reader-page { width: min(100%, 820px); height: auto; min-height: 100%; }
.reader[data-layout="scroll"] .reader-turn { display: none; }
.reader-turn { position: absolute; z-index: 2; top: 0; bottom: 0; width: clamp(44px, 6vw, 84px); display: grid; place-items: center; border: 0; background: transparent; color: var(--r-muted); opacity: 0; transition: opacity .2s, color .2s; }
.reader-turn:hover, .reader-turn:focus-visible { opacity: 1; color: var(--r-accent); }
.reader-turn svg { width: 28px; height: 28px; }
.reader-prev { left: 0; }
.reader-prev svg { transform: rotate(180deg); }
.reader-next { right: 0; }
.reader-loading { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: var(--r-bg); }
.reader-chapter-end { display: flex; justify-content: center; padding: 24px 0 64px; }
.reader .btn-outline { border-color: var(--r-line); color: var(--r-fg); }
.reader .btn-outline:hover { border-color: var(--r-accent); color: var(--r-accent); }
.reader-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--r-muted); }
.reader-error h2 { margin: 0; color: var(--r-fg); font-weight: 500; font-size: 20px; }

/* Contents and settings slide in from the right */
.reader-panel { position: absolute; z-index: 5; top: calc(60px + env(safe-area-inset-top)); right: 0; bottom: 0; width: min(380px, 92vw); display: flex; flex-direction: column; background: var(--r-panel); border-left: 1px solid var(--r-line); box-shadow: -20px 0 60px rgba(0,0,0,.35); animation: slide-in .22s ease-out; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.reader-panel-head { height: 52px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 22px; }
.reader-panel .eyebrow { color: var(--r-accent); }
.reader-panel-body { flex: 1; overflow-y: auto; padding: 4px 12px calc(24px + env(safe-area-inset-bottom)); }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list .toc-list { padding-left: 14px; }
.toc-link { width: 100%; display: block; border: 0; background: none; color: var(--r-fg); text-align: left; font-size: 14px; line-height: 1.4; padding: 9px 10px; border-radius: 10px; }
.toc-link:hover { background: var(--r-hover); }
.toc-link.current { color: var(--r-accent); font-weight: 600; background: var(--r-hover); }
.setting { padding: 14px 10px; border-bottom: 1px solid var(--r-line); }
.setting:last-child { border-bottom: 0; }
.setting-label { display: block; color: var(--r-muted); font-size: 11px; font-weight: 500; letter-spacing: .8px; text-transform: uppercase; margin-bottom: 10px; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--r-hover); }
.segmented button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--r-fg); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button[aria-pressed="true"] { background: var(--r-bg); color: var(--r-accent); box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.segmented .serif { font-family: var(--serif); }
.theme-swatches { display: flex; gap: 12px; }
.theme-swatch { flex: 1; height: 54px; display: grid; place-items: center; border-radius: 12px; border: 2px solid var(--r-line); font-family: var(--serif); font-size: 18px; }
.theme-swatch[data-value="night"] { background: #0b0a10; color: #e7e2ec; }
.theme-swatch[data-value="sepia"] { background: #f4ead8; color: #4b3b29; }
.theme-swatch[data-value="paper"] { background: #fbfaf6; color: #1e1c24; }
.theme-swatch[aria-pressed="true"] { border-color: var(--r-accent); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 38px; border: 0; border-radius: 10px; background: var(--r-hover); color: var(--r-fg); font-size: 18px; font-family: var(--serif); }
.stepper button:hover { color: var(--r-accent); }
.stepper output { flex: 1; text-align: center; font-variant-numeric: tabular-nums; }

@media (min-width:1600px) {
  .rail.books { --rail-cards: 9; }
}
@media (max-width:1300px) {
  .rail.books { --rail-cards: 7; }
  .rail { --rail-cards: 6; }
}
@media (max-width:1150px) {
  .logo-word { font-size: 16px; }
  .rail.books { --rail-cards: 6; }
  .continue-grid { grid-auto-columns: minmax(280px, calc((100% - 14px) / 2)); }
  .detail-cover.book { flex-basis: 180px; width: 180px; }
  .book-body { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width:1000px) {
  .search-box kbd { display: none; }
  .topbar > .logo .logo-word { display: none; }
  .reader-where { display: none; }
}
@media (max-width:780px) {
  .menu-button { display: grid; }
  .section-tabs { display: none; }
  .topbar > .logo { margin-right: 4px; }
  .search-box { flex: 1 1 auto; }
  .topbar { height: 80px; }
  .hero { margin-top: -88px; }
  .rail.books { --rail-cards: 4; }
  .detail-backdrop { top: -80px; }
  .detail-cover.book { flex-basis: 150px; width: 150px; }
  .reader-turn { display: none; }
}
@media (max-width:600px) {
  .topbar { padding: 14px 16px; height: auto; flex-wrap: wrap; gap: 14px 6px; }
  .topbar .logo { gap: 10px; }
  .topbar .logo-mark { width: 32px; height: 32px; border-radius: 10px; }
  .topbar .logo-mark svg { width: 19px; height: 19px; }
  .topbar > .logo .logo-word { display: inline; }
  .search-box { width: 100%; flex: 1 0 100%; order: 2; height: 44px; }
  .top-actions { margin-left: auto; gap: 8px; }
  .install-button { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .install-label { display: none; }
  .offline-banner { margin: 0 16px 8px; }
  .main { padding: 12px 16px 56px; }
  .home-view { gap: 32px; }
  .hero { margin: -12px -16px 0; min-height: 600px; }
  .hero-cover-wrap { left: 50%; right: auto; top: 28px; bottom: auto; width: min(44vw, 190px); transform: translateX(-50%); }
  .hero-content { width: 100%; padding: 0 20px 56px; }
  .hero h1 { font-size: 32px; }
  .hero-blurb { font-size: 14px; margin-bottom: 18px; }
  .hero-arrow { display: none; }
  .hero-dots { left: 13px; bottom: 12px; }
  .section-heading h2 { font-size: 18px; line-height: 24px; }
  .rail-controls button { display: none; }
  .rail, .rail.books { grid-auto-columns: 128px; margin-right: -16px; padding-right: 16px; }
  .continue-grid { grid-auto-columns: 84vw; margin-right: -16px; padding-right: 16px; }
  .card { padding: 8px; margin: -8px; }
  .grid.books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .source-tab { min-width: 0; flex: 1 1 140px; }
  .detail-view { margin: -12px -16px 0; }
  .detail-backdrop { top: -200px; height: 640px; }
  .detail-top { padding: 14px 16px 26px; }
  .detail-main { flex-direction: column; align-items: flex-start; gap: 20px; margin-top: 18px; }
  .detail-cover.book { flex-basis: auto; width: min(46vw, 200px); align-self: center; }
  .detail-info { width: 100%; }
  .detail-info h1 { font-size: 30px; letter-spacing: -.3px; }
  .detail-actions .btn-primary { flex: 1 1 auto; }
  .detail-body { padding: 0 16px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .app-dialog { padding: 24px 20px; }
  .reader-bottom { padding: 0 16px env(safe-area-inset-bottom); }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior: auto!important; animation-duration: .001s!important; transition-duration: .001s!important; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
/* In Kiko's frame (?embed=kiko), Kiko has the account and installing */
.in-kiko #accountMenu, .in-kiko #installButton { display: none !important; }
