@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary: #e11d48;
  --primary-deep: #881337;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --ink: #26211f;
  --muted-ink: #655e5b;
  --paper: #fffdf9;
  --canvas: #fff5ee;
  --panel: #ffffff;
  --soft: #f7e8e5;
  --line: #ebd7d1;
  --success: #17785d;
  --warning: #a65d08;
  --danger: #bd2c3a;
  --shadow-sm: 0 1px 2px rgba(55, 29, 24, .06);
  --shadow-md: 0 8px 24px rgba(81, 42, 34, .08);
  --shadow-lg: 0 22px 50px rgba(81, 42, 34, .14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-width: 248px;
  --topbar-height: 78px;
  --focus: 0 0 0 3px rgba(225, 29, 72, .28);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --primary: #fb7185;
  --primary-deep: #fecdd3;
  --accent: #7aa7ff;
  --accent-soft: #1d335c;
  --ink: #fdf7f4;
  --muted-ink: #c8bebb;
  --paper: #211c1b;
  --canvas: #171312;
  --panel: #292120;
  --soft: #3a2b2a;
  --line: #4f3b39;
  --success: #74d5b1;
  --warning: #f8c377;
  --danger: #ff9ca8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 22px 50px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); scroll-padding-top: calc(var(--topbar-height) + 20px); }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); font-family: "Work Sans", system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-sprite { display: none; }
.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; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .7rem 1rem; border-radius: var(--radius-sm); color: white; background: var(--primary-deep); transition: top .2s ease; }
.skip-link:focus { top: 1rem; outline: none; box-shadow: var(--focus); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; display: flex; flex-direction: column; width: var(--sidebar-width); height: 100vh; padding: 1.8rem 1.15rem 1.25rem; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); }
.brand { display: inline-flex; align-items: center; gap: .65rem; padding: .25rem .6rem; font-family: Outfit, sans-serif; font-size: 1.65rem; font-weight: 700; letter-spacing: -.05em; color: var(--primary-deep); }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 8px; color: var(--primary); background: #ffe5e9; }
.brand-mark svg { width: 1.45rem; height: 1.45rem; fill: currentColor; stroke: none; }
.side-nav { display: grid; gap: .38rem; margin-top: 3rem; }
.side-nav a, .theme-button { display: flex; align-items: center; gap: .85rem; min-height: 48px; padding: .75rem .9rem; border: 0; border-radius: 10px; color: var(--muted-ink); background: transparent; font-weight: 600; text-align: left; transition: background-color .2s ease, color .2s ease, transform .2s ease; }
.side-nav a:hover, .theme-button:hover { color: var(--primary-deep); background: var(--soft); }
.side-nav a[aria-current="page"] { color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 12%, var(--paper)); }
.side-nav a[aria-current="page"] svg { color: var(--primary); }
.sidebar-footer { display: grid; gap: .35rem; margin-top: auto; padding: .85rem .6rem .15rem; border-top: 1px solid var(--line); }
.theme-button { width: 100%; }
.text-button { width: fit-content; padding: .45rem .3rem; border: 0; color: var(--muted-ink); background: transparent; font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; }

.topbar { position: fixed; z-index: 15; top: 0; right: 0; left: var(--sidebar-width); display: flex; align-items: center; justify-content: space-between; height: var(--topbar-height); padding: 0 clamp(1.25rem, 3vw, 3rem); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(14px); }
.global-search { position: relative; display: flex; align-items: center; width: min(540px, 55vw); min-height: 46px; padding-left: 1rem; border: 1px solid var(--line); border-radius: 12px; color: var(--muted-ink); background: var(--panel); box-shadow: var(--shadow-sm); transition: border-color .2s ease, box-shadow .2s ease; }
.global-search:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.global-search input { width: 100%; min-width: 0; padding: .66rem .65rem; border: 0; outline: 0; color: var(--ink); background: transparent; }
.global-search input::placeholder { color: color-mix(in srgb, var(--muted-ink) 70%, transparent); }
.voice-button, .icon-button, .mobile-menu-button { display: inline-grid; width: 42px; height: 42px; place-items: center; padding: 0; border: 0; border-radius: 10px; color: var(--muted-ink); background: transparent; transition: background-color .2s ease, color .2s ease; }
.voice-button:hover, .icon-button:hover, .mobile-menu-button:hover { color: var(--primary-deep); background: var(--soft); }
.voice-button.is-listening { color: var(--danger); background: #ffe1e5; animation: subtle-pulse 1.25s ease-in-out infinite; }
.search-suggestions { position: absolute; z-index: 30; top: calc(100% + .55rem); right: 0; left: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-lg); }
.search-suggestions button { display: grid; grid-template-columns: 36px 1fr; gap: .75rem; width: 100%; padding: .7rem; border: 0; color: var(--ink); background: transparent; text-align: left; }
.search-suggestions button:hover, .search-suggestions button:focus-visible { background: var(--soft); outline: 0; }
.suggestion-cover { width: 36px; height: 48px; border-radius: 5px; object-fit: cover; background: var(--soft); }
.suggestion-text { min-width: 0; }
.suggestion-text b, .suggestion-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-text small { color: var(--muted-ink); font-size: .78rem; }
.topbar-actions { display: flex; align-items: center; gap: .35rem; }
.icon-button { position: relative; }
.notification-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border: 1.5px solid var(--paper); border-radius: 50%; background: var(--primary); }
.account-button { display: flex; align-items: center; gap: .5rem; min-height: 42px; padding: .3rem .45rem; border: 0; border-radius: 12px; color: var(--ink); background: transparent; font-weight: 600; }
.account-button:hover { background: var(--soft); }
.account-button svg { width: 1rem; height: 1rem; color: var(--muted-ink); }
.avatar { display: inline-grid; width: 42px; height: 42px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; color: var(--primary-deep); background: #ffe6eb; font-family: Outfit, sans-serif; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: .78rem; }
.mobile-menu-button { display: none; }

.main-content { grid-column: 2; padding: calc(var(--topbar-height) + 2.25rem) clamp(1.25rem, 4vw, 4.5rem) 4.5rem; }
.page { width: min(1250px, 100%); margin: 0 auto; }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.8rem; }
.page-eyebrow { margin: 0 0 .35rem; color: var(--primary); font-size: .76rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-family: Outfit, sans-serif; line-height: 1.1; letter-spacing: -.035em; }
h1 { margin-bottom: .5rem; font-size: clamp(2rem, 3.8vw, 3.35rem); }
h2 { margin-bottom: .4rem; font-size: clamp(1.35rem, 2.3vw, 1.85rem); }
h3 { margin-bottom: .4rem; font-size: 1.12rem; }
.page-lead { max-width: 62ch; margin: 0; color: var(--muted-ink); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 1rem; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.section-heading a, .section-heading button { padding: .35rem 0; border: 0; color: var(--primary-deep); background: transparent; font-size: .88rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.card { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel); box-shadow: var(--shadow-sm); }
.card-pad { padding: clamp(1rem, 2.5vw, 1.55rem); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .9fr); gap: 1.25rem; }
.hero-card { position: relative; min-height: 280px; overflow: hidden; padding: clamp(1.5rem, 4vw, 3rem); border: 0; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(125deg, #7c1c3a, #b83055 55%, #e67575); box-shadow: var(--shadow-md); }
.hero-card::after { position: absolute; right: -10%; bottom: -42%; width: 300px; height: 300px; border: 36px solid rgba(255,255,255,.12); border-radius: 50%; content: ""; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card .eyebrow { margin: 0 0 1rem; color: #ffe6e6; font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.hero-card h1 { max-width: 13ch; font-size: clamp(2rem, 4vw, 3.8rem); }
.hero-card p { max-width: 48ch; margin-bottom: 1.45rem; color: rgba(255,255,255,.9); }
.button-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.button, .button-outline, .button-quiet { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .68rem 1rem; border: 1px solid transparent; border-radius: 10px; font-weight: 700; transition: transform .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease; }
.button:hover, .button-outline:hover, .button-quiet:hover { transform: translateY(-1px); }
.button { color: white; background: var(--accent); }
.button:hover { background: #1d4ed8; }
.button-on-dark { color: var(--primary-deep); background: white; }
.button-on-dark:hover { background: #fff4f5; }
.button-outline { border-color: var(--line); color: var(--primary-deep); background: transparent; }
.button-outline:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.button-quiet { padding-inline: .7rem; color: var(--muted-ink); background: transparent; }
.button-quiet:hover { color: var(--primary-deep); background: var(--soft); }
.button[disabled], .button-outline[disabled], .button-quiet[disabled] { pointer-events: none; opacity: .55; }
.hero-aside { display: grid; gap: 1.25rem; }
.goal-card { padding: 1.4rem; }
.goal-card header { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.goal-card h2 { margin-bottom: .15rem; font-size: 1.25rem; }
.goal-card p { margin-bottom: 1rem; color: var(--muted-ink); font-size: .92rem; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--soft); }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #f58998); transition: width .3s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: .75rem; margin-top: .55rem; color: var(--muted-ink); font-size: .78rem; }
.challenge-row { display: flex; align-items: center; gap: .8rem; padding: 1rem 0 0; }
.challenge-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--success); background: #e2f5ed; }
.challenge-row strong, .challenge-row span { display: block; }
.challenge-row span { color: var(--muted-ink); font-size: .82rem; }
.quote-card { padding: 1.35rem; color: var(--ink); background: #f7e8d2; }
.quote-card p { margin-bottom: .6rem; font-family: Outfit, sans-serif; font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.quote-card small { color: #6f5142; }

.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 1.6rem; align-items: start; }
.feed-filters { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.filter-chip { flex: 0 0 auto; min-height: 38px; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted-ink); background: var(--panel); font-size: .86rem; font-weight: 600; }
.filter-chip:hover, .filter-chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--panel)); }
.feed-list { display: grid; gap: 1rem; margin-top: 1rem; }
.post { padding: 1.2rem; }
.post-top { display: flex; align-items: center; gap: .7rem; }
.post-author { min-width: 0; flex: 1; }
.post-author strong, .post-author small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-author small { color: var(--muted-ink); font-size: .78rem; }
.post-menu { width: 34px; height: 34px; border: 0; border-radius: 8px; color: var(--muted-ink); background: transparent; font-size: 1.25rem; }
.post-menu:hover { background: var(--soft); }
.post-book { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .9rem; align-items: center; margin: 1rem 0 .8rem; padding: .75rem; border-radius: 12px; background: var(--soft); }
.post-book:hover { background: color-mix(in srgb, var(--soft) 75%, var(--primary) 7%); }
.post-book .book-cover { width: 72px; height: 96px; }
.post-book h3 { overflow: hidden; margin: 0 0 .2rem; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.post-book p { margin: 0; color: var(--muted-ink); font-size: .83rem; }
.post-copy { margin: .85rem 0; color: var(--ink); }
.rating { display: inline-flex; align-items: center; gap: .15rem; color: #e89a20; font-size: .96rem; font-weight: 700; }
.rating svg { width: 1rem; height: 1rem; fill: currentColor; stroke: currentColor; }
.post-actions { display: flex; gap: .4rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.post-action { display: inline-flex; align-items: center; gap: .4rem; min-height: 36px; padding: .4rem .65rem; border: 0; border-radius: 8px; color: var(--muted-ink); background: transparent; font-size: .82rem; font-weight: 600; }
.post-action:hover, .post-action.is-active { color: var(--primary-deep); background: var(--soft); }
.post-action.is-active svg { fill: currentColor; }
.side-stack { display: grid; gap: 1rem; position: sticky; top: calc(var(--topbar-height) + 1.25rem); }
.side-stack .card { padding: 1.15rem; }
.side-stack h3 { font-size: 1rem; }
.mini-user { display: flex; align-items: center; gap: .65rem; padding: .55rem 0; }
.mini-user + .mini-user { border-top: 1px solid var(--line); }
.mini-user .avatar { width: 33px; height: 33px; font-size: .75rem; }
.mini-user strong, .mini-user small { display: block; }
.mini-user small { color: var(--muted-ink); font-size: .75rem; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.book-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-sm); transition: box-shadow .2s ease, transform .2s ease; }
.book-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.book-cover { position: relative; overflow: hidden; width: 100%; aspect-ratio: 2 / 3; border-radius: 7px; background: linear-gradient(135deg, #f4ccbd, #c2626f); object-fit: cover; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover-fallback { display: grid; width: 100%; height: 100%; place-items: center; padding: .7rem; color: #fff; text-align: center; background: linear-gradient(135deg, #8e2f47, #e2786e); font-family: Outfit, sans-serif; font-size: .9rem; font-weight: 700; line-height: 1.15; }
.book-card .book-cover { border-radius: 0; }
.book-info { display: flex; min-height: 150px; flex: 1; flex-direction: column; padding: .85rem; }
.book-info h3 { display: -webkit-box; overflow: hidden; margin: 0 0 .3rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 1rem; }
.book-author { min-height: 2.4em; margin: 0 0 .6rem; color: var(--muted-ink); font-size: .8rem; }
.book-meta { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-top: auto; color: var(--muted-ink); font-size: .74rem; }
.book-meta .rating { font-size: .78rem; }
.discover-controls { display: grid; grid-template-columns: 1fr auto; gap: .75rem; margin: 1.25rem 0; }
.input, .select { width: 100%; min-height: 46px; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--panel); }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: var(--focus); }
.book-detail { display: grid; grid-template-columns: minmax(180px, 250px) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.book-detail-cover { border-radius: 14px; box-shadow: var(--shadow-md); }
.book-detail .book-cover { border-radius: 14px; }
.book-detail h1 { margin-bottom: .5rem; }
.book-subtitle { margin: -.25rem 0 .75rem; color: var(--muted-ink); }
.genre-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tag { display: inline-flex; align-items: center; min-height: 27px; padding: .18rem .55rem; border-radius: 999px; color: var(--primary-deep); background: color-mix(in srgb, var(--primary) 10%, var(--panel)); font-size: .74rem; font-weight: 700; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0; }
.summary { max-width: 76ch; color: var(--muted-ink); }
.review-list { display: grid; gap: .75rem; }
.review-item { padding: 1rem; }
.review-item header { display: flex; align-items: center; gap: .65rem; margin-bottom: .6rem; }
.review-item p { margin: 0; color: var(--muted-ink); font-size: .92rem; }

.shelf-tabs { display: flex; gap: .4rem; overflow-x: auto; margin-bottom: 1.2rem; padding-bottom: .25rem; }
.shelf-tab { flex: 0 0 auto; min-height: 42px; padding: .5rem .8rem; border: 0; border-bottom: 2px solid transparent; color: var(--muted-ink); background: transparent; font-size: .88rem; font-weight: 700; }
.shelf-tab[aria-selected="true"] { border-bottom-color: var(--primary); color: var(--primary-deep); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.shelf-book { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: .85rem; padding: .8rem; }
.shelf-book .book-cover { width: 72px; height: 100px; border-radius: 7px; }
.shelf-book h3 { margin: 0 0 .25rem; font-size: 1rem; }
.shelf-book p { margin: 0 0 .55rem; color: var(--muted-ink); font-size: .8rem; }
.shelf-book .progress-track { height: 6px; }
.shelf-book .book-actions { display: flex; align-items: center; gap: .45rem; margin-top: .7rem; }
.small-action { min-height: 32px; padding: .3rem .55rem; border: 0; border-radius: 7px; color: var(--primary-deep); background: var(--soft); font-size: .75rem; font-weight: 700; }
.small-action:hover { background: color-mix(in srgb, var(--primary) 18%, var(--soft)); }

.profile-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1.1rem; align-items: center; padding: clamp(1.2rem, 3vw, 2rem); }
.profile-hero .avatar { width: 86px; height: 86px; font-size: 1.8rem; }
.profile-hero h1 { margin: 0 0 .25rem; font-size: 2rem; }
.profile-hero p { margin: 0; color: var(--muted-ink); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; min-width: 240px; }
.stat { text-align: center; }
.stat strong, .stat span { display: block; }
.stat strong { font-family: Outfit, sans-serif; font-size: 1.35rem; }
.stat span { color: var(--muted-ink); font-size: .72rem; }
.profile-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr); gap: 1rem; margin-top: 1rem; }
.profile-columns .card { padding: 1.15rem; }
.genre-list { display: flex; flex-wrap: wrap; gap: .45rem; }

.friends-layout, .groups-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; }
.list-card { display: grid; gap: .2rem; padding: .8rem 1rem; }
.friend-row, .group-row { display: flex; align-items: center; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.friend-row:last-child, .group-row:last-child { border-bottom: 0; }
.friend-row .grow, .group-row .grow { min-width: 0; flex: 1; }
.friend-row strong, .friend-row small, .group-row strong, .group-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-row small, .group-row small { color: var(--muted-ink); font-size: .76rem; }
.group-row { align-items: flex-start; }
.group-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 12px; color: var(--primary-deep); background: #ffe2dc; font-family: Outfit, sans-serif; font-weight: 700; }
.empty-state { display: grid; min-height: 240px; place-items: center; padding: 2rem; text-align: center; }
.empty-state > div { max-width: 360px; }
.empty-state h2 { margin: .7rem 0 .45rem; }
.empty-state p { color: var(--muted-ink); }
.empty-icon { display: grid; width: 56px; height: 56px; margin: 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--panel)); }
.empty-icon svg { width: 1.6rem; height: 1.6rem; }

.modal-backdrop { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(34, 24, 22, .52); backdrop-filter: blur(4px); }
.modal { width: min(560px, 100%); max-height: min(720px, calc(100vh - 2rem)); overflow: auto; padding: 1.3rem; border-radius: var(--radius-lg); color: var(--ink); background: var(--panel); box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.modal-header h2 { margin: 0; font-size: 1.35rem; }
.modal-close { display: grid; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 8px; color: var(--muted-ink); background: transparent; }
.modal-close:hover { color: var(--primary-deep); background: var(--soft); }
.form-grid { display: grid; gap: .9rem; }
.form-grid label { display: grid; gap: .38rem; color: var(--ink); font-size: .87rem; font-weight: 700; }
.form-grid textarea { min-height: 110px; resize: vertical; }
.form-grid .button-row { margin-top: .35rem; }
.star-picker { display: flex; gap: .2rem; }
.star-picker button { display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 0; color: #d1b27d; background: transparent; }
.star-picker button[aria-pressed="true"] { color: #e89a20; }
.star-picker svg { fill: currentColor; stroke: currentColor; }
.toast-region { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; display: grid; gap: .6rem; width: min(390px, calc(100% - 2rem)); }
.toast { padding: .85rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-md); font-size: .9rem; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.loading { display: grid; min-height: 280px; place-items: center; color: var(--muted-ink); }
.loading::before { width: 28px; height: 28px; border: 3px solid var(--soft); border-top-color: var(--primary); border-radius: 50%; content: ""; animation: spin .8s linear infinite; }
.noscript-notice { max-width: 720px; margin: 2rem auto; padding: 1.5rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes subtle-pulse { 50% { box-shadow: 0 0 0 8px rgba(225, 29, 72, .08); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

@media (max-width: 1060px) {
  .feed-layout { grid-template-columns: minmax(0, 1fr); }
  .side-stack { display: none; }
  .hero-grid, .profile-columns { grid-template-columns: 1fr; }
  .profile-hero { grid-template-columns: auto 1fr; }
  .stat-row { grid-column: 1 / -1; max-width: 420px; }
}
@media (max-width: 820px) {
  :root { --topbar-height: 66px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-101%); width: min(290px, 88vw); padding-top: 1.2rem; box-shadow: var(--shadow-lg); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .topbar { left: 0; padding: 0 1rem; }
  .mobile-menu-button { display: inline-grid; margin-right: .45rem; }
  .global-search { width: min(100%, 520px); }
  .account-name { display: none; }
  .main-content { padding: calc(var(--topbar-height) + 1.5rem) 1rem 5rem; }
  .friends-layout, .groups-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar { gap: .4rem; }
  .global-search { flex: 1; min-width: 0; }
  .global-search input { font-size: .9rem; }
  .topbar-actions .icon-button { display: none; }
  .hero-card { min-height: 260px; }
  .hero-grid { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .book-info { min-height: 137px; padding: .7rem; }
  .book-info h3 { font-size: .9rem; }
  .book-author { font-size: .74rem; }
  .book-detail { grid-template-columns: 120px minmax(0, 1fr); gap: 1rem; }
  .book-detail-cover { width: 120px; }
  .book-detail h1 { font-size: 1.7rem; }
  .book-detail .summary, .book-detail .detail-actions, .book-detail .genre-row, .book-detail .rating { grid-column: 1 / -1; }
  .page-header { align-items: start; flex-direction: column; gap: .7rem; }
  .profile-hero { grid-template-columns: 1fr; text-align: center; }
  .profile-hero .avatar { margin: 0 auto; }
  .stat-row { min-width: 0; }
  .discover-controls { grid-template-columns: 1fr; }
  .account-button { padding: .3rem; }
  .account-button svg { display: none; }
}
