/* Fiction Realm: the website's look, matching the app (dark purple, lavender, white pill buttons, glass cards).
   The app itself keeps using site.css for the pages it shows; this file is only for browsers.
   TO CHANGE THE LOOK: the colors, sizes and corners are listed right below. */
@font-face { font-family: "Inspiration"; src: url("/fonts/Inspiration-Regular.ttf") format("truetype"); font-display: block; }

:root {
  --bg: #1a0129;
  --surface: #28103f;
  --surface-2: #321650;
  --glass: rgba(255, 255, 255, 0.075)
  --glass-2: rgba(255, 255, 255, .1);
  --text: #ffffff;
  --muted: #c4b4ee;
  --lavender: #d6c4ff;
  --lavender-soft: rgba(214, 196, 255, .14);
  --cover: #3b1f66;
  --border: rgba(255, 255, 255, .14);
  --border-strong: rgba(255, 255, 255, .24);
  --link: #d6c4ff;
  --button: #ffffff;
  --button-hover: #e9dcff;
  --button-text: #1a0129;
  --focus: #ac9fca;
  --danger: #ff8ca0;
  --gold: #ffd46b;

  --radius: 22px;
  --radius-small: 14px;
  --page-width: 1180px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --title-font: "Inspiration", "Snell Roundhand", cursive;
  --story-font: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-size: 16px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--font-size); background: var(--bg); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body > main { flex: 1 0 auto; width: 100%; }
.site-header .wrap.bar { max-width: 1380px; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; margin: 1.4em 0 .5em; color: var(--text); }
h1 { font-size: 2rem; margin-top: .3em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: .6em 0; }
small { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.6rem 0; }
ul, ol { padding-left: 1.4rem; }
li { margin: .2rem 0; }
strong, b { color: inherit; }
::selection { background: rgba(214, 196, 255, .35); }

a { color: var(--link); text-decoration: underline; text-decoration-color: rgba(214, 196, 255, .35); text-underline-offset: 3px; }
a:hover { color: var(--text); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.fr-navigation-focus:focus { outline: none; }
.error-page { min-height: 100vh; background: radial-gradient(circle at 50% 18%, #351254 0, var(--bg) 48%); }
.error-page-shell { width: min(720px, calc(100% - 32px)); min-height: 100vh; margin: auto; padding: 42px 0; display: grid; align-content: center; gap: 24px; }
.error-page-brand { justify-self: center; color: var(--text); text-decoration: none; font: 400 3rem/1 var(--title-font); }
.error-page-card { padding: clamp(28px, 6vw, 58px); border: 1px solid var(--border-strong); border-radius: var(--radius); background: rgba(40,16,63,.86); text-align: center; box-shadow: 0 30px 90px rgba(8,0,15,.38); backdrop-filter: blur(16px); }
.error-page-code { display: inline-flex; padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px; color: var(--lavender); font-size: .78rem; font-weight: 800; letter-spacing: .12em; }
.error-page-card h1 { margin: 18px 0 8px; font-size: clamp(2rem, 6vw, 3.3rem); }
.error-page-card p { max-width: 530px; margin: 0 auto 28px; color: var(--muted); font-size: 1.03rem; white-space: pre-line; }
.error-page-action { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0 20px; border-radius: 999px; background: var(--button); color: var(--button-text); font-weight: 750; text-decoration: none; }
.error-page-action:hover { background: var(--button-hover); color: var(--button-text); }

.wrap { max-width: var(--page-width); margin: 0 auto; padding: 0 24px; }
main.page { padding-top: 28px; padding-bottom: 80px; min-height: 60vh; position: relative; z-index: 1; }

/* ---------- the stars behind every page (placed by fx.js) ---------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky i { position: absolute; background: url("/fx/star.png") center / contain no-repeat; animation: twinkle var(--p, 3s) ease-in-out var(--d, 0s) infinite alternate; opacity: var(--lo, .35); }
@keyframes twinkle { from { opacity: var(--lo, .35); } to { opacity: var(--hi, .6); } }
.site-header, .section-head, .site-footer { position: relative; z-index: 2; }

/* ---------- the spinning planet (logo, welcome page, loading) ---------- */
.planet { --ps: 40px; position: relative; display: inline-block; width: var(--ps); height: var(--ps); flex: none; }
.planet > span { position: absolute; display: block; }
.planet-back, .planet-front { inset: 0; background: center / 100% 100% no-repeat; }
.planet-back { background-image: url("/fx/planet-back.png"); }
.planet-front { background-image: url("/fx/planet-front.png"); }
.planet-window { left: 21%; top: 21%; width: 58%; height: 58%; border-radius: 50%; overflow: hidden; }
.planet-bands {
  position: absolute; display: block; inset: 0; background: url("/fx/planet-bands.png") repeat-x;
  background-size: calc(var(--ps) * 1.2) var(--ps);
  background-position: calc(var(--ps) * -0.21) calc(var(--ps) * -0.21);
  animation: planet-turn 14s linear infinite;
}
@keyframes planet-turn {
  from { background-position: calc(var(--ps) * -0.21) calc(var(--ps) * -0.21); }
  to { background-position: calc(var(--ps) * -1.41) calc(var(--ps) * -0.21); }
}
.planet-spinner { position: relative; display: inline-block; width: 48px; height: 48px; }
.planet-spinner .planet { --ps: 36px; position: absolute; left: 6px; top: 6px; }
.planet-spinner .moon { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: var(--button); box-shadow: 0 0 6px #fff;
  offset-path: path("M 23 0 A 23 8.7 0 1 1 -23 0 A 23 8.7 0 1 1 23 0"); offset-rotate: 0deg; animation: moon-orbit 1.1s linear infinite; transform: rotate(-20deg); }
@keyframes moon-orbit { from { offset-distance: 0%; } to { offset-distance: 100%; } }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; border-bottom: 1px solid rgba(255, 255, 255, .1);
  background: rgba(26, 1, 41, .82); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.site-header .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 10px; padding-bottom: 10px; }
.site-header .brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-right: 4px; }
.site-header .brand .planet { --ps: 42px; }
.site-header .brand .planet-bands { animation-duration: 8s; }
.site-header .brand-name { font-family: var(--title-font); font-size: 2.6rem; line-height: 1; font-weight: 400; white-space: nowrap; padding-top: 4px; }
.site-header .main-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.site-header .main-nav a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.site-header .main-nav a:hover { color: var(--text); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.site-header .main-nav a.on { color: var(--text); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }
.quick-search {
  flex: 1 1 120px; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; padding: 0 16px;
  border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border);
}
.quick-search:focus-within { border-color: var(--border); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); box-shadow: none; outline: none; }
.quick-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.quick-search input, .quick-search input:focus { flex: 1; min-width: 0; background: none !important; border: 0 !important; outline: none !important; box-shadow: none !important; color: var(--text); font: inherit; font-size: .95rem !important; padding: 10px 0 !important; }
.quick-search input::placeholder { color: rgba(255, 255, 255, .55); }
.quick-search-advanced{position:relative;display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:50%;color:var(--muted);text-decoration:none}.quick-search-advanced:hover{color:var(--text);background:var(--glass-2)}.quick-search-advanced svg{width:18px;height:18px}.quick-search-advanced::after{content:attr(data-tip);position:absolute;z-index:1001;top:calc(100% + 10px);right:0;width:max-content;padding:6px 9px;border:1px solid var(--border);border-radius:8px;background:var(--panel);color:var(--text);font-size:.7rem;font-weight:600;box-shadow:0 10px 28px rgba(0,0,0,.28);opacity:0;transform:translateY(-3px);pointer-events:none;transition:.15s}.quick-search-advanced:hover::after,.quick-search-advanced:focus-visible::after{opacity:1;transform:none}
.site-header .user-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.site-header .user-nav form { margin: 0; }
.create-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.nav-icon, .nav-me {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%; font-size: 0; text-decoration: none; color: var(--text);
  background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border);
}
.nav-icon:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.nav-icon.on { background: var(--button); color: var(--bg); }
.nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-me { background: none; border: 2px solid var(--lavender); overflow: visible; }
.nav-me.on { box-shadow: 0 0 0 3px rgba(214, 196, 255, .35); }
.nav-me img, .nav-me > span:not(.badge) { width: 36px !important; height: 36px !important; border-radius: 50% !important; object-fit: cover; }
.badge {
  position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--lavender); color: var(--bg); font-size: 11px; font-weight: 800; line-height: 19px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.count {
  display: inline-block; min-width: 1.5em; padding: 0 .45em; border-radius: 999px; background: var(--lavender); color: var(--bg);
  font-size: .72rem; line-height: 1.6; text-align: center; font-weight: 800; vertical-align: 1px;
}

/* ---------- section title and tabs (Discover, Bookshelf, Studio) ---------- */
.section-head { padding-top: 26px; }
.section-title { font-family: var(--title-font); font-size: 4.4rem; line-height: 1; margin: 0 0 14px; font-weight: 400; }
.section-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; width: fit-content; max-width: 100%;
  border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border);
}
.section-tabs a {
  display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 18px; border-radius: 999px;
  color: var(--muted); font-weight: 600; text-decoration: none; font-size: .95rem;
}
.section-tabs a:hover { color: var(--text); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.section-tabs a.on { background: var(--button); color: var(--bg); }
.section-tabs a.on .count { background: var(--bg); color: var(--text); }
.has-sub main.page { padding-top: 18px; }
.has-sub main.page > h1:first-of-type { font-size: 1.5rem; margin-top: .4em; }

/* page titles in the app's script font (story, chapter and profile pages keep their own titles) */
.pg-home h1, .pg-notes main > h1, .pg-inbox:not(.pg-chat) main > h1, .pg-search main h1, .pg-settings main h1,
.pg-other main.page > h1:first-of-type, .pg-auth main h1, .studio-title {
  font-family: var(--title-font); font-weight: 400; font-size: 4.2rem; line-height: 1; letter-spacing: 0; margin: .1em 0 .3em;
}
.lead { color: var(--muted); margin-top: -.2rem; font-size: 1.05rem; }

/* ---------- side menu (Settings) and the Search filters beside the results ---------- */
.side-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.side-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); }
.side-nav a, .side-nav .side-logout {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 46px; padding: 0 14px; border-radius: 14px;
  color: #e9dcff; text-decoration: none; font-weight: 600; font-size: .95rem; width: 100%;
}
.side-nav a:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.side-nav a.on { background: var(--button); color: var(--bg); }
.side-nav a.on .count { background: var(--bg); color: var(--text); }
.side-nav form { margin: 6px 0 0; padding-top: 8px; border-top: 1px solid var(--border); }
.side-nav .side-logout { background: none !important; border: 0 !important; color: var(--danger) !important; justify-content: flex-start; cursor: pointer; }
.side-nav .side-logout:hover { background: rgba(255, 140, 160, .1) !important; }
.side-main { min-width: 0; }
.side-main > h1:first-child { margin-top: 0; }

.search-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; }
.search-side { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; padding: 18px; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); scrollbar-width: thin; }
.search-main { min-width: 0; }
.search-main > h1:first-of-type { margin-top: 0; }
#topsearch { margin: 0; }
#topsearch .ts-row { display: flex; flex-direction: column; gap: 10px; }
#topsearch .ts-q { width: 100%; padding: .75rem 1rem; border-radius: 999px; }
#topsearch .ts-row > label, #topsearch .ts-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#topsearch .ts-row > label select, #topsearch .ts-grid select, #topsearch .ts-grid input[type=text] { width: 100%; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
#topsearch .ts-row > button { width: 100%; }
#topsearch details.ts-more { margin-top: 14px; }
#topsearch details.ts-more > summary { font-weight: 700; color: var(--text); list-style: none; }
#topsearch details.ts-more > summary::-webkit-details-marker { display: none; }
#topsearch .ts-panel { margin-top: 12px; }
#topsearch .ts-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
#topsearch .ts-check { margin-top: 14px; display: flex; gap: 10px; align-items: center; font-size: .95rem; }
#topsearch details.ts-warn { margin-top: 14px; }
#topsearch details.ts-warn > summary { font-size: .95rem; font-weight: 600; }
#topsearch .ts-warn-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
#topsearch .ts-warn-grid label { position: relative; display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: #e9dcff; font-size: .82rem; font-weight: 600; cursor: pointer; }
#topsearch .ts-warn-grid label input { position: absolute; opacity: 0; pointer-events: none; }
#topsearch .ts-warn-grid label:has(input:checked) { background: var(--danger); border-color: var(--danger); color: var(--bg); }
#topsearch .ts-warn-grid label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
#topsearch .ts-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#topsearch .ts-actions button { flex: 1; }

/* ---------- buttons and fields ---------- */
button, input[type=submit], input[type=button], .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  font: inherit; font-size: .95rem; font-weight: 700; line-height: 1.2;
  padding: .55rem 1.2rem; border-radius: 999px; border: 1px solid var(--button);
  background: var(--button); color: var(--button-text); cursor: pointer; text-decoration: none;
  transition: background .12s ease, transform .12s ease, opacity .12s ease;
}
button:hover, input[type=submit]:hover, input[type=button]:hover, .button:hover { background: var(--button-hover); border-color: var(--button-hover); color: var(--button-text); }
button:active, .button:active { transform: scale(.98); opacity: .85; }
button:disabled { opacity: .45; cursor: not-allowed; }
.button.light, button.light, button[type=button], li form[style*="inline"] button, .bk-box form button, .pf-box button {
  background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); border-color: var(--border-strong); font-weight: 600;
}
.button.light:hover, button.light:hover, button[type=button]:hover, li form[style*="inline"] button:hover, .bk-box form button:hover, .pf-box button:hover {
  background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); border-color: var(--border-strong);
}
.pf-box form:first-of-type button { background: var(--button); color: var(--bg); border-color: #fff; }
li form[style*="inline"] button { min-height: 34px; font-size: .82rem; padding: .3rem .8rem; }
.button.danger, .button.danger:hover { color: var(--danger); }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=url], input[type=tel], input:not([type]), select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); min-height: 44px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-small); padding: .55rem .85rem; width: 100%;
}
select { appearance: none; padding-right: 1rem; }
select option { color: var(--text); background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }

input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, .5); }
textarea { line-height: 1.55; width: 100%; max-width: 100%; border-radius: 16px; }

input:focus { outline: none; border-color: var(--lavender); background: #28103F; background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); box-shadow: 0 0 0 3px rgba(214, 196, 255, .2) !important; }
textarea:focus { outline: none; border-color: var(--lavender); background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); box-shadow: 0 0 0 3px rgba(214, 196, 255, .2) !important; }
select:focus { outline: none !important; border-color: var(--lavender); }
select:focus-visible { background: #513d64 !important; }

input[type=checkbox], input[type=radio] { accent-color: var(--lavender); width: 1.15rem; height: 1.15rem; vertical-align: -3px; }
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; color: var(--muted); }
input[type=file]::file-selector-button {
  font: inherit; font-size: .88rem; font-weight: 600; margin-right: 12px; padding: .5rem 1rem; cursor: pointer; min-height: 38px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text);
}
input[type=file]::file-selector-button:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }
label { cursor: default; }
form p { margin: .9em 0; }
label[style*="margin-right"] { display: inline-block; white-space: nowrap; margin-bottom: 4px; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.35rem 1.2rem; margin: 0 0 1.25rem; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
legend { font-weight: 700; padding: 0 .5rem; color: var(--text); }
details > summary { cursor: pointer; }
details > summary:hover { color: var(--lavender); }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .95rem; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); display: table; }
th, td { text-align: left; padding: .8rem .95rem; border-bottom: 1px solid rgba(255, 255, 255, .08); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 700; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; background: rgba(255, 255, 255, .03); }
table[border] { border: 1px solid var(--border); }
table[border] th, table[border] td { border: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.table-scroll { overflow-x: auto; }

pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border); border-radius: var(--radius-small); padding: .8rem 1rem; overflow-x: auto; }
blockquote { margin: 1rem 0; padding: .4rem 1rem; border-left: 3px solid var(--lavender); color: var(--muted); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border-radius: 0 12px 12px 0; }

.alert { border: 1px solid rgba(255, 140, 160, .5); background: rgba(255, 140, 160, .1); color: #ffd3dc; border-radius: var(--radius-small); padding: .75rem 1rem; }
main.page p.notice { display: block; padding: .75rem 1rem; border-radius: var(--radius-small); background: var(--lavender-soft); border: 1px solid rgba(214, 196, 255, .35); font-weight: 600; }

/* the website's older inline boxes, in the new colors */
[style*="background:#f4f4f4"], [style*="background: #f4f4f4"], [style*="background:#f2f2f2"], [style*="background:#fff"], [style*="background:#eee"]:not(.poll *) {
  background: var(--glass) !important; color: var(--text) !important;
}
[style*="background:#ccc"] { background: var(--cover) !important; color: var(--lavender) !important; }
[style*="rgba(255,255,255,0.9)"] { background: rgba(26, 1, 41, .86) !important; }
[style*="border:1px solid #999"], [style*="border: 1px solid #999"] { border-color: var(--border) !important; border-radius: var(--radius-small); }
[style*="border-left:3px solid #999"] { border-left-color: var(--lavender) !important; }
[style*="border-top:1px solid #999"], [style*="border-top:1px solid #ccc"] { border-top-color: rgba(255, 255, 255, .1) !important; }
[style*="color:#555"], [style*="color: #555"] { color: var(--muted) !important; }
[style*="color:#666"], [style*="color:gray"] { color: var(--muted) !important; }

/* round pictures of people */
img[src^="/avatars/"] { border-radius: 50%; object-fit: cover; }
span[style*="background:#ccc"][style*="display:inline-block"] { border-radius: 50%; font-weight: 800 !important; }

/* ---------- lists of things become cards ---------- */
main.page > ul:not(.st-list):not(.people), main.page > ol:not(.bk-chapters), .side-main > ul, .side-main > ol, .search-main > ul {
  list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 12px;
}
main.page > ul:not(.st-list):not(.people) > li, main.page > ol:not(.bk-chapters) > li, .side-main > ul > li, .side-main > ol > li, .search-main > ul > li {
  margin: 0 !important; padding: 16px 18px; border-radius: 18px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); line-height: 1.6;
}
main.page > ul > li > img[src^="/avatars/"], main.page > ul > li > span[style*="background:#ccc"] { margin-right: 6px; vertical-align: middle; }
main.page > ul > li > a > strong, main.page > ol > li > a > strong { font-size: 1.05rem; }
main.page > ul > li a strong, main.page > ol > li a strong { color: var(--text); }

/* ---------- story cards (home, search) ---------- */
.st-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin: 6px 0 12px; }
.st-head h1, .st-head h2 { margin: 0; }
.st-find { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 14px 0 20px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.st-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.st-row label { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.st-count { margin: 0 0 6px; color: var(--muted); font-size: .92rem; }
.st-count strong { color: var(--text); }
.st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.st-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 0; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); transition: border-color .15s ease, transform .15s ease; }
.st-item:hover { border-color: rgba(214, 196, 255, .45); }
.st-title { font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.st-title a { text-decoration: none; color: var(--text); }
.st-title a:hover { color: var(--lavender); }
.st-by { margin-top: 3px; font-size: .92rem; color: var(--muted); }
.st-by img, .st-by span[style*="background:#ccc"] { vertical-align: -5px; margin: 0 2px; }
.st-tag { font-style: italic; margin: 8px 0 0; font-family: var(--story-font); font-size: 1.02rem; color: rgba(255, 255, 255, .92); }
.st-blurb { margin: 8px 0; max-width: 75ch; color: rgba(255, 255, 255, .88); }
.st-facts { display: flex; flex-wrap: wrap; gap: 6px 8px; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.st-facts span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid rgba(255, 255, 255, .1); }
.st-facts b { color: var(--text); font-weight: 600; }
.st-facts + .st-facts span { background: none; border: 0; padding: 0 12px 0 0; }
.st-tags { margin-top: 8px; font-size: .84rem; color: var(--muted); }
.st-pager { margin: 26px 0; display: flex; gap: 16px; align-items: center; justify-content: center; color: var(--muted); }
.st-pager a, main.page > p > a[href*="page="], .side-main > p > a[href*="page="] {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%);
  border: 1px solid var(--border-strong); text-decoration: none; color: var(--text); font-weight: 600;
}
.st-pager a:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }
.st-with-cover { display: flex; flex-direction: row-reverse; gap: 20px; align-items: flex-start; }
.st-with-cover .st-info { flex: 1 1 auto; min-width: 0; }
.st-cover, .pf-cover, .bk-cover { background: var(--cover) !important; }
/* .st-cover img:hover, .pf-cover img:hover, .bk-cover img:hover { background: var(--cover) !important; transform: scale(1.3); transition: 0.5s;} */
.st-cover { flex: 0 0 120px; aspect-ratio: 512 / 800; border-radius: 12px; overflow: hidden; display: block; border: 1px solid var(--border); position: relative; }
.st-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-cover:empty::after, .pf-cover:empty::after, .bk-cover:empty::after {
  content: ""; position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; opacity: .7;
  background: url("/fx/star.png") center / contain no-repeat;
}
.pf-cover, .bk-cover { position: relative; }

/* ---------- home ---------- */
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 30px; align-items: start; }
.col-title { font-size: 1.6rem; line-height: 1.25; margin: .2em 0 16px; }
.home-main > .col-title { font-family: var(--title-font); font-weight: 400; font-size: 4.2rem; line-height: 1; letter-spacing: 0; }
.home-side-col .col-title { font-size: 1.25rem; font-family: var(--font); font-weight: 700; margin-top: .4em; }
.home-side { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 18px 16px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); position: sticky; top: 92px; }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, .08); margin: 0; }
.people li:first-child { border-top: 0; }
.people span { min-width: 0; line-height: 1.35; word-break: break-word; }
.people a { text-decoration: none; color: var(--text); }
.people img, .people span[style*="background:#ccc"] { width: 40px !important; height: 40px !important; line-height: 40px !important; }
.home-side > p:last-child { margin: 12px 0 0; font-size: .92rem; }
.home-side > p:last-child a { font-weight: 600; text-decoration: none; }
.home-cols .st-find:first-of-type { margin-top: 0; }
.home-main .st-find .st-list { margin-top: 12px; }
.home-main .st-find .st-item { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.home-main .st-find > strong { font-size: 1.1rem; }

/* ---------- welcome page ---------- */
.welcome-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 30px; align-items: center; margin: 10px 0 40px; }
.wl-hero { max-width: 640px; margin: 0; }
.pg-welcome .wl-hero h1 { font-family: var(--title-font); font-weight: 400; font-size: 5.6rem; line-height: .95; letter-spacing: 0; margin: 0 0 .25em; }
.wl-tagline { font-family: Copperplate, "Copperplate Gothic Light", "Copperplate Gothic", "Cormorant SC", Georgia, serif; font-variant: small-caps; letter-spacing: .08em; font-size: 1.35rem; color: var(--text); margin: 0 0 14px; }
.wl-hero p { font-size: 1.12rem; color: rgba(255, 255, 255, .9); }
.wl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 1.4rem; }
.wl-actions .button { min-height: 52px; padding: 0 30px; font-size: 1.05rem; }
.welcome-art { position: relative; height: 420px; }
.welcome-art .planet { --ps: 300px; position: absolute; right: 4%; top: 6%; }
.welcome-art .astronaut { position: absolute; left: 4%; bottom: 0; width: 190px; height: 219px; }
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 0 0 2rem; }
.wl-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.wl-card h3 { margin: .1em 0 .4em; }
.wl-card p { margin: 0; color: var(--muted); }

/* the floating astronaut (welcome page and empty pages) */
.astronaut { position: relative; display: inline-block; width: 120px; height: 138px; }
.astronaut .a-float, .astronaut .a-sway, .astronaut .a-body, .astronaut .a-arm { position: absolute; inset: 0; }
.astronaut .a-float { animation: a-float 3s ease-in-out infinite alternate; }
.astronaut .a-sway { transform-origin: 50% 50%; animation: a-sway 4.5s ease-in-out infinite alternate; }
.astronaut .a-body { background: url("/fx/astronaut-body.png") center / contain no-repeat; }
.astronaut .a-arm { background: url("/fx/astronaut-arm.png") center / contain no-repeat; transform-origin: 35.4% 55.3%; animation: a-wave .75s ease-in-out infinite alternate; }
@keyframes a-float { from { transform: translateY(2.3%); } to { transform: translateY(-3%); } }
@keyframes a-sway { from { transform: rotate(-8deg); } to { transform: rotate(5deg); } }
@keyframes a-wave { from { transform: rotate(0deg); } to { transform: rotate(-22deg); } }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 20px; border-radius: var(--radius); background: rgba(255, 255, 255, .04); border: 1px dashed var(--border); color: var(--muted); }
.empty-state p { margin: 0; }

/* ---------- log in, sign up ---------- */
.pg-auth main.page { max-width: 520px; }
.pg-auth main.page > form, .pg-auth main.page > p:has(> a[href="/forgot"]) { background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; }
.pg-auth main.page > p:has(> a[href="/forgot"]) { background: none; border: 0; padding: 4px 0 0; text-align: center; }
.pg-auth form p label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: #e9dcff; font-size: .95rem; }
.pg-auth form p label input { width: 100%; border-radius: 999px; min-height: 50px; padding: 0 18px; }
.pg-auth form > button { width: 100%; min-height: 52px; font-size: 1.05rem; margin-top: 6px; }

/* ---------- profile ---------- */
.pf { gap: 30px !important; }
.pf-side { background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 22px; max-width: 360px !important; position: relative; }
.pf-side > img:first-child, .pf-side > span:first-child, .pf-side > .orbit + img, .pf-side > .orbit + span { width: 128px !important; height: 128px !important; border-radius: 50% !important; display: block; margin: 6px auto 0; position: relative; z-index: 1; border: 4px solid var(--surface); line-height: 128px !important; font-size: 56px !important; }
.orbit { position: absolute; left: 50%; top: 18px; z-index: 2; width: 160px; height: 160px; margin-left: -80px; pointer-events: none; }
.orbit svg { width: 100%; height: 100%; overflow: visible; }
.orbit .ring { fill: none; stroke: rgba(214, 196, 255, .4); stroke-width: 1; stroke-dasharray: 2 5; }
.orbit .moon { fill: #e6d9ff; filter: drop-shadow(0 0 4px #fff); offset-rotate: 0deg; animation: moon-orbit 12s linear infinite; }
.pf-side h1 { text-align: center; margin: 22px 0 2px !important; font-size: 1.7rem; }
.pf-side h1 + p { text-align: center; color: var(--muted); }
.pf-stats { display: flex; justify-content: center; gap: 8px; margin: 14px 0 10px; }
.pf-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 90px; height: 70px; border: 1px solid var(--border); border-radius: 18px; text-decoration: none; color: var(--muted); font-size: .8rem; line-height: 1.2; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.pf-stat strong { font-size: 1.3rem; color: var(--text); }
a.pf-stat:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.pf-side > p[style*="margin:0"]:not(:first-of-type) { text-align: center; color: var(--muted); font-size: .9rem; }
.pf-side form textarea { margin-bottom: 8px; }
.pf-box { border-top: 1px solid var(--border) !important; margin-top: 16px !important; padding-top: 14px !important; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pf-box > p { flex-basis: 100%; margin: 4px 0; }
.pf-box form { margin: 0; }
.pf-box > .pf-action-row { order: 1; display: flex; flex: 0 0 auto; align-items: center; justify-content: flex-end; gap: 8px; }
.pf-box > .pf-report-media-actions { order: 2; display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.pf-action-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; border: 1px solid var(--border-strong); border-radius: 14px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--lavender); text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }
.pf-action-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pf-action-icon:hover, .pf-action-icon:focus-visible { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); border-color: var(--lavender); color: var(--text); outline: none; }
.pf-action-icon:active { transform: scale(.96); }
.pf-action-icon.pf-action-warning { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.pf-action-icon.pf-action-warning:hover, .pf-action-icon.pf-action-warning:focus-visible { background: color-mix(in srgb, var(--gold) 13%, transparent); border-color: var(--gold); color: #ffe8a6; }
.pf-action-icon.pf-action-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.pf-action-icon.pf-action-danger:hover, .pf-action-icon.pf-action-danger:focus-visible { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); color: #ffc2cc; }
.pf-tabs { display: flex !important; flex-wrap: wrap; gap: 4px !important; padding: 5px; width: fit-content; max-width: 100%; border: 1px solid var(--border) !important; border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); margin: 0 0 20px !important; }
.pf-tabs a { background: transparent !important; border: 0 !important; border-radius: 999px !important; padding: 0 16px !important; min-height: 42px; display: inline-flex !important; align-items: center; color: var(--muted) !important; font-weight: 600; top: 0 !important; }
.pf-tabs a:hover { color: var(--text) !important; background: var(--glass) !important; }
.pf-tabs a.on { background: var(--button) !important; color: var(--bg) !important; font-weight: 700 !important; padding-bottom: 0 !important; }
.pf-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin: 14px 0 22px; }
.pf-card { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; background: none; min-width: 0; }
.pf-cover { width: 100%; height: auto; aspect-ratio: 512 / 800; border-radius: 12px; overflow: hidden; display: block; border: 1px solid var(--border); }
.pf-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-card-info { min-width: 0; font-size: .82rem; line-height: 1.5; word-break: break-word; color: var(--muted); }
.pf-card-title { display: block; font-weight: 700; font-size: 1rem; text-decoration: none; margin-bottom: 2px; color: var(--text); }
.pf-card-title:hover { color: var(--lavender); }
.pf-muted { color: var(--muted); }
.pf-date { white-space: nowrap; }
.pf-card[hidden] { display: none; }
.tab-panel > h2:first-child { font-size: 1.3rem; }

/* ---------- a story ---------- */
.icon { flex: 0 0 auto; vertical-align: -3px; }
.bk-top { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 36px; align-items: start; margin-bottom: 26px; }
.bk-cover { aspect-ratio: 512 / 800; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.bk-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-main h1 { margin: 0 0 6px; font-size: 2.6rem; font-family: var(--story-font); line-height: 1.1; }
.bk-tagline { margin: 0 0 10px; color: rgba(255, 255, 255, .92); font-family: var(--story-font); font-size: 1.2rem; }
.bk-main > p:has(> a[href^="/u/"]) img, .bk-main > p:has(> a[href^="/u/"]) span[style*="background:#ccc"] { vertical-align: -6px; }
.bk-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0 0; padding: 5px; border: 1px solid var(--border); border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); width: fit-content; max-width: 100%; }
.bk-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 0; border-radius: 999px; background: none; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; }
.bk-tabs a:hover { color: var(--text); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.bk-tabs a.on { background: var(--button); color: var(--bg); border: 0; }
.bk-facts { margin-top: 18px; color: var(--muted); padding: 16px 20px; border-radius: 18px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); }
.bk-facts p { margin: .3em 0; }
.bk-facts strong { color: var(--text); font-weight: 600; }
.fr-facts { display: grid; grid-template-columns: max-content 1fr; column-gap: 22px; row-gap: 9px; margin: 0; }
.fr-facts .fr-k { color: var(--muted); }
.fr-facts .fr-v { color: var(--text); }
.fr-facts .fr-v strong, .fr-facts .fr-v b { font-weight: inherit; }
.bk-blurb { margin: 18px 0; font-family: var(--story-font); font-size: 1.08rem; line-height: 1.7; color: rgba(255, 255, 255, .92); white-space: pre-wrap; }
.bk-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.bk-box { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; overflow: hidden; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.bk-box > h2 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 20px; font-size: 1.1rem; background: rgba(255, 255, 255, .03); border-bottom: 1px solid rgba(255, 255, 255, .08); }
.bk-box > h2 .icon { width: 20px; height: 20px; color: var(--lavender); }
.bk-box > h2 small { font-weight: 600; }
.bk-box > :not(h2) { margin-left: 20px; margin-right: 20px; }
.bk-box > :last-child { margin-bottom: 16px; }
.bk-box > form, .bk-box > p:first-of-type { margin-top: 14px; }
.bk-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bk-chapters { margin: 6px 20px 14px !important; padding: 0 !important; list-style: none; counter-reset: ch; }
.bk-chapters li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 0 12px 48px; border-bottom: 1px solid rgba(255, 255, 255, .08); position: relative; margin: 0; }
.bk-chapters li::before { content: attr(value); position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--lavender); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.bk-chapters li:last-child { border-bottom: 0; }
.bk-chapters li > a:first-child { font-weight: 600; color: var(--text); text-decoration: none; }
.bk-chapters li > a:first-child:hover { color: var(--lavender); }
.edit-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.edit-nav .button { padding: .6rem 1.1rem; }
.edit-nav-story { display: inline-flex; align-items: center; padding: .6rem 1.2rem; border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.edit-nav .edit-nav-main { border: 2px solid #fff; font-weight: 700; }
.tl-events { list-style: none; margin: 18px 0; padding: 0; }
.tl-events li { position: relative; margin: 0; padding: 4px 0 34px 56px; min-height: 30px; }
.tl-events li::before { content: ""; position: absolute; left: 6px; top: 4px; width: 26px; height: 26px; border: 3px solid var(--lavender); border-radius: 50%; background: var(--bg); box-sizing: border-box; z-index: 1; }
.tl-events li:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 30px; bottom: -4px; width: 2px; background: rgba(214, 196, 255, .35); }

/* a chapter: a narrow reading column */s
.pg-chapter main.page { max-width: 860px; }
.pg-chapter main.page > p:first-of-type { text-align: center; color: var(--muted); display: flex; gap: 7px; align-items: center; justify-content: center; }
.pg-chapter main.page > h1 { text-align: center; font-family: var(--story-font); font-size: 2.4rem; margin: .3em 0 .4em; }
.pg-chapter .story-text { font-size: 1.2rem; line-height: 1.85; color: rgba(255, 255, 255, .94); }
.fr-lock-wrap .fr-lock { max-width: 560px; margin: 30px auto; }

/* reader reviews summary bars and polls */
.poll { border-radius: var(--radius) !important; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.poll [style*="background:#eee"] { background: rgba(255, 255, 255, .1) !important; }
.poll [style*="background:#666"] { background: var(--lavender) !important; }

/* rankings: the top three get twinkling stars (fx.js) */
.rank-star { position: relative; display: inline-block; width: 34px; height: 34px; vertical-align: middle; }
.rank-star svg { position: absolute; inset: 0; overflow: visible; }
.rank-star .rs-star { transform-origin: 17px 18px; animation: rank-pulse var(--rp, 1.6s) ease-in-out infinite alternate; }
.rank-star .rs-glint { transform-origin: 27px 8px; animation: rank-glint var(--rg, 3.1s) linear infinite; opacity: 0; }
.rank-star b { position: absolute; left: 0; right: 0; top: 10px; text-align: center; font-size: 11px; font-weight: 900; color: var(--bg); }
@keyframes rank-pulse { from { transform: scale(.94); } to { transform: scale(1.06); } }
@keyframes rank-glint { 0%, 70% { opacity: 0; transform: rotate(0deg); } 82% { opacity: 1; } 100% { opacity: 0; transform: rotate(180deg); } }

/* ---------- messages ---------- */
.pg-chat main.page > h1 { display: flex; align-items: center; gap: 12px; font-size: 1.6rem; }
.pg-chat main.page > h1 img, .pg-chat main.page > h1 span[style*="background:#ccc"] { width: 52px !important; height: 52px !important; line-height: 52px !important; }
.pg-chat div[id^="m"][style*="border-top"] { border: 0 !important; padding: 10px 14px !important; margin: 8px 0; border-radius: 18px 18px 18px 4px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); max-width: 78%; width: fit-content; min-width: 200px; }
.pg-chat div[id^="m"].mine { margin-left: auto; border-radius: 18px 18px 4px 18px; background: var(--lavender); color: var(--bg); }
.pg-chat div[id^="m"].mine small, .pg-chat div[id^="m"].mine a { color: #b8a6b8; }
.pg-chat div[id^="m"].mine strong { color: #e6c9e7; }
.pg-chat div[id^="m"] > div[style*="pre-wrap"] { margin-top: 4px; font-size: 1rem; }
.pg-chat div[id^="m"] > a { font-size: .8rem; margin-left: 6px; }
.pg-chat #send { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); position: relative; }
.pg-chat #send br { display: none; }
.pg-chat #send button { align-self: flex-end; min-width: 120px; }
.pg-chat #send button.msg-send { align-self: flex-end; width: 132px; position: absolute; right: 22px; top: 18px; }
.meteor-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.meteor-layer canvas { width: 100%; height: 100%; display: block; }

/* the comet when something is sent, the rocket for a new book */
.fx-overlay { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.fx-overlay canvas { width: 100%; height: 100%; display: block; }

/* ---------- settings ---------- */
.lead { color: var(--muted); }
form.settings { max-width: 760px; }
.settings-box { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem 1.3rem; margin: 0 0 1rem; max-width: 760px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
fieldset.settings-box > legend { font-size: 1.05rem; padding: 0 .5rem; }
section.settings-box h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.settings-box .field { display: flex; flex-direction: column; gap: 6px; margin: 1rem 0; }
.settings-box .field > label { font-weight: 600; font-size: .95rem; color: #e9dcff; }
.settings-box .field > input, .settings-box .field > textarea { width: 100%; max-width: 520px; }
.settings-box .field > textarea { max-width: 100%; }
.settings-box p > small, .settings-box .field > small { display: block; margin-top: 4px; }
.settings-box label:has(> input[type=checkbox]) { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; line-height: 1.45; }
.settings-box label > input[type=checkbox] { margin-top: 2px; flex: none; }
.save-bar {
  position: sticky; bottom: 14px; z-index: 20; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: rgba(40, 16, 63, .95); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(214, 196, 255, .45); border-radius: 999px; padding: 10px 10px 10px 22px; margin-top: 12px; max-width: 760px;
}
.save-bar button { min-width: 130px; margin-left: auto; }
#unsaved-note { color: var(--text); font-weight: 600; }

/* ---------- Studio ---------- */
.studio-head { position: relative; padding: 4px 0 18px; }
.studio-head .constellation { position: absolute; right: 0; top: -10px; width: min(460px, 60%); height: 190px; pointer-events: none; }
.studio-head .constellation canvas { width: 100%; height: 100%; display: block; }
.studio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 18px; position: relative; z-index: 1; }
.studio-card { display: flex; flex-direction: column; gap: 10px; padding: 24px; border-radius: 24px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); text-decoration: none; color: var(--text); transition: border-color .15s ease, transform .15s ease; }
.studio-card:hover { color: var(--text); border-color: rgba(214, 196, 255, .55); transform: translateY(-2px); }
.studio-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--lavender-soft); display: flex; align-items: center; justify-content: center; }
.studio-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--lavender); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.studio-name { font-size: 1.45rem; font-weight: 800; }
.studio-text { color: var(--muted); line-height: 1.55; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid rgba(255, 255, 255, .1); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-top: 20px; padding-bottom: 26px; }
.footer-name { font-family: var(--title-font); font-size: 2rem; color: var(--text); line-height: 1; }

/* ---------- phones and small windows ---------- */
@media (max-width: 1020px) {
  .site-header .main-nav { order: 3; flex-basis: 100%; }
  .quick-search { order: 4; flex-basis: 100%; }
  .search-layout { grid-template-columns: 1fr; }
  .search-side { position: static; max-height: none; }
  .home-cols { grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 1.6rem; }
  .site-header { position: static; }
  .site-header .bar { gap: 8px 10px; }
  .site-header .brand-name { font-size: 2.1rem; }
  .site-header .brand .planet { --ps: 34px; }
  .site-header .main-nav { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 12px; scrollbar-width: none; }
  .site-header .main-nav a { white-space: nowrap; }
  .site-header .user-nav { margin-left: auto; gap: 6px; }
  .create-btn { font-size: 0 !important; width: 44px; padding: 0 !important; }
  .create-btn svg { width: 20px; height: 20px; }
  .nav-icon, .nav-me { width: 40px; height: 40px; }
  .nav-me img, .nav-me > span:not(.badge) { width: 32px !important; height: 32px !important; }
  .section-title { font-size: 3.4rem; }
  .section-tabs, .pf-tabs, .bk-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .section-tabs a, .pf-tabs a, .bk-tabs a { white-space: nowrap; flex: none; }
  .pg-home h1, .pg-notes main > h1, .pg-inbox:not(.pg-chat) main > h1, .pg-search main h1, .pg-settings main h1,
  .pg-other main.page > h1:first-of-type, .pg-auth main h1, .studio-title, .home-main > .col-title { font-size: 3.2rem; }
  .side-layout { grid-template-columns: 1fr; gap: 16px; }
  .side-nav { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border-radius: 999px; padding: 5px; scrollbar-width: none; }
  .side-nav a { white-space: nowrap; flex: none; min-height: 40px; border-radius: 999px; }
  .side-nav form { margin: 0; padding: 0; border: 0; }
  .side-nav .side-logout { min-height: 40px; white-space: nowrap; }
  .home-cols { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .home-side-col { order: -1; }
  .home-side { position: static; padding: 10px 14px; }
  .people { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; }
  .people li { flex: 0 0 auto; flex-direction: column; text-align: center; border: 0; padding: 0; width: 76px; gap: 4px; }
  .people li span { font-size: .8rem; }
  .people small { display: none; }
  .st-with-cover { gap: 14px; }
  .st-cover { flex-basis: 84px; }
  .st-item { padding: 14px; }
  .bk-top { grid-template-columns: 1fr; gap: 20px; }
  .bk-cover { max-width: 220px; }
  .bk-main h1 { font-size: 2rem; }
  .welcome-hero { grid-template-columns: 1fr; }
  .welcome-art { height: 260px; order: -1; }
  .welcome-art .planet { --ps: 190px; right: 6%; top: 0; }
  .welcome-art .astronaut { width: 120px; height: 138px; }
  .pg-welcome .wl-hero h1 { font-size: 4rem; }
  .pf-side { max-width: none !important; }
  .pg-chat div[id^="m"][style*="border-top"] { max-width: 92%; }
  fieldset { padding: .9rem 1rem; }
  .save-bar { border-radius: 22px; }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .planet-spinner .moon { animation: moon-orbit 1.1s linear infinite !important; }
}

/* the old tab line on Bookshelf pages: the tabs under the title replace it */
.pg-shelf main.page > p:has(> a[href="/bookshelf/bookmarks"]), .pg-shelf main.page > p:has(> a[href="/bookshelf"]) { display: none; }

/* statistics: the bars in lavender */
[style*="background:#555"] { background: var(--lavender) !important; border-radius: 3px 3px 0 0; }

/* ---------- Profile, the mockup's layout (put together by fx.js) ---------- */
.pf-unframed { padding: 0 !important; background: none !important; }
.pf.pf-rebuilt { display: block !important; }
.pf-side.pf-side-hero { max-width: none !important; padding: 0; background: none; border: 0; border-radius: 0; margin-bottom: 26px; }
.pf-hero { position: relative; border-radius: 26px; overflow: hidden; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); }
.pf-banner { height: 190px; background: var(--cover) center / cover no-repeat; }
.pf-banner-stars {
  background-color: var(--cover);
  background-image: radial-gradient(2px 2px at 8% 30%, #fff, transparent 60%), radial-gradient(1.5px 1.5px at 22% 70%, var(--lavender), transparent 60%),
    radial-gradient(1.5px 1.5px at 37% 22%, #fff, transparent 60%), radial-gradient(2px 2px at 55% 64%, #fff, transparent 60%),
    radial-gradient(1.5px 1.5px at 71% 30%, var(--lavender), transparent 60%), radial-gradient(1.5px 1.5px at 88% 72%, #fff, transparent 60%);
}
.pf-admin-actions { position: absolute; top: .5rem; right: .5rem; z-index: 4; display: flex; align-items: center; gap: 8px; }
.pf-admin-actions .pf-action-row { display: flex; margin: 0; }
.pf-hero-body { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 8px 28px; padding: 0 30px 26px; align-items: start; }
.pf-pic { position: relative; width: 160px; height: 160px; margin-top: -80px; }
.pf-pic > img, .pf-pic > span:not(.orbit) {
  position: absolute !important; left: 14px; top: 14px; width: 132px !important; height: 132px !important; margin: 0 !important;
  border-radius: 50% !important; border: 5px solid var(--surface) !important; object-fit: cover; display: block;
  line-height: 122px !important; font-size: 56px !important; text-align: center; z-index: 1; box-sizing: border-box;
}
.pf-pic .orbit { position: absolute; inset: 0; width: auto; height: auto; margin: 0; left: 0; top: 0; z-index: 2; }
.pf-id { min-width: 0; padding-top: 16px; }
.pf-id h1 { text-align: left !important; margin: 0 !important; font-size: 2rem; }
.pf-id h1 + p { text-align: left !important; margin: 2px 0 0 !important; }
.pf-id > p[style*="margin:0"] { text-align: left !important; color: var(--muted); font-size: .92rem; }
.pf-id > p { margin: 8px 0; max-width: 64ch; }
.pf-status-form { margin-top: 10px; max-width: 560px; }
.pf-status-form textarea { min-height: 70px; }
.pf-status-form br { display: none; }
.pf-status-form button { margin: 8px 10px 0 0; }
.pf-acts { padding-top: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; min-width: 0; }
.pf-acts .pf-stats { margin: 0; justify-content: flex-end; }
.pf-acts .pf-box { border: 0 !important; margin: 0 !important; padding: 0 !important; justify-content: flex-end; max-width: 380px; }
.pf-acts .pf-box > p { text-align: right; }
.pf-rebuilt > .pf-main { width: 100%; }

/* ---------- a story: the buttons under the title ---------- */
.bk-quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 4px; }
.bk-quick .bk-read { min-height: 48px; padding: 0 28px; font-size: 1rem; }
.bk-quick form.bk-inline { margin: 0; }
.bk-quick form.bk-inline button { min-height: 48px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); border-color: var(--border-strong); }
.bk-quick form.bk-inline button:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }
.bk-quick form.bk-inline small { display: none; }
.bk-pop { position: relative; }
.bk-pop > summary { list-style: none; min-height: 48px; }
.bk-pop > summary::-webkit-details-marker { display: none; }
.bk-pop > summary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.bk-pop[open] > summary svg { transform: rotate(180deg); }
.bk-pop-panel { position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: min(420px, 86vw); padding: 16px 18px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid rgba(214, 196, 255, .35); box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
.bk-pop-panel > :first-child { margin-top: 0; }
.bk-pop-panel > :last-child { margin-bottom: 0; }
.bk-pop-panel form.bk-row { flex-direction: column; align-items: stretch; }
.bk-pop-panel form.bk-row select, .bk-pop-panel form.bk-row input { width: 100%; }

/* ---------- Home: "Recommended for you" as covers ---------- */
.rec-box { padding: 18px 20px 20px; }
.rec-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 14px; font-size: 1.1rem; }
.rec-head a { font-size: .95rem; font-weight: 600; text-decoration: none; }
.rec-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
.rec-tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rec-cover { position: relative; display: flex; align-items: flex-end; aspect-ratio: 512 / 800; border-radius: 12px; overflow: hidden; background: var(--cover); border: 1px solid var(--border); text-decoration: none; color: var(--text); padding: 12px; }
.rec-cover:hover { border-color: rgba(214, 196, 255, .55); color: var(--text); }
.rec-cover::after { content: ""; position: absolute; right: 10px; top: 10px; width: 20px; height: 20px; opacity: .7; background: url("/fx/star.png") center / contain no-repeat; }
.rec-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rec-cover.has-img::after, .rec-cover.has-img .rec-cover-title { display: none; }
.rec-cover-title { font-family: var(--story-font); font-weight: 600; font-size: 1rem; line-height: 1.2; }
.rec-title { font-weight: 700; color: var(--text); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-title:hover { color: var(--lavender); }
.rec-by { font-size: .85rem; }
.rec-by a { text-decoration: none; font-weight: 600; }
.rec-facts { display: block; font-size: .78rem; }
.rec-why { font-size: .78rem; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.rec-dismiss { margin: 0; }
.rec-dismiss button { min-height: 32px; padding: 0 12px; font-size: .8rem; width: 100%; }

/* ---------- Inbox: list on the left, chat on the right ---------- */
@media (min-width: 900px) {
  main.inbox-split { display: grid; grid-template-columns: 340px minmax(0, 1fr); column-gap: 28px; align-items: start; grid-auto-flow: row dense; }
  main.inbox-split > *:not(.inbox-list):not(.inbox-pane) { grid-column: 1; }
  .pg-chat main.inbox-split > *:not(.inbox-list) { grid-column: 2; }
  .inbox-pane { grid-column: 2; grid-row: 1 / span 60; align-self: stretch; min-height: 520px; display: flex; }
  .inbox-pane .empty-state { flex: 1; justify-content: center; }
  .inbox-list { grid-column: 1; grid-row: 1 / span 200; position: sticky; top: 92px; max-height: calc(100vh - 112px); overflow: auto; align-self: start;
    padding: 12px; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); scrollbar-width: thin; }
}
@media (max-width: 899px) { .inbox-list, .inbox-pane { display: none; } }
.inbox-list-title { margin: 2px 6px 6px; }
.inbox-list-title a { font-family: var(--title-font); font-size: 2.6rem; line-height: 1; color: var(--text); text-decoration: none; }
.inbox-group { margin-top: 8px; }
.inbox-group-title { margin: 10px 8px 6px; font-size: .75rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.inbox-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; text-decoration: none; color: var(--text); }
.inbox-item:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.inbox-item.on { background: rgba(214, 196, 255, .16); }
.inbox-av { width: 42px !important; height: 42px !important; border-radius: 50% !important; flex: none; object-fit: cover; background: var(--cover); color: var(--lavender);
  display: inline-flex !important; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.inbox-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inbox-txt strong { font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .8rem; }
.inbox-new { display: block; margin: 6px 8px 2px; font-size: .88rem; font-weight: 600; text-decoration: none; }

/* ---------- Webchat inbox: section rail, item list, open thread ---------- */
.pg-inbox main.page{max-width:1380px;padding-left:18px;padding-right:18px}.webchat-shell{display:grid;grid-template-columns:76px 330px minmax(0,1fr);min-height:clamp(620px,calc(100vh - 150px),900px);overflow:hidden;border:1px solid var(--border);border-radius:var(--radius);background:color-mix(in srgb,var(--surface) 92%,#0d0617 8%);box-shadow:0 28px 80px rgba(8,0,15,.34)}
.webchat-rail{display:flex;flex-direction:column;align-items:center;gap:14px;padding:22px 12px;border-right:1px solid var(--border);background:color-mix(in srgb,var(--bg) 88%,#fff 2%)}.webchat-rail a{position:relative;display:grid;place-items:center;width:48px;height:48px;border-radius:15px;color:var(--muted);background:var(--glass);border:1px solid transparent}.webchat-rail a:hover,.webchat-rail a.on{color:#fff;background:var(--primary);border-color:color-mix(in srgb,var(--lavender) 45%,transparent)}.webchat-rail svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.webchat-rail a>span{position:absolute;right:-5px;top:-5px;display:grid;place-items:center;min-width:19px;height:19px;padding:0 4px;border-radius:999px;background:var(--danger);color:#fff;font-size:.64rem;font-weight:800;box-shadow:0 0 0 3px var(--bg)}
.webchat-list{min-width:0;border-right:1px solid var(--border);background:color-mix(in srgb,var(--surface) 95%,transparent)}.webchat-list>header{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:92px;padding:18px 20px;border-bottom:1px solid var(--border)}.webchat-list h1{margin:0;font-family:var(--title-font);font-size:2rem;line-height:1}.webchat-list header small{color:var(--muted)}.webchat-add{display:grid;place-items:center;flex:none;width:36px;height:36px;border-radius:12px;background:var(--glass-2);color:var(--text);font-size:1.55rem;text-decoration:none}.webchat-items{max-height:calc(100vh - 242px);overflow:auto;padding:12px}.webchat-item{position:relative;display:grid;grid-template-columns:46px minmax(0,1fr) auto;align-items:center;gap:11px;min-height:70px;padding:10px;border-radius:16px;color:var(--text);text-decoration:none}.webchat-item:hover{background:var(--glass)}.webchat-item.on{background:var(--lavender-soft)}.webchat-item>img,.webchat-item>span[style]{width:44px!important;height:44px!important;border-radius:50%!important;object-fit:cover}.webchat-group-avatar,.webchat-ticket-avatar{display:grid;place-items:center;flex:none;width:44px;height:44px;border-radius:50%;background:linear-gradient(145deg,var(--primary),#5b42d9);color:#fff;font-size:.76rem;font-weight:800}.webchat-ticket-avatar{background:var(--glass-2);color:var(--lavender);font-size:1.1rem}.webchat-item>span:nth-child(2){min-width:0}.webchat-item strong,.webchat-item small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.webchat-item small{margin-top:3px;color:var(--muted);font-size:.74rem}.webchat-item time{align-self:start;color:var(--muted);font-size:.62rem}.webchat-item>b{position:absolute;right:10px;bottom:10px;display:grid;place-items:center;min-width:20px;height:20px;padding:0 5px;border-radius:999px;background:var(--danger);color:#fff;font-size:.64rem}.webchat-none{padding:24px 10px;color:var(--muted);font-size:.84rem}
.webchat-thread{min-width:0;display:flex;flex-direction:column;background:color-mix(in srgb,var(--bg) 72%,var(--surface) 28%)}.webchat-thread-head{display:flex;align-items:center;gap:13px;min-height:92px;padding:16px 24px;border-bottom:1px solid var(--border);background:color-mix(in srgb,var(--surface) 88%,transparent)}.webchat-thread-head>div{min-width:0;flex:1}.webchat-thread-head h1{margin:2px 0 0;font-family:inherit;font-size:1.15rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.webchat-thread-head small{color:var(--muted)}.webchat-status{padding:5px 9px;border-radius:999px;background:var(--lavender-soft);color:var(--lavender);font-size:.68rem;text-transform:capitalize}.webchat-messages{flex:1;max-height:calc(100vh - 330px);min-height:360px;overflow:auto;padding:22px 24px}.chat-message,.support-message{width:fit-content;max-width:min(76%,680px);margin:0 0 14px!important;padding:12px 15px!important;border:1px solid var(--border)!important;border-radius:18px!important;background:var(--surface)!important;box-shadow:0 9px 25px rgba(8,0,15,.16)}.chat-message.mine,.support-message.mine{margin-left:auto!important;border-bottom-right-radius:6px!important;background:color-mix(in srgb,var(--primary) 28%,var(--surface))!important}.chat-message.other,.support-message.other{border-bottom-left-radius:6px!important}.support-message header{display:flex;justify-content:space-between;gap:16px;margin-bottom:7px}.support-message header small{color:var(--muted)}.support-message>div{white-space:pre-wrap}.webchat-thread>hr{display:none}.webchat-thread #send,.webchat-compose{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;margin:0!important;padding:16px 20px;border-top:1px solid var(--border);background:color-mix(in srgb,var(--surface) 90%,transparent)}.webchat-thread #send>p,.webchat-thread #send>input,.webchat-thread #send>br{grid-column:1/-1}.webchat-thread #send textarea,.webchat-compose textarea{width:calc(100% - 145px);min-height:52px;max-height:160px;margin:0;resize:vertical}.webchat-thread #send>button,.webchat-compose>button{align-self:end;min-width:74px}.webchat-thread>.chat-clear,.webchat-thread>form:not(#send):not(.webchat-compose),.webchat-thread>form:not(#send):not(.webchat-compose)+form{margin:8px 20px}.webchat-details{margin:14px 20px;padding:10px 14px;border:1px solid var(--border);border-radius:14px;background:var(--glass)}.webchat-details>summary{cursor:pointer;font-weight:700}.webchat-details form{margin:8px 0}.webchat-thread-empty{display:grid;place-items:center;text-align:center;color:var(--muted)}.webchat-thread-empty>div{max-width:360px;padding:30px}.webchat-thread-empty h2{color:var(--text)}.webchat-empty-icon{display:grid;place-items:center;width:64px;height:64px;margin:0 auto 14px;border-radius:20px;background:var(--lavender-soft);color:var(--lavender);font-size:1.7rem}.webchat-closed{margin:18px;color:var(--muted)}
@media(max-width:900px){.webchat-shell{grid-template-columns:66px minmax(0,1fr);min-height:620px}.webchat-rail{grid-column:1;grid-row:1;padding:16px 9px}.webchat-list,.webchat-thread{grid-column:2;grid-row:1}.pg-inbox.pg-chat .webchat-list{display:none}.pg-inbox:not(.pg-chat) .webchat-thread{display:none}.webchat-items{max-height:calc(100vh - 220px)}.webchat-messages{max-height:calc(100vh - 310px);padding:16px}.chat-message,.support-message{max-width:88%}}
@media(max-width:560px){.pg-inbox main.page{padding-left:8px;padding-right:8px}.webchat-shell{grid-template-columns:1fr;display:block}.webchat-rail{position:sticky;top:0;z-index:3;flex-direction:row;justify-content:center;border-right:0;border-bottom:1px solid var(--border);padding:8px}.webchat-rail a{width:42px;height:42px}.webchat-list>header,.webchat-thread-head{min-height:76px;padding:12px 14px}.webchat-thread #send,.webchat-compose{padding:10px}.webchat-item{padding:9px 6px}}

/* Inbox readability refresh: public-theme surfaces, calmer contrast and roomier controls. */
.pg-inbox main.page { max-width: 1180px; padding: 61px 0 38px 0; }
.webchat-shell { grid-template-columns: 88px 350px minmax(0, 1fr); min-height: clamp(640px, calc(100vh - 154px), 920px); border-color: var(--border-strong); border-radius: 26px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); box-shadow: 0 26px 70px rgba(8,0,15,.3); }
.webchat-rail { gap: 12px; padding: 22px 16px; border-color: var(--border); background: #210c36; }
.webchat-rail a { width: 54px; height: 54px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2); color: var(--lavender); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease; }
.webchat-rail a:hover { transform: translateY(-1px); border-color: var(--lavender); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.webchat-rail a.on { border-color: var(--button); background: var(--button); color: var(--button-text); box-shadow: 0 8px 20px rgba(8,0,15,.24); }
.webchat-rail a:focus-visible { outline-offset: 3px; }
.webchat-rail a > span { right: -4px; top: -4px; min-width: 21px; height: 21px; padding: 0 5px; font-size: .68rem; box-shadow: 0 0 0 3px #210c36; }
.webchat-list { border-color: var(--border); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.webchat-list > header { min-height: 104px; padding: 20px 22px; border-color: var(--border); background: rgba(255,255,255,.025); }
.webchat-list h1 { margin: 0 0 4px; font-family: var(--font); font-size: 1.35rem; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.webchat-list header small { display: block; color: #d2c6ef; font-size: .82rem; line-height: 1.4; }
.webchat-add { width: 42px; height: 42px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--button); color: var(--button-text); font-size: 1.45rem; font-weight: 600; box-shadow: 0 7px 18px rgba(8,0,15,.2); }
.webchat-add svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.webchat-add:hover, .webchat-add:focus-visible { border-color: var(--button-hover); background: var(--button-hover); color: var(--button-text); }
.webchat-items { max-height: calc(100vh - 258px); padding: 14px; scrollbar-color: var(--border-strong) transparent; }
.webchat-item { min-height: 78px; gap: 12px; padding: 12px; border: 1px solid transparent; border-radius: 18px; color: var(--text); }
.webchat-item + .webchat-item { margin-top: 4px; }
.webchat-item:hover { border-color: var(--border); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.webchat-item.on { border-color: rgba(214,196,255,.28); background: var(--lavender-soft); box-shadow: inset 3px 0 0 var(--lavender); }
.webchat-item strong { color: var(--text); font-size: .94rem; line-height: 1.35; }
.webchat-item small { margin-top: 5px; color: #cfc1ed; font-size: .8rem; line-height: 1.4; }
.webchat-item time { padding-top: 2px; color: #bcaadd; font-size: .68rem; }
.webchat-item > b { right: 11px; bottom: 11px; min-width: 22px; height: 22px; font-size: .68rem; }
.webchat-group-avatar, .webchat-ticket-avatar { background: var(--cover); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.webchat-ticket-avatar { color: var(--lavender); }
.webchat-none { margin: 0; padding: 28px 14px; color: #d2c6ef; font-size: .9rem; line-height: 1.55; text-align: center; }
.webchat-thread { color: var(--text); background: #200c34; }
.webchat-thread-head { min-height: 104px; padding: 18px 26px; border-color: var(--border); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.webchat-thread-head > img, .webchat-thread-head > span[style] { flex: none; box-shadow: 0 0 0 3px var(--glass-2); }
.webchat-thread-head h1 { margin: 2px 0 3px; color: var(--text); font-size: 1.18rem; font-weight: 800; }
.webchat-thread-head small { color: #d2c6ef; font-size: .82rem; }
.webchat-thread-head small a { color: var(--lavender); }
.webchat-head-action { display: grid !important; place-items: center; flex: 0 0 44px; width: 44px; min-width: 44px !important; height: 44px; min-height: 44px !important; margin-left: auto; padding: 0 !important; border: 1px solid var(--border-strong) !important; border-radius: 14px !important; background: var(--glass) !important; color: var(--lavender) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important; }
.webchat-head-action:hover, .webchat-head-action:focus-visible { border-color: var(--lavender) !important; background: var(--glass-2) !important; color: var(--text) !important; }
.webchat-head-action svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.webchat-status { padding: 6px 11px; border: 1px solid rgba(214,196,255,.24); background: var(--lavender-soft); color: #eadfff; font-size: .72rem; font-weight: 700; }
.webchat-messages { max-height: calc(100vh - 346px); min-height: 380px; padding: 28px; color: var(--text); line-height: 1.6; scrollbar-color: var(--border-strong) transparent; }
.chat-message, .support-message { max-width: min(78%, 700px); padding: 13px 16px !important; border-color: var(--border) !important; border-radius: 18px !important; background: var(--surface-2) !important; color: var(--text) !important; box-shadow: 0 8px 22px rgba(8,0,15,.17); }
.chat-message.mine, .support-message.mine { border-color: rgba(214,196,255,.25) !important; background: #503178 !important; }
.chat-message a, .support-message a { color: #eee5ff; }
.chat-message small, .support-message small, .support-message header small { color: #e6c9e7; }
.chat-message { position: relative; padding-right: 44px !important; overflow: visible; }
.message-menu { position: absolute; top: 5px; right: 5px; z-index: 3; }
.message-menu > summary { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid transparent; border-radius: 9px; color: #d6c9f1; cursor: pointer; list-style: none; }
.message-menu > summary::-webkit-details-marker { display: none; }
.message-menu > summary:hover, .message-menu > summary:focus-visible, .message-menu[open] > summary { border-color: var(--border); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); outline: none; }
.message-menu > summary svg { width: 18px; height: 18px; fill: currentColor; }
.message-menu-popover { position: absolute; top: calc(100% + 5px); right: 0; z-index: 8; width: max-content; min-width: 112px; padding: 7px; border: 1px solid var(--border-strong); border-radius: 13px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); box-shadow: 0 14px 34px rgba(8,0,15,.42); }
.message-actions { display: flex; align-items: center; justify-content: flex-start; gap: 6px; margin: 7px 0 9px; }
.message-actions.message-menu-popover { margin: 0; }
.chat-message.mine .message-actions { justify-content: flex-end; }
.message-action-form { display: flex; margin: 0; }
.message-action-icon, body button.message-action-icon { display: grid !important; place-items: center; flex: 0 0 32px; width: 32px !important; min-width: 32px !important; height: 32px !important; min-height: 32px !important; margin: 0; padding: 0 !important; border-radius: 10px !important; color: #e4d8fa !important; text-decoration: none; box-shadow: none !important; }
.message-action-icon:hover, .message-action-icon:focus-visible, body button.message-action-icon:hover, body button.message-action-icon:focus-visible { border-color: var(--lavender) !important; background: var(--glass-2) !important; color: var(--text) !important; transform: none; }
.message-action-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.message-action-icon.message-action-delete, body button.message-action-delete { border-color: rgba(255,140,160,.32) !important; color: #ffb3c1 !important; border: none; background: transparent; }
.message-action-icon.message-action-delete:hover, .message-action-icon.message-action-delete:focus-visible, body button.message-action-delete:hover, body button.message-action-delete:focus-visible { border-color: var(--danger) !important; background: rgba(255,140,160,.12) !important; color: #ffd4dc !important; }
.message-report-link { margin-left: 3px; color: #d6c9f1 !important; font-size: .72rem; }
.message-content[hidden], .message-inline-edit[hidden] { display: none !important; }
.message-inline-edit { display: grid; gap: 9px; width: min(440px, 60vw); max-width: 100%; margin: 10px 0 2px; }
.message-inline-edit textarea { width: 100%; min-height: 92px; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--bg); color: var(--text); line-height: 1.5; resize: vertical; }
.message-inline-edit textarea:focus { border-color: var(--lavender); outline: 2px solid rgba(214,196,255,.18); }
.message-inline-edit > div { display: flex; justify-content: flex-end; gap: 7px; }
.message-inline-edit button { min-height: 36px; padding: 5px 14px; font-size: .78rem; }
.message-optimistic { opacity: .82; }
.message-optimistic .message-content { white-space: pre-wrap; }
.message-send-state { color: #d6c9f1; }
.message-send-failed { opacity: 1; border-color: rgba(255,140,160,.55) !important; }
.message-send-failed .message-send-state { color: #ffb3c1; }
.support-message header strong { color: var(--text); }

.webchat-thread #send, .webchat-compose { width: 100%;gap: 12px; display: flex !important; flex-direction: row !important; padding: 18px 22px; border-color: var(--border); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: none;}
.webchat-thread #send textarea, .webchat-compose textarea { height: 52px; padding: 13px 15px; border-radius: 25px; background: var(--bg); color: var(--text); line-height: 1.5; box-shadow: inset 0 1px 4px rgba(8,0,15,.2); resize: none;}
.webchat-thread #send textarea::placeholder, .webchat-compose textarea::placeholder { color: #ad9acb; opacity: 1; }
.webchat-thread #send textarea:focus, .webchat-compose textarea:focus { border-color: var(--lavender); background: #210b36; outline: 2px solid rgba(214,196,255,.18); }
.webchat-thread #send > button, .webchat-compose > button { width: 132px; min-height: 52px; padding: 0 22px; box-shadow: 0 7px 18px rgba(8,0,15,.2); }
.webchat-replying { position: absolute;top: -6px;left: 38px;font-size: 14px;}
.webchat-replying small { color: #ded3f5; }
.webchat-notice { margin: 14px 20px 0; padding: 11px 14px; border: 1px solid rgba(214,196,255,.24); border-radius: 14px; background: var(--lavender-soft); color: var(--text); }
.webchat-disabled, .webchat-closed { margin: 16px 20px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 14px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: #d8ccef; line-height: 1.5; }
.webchat-details { margin: 16px 22px; padding: 15px 17px; border-color: var(--border-strong); border-radius: 16px; background: var(--surface-2); color: var(--text); }
.webchat-details > summary { color: var(--lavender); font-weight: 750; }
.webchat-details h2 { margin: 18px 0 8px; font-size: 1rem; }
.webchat-details ul { display: grid; gap: 7px; margin: 8px 0 16px; padding: 0; list-style: none; }
.webchat-details li { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 12px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.webchat-details form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.webchat-details input { flex: 1 1 210px; min-width: 0; }
.webchat-details button, .webchat-thread button.tag { min-height: 34px; padding: 5px 12px; border-color: var(--border-strong); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); font-size: .78rem; }
.webchat-details button:hover, .webchat-thread button.tag:hover { border-color: var(--lavender); background: var(--lavender-soft); color: var(--text); }
.webchat-thread #send > p:not(.webchat-replying) { margin: 0; color: #d2c6ef; }
.webchat-thread-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--border); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.webchat-thread-actions form { margin: 0; }
.webchat-thread-actions button, .webchat-thread > .chat-clear button { min-height: 40px; border-color: var(--border-strong); background: transparent; color: var(--lavender); }
.webchat-thread-actions button:hover, .webchat-thread > .chat-clear button:hover { border-color: var(--lavender); background: var(--lavender-soft); color: var(--text); }
.webchat-thread-actions .webchat-danger-action button { border-color: rgba(255,140,160,.48); color: #ffb3c1; }
.webchat-thread-actions .webchat-danger-action button:hover { border-color: var(--danger); background: rgba(255,140,160,.1); color: #ffd3da; }
.webchat-thread > .chat-clear { margin: 0 !important; padding: 12px 20px 18px; border-top: 1px solid var(--border); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
.webchat-thread > .chat-clear p { margin: 0; }
.webchat-group-settings { display: grid; gap: 22px; color: var(--text); }
.webchat-group-settings section + section { padding-top: 20px; border-top: 1px solid var(--border); }
.webchat-group-settings h3 { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-size: 1rem; }
.webchat-group-settings h3 span { padding: 4px 9px; border-radius: 999px; background: var(--lavender-soft); color: var(--lavender); font-size: .72rem; }
.webchat-member-list { display: grid; gap: 7px; max-height: 260px; margin: 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-color: var(--border-strong) transparent; }
.webchat-member-list li { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 52px; margin: 0; padding: 8px 10px; border: 1px solid transparent; border-radius: 13px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); }
.webchat-member-list li > img, .webchat-member-list li > span[style] { width: 32px !important; height: 32px !important; border-radius: 50% !important; object-fit: cover; }
.webchat-member-list li > span:not([style]) { display: flex; min-width: 0; flex-direction: row; gap: 10px; line-height: 24px; }
.webchat-member-list li a { overflow: hidden; color: var(--text); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.webchat-member-list li small { color: #cfc1ed; font-size: .76rem; }
.webchat-member-list form, .webchat-modal-actions form { margin: 0; }
.webchat-member-list button { min-height: 32px; padding: 4px 11px; border-color: var(--border-strong); background: transparent; color: var(--lavender); font-size: .76rem; }
.webchat-member-list button:hover { border-color: var(--lavender); background: var(--lavender-soft); color: var(--text); }
.webchat-group-manage { display: grid; gap: 14px; }
.webchat-group-manage h3 { margin-bottom: 0; }
.webchat-group-manage .fr-modal__form { grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 10px; }
.webchat-group-manage .fr-modal__form label { min-width: 0; }
.webchat-group-manage .fr-modal__form button { min-height: 44px; white-space: nowrap; }
.webchat-group-danger h3 { color: #ffc1cc; }
.webchat-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.webchat-modal-actions button { min-height: 40px; border-color: var(--border-strong); background: transparent; color: var(--lavender); }
.webchat-modal-actions button:hover { border-color: var(--lavender); background: var(--lavender-soft); color: var(--text); }
.webchat-modal-actions .webchat-danger-action button { border-color: rgba(255,140,160,.5); color: #ffb3c1; }
.webchat-modal-actions .webchat-danger-action button:hover { border-color: var(--danger); background: rgba(255,140,160,.1); color: #ffd3da; }
.webchat-thread-empty { color: #d2c6ef; }
.webchat-thread-empty > div { max-width: 390px; padding: 36px; }
.webchat-thread-empty h2 { margin: 14px 0 6px; color: var(--text); }
.webchat-thread-empty p { line-height: 1.55; }
.webchat-empty-icon { border: 1px solid rgba(214,196,255,.22); background: var(--lavender-soft); color: var(--lavender); }
@media (max-width: 900px) {
  .pg-inbox main.page { padding: 16px 14px 26px; }
  .webchat-shell { grid-template-columns: 76px minmax(0,1fr); }
  .webchat-rail { padding: 18px 11px; }
  .webchat-rail a { width: 50px; height: 50px; }
  .webchat-messages { padding: 20px; }
}
@media (max-width: 560px) {
  .pg-inbox main.page { padding: 8px 6px 18px; }
  .webchat-shell { border-radius: 20px; }
  .webchat-rail { gap: 10px; padding: 9px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); }
  .webchat-rail a { width: 44px; height: 44px; border-radius: 14px; }
  .webchat-rail a > span { box-shadow: 0 0 0 3px var(--surface); }
  .webchat-list > header, .webchat-thread-head { min-height: 84px; padding: 14px 16px; }
  .webchat-items { padding: 10px; }
  .webchat-item { min-height: 72px; padding: 10px; }
  .webchat-messages { min-height: 340px; padding: 16px 12px; }
  .chat-message, .support-message { max-width: 92%; }
  .message-inline-edit { width: min(100%, 76vw); }
  .webchat-thread #send, .webchat-compose { padding: 12px; }
  .webchat-thread #send > button, .webchat-compose > button { min-width: 78px; padding: 0 16px; }
  .webchat-details { margin: 12px; }
  .webchat-thread-actions { padding: 12px; }
  .webchat-group-manage .fr-modal__form { grid-template-columns: 1fr; }
  .webchat-group-manage .fr-modal__form button { width: 100%; }
  .webchat-modal-actions { flex-direction: column; }
  .webchat-modal-actions button { width: 100%; }
}

@media (max-width: 760px) {
  .pf-banner { height: 130px; }
  .pf-hero-body { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 0 18px 22px; }
  .pf-id { padding-top: 4px; text-align: center; }
  .pf-id h1, .pf-id h1 + p, .pf-id > p[style*="margin:0"] { text-align: center !important; }
  .pf-id > p { margin-left: auto; margin-right: auto; }
  .pf-acts { align-items: center; padding-top: 4px; }
  .pf-acts .pf-stats, .pf-acts .pf-box { justify-content: center; }
  .pf-acts .pf-box > p { text-align: center; }
}

/* phones: keep the story page inside the screen; profile tabs in one row you can swipe */
.bk-top { grid-template-columns: 280px minmax(0, 1fr); }
.bk-main { min-width: 0; }
@media (max-width: 760px) {
  .bk-top { grid-template-columns: minmax(0, 1fr); }
  .bk-quick > * { flex: 1 1 auto; }
  .bk-quick .bk-read, .bk-quick form.bk-inline button { width: 100%; }
  .bk-pop-panel { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; }
  .pf-tabs { flex-wrap: nowrap !important; overflow-x: auto; width: 100% !important; }
}

/* ---------- covers shared by the layouts below ---------- */
.cov { position: relative; display: flex; align-items: flex-end; aspect-ratio: 512 / 800; border-radius: 12px; overflow: hidden; background: var(--cover);
  border: 1px solid var(--border); text-decoration: none; color: var(--text); padding: 10px; flex: none; }
.cov:hover { border-color: rgba(214, 196, 255, .55); color: var(--text); }
.cov img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cov:not(.has-img)::after { content: ""; position: absolute; right: 9px; top: 9px; width: 18px; height: 18px; opacity: .7; background: url("/fx/star.png") center / contain no-repeat; }
.cov-title { font-family: var(--story-font); font-weight: 600; font-size: .95rem; line-height: 1.2; position: relative; }
.card-grid { list-style: none; padding: 0; display: grid !important; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.card-grid > li { margin: 0 !important; }
.cover-card { display: flex; gap: 16px; align-items: flex-start; }
.cover-card .side-cover { width: 104px; }
.card-info { min-width: 0; flex: 1; }
.card-info form { display: inline-block; margin: 8px 6px 0 0; }

/* ---------- Home ---------- */
.home-hello { font-family: var(--title-font); font-size: 4.4rem; line-height: 1; margin: .1em 0 .4em; }
.home-main > h1.home-section-title { font-family: var(--font) !important; font-size: 1.4rem !important; font-weight: 700; margin: 26px 0 12px !important; letter-spacing: -0.01em; }
.home-extra { margin-bottom: 22px; }
.home-extra-head { display: flex; align-items: baseline; justify-content: space-between; }
.home-extra-head .col-title { margin-bottom: 12px; }
.home-see { font-size: .88rem; font-weight: 600; text-decoration: none; }
.home-extra .home-side { position: static; }
.home-side-col > h2.col-title { display: flex; }
.home-ranks { list-style: none; margin: 4px 0; padding: 0; }
.home-ranks li { margin: 0; }
.home-rank { display: flex; align-items: center; gap: 12px; padding: 8px 0; text-decoration: none; color: var(--text); border-top: 1px solid rgba(255, 255, 255, .08); }
.home-ranks li:first-child .home-rank { border-top: 0; }
.home-rank:hover strong { color: var(--lavender); }
.home-rank-n { width: 34px; text-align: center; font-weight: 800; color: var(--muted); flex: none; }
.home-rank-t { min-width: 0; display: flex; flex-direction: column; }
.home-rank-t strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.home-rank-t small { font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-comm { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 12px; font-size: .88rem; line-height: 1.45; }
.home-comm li { margin: 0; padding: 0 !important; border: 0 !important; background: none !important; }
.home-comm img, .home-comm span[style*="display:inline-block"] { width: 28px !important; height: 28px !important; line-height: 28px !important; font-size: 13px !important; vertical-align: middle; margin-right: 4px; }
.home-comm a strong { color: var(--text); }
.home-comm small em { display: block; margin-top: 2px; }
.pg-home .home-main > .st-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg-home .home-main > .st-list .st-item { padding: 14px; }
.pg-home .home-main > .st-list .st-cover { flex-basis: 92px; }
.pg-home .home-main > .st-list .st-blurb { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; }
.pg-home .home-main > .st-list .st-facts span:nth-child(n+5), .pg-home .home-main > .st-list .st-tags { display: none; }
.pg-home .home-main > .st-list .st-title { font-size: 1.08rem; }

/* ---------- Rankings: the podium ---------- */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 14px 0 20px; }
.podium-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); min-width: 0; }
.podium-cover { width: 86px; }
.podium-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.podium-info .rank-star { width: 40px; height: 40px; }
.podium-info .rank-star b { top: 12px; font-size: 13px; }
.podium-title { font-weight: 800; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.podium-title:hover { color: var(--lavender); }
.podium-meta { color: var(--muted); font-size: .85rem; }
tr.on-podium { display: none; }

/* ---------- New users ---------- */
.ulist.people-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ulist.people-grid li { border: 1px solid var(--border) !important; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); padding: 20px 16px !important; }
.ulist.people-grid .urow { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.ulist.people-grid .urow > a img, .ulist.people-grid .urow > a span { width: 64px !important; height: 64px !important; line-height: 64px !important; font-size: 26px !important; }
.ulist.people-grid .info strong { display: block; color: var(--text); font-size: 1.05rem; }
.ulist.people-grid .info a { text-decoration: none; }
.ulist.people-grid .info br { display: none; }
.ulist.people-grid .info > small { display: inline-block; margin: 2px 3px; }

/* ---------- Bookshelf ---------- */
.shelf-grid { list-style: none; padding: 0; display: grid !important; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 26px 20px; }
.shelf-grid > li.shelf-tile { margin: 0 !important; padding: 0 !important; background: none !important; border: 0 !important; position: relative; display: flex; flex-direction: column; gap: 8px; }
.shelf-cover { width: 100%; }
.shelf-info { font-size: .82rem; color: var(--muted); line-height: 1.45; }
.shelf-info > a:first-child { display: block; font-size: 1rem; color: var(--text); text-decoration: none; }
.shelf-info > a:first-child strong { font-weight: 700; }
.shelf-info small { font-size: .78rem; }
.shelf-info > small:not(.shelf-progress small), .shelf-info em { display: none; }
.shelf-progress { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 2px; }
.shelf-progress .bar { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.shelf-progress .bar i { display: block; height: 100%; width: 0; background: var(--lavender); border-radius: 3px; transition: width .4s ease; }
.shelf-progress small { color: var(--muted); }
.shelf-remove { position: absolute; top: 8px; right: 8px; margin: 0; }
.shelf-remove button { min-height: 30px !important; padding: 0 10px !important; font-size: .75rem !important; background: rgba(26, 1, 41, .8) !important; border-color: rgba(255, 255, 255, .25) !important; }
.mark-row { display: flex; gap: 16px; align-items: flex-start; }
.mark-row .mini-cover { width: 70px; }
.mark-row .card-info br { display: none; }
.mark-row .card-info > a:first-child { display: block; }
.mark-go { margin: 10px 8px 6px 0; min-height: 40px !important; }
.mark-row .card-info > small { display: block; }
.list-grid > li.list-card { display: flex; flex-direction: column; gap: 12px; }
.cover-stack { display: flex; gap: 6px; text-decoration: none; }
.cover-stack .cov { width: 64px; padding: 0; }
.cover-stack .cov.filled:empty { opacity: .55; }
.history-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.history-col > h2:first-child { margin-top: 0; }
.history-col > ol { list-style: none; padding: 0; display: grid; gap: 10px; }
.history-col > ol > li { padding: 12px 16px; border-radius: 16px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); margin: 0; }
.history-col > div[style*="border-top"] { border-top: 0 !important; padding: 12px 16px !important; margin: 0 0 10px; border-radius: 16px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); }

/* ---------- Notifications ---------- */
.note-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.note-filter { min-height: 38px !important; padding: 0 16px !important; font-size: .9rem; background: var(--glass) !important; color: #e9dcff !important; border: 1px solid var(--border) !important; }
.note-filter.on { background: var(--button) !important; color: var(--bg) !important; border-color: #fff !important; }
.note-day-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.note-list { list-style: none; padding: 6px; margin: 0; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); display: grid; gap: 2px; }
.note-list > li.note-row { position: relative; margin: 0 !important; padding: 14px 16px 14px 60px; border-radius: 16px; line-height: 1.55; }
.note-list > li.note-row.unread { background: rgba(214, 196, 255, .08); }
.note-kind { position: absolute; left: 14px; top: 14px; width: 32px; height: 32px; border-radius: 50%; background: var(--lavender); display: flex; align-items: center; justify-content: center; }
.note-kind svg { width: 17px; height: 17px; fill: none; stroke: var(--bg); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.note-row img[src^="/avatars/"], .note-row > span[style*="display:inline-block"] { vertical-align: middle; margin-right: 4px; }
.note-row > form { display: inline; margin-left: 6px; }
.note-row > strong:last-of-type { color: var(--lavender); }

/* ---------- Writing: steps on the left ---------- */
.write-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.write-nav { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--radius); background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); scrollbar-width: thin; }
.write-nav-title { margin: 8px 8px 4px; font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.write-nav-title:first-child { margin-top: 2px; }
.write-step, .write-add { display: block; padding: 9px 12px; border-radius: 12px; color: #e9dcff; text-decoration: none; font-weight: 600; font-size: .92rem; }
.write-step:hover, .write-add:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.write-step.on, .write-add.on { background: var(--button); color: var(--bg); }
.write-ch { display: flex; flex-direction: column; }
.write-live { margin: -2px 0 4px 24px; font-size: .78rem; font-weight: 600; text-decoration: none; }
.write-add { color: var(--lavender); }
.write-main { min-width: 0; }
.write-main > h1:first-child { margin-top: 0; }
.write-main fieldset { scroll-margin-top: 96px; }

/* ---------- a story: score and series ---------- */
.bk-score { display: inline-flex; align-items: center; gap: 8px; margin: 4px 0 0; text-decoration: none; color: var(--text); }
.bk-score strong { font-size: 1.15rem; }
.bk-stars { display: inline-flex; gap: 2px; }
.bk-stars svg { width: 18px; height: 18px; }
.bk-score:hover small { color: var(--text); }
.bk-series { margin: 16px 0 0; padding: 16px 20px; border-radius: 18px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); }
.bk-series-title { margin: 0; font-weight: 800; }
.bk-series-title a { color: var(--text); text-decoration: none; }
.bk-series-sub { margin: 2px 0 8px; color: var(--muted); font-size: .88rem; }
.bk-series ol { margin: 0; padding-left: 1.3rem; line-height: 1.9; }
.bk-series li.on a { color: var(--text); font-weight: 700; text-decoration: none; }

@media (max-width: 900px) {
  .podium { grid-template-columns: 1fr; }
  .history-cols { grid-template-columns: 1fr; }
  .write-layout { grid-template-columns: minmax(0, 1fr); }
  .write-nav { position: static; max-height: none; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; border-radius: 22px; }
  .write-nav-title { display: none; }
  .write-step, .write-add { white-space: nowrap; flex: none; }
  .write-ch { flex-direction: row; align-items: center; flex: none; }
  .write-live { margin: 0 8px 0 0; white-space: nowrap; }
}
@media (max-width: 760px) {
  .pg-home .home-main > .st-list { grid-template-columns: 1fr; }
  .home-hello { font-size: 3.2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .shelf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
}

.home-hello + .home-cols { margin-top: 0; }
.write-main fieldset { min-width: 0; }
.write-main input:not([type=checkbox]):not([type=radio]), .write-main textarea, .write-main select { max-width: 100%; box-sizing: border-box; }

/* ---------- Badges (each one a small constellation; ring: level 1 lavender, 2 white, 3 gold, dashed = not yet) ---------- */
.medal { --ms: 72px; flex: none; display: inline-flex; align-items: center; justify-content: center; width: var(--ms); height: var(--ms);
  border-radius: 50%; background: var(--bg); border: calc(var(--ms) * .035 + 1px) solid var(--lavender); box-sizing: border-box; }
.medal svg { width: 78% !important; height: 78% !important; flex: none; }
.medal polyline { fill: none; stroke: rgba(214, 196, 255, .65); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.medal path { fill: #fff; }
.medal.l2 { border-color: #fff; }
.medal.l3 { border-color: var(--gold); }
.medal.l0 { border-style: dashed; border-color: rgba(255, 255, 255, .4); }
.medal.l0 polyline { stroke: rgba(214, 196, 255, .4); }
.medal.l0 path { fill: rgba(255, 255, 255, .55); }

/* the strip under the name on a profile */
.pf-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 12px 0 4px; padding: 8px 12px 8px 18px;
  border-radius: 999px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); width: fit-content; max-width: 100%; }
.pf-hero-body > .pf-badges { grid-column: 2 / -1; margin: 0; }
.pf-badges-label { font-size: .78rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.pf-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.pf-badge:hover span { color: var(--lavender); }
.pf-badges-more { font-weight: 700; font-size: .88rem; text-decoration: none; padding: 7px 12px; border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); }

/* the Badges tab */
.badge-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.badge-head h2 { margin: 0; }
.badge-count { color: var(--muted); font-size: .9rem; }
.badge-panel { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; align-items: start; margin-top: 14px; }
.badge-lists h3 { margin: 0 0 12px; font-size: 1.15rem; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 10px; border-radius: 20px; text-align: center;
  background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.badge-card strong { font-size: .95rem; }
.badge-card small { color: var(--muted); font-size: .78rem; }
.badge-card:hover, .badge-row:hover { border-color: rgba(214, 196, 255, .5); color: var(--text); }
.badge-card.sel, .badge-row.sel { background: var(--surface-2); border-color: var(--lavender); }
.badge-next-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.badge-next-head h3 { margin: 0; }
.badge-next-head small { color: var(--muted); }
.badge-next { display: flex; flex-direction: column; gap: 10px; }
.badge-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; }
.badge-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.badge-row-top { display: flex; justify-content: space-between; gap: 12px; }
.badge-row-top small { color: var(--muted); white-space: nowrap; }
.badge-bar { display: block; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.badge-bar i { display: block; height: 100%; background: var(--lavender); border-radius: 3px; }
.badge-details { position: sticky; top: 92px; }
.badge-detail { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 22px; border-radius: var(--radius);
  background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%); border: 1px solid var(--border); text-align: center; margin-bottom: 14px; scroll-margin-top: 96px; }
.badge-panel.js .badge-detail { display: none; margin: 0; }
.badge-panel.js .badge-detail.on { display: flex; }
.badge-detail h3 { margin: 4px 0 0; font-size: 1.45rem; }
.badge-detail > p { margin: 0; color: var(--muted); }
.badge-ladder { list-style: none; margin: 6px 0 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.badge-ladder li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .05); margin: 0; }
.badge-ladder li > span:nth-child(2) { flex: 1; font-weight: 600; font-size: .92rem; }
.badge-ladder small { color: var(--muted); white-space: nowrap; }
.badge-ladder .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .4); box-sizing: border-box; }
.badge-ladder .dot.l1 { border: 2px solid var(--lavender); }
.badge-ladder .dot.l2 { border: 2px solid #fff; }
.badge-ladder .dot.l3 { border: 2px solid var(--gold); }
.badge-detail form { margin: 8px 0 0; }
.badge-detail > small { color: var(--muted); font-size: .8rem; }

/* the card when you earn one */
.badge-toast { position: fixed; right: 22px; bottom: 22px; z-index: 60; width: min(440px, calc(100vw - 32px)); box-sizing: border-box;
  display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: 24px; background: #28103F;background: linear-gradient(208deg,rgba(40, 16, 63, 1) 0%, rgba(64, 46, 71, .65) 80%);
  border: 1px solid rgba(214, 196, 255, .45); box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  transform: translateY(30px); opacity: 0; transition: transform .35s ease, opacity .35s ease; }
.badge-toast.in { transform: none; opacity: 1; }
.badge-toast .medal polyline { stroke-dasharray: 140; stroke-dashoffset: 140; animation: badge-draw 1.4s .3s ease-out forwards; }
.badge-toast .medal path { opacity: 0; animation: badge-stars .5s .1s ease-out forwards; }
@keyframes badge-draw { to { stroke-dashoffset: 0; } }
@keyframes badge-stars { to { opacity: 1; } }
.badge-toast-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.badge-toast-kicker { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--lavender); }
.badge-toast-text strong { font-size: 1.15rem; }
.badge-toast-what { color: var(--muted); font-size: .9rem; }
.badge-toast-text a { font-weight: 700; font-size: .9rem; text-decoration: none; }
.badge-toast-close { align-self: flex-start; flex: none; width: 36px; height: 36px; min-height: 0 !important; padding: 0 !important; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: var(--glass-2) !important; border: 0 !important; color: var(--text) !important; }
.badge-toast-close svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }

@media (max-width: 900px) {
  .badge-panel { grid-template-columns: minmax(0, 1fr); }
  .badge-details { position: static; order: -1; }
  .pf-hero-body > .pf-badges { grid-column: 1 / -1; justify-self: center; }
}
@media (max-width: 760px) {
  .pf-badges { border-radius: 22px; justify-content: center; }
  .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-toast .medal polyline { stroke-dashoffset: 0; }
  .badge-toast .medal path { opacity: 1; }
}

/* a badge you have, with the way to its next level (only you see it) */
.badge-card-next { display: flex; flex-direction: column; gap: 5px; width: 100%; margin-top: 4px; padding: 0 6px; box-sizing: border-box; }
.badge-card-next small { font-size: .74rem; }

/* ---------- Edit book: four parts as tabs (and the Danger zone), one Save for everything ---------- */
.edit-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; width: fit-content; max-width: 100%; margin: 0 0 18px;
  border-radius: 999px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border); }
.edit-tab { min-height: 42px !important; padding: 0 18px !important; border-radius: 999px !important; border: 0 !important;
  background: transparent !important; color: #e9dcff !important; font-weight: 700; font-size: .95rem; }
.edit-tab:hover { background: var(--glass) !important; color: var(--text) !important; }
.edit-tab.on { background: var(--button) !important; color: var(--bg) !important; }
.edit-tab.danger { color: #ffb3c1 !important; }
.edit-tab.danger.on { background: #ffb3c1 !important; color: var(--bg) !important; }
.edit-tabbed fieldset.edit-part > legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.edit-tabbed fieldset.edit-part { max-width: 820px; padding-top: 26px !important; }
.edit-tabbed fieldset.edit-part[hidden] { display: none !important; }
details.more { margin: -4px 0 12px; font-size: .86rem; color: var(--muted); }
details.more > summary { cursor: pointer; color: var(--lavender); font-weight: 700; width: fit-content; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: " \203A"; }
details.more[open] > summary::after { content: " \2039"; }
details.more > p { margin: 6px 0 0; line-height: 1.5; }
.edit-warn { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; margin: 8px 0; border-radius: 16px; background: rgba(255,255,255,.05); }
.edit-warn-btn { min-height: 36px !important; padding: 0 16px !important; font-size: .88rem !important; }
.edit-warn-list { display: none; }
.edit-warn-list.open { display: block; }
.edit-handover { margin: 22px 0 0 !important; border: 1px solid var(--border) !important; border-radius: 18px !important; background: rgba(255,255,255,.03) !important; }
.edit-danger { border-color: rgba(255,140,160,.45) !important; }
.edit-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 18px; border-radius: 16px;
  border: 1px solid rgba(255,140,160,.5); background: rgba(255,140,160,.06); }
.edit-danger-row span { display: flex; flex-direction: column; gap: 4px; }
.edit-danger-row strong { color: #ffb3c1; font-size: 1.05rem; }
.edit-danger-row small { color: #e9dcff; }
.edit-danger-btn { background: transparent !important; color: #ffb3c1 !important; border: 1px solid #ff8ca0 !important; white-space: nowrap; }
.edit-save { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 16px; margin: 18px 0 0 !important; padding: 14px 0 !important;
  background: rgba(26,1,41,.94); border-top: 1px solid var(--border); }
.edit-save[hidden] { display: none !important; }
.edit-story { display: flex; gap: 12px; align-items: center; padding: 8px; margin-bottom: 6px; border-radius: 16px; text-decoration: none; color: var(--text); }
.edit-story:hover { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.edit-story-cover { flex: none; width: 46px; height: 70px; border-radius: 7px; background: var(--cover); overflow: hidden; }
.edit-story-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edit-story-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.edit-story-text strong { font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-story-text small { color: var(--lavender); font-weight: 700; font-size: .8rem; }
@media (max-width: 900px) {
  .edit-story { flex: none; }
  .edit-tabs { flex-wrap: nowrap; overflow-x: auto; width: 100%; border-radius: 22px; }
  .edit-tab { flex: none; }
  .edit-danger-row { flex-direction: column; align-items: flex-start; }
}
.write-layout.write-solo { grid-template-columns: minmax(0, 1fr); }

/* Chapters: rearranging (Edit book and its Chapters page) */
.co-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.co-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); border: 1px solid var(--border); }
.co-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.co-num { font-size: .78rem; font-weight: 700; color: var(--lavender); text-transform: uppercase; letter-spacing: .04em; }
.co-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-vis { flex: none; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--lavender-soft); color: var(--lavender); }
.co-vis-private, .co-vis-waiting { background: rgba(255,255,255,.08); color: var(--muted); }
.co-vis-scheduled { background: rgba(255,212,107,.14); color: var(--gold); }
.co-moves { display: flex; gap: 6px; flex: none; }
.co-move { display: inline; margin: 0; }
.co-move button { min-height: 32px; padding: 0 12px; font-size: .82rem; }
.co-drag .co-moves { display: none; }
.co-grip { flex: none; width: 34px; height: 34px; min-height: 0 !important; padding: 0 !important; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: none !important; color: var(--muted) !important; border: 1px solid transparent; cursor: grab; touch-action: none; }
.co-grip:hover, .co-grip:focus-visible { color: var(--lavender) !important; border-color: var(--border-strong); }
.co-dragging { border-color: var(--lavender); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.co-dragging .co-grip { cursor: grabbing; }
.co-save { position: sticky; bottom: 10px; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.co-save p { margin: 4px 0; }
.co-blocked { padding: 10px 14px; border-radius: 14px; background: rgba(255,212,107,.1); border: 1px solid rgba(255,212,107,.35); }
@media (max-width: 560px) { .co-row { flex-wrap: wrap; } .co-moves { width: 100%; justify-content: flex-end; } }

/* Rankings: All and each genre as tabs */
.rank-genres { font-size: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.rank-genres a, .rank-genres strong { font-size: .9rem; font-weight: 600; padding: 7px 15px; border-radius: 999px; text-decoration: none; border: 1px solid var(--border); background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.08) 50%, rgba(69, 69, 69, 0.45) 100%); color: var(--text); }
.rank-genres a:hover { border-color: var(--lavender); background: var(--lavender-soft); }
.rank-genres strong { background: var(--button); color: var(--bg); border-color: #fff; }

/* ---------- header drop-down menus (nav-menus.js): the bell's latest notifications and the avatar's menu ---------- */
.site-header .user-nav { position: relative; }
.nav-menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 60; width: 260px; max-width: calc(100vw - 32px); box-sizing: border-box;
  padding: 8px; border-radius: 18px; background: #24103b; border: 1px solid var(--border); box-shadow: 0 18px 40px rgba(10, 0, 20, .55);
  color: var(--text); font-size: .95rem; text-align: left;
}
.nav-menu[hidden] { display: none; }
.me-menu .nm-who { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; margin-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.me-menu .nm-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu .nm-who small { color: var(--muted); }
.me-menu a, .me-menu .nm-logout button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; box-sizing: border-box;
  padding: 0 12px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.me-menu a:hover, .me-menu a:focus-visible, .me-menu .nm-logout button:hover, .me-menu .nm-logout button:focus-visible { background: #ffffff;background: radial-gradient(circle,rgba(255, 255, 255, 0.11) 60%, rgba(69, 69, 69, 0.45) 100%); outline: none; transform: none; }
.me-menu .nm-logout { margin: 6px 0 0 !important; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, .1); }
.me-menu .nm-logout button { color: var(--danger); min-height: 40px; }
.notes-menu { width: 400px; padding: 8px 8px 4px; }
.notes-menu .nm-head { margin: 4px 10px 6px; font-weight: 700; font-size: 1rem; }
.notes-menu .nm-body { max-height: min(70vh, 520px); overflow-y: auto; }
.nm-list { list-style: none; margin: 0; padding: 0; }
.nm-list li { padding: 10px; border-radius: 12px; font-size: .9rem; line-height: 1.45; }
.nm-list li + li { border-top: 1px solid rgba(255, 255, 255, .06); }
.nm-list li.nm-new { background: rgba(214, 196, 255, .13); }
.nm-list li img, .nm-list li > span[style*="border-radius"] { vertical-align: middle; margin-right: 6px; }
.nm-list a { color: var(--lavender); }
.nm-list a strong { color: var(--text); }
.nm-list small { color: var(--muted); }
.nm-empty { margin: 10px; color: var(--muted); }
.nm-foot { margin: 4px 4px 6px; padding: 10px 6px 4px; border-top: 1px solid rgba(255, 255, 255, .1); text-align: center; font-size: .9rem; color: var(--muted); }
.nm-foot a { color: var(--text); font-weight: 600; }
@media (max-width: 560px) {
  .notes-menu, .me-menu { position: fixed; top: 72px; left: 16px; right: 16px; width: auto; max-width: none; overflow-y: auto; }
  .notes-menu .nm-body { max-height: none; }
}

/* The website's header: Settings lives in the avatar menu, so the gear button is hidden (it stays without scripts).
   Its number (follow requests, reports) shows on the avatar instead, added to the questions number. */
.in-web .user-nav a.nav-icon[href="/profile/edit"] { display: none; }
.me-all { display: none; }
.in-web .me-all { display: block; }
.in-web .me-q { display: none; }
