:root {
  --pc: #B4306E; --on-pc: #ffffff; --pc-cont: #FFD8E6; --on-pc-cont: #3E001D;
  --sec: #B4306E; --tert: #1E9E6A;
  --bg: #FFF7FA; --surf: #FFFFFF;
  --surf-1: #FBEEF3; --surf-2: #F6E4EC; --surf-3: #F1DBE5;
  --on-surf: #201A1C; --on-surf-var: #6B5B62;
  --outline: #E4CBD5; --error: #B3261E;
  --font: 'Roboto Flex', sans-serif; --display: 'Bricolage Grotesque', sans-serif;
}
body[data-theme="dark"] {
  --pc: #FFB0CB; --on-pc: #5E1136; --pc-cont: #7C294E; --on-pc-cont: #FFD8E6;
  --bg: #191113; --surf: #201A1C;
  --surf-1: #271F22; --surf-2: #2C2327; --surf-3: #34292E;
  --on-surf: #ECE0E4; --on-surf-var: #C6A9B3;
  --outline: #4A3A40;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--on-surf);
  overscroll-behavior: none;
}
a { color: var(--pc); }

.app-root { display: flex; flex-direction: column; height: 100vh; max-width: 620px; margin: 0 auto; position: relative; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surf-1); position: sticky; top: 0; z-index: 20;
  border-radius: 0 0 24px 24px;
}
.topbar-title-wrap { display: flex; align-items: center; gap: 6px; flex: 1; }
.topbar-title { font-family: var(--display); font-weight: 700; font-size: 24px; letter-spacing: -.5px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 42px; height: 42px; border: none; background: transparent; color: var(--on-surf);
  border-radius: 50%; display: grid; place-items: center; cursor: pointer; transition: background .2s;
}
.icon-btn:active { background: var(--surf-3); transform: scale(.9); }

/* scroll area */
.main-scroll { flex: 1; overflow-y: auto; padding: 12px 12px 120px; }

/* M3 buttons */
.m3-btn {
  position: relative; overflow: hidden; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  padding: 11px 22px; border-radius: 100px; display: inline-flex; align-items: center; gap: 8px;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .2s, background .2s;
}
.m3-btn:active { transform: scale(.93); border-radius: 16px; }
.m3-filled { background: var(--pc); color: var(--on-pc); }
.m3-tonal { background: var(--pc-cont); color: var(--on-pc-cont); }
.m3-outlined { background: transparent; color: var(--pc); border: 1.5px solid var(--outline); }
.m3-text { background: transparent; color: var(--pc); padding: 10px 14px; }
.m3-disabled { opacity: .4; cursor: not-allowed; }
.ripple {
  position: absolute; width: 12px; height: 12px; background: rgba(255,255,255,.5);
  border-radius: 50%; transform: translate(-50%,-50%); animation: rip .6s ease-out;
  pointer-events: none;
}
.m3-tonal .ripple, .m3-text .ripple, .m3-outlined .ripple { background: rgba(180,48,110,.3); }
@keyframes rip { to { width: 220px; height: 220px; opacity: 0; } }

/* Avatars */
.avatar { width: 40px; height: 40px; border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; display: grid; place-items: center; color: #fff; font-weight: 700; text-transform: uppercase; font-family: var(--display); flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar.big { width: 64px; height: 64px; font-size: 30px; }
.avatar.huge { width: 96px; height: 96px; font-size: 44px; margin: 0 auto; }
.avatar.clickable { border: none; cursor: pointer; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar { overflow: hidden; }

/* Author links */
.author-link { cursor: pointer; transition: color .15s; }
.author-link:hover { color: var(--pc); text-decoration: underline; }

/* Profile page */
.profile-page { position: relative; }
.profile-back { align-self: flex-start; }
.profile-bio { color: var(--on-surf-var); font-size: 14px; max-width: 340px; text-align: center; line-height: 1.5; }
.profile-stats { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--on-surf-var); }
.profile-stats b { color: var(--on-surf); }
.profile-posts-label { align-self: stretch; margin-top: 16px; display: flex; align-items: center; gap: 6px; }
.page-title { display: inline-flex; align-items: center; gap: 8px; }

/* Edit profile */
.edit-avatar-preview { display: flex; justify-content: center; margin: 8px 0 16px; }
.edit-avatar-img { width: 110px; height: 110px; border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%; object-fit: cover; }
.field-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--on-surf-var); margin-top: 6px; }
.gen-row { display: flex; gap: 8px; }
.gen-row .m3-input { flex: 1; }

/* Auth error */
.auth-err { color: var(--error); font-size: 13px; text-align: center; margin-top: 10px; font-weight: 600; }

/* Admin FAB */
.admin-fab { position: fixed; left: max(16px, calc(50% - 310px + 16px)); bottom: 90px; z-index: 30; width: 56px; height: 56px; border-radius: 20px; border: none; background: var(--error); cursor: pointer; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(179,38,30,.4); transition: transform .2s cubic-bezier(.34,1.56,.64,1); }
.admin-fab:active { transform: scale(.9) rotate(8deg); }

/* Music player */
.music-mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: 82px; z-index: 40; width: min(600px, calc(100% - 24px)); background: var(--surf-3); border-radius: 20px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: snackIn .35s cubic-bezier(.34,1.56,.64,1); }
.music-mini-thumb { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.music-mini-info { flex: 1; min-width: 0; }
.music-mini-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-mini-artist { font-size: 11px; color: var(--on-surf-var); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-ctrl { border: none; background: transparent; color: var(--on-surf); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; transition: transform .15s, background .2s; }
.music-ctrl:active { transform: scale(.85); background: var(--surf-1); }
.music-ctrl.big { background: var(--pc); color: var(--on-pc); }
.music-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; max-height: 55vh; overflow-y: auto; }
.music-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 16px; cursor: pointer; transition: background .2s, transform .15s; }
.music-item:active { transform: scale(.98); }
.music-item:hover, .music-item-on { background: var(--surf-3); }
.music-thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
.music-thumb.ph { display: grid; place-items: center; background: var(--surf-2); color: var(--on-surf-var); }
.music-item-info { flex: 1; min-width: 0; }
.music-item-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-item-artist { font-size: 12px; color: var(--on-surf-var); }

/* Cards / feed */
.feed, .sub-view, .explore-view, .profile-view, .detail-page { display: flex; flex-direction: column; gap: 14px; animation: fadeUp .5s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } }
.welcome-card { background: linear-gradient(135deg, var(--pc), var(--tert)); color: #fff; padding: 22px; border-radius: 28px; }
.welcome-card h2 { font-family: var(--display); font-size: 26px; margin-bottom: 4px; }
.welcome-card p { opacity: .92; font-size: 14px; }

.post-card {
  background: var(--surf-1); border-radius: 26px; padding: 16px; cursor: pointer;
  transition: transform .2s cubic-bezier(.34,1.4,.64,1), background .2s;
  animation: fadeUp .5s cubic-bezier(.2,.8,.2,1);
}
.post-card:active { transform: scale(.98); background: var(--surf-2); }
.post-card.static { cursor: default; }
.post-card.static:active { transform: none; }
.post-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--on-surf-var); flex-wrap: wrap; }
.post-sub { font-weight: 700; color: var(--on-surf); }
.post-dot { opacity: .5; }
.pin-chip { margin-left: auto; background: var(--tert); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.post-title { font-family: var(--display); font-size: 18px; font-weight: 700; margin: 10px 0 8px; line-height: 1.25; }
.post-title.big { font-size: 24px; }
.flair-chip { display: inline-block; background: var(--pc-cont); color: var(--on-pc-cont); font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 100px; }
.post-body { color: var(--on-surf-var); font-size: 14px; margin-top: 10px; line-height: 1.5; }
.post-body.full { color: var(--on-surf); }
.essay-teaser { margin-top: 12px; background: var(--surf-3); padding: 12px 14px; border-radius: 16px; font-size: 13px; color: var(--on-surf-var); }
.post-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

/* Vote widget */
.vote-widget { display: flex; align-items: center; gap: 4px; background: var(--surf-3); border-radius: 100px; padding: 3px; }
.vote-btn { border: none; background: transparent; color: var(--on-surf-var); width: 34px; height: 30px; border-radius: 100px; cursor: pointer; display: grid; place-items: center; transition: transform .15s cubic-bezier(.34,1.56,.64,1), background .2s, color .2s; }
.vote-btn:active { transform: scale(1.3); }
.vote-up-on { background: var(--tert); color: #fff; }
.vote-down-on { background: var(--error); color: #fff; }
.vote-count { font-weight: 700; font-size: 14px; min-width: 22px; text-align: center; }
.action-chip { display: flex; align-items: center; gap: 6px; background: var(--surf-3); border-radius: 100px; padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--on-surf-var); }

/* Sub view */
.sub-banner { color: #fff; padding: 22px; border-radius: 28px; display: flex; align-items: center; gap: 16px; }
.sub-name-row { display: flex; align-items: center; gap: 8px; }
.sub-name-row h1 { font-family: var(--display); font-size: 26px; }
.sub-desc { opacity: .92; font-size: 13px; margin-top: 4px; }

/* Sub hero (image + name overlay) */
.sub-hero { position: relative; border-radius: 28px; overflow: hidden; min-height: 180px; display: flex; }
.sub-hero-img { width: 100%; height: 200px; object-fit: cover; display: block; }
.sub-hero-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 14px; padding: 18px 22px; }
.sub-hero-overlay .avatar.big { border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.sub-hero-overlay h1 { font-family: var(--display); font-size: 28px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); }

/* About community card */
.sub-about-card { background: var(--surf-1); border-radius: 24px; padding: 18px 20px; }
.sub-about-label { font-family: var(--display); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--on-surf-var); margin-bottom: 8px; }
.sub-about-desc { font-size: 15px; line-height: 1.5; color: var(--on-surf); }
.sub-stats { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--on-surf-var); }
.sub-stats b { color: var(--on-surf); }
.sub-stats-dot { opacity: .5; }

/* Sort tabs */
.sort-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px; }
.sort-chip { flex-shrink: 0; border: 1.5px solid var(--outline); background: transparent; color: var(--on-surf-var); font-family: var(--font); font-weight: 600; font-size: 13px; padding: 8px 18px; border-radius: 100px; cursor: pointer; transition: transform .18s cubic-bezier(.34,1.56,.64,1), background .2s, color .2s, border-color .2s; }
.sort-chip:active { transform: scale(.9); }
.sort-on { background: var(--pc); color: var(--on-pc); border-color: var(--pc); }

/* Explore */
.page-title { font-family: var(--display); font-size: 28px; margin-bottom: 6px; }
.sub-tile { display: flex; align-items: center; gap: 14px; background: var(--surf-1); border-radius: 22px; padding: 14px; cursor: pointer; transition: transform .2s cubic-bezier(.34,1.4,.64,1), background .2s; }
.sub-tile:active { transform: scale(.98); background: var(--surf-2); }
.sub-tile-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sub-tile-desc { font-size: 13px; color: var(--on-surf-var); margin-top: 2px; }
.banned-tag { background: var(--error); color: #fff; font-size: 9px; font-weight: 800; padding: 2px 7px; border-radius: 100px; }
.banned-tag.big { display: inline-block; margin: 8px auto; padding: 5px 14px; font-size: 12px; }

/* Profile */
.profile-view { align-items: center; text-align: center; padding-top: 24px; gap: 12px; }
.admin-badge { display: inline-flex; align-items: center; gap: 5px; background: var(--error); color: #fff; font-weight: 800; font-size: 12px; padding: 5px 14px; border-radius: 100px; }
.guest-note, .muted-note { color: var(--on-surf-var); font-size: 14px; max-width: 320px; }
.muted-note { color: var(--error); }

/* Comments */
.section-label { font-family: var(--display); font-size: 18px; margin: 8px 0; }
.comment-box { display: flex; flex-direction: column; gap: 10px; }
.comment { display: flex; gap: 10px; background: var(--surf-1); border-radius: 20px; padding: 12px; }
.comment-author { font-weight: 700; font-size: 13px; }
.comment-body { font-size: 14px; color: var(--on-surf-var); margin-top: 2px; }
.empty-mini { text-align: center; color: var(--on-surf-var); padding: 20px; }

/* Inputs */
.m3-input { width: 100%; font-family: var(--font); font-size: 15px; padding: 14px 16px; border: 1.5px solid var(--outline); border-radius: 16px; background: var(--surf); color: var(--on-surf); resize: vertical; }
.m3-input:focus { outline: none; border-color: var(--pc); border-width: 2px; }

/* FAB */
.fab {
  position: fixed; right: max(16px, calc(50% - 310px + 16px)); bottom: 90px; z-index: 30;
  background: var(--pc-cont); color: var(--on-pc-cont); border: none; cursor: pointer;
  height: 60px; padding: 0 22px; border-radius: 22px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 18px rgba(180,48,110,.35); font-weight: 700; font-size: 15px;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1);
}
.fab:active { transform: scale(.9) rotate(-8deg); border-radius: 30px; }
.fab-label { color: var(--on-pc-cont); }

/* Bottom nav */
.bottom-nav {
  position: sticky; bottom: 0; display: flex; justify-content: space-around;
  background: var(--surf-2); padding: 10px 8px 14px; z-index: 20;
  border-radius: 24px 24px 0 0;
}
.nav-item { border: none; background: transparent; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--on-surf-var); flex: 1; }
.nav-pill { width: 64px; height: 34px; display: grid; place-items: center; border-radius: 100px; transition: background .3s cubic-bezier(.34,1.4,.64,1), transform .2s; }
.nav-item:active .nav-pill { transform: scale(.85); }
.nav-label { font-size: 11px; font-weight: 600; }
.nav-on { color: var(--pc); }
.nav-on .nav-pill { background: var(--pc-cont); color: var(--on-pc-cont); }

/* Dialogs */
.dialog-scrim, .sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: var(--surf-1); border-radius: 28px; padding: 24px; width: 100%; max-width: 400px; animation: pop .4s cubic-bezier(.34,1.56,.64,1); }
.dialog.wide { max-width: 460px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.dialog-icon { width: 56px; height: 56px; background: var(--pc-cont); border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%; display: grid; place-items: center; margin: 0 auto 16px; color: var(--on-pc-cont); }
.dialog-icon svg { fill: var(--on-pc-cont); }
.dialog-title { font-family: var(--display); font-size: 22px; text-align: center; margin-bottom: 8px; }
.dialog-text { color: var(--on-surf-var); font-size: 14px; text-align: center; margin-bottom: 16px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.tabs { display: flex; background: var(--surf-3); border-radius: 100px; padding: 4px; margin-bottom: 16px; }
.tab { flex: 1; border: none; background: transparent; padding: 10px; border-radius: 100px; font-family: var(--font); font-weight: 600; cursor: pointer; color: var(--on-surf-var); transition: all .2s; }
.tab-on { background: var(--pc); color: var(--on-pc); }
.color-row { display: flex; gap: 12px; justify-content: center; }
.color-dot { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform .2s; }
.color-dot:active { transform: scale(.85); }
.color-on { border-color: var(--on-surf); transform: scale(1.15); }

/* Bottom sheet (admin) */
.sheet-scrim { align-items: flex-end; padding: 0; }
.sheet { background: var(--surf-1); width: 100%; max-width: 620px; border-radius: 28px 28px 0 0; padding: 12px 20px 32px; max-height: 88vh; overflow-y: auto; animation: slideUp .4s cubic-bezier(.2,.8,.2,1); }
@keyframes slideUp { from { transform: translateY(100%); } }
.sheet-handle { width: 40px; height: 4px; background: var(--outline); border-radius: 4px; margin: 4px auto 18px; }
.admin-head { display: flex; align-items: center; gap: 10px; }
.admin-head h2 { font-family: var(--display); font-size: 22px; }
.admin-sub { color: var(--on-surf-var); font-size: 13px; margin: 4px 0 18px; }
.admin-block { background: var(--surf); border-radius: 20px; padding: 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.admin-block h4 { font-size: 15px; }

/* Banned page */
.banned-page { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 60px 20px; gap: 12px; animation: fadeUp .5s; }
.banned-icon { width: 120px; height: 120px; background: var(--surf-2); border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%; display: grid; place-items: center; margin-bottom: 8px; }
.banned-page h1 { font-family: var(--display); font-size: 40px; color: var(--error); }
.banned-msg { font-size: 17px; color: var(--on-surf); max-width: 340px; line-height: 1.5; }
.banned-sub { font-weight: 700; color: var(--on-surf-var); margin-bottom: 12px; }

/* Essay page */
.essay-page { max-width: 640px; margin: 0 auto; padding: 20px 22px 80px; min-height: 100vh; background: var(--bg); position: relative; animation: fadeUp .5s; }
.essay-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.essay-flair { background: var(--tert); color: #fff; font-size: 11px; font-weight: 700; padding: 5px 14px; border-radius: 100px; }
.essay-title { font-family: var(--display); font-size: clamp(28px, 6vw, 40px); line-height: 1.1; margin-bottom: 16px; letter-spacing: -1px; }
.essay-byline { display: flex; align-items: center; gap: 8px; margin-bottom: 26px; color: var(--on-surf-var); font-size: 14px; }
.essay-body { font-size: 17px; line-height: 1.75; }
.essay-p { margin-bottom: 20px; }
.essay-word { cursor: pointer; border-radius: 3px; transition: background .15s; padding: 0 1px; }
.essay-word:hover { background: var(--pc-cont); }
.essay-word.defined { text-decoration: underline; text-decoration-color: var(--tert); text-decoration-thickness: 3px; text-underline-offset: 3px; background: rgba(30,158,106,.12); }
.def-pop { position: fixed; z-index: 100; background: var(--surf-1); border: 1.5px solid var(--tert); border-radius: 18px; padding: 14px 16px; max-width: 280px; box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: pop .25s cubic-bezier(.34,1.56,.64,1); }
.def-word { font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--tert); margin-bottom: 4px; text-transform: capitalize; }
.def-text { font-size: 14px; line-height: 1.5; color: var(--on-surf); }

/* Snackbar */
.snackbar { position: fixed; bottom: 160px; left: 50%; transform: translateX(-50%); background: var(--on-surf); color: var(--surf); padding: 14px 22px; border-radius: 16px; font-size: 14px; font-weight: 500; z-index: 200; max-width: 90%; text-align: center; animation: snackIn .35s cubic-bezier(.34,1.56,.64,1); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
@keyframes snackIn { from { transform: translate(-50%, 30px); opacity: 0; } }

/* Footer */
.foot { text-align: center; padding: 24px 0 8px; font-size: 13px; color: var(--on-surf-var); }
.foot a { font-weight: 600; }
</parameter>
</invoke>