/* Lila — demon chat theme. One dark world on purpose (no light variant).
   Lila speaks from the right, the user from the left, in angular bubbles.
   Angular panels use one technique throughout: the element's clip-path shape
   carries the edge colour as background, and ::before (inset by --b with the
   same shape) carries the fill, so edges stay even on every chamfer. */
/* Colours, fonts, the chat width, the eye position and the mood colours are
   variables from /theme.css, which the server builds from settings/theme.json. */
:root { color-scheme: dark; --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--bone); font: 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
body[data-view="chat"] { overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: #ff9aa8; }
a:hover { color: #ffc2ca; }
img { max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--flare); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted { color: var(--mist); }
.hint { margin-top: 6px; font-size: 13px; color: var(--mist); }
.optional { color: var(--mist); font-weight: 400; }
.noscript { position: fixed; inset: auto 16px 16px; padding: 12px 16px; background: var(--blood); color: #fff; }
#app { position: relative; z-index: 1; }

/* ---------------- angular building blocks ---------------- */
.angular, .card, .btn, .menu-item, .stat, .emote-picker, .dice-tray, .note, .access-banner, .pic-frame, .scenario, .scene-card {
  --c: 12px; --b: 1.5px;
  --shape: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  position: relative; isolation: isolate; clip-path: var(--shape); background: var(--edge, var(--panel-edge));
}
.angular::before, .card::before, .btn::before, .menu-item::before, .stat::before, .emote-picker::before, .dice-tray::before, .note::before, .access-banner::before, .scenario::before, .scene-card::before {
  content: ""; position: absolute; inset: var(--b); z-index: -1; clip-path: var(--shape); background: var(--fill, var(--panel-fill));
}
.hex { display: inline-block; flex: none; padding: 1.5px; background: var(--lila-edge); clip-path: var(--hex); }
.hex img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; clip-path: var(--hex); background: #2a0710; }
.hex .initial { display: grid; place-items: center; width: 100%; height: 100%; clip-path: var(--hex); background: #1e1724; font-weight: 700; font-size: 1.25em; color: #d9c6e6; }

/* ---------------- backdrop ---------------- */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bd-glow {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 115%, rgba(179, 18, 46, .55) 0%, rgba(90, 6, 20, .35) 35%, transparent 70%),
    radial-gradient(60% 50% at 85% 20%, rgba(120, 10, 40, .22), transparent 70%),
    radial-gradient(50% 45% at 10% 30%, rgba(70, 10, 60, .25), transparent 70%),
    radial-gradient(140% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, .85) 100%);
}
.bd-circle {
  position: absolute; left: 50%; top: 47%; width: min(118vh, 1150px); height: auto; max-width: none;
  translate: -50% -50%; opacity: .13; filter: drop-shadow(0 0 6px #ff2a4a);
  animation: bd-spin 240s linear infinite, bd-pulse 9s ease-in-out infinite;
}
.bd-smoke { position: absolute; width: 90vmax; height: 60vmax; border-radius: 50%; filter: blur(60px); opacity: .5; }
.bd-smoke-a { left: -30vmax; bottom: -25vmax; background: radial-gradient(closest-side, rgba(90, 20, 40, .55), transparent); animation: bd-drift-a 38s ease-in-out infinite alternate; }
.bd-smoke-b { right: -35vmax; top: -20vmax; background: radial-gradient(closest-side, rgba(60, 12, 50, .5), transparent); animation: bd-drift-b 46s ease-in-out infinite alternate; }
.bd-shade { position: absolute; right: max(2vw, calc((100vw - var(--col)) / 2 - 400px)); bottom: -2vh; height: 94vh; aspect-ratio: 594 / 1078; animation: bd-breathe 7s ease-in-out infinite; }
.bd-shade img { display: block; width: 100%; height: 100%; max-width: none; opacity: .5; filter: brightness(0) drop-shadow(0 0 2px #ff2a4a) drop-shadow(0 0 26px rgba(255, 26, 61, .55)); }
/* Eyes sit on her face: centre x 259, y 196 of the 594x1078 silhouette. The eye
   level comes from her side view (between the fringe and the nose tip), the centre
   from the jaw line; a slight outward slant gives the demon look. */
.bd-eyes { position: absolute; left: var(--eyes-left); top: var(--eyes-top); width: var(--eyes-width); height: var(--eyes-height); translate: 0 -50%; animation: bd-blink 9s infinite; }
.bd-eyes i { position: absolute; top: 0; width: 25%; height: 100%; background: var(--eyes-color); border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; box-shadow: 0 0 6px 2px rgba(255, 40, 70, .9), 0 0 22px 6px rgba(255, 30, 60, .45); }
.bd-eyes i:first-child { left: 0; rotate: var(--eyes-slant); }
.bd-eyes i:last-child { right: 0; rotate: calc(var(--eyes-slant) * -1); }
/* Sky by local time. Night is the base look; the other phases fade in tints, a sun or the moon. */
.bd-sky { position: absolute; inset: 0; }
.bd-tint { position: absolute; inset: 0; opacity: 0; transition: opacity 4s ease; }
.bd-tint-dawn { background: radial-gradient(90% 55% at 82% 100%, rgba(190, 90, 210, .32), transparent 70%), linear-gradient(180deg, rgba(70, 30, 90, .28), transparent 55%); }
.bd-tint-day { background: radial-gradient(80% 60% at 20% 0%, rgba(255, 120, 95, .22), transparent 70%), linear-gradient(180deg, rgba(120, 35, 45, .38), rgba(60, 12, 20, .1) 60%, transparent); }
.bd-tint-dusk { background: radial-gradient(85% 55% at 8% 92%, rgba(255, 110, 40, .38), transparent 70%), linear-gradient(0deg, rgba(120, 30, 10, .3), transparent 50%); }
html[data-phase="dawn"] .bd-tint-dawn, html[data-phase="day"] .bd-tint-day, html[data-phase="dusk"] .bd-tint-dusk { opacity: 1; }
.bd-sun { position: absolute; left: 8vw; top: 66vh; width: 300px; height: 300px; border-radius: 50%; opacity: 0; background: radial-gradient(circle, #ffc27a 0 18%, #ff6a2d 40%, rgba(255, 60, 40, .35) 58%, transparent 72%); filter: blur(1px); transition: opacity 4s ease, top 4s ease, left 4s ease; }
html[data-phase="dusk"] .bd-sun { opacity: .7; }
html[data-phase="dawn"] .bd-sun { opacity: .45; left: auto; right: 10vw; background: radial-gradient(circle, #ffd2e6 0 20%, #d86ad8 44%, rgba(160, 60, 200, .3) 60%, transparent 72%); }
html[data-phase="day"] .bd-sun { opacity: .38; top: 7vh; left: 12vw; width: 220px; height: 220px; background: radial-gradient(circle, #ffe2c8 0 24%, #ff8a6b 46%, rgba(255, 70, 60, .25) 62%, transparent 74%); }
.bd-moon { position: absolute; left: 10vw; top: 9vh; width: 96px; height: 96px; border-radius: 50%; opacity: 0; box-shadow: inset -22px 9px 0 0 #f4d5db; filter: drop-shadow(0 0 16px rgba(255, 120, 140, .55)); transition: opacity 4s ease; }
html[data-phase="night"] .bd-moon { opacity: .75; }
html[data-phase="dawn"] .bd-moon { opacity: .25; }
html[data-phase="day"] .bd-eyes { opacity: .55; }
html[data-phase="day"] .bd-shade img { opacity: .38; }
.bd-embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.bd-cracks { position: absolute; left: 0; right: 0; bottom: 0; height: 22vh; background: radial-gradient(40% 60% at 30% 100%, rgba(255, 74, 61, .28), transparent 70%), radial-gradient(35% 50% at 72% 100%, rgba(255, 120, 61, .2), transparent 70%); animation: bd-flicker 5s ease-in-out infinite; }
@keyframes bd-spin { to { rotate: 360deg; } }
@keyframes bd-pulse { 50% { opacity: .19; } }
@keyframes bd-drift-a { to { transform: translate(14vmax, -6vmax) scale(1.15); } }
@keyframes bd-drift-b { to { transform: translate(-12vmax, 8vmax) scale(1.1); } }
@keyframes bd-breathe { 50% { transform: translateY(-6px) scale(1.006); } }
@keyframes bd-flicker { 50% { opacity: .65; } }
@keyframes bd-blink { 0%, 46%, 50%, 100% { transform: scaleY(1); } 48% { transform: scaleY(.1); } }

/* ---------------- buttons and forms ---------------- */
.btn {
  --c: 9px; --edge: linear-gradient(160deg, #6b2a3a, #2c1219); --fill: linear-gradient(170deg, #1d0b11, #12070a);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 0; font-weight: 600; letter-spacing: .02em; text-decoration: none; color: var(--bone); cursor: pointer;
}
.btn:hover { --edge: linear-gradient(160deg, #ff3355, #5a1424); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: default; }
.btn--primary { --edge: linear-gradient(160deg, #ff8a3d, #ff3355 50%, #a10f2a); --fill: linear-gradient(160deg, #ff3355, #a10f2a); color: #fff; filter: drop-shadow(0 0 10px rgba(255, 51, 85, .35)); }
.btn--primary:hover { --edge: linear-gradient(160deg, #ffb36b, #ff5a6e); --fill: linear-gradient(160deg, #ff5a6e, #c4122f); }
.btn--ghost { --fill: linear-gradient(170deg, #160810, #0d0407); }
.btn--danger { --edge: linear-gradient(160deg, #ff3355, #7a0c22); --fill: linear-gradient(160deg, #5f0f22, #2a060e); color: #ffd0d6; }
.btn--block { width: 100%; }
.btn--sm { --c: 7px; min-height: 36px; padding: 0 12px; font-size: 14px; }
.icon-btn { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; cursor: pointer; color: #ffb3bf; background: rgba(255, 255, 255, .06); clip-path: var(--hex); }
.icon-btn:hover { background: rgba(255, 51, 85, .25); color: #fff; }
.link-btn { padding: 2px 4px; border: 0; background: none; color: #ff9aa8; text-decoration: underline; cursor: pointer; font-size: 13px; }

label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #d9b4bc; }
input[type="text"], input[type="password"], input[type="number"], input[type="search"] {
  display: block; width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid rgba(255, 51, 85, .28); border-radius: 0;
  background: #0f0508; color: var(--bone); font-size: 16px;
}
input::placeholder, textarea::placeholder { color: #7a5c64; font-style: italic; }
.field textarea { display: block; width: 100%; min-height: 120px; padding: 10px 14px; border: 1px solid rgba(255, 51, 85, .28); border-radius: 0; background: #0f0508; color: var(--bone); font-size: 16px; line-height: 1.45; resize: vertical; }
.field textarea:focus-visible { outline: none; border-color: var(--crimson); box-shadow: 0 0 0 1px var(--crimson), 0 0 14px rgba(255, 51, 85, .35); }
input:focus-visible { outline: none; border-color: var(--crimson); box-shadow: 0 0 0 1px var(--crimson), 0 0 14px rgba(255, 51, 85, .35); }
.field { margin-bottom: 16px; }
.field--short { max-width: 150px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 12px; text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 400; color: var(--bone); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--crimson); flex: none; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.row .btn { flex: none; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form .field { flex: 1 1 200px; margin-bottom: 0; }
.inline-form .field--short { flex: 0 1 150px; }
.form-msg { font-size: 14px; }
.form-msg:empty { display: none; }
.form-msg:not(:empty) { margin: 4px 0 12px; }
.form-msg[data-kind="error"] { color: var(--error); }
.form-msg[data-kind="success"] { color: #8fe3b0; }
.note { --c: 8px; --fill: linear-gradient(170deg, #2a0a14, #1a060c); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; color: #ffd0d6; }
.note--error { --edge: linear-gradient(160deg, #ff3355, #7a0c22); }

/* ---------------- loading ---------------- */
.view--center { display: grid; place-items: center; min-height: 100dvh; }
.spinner { width: 42px; height: 42px; background: conic-gradient(var(--crimson), transparent 70%); clip-path: var(--hex); animation: bd-spin 1s linear infinite; }

/* ---------------- auth ---------------- */
.auth { display: grid; place-items: center; min-height: 100dvh; padding: calc(28px + env(safe-area-inset-top, 0px)) 16px calc(28px + env(safe-area-inset-bottom, 0px)); }
.auth-inner { width: min(420px, 100%); display: grid; gap: 18px; }
.hero { display: grid; justify-items: center; gap: 8px; text-align: center; }
.hero-avatar { width: 112px; height: 112px; filter: drop-shadow(0 0 18px rgba(255, 51, 85, .55)); margin-bottom: 4px; }
.hero h1 { font: 600 52px/1 var(--font-name); letter-spacing: .08em; color: #ffd9de; text-shadow: 0 0 22px rgba(255, 51, 85, .6); }
.tagline { color: #e6c9cf; font-size: 17px; }
.age-note { font-size: 13px; color: var(--mist); letter-spacing: .04em; }
.card { --c: 18px; padding: 22px 22px 20px; filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .6)); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 20px; }
.tab { min-height: 44px; border: 0; cursor: pointer; font-weight: 600; letter-spacing: .04em; color: var(--mist); background: rgba(255, 255, 255, .04); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.tab:hover { color: var(--bone); }
.tab[aria-selected="true"] { color: #fff; background: linear-gradient(160deg, #ff3355, #8a0c24); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; font-size: 14px; }
.footer-links a { color: var(--mist); }
.footer-links a:hover { color: var(--bone); }

/* ---------------- chat ---------------- */
.chat {
  display: flex; flex-direction: column; width: min(var(--col), 100%); height: 100vh; height: 100dvh; margin: 0 auto;
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  background: linear-gradient(180deg, rgba(10, 4, 7, .72), rgba(10, 4, 7, .55) 40%, rgba(10, 4, 7, .78));
  border-inline: 1px solid rgba(255, 51, 85, .18);
  box-shadow: 0 0 80px rgba(0, 0, 0, .7), inset 0 0 60px rgba(120, 8, 30, .12);
}
.chat-header {
  display: grid; grid-template-columns: auto minmax(0, max-content) minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(20, 5, 9, .92), rgba(20, 5, 9, .6));
}
.who { display: grid; justify-items: end; gap: 2px; text-align: right; min-width: 0; }
.who h1 { white-space: nowrap; font: 600 26px/1 var(--font-name); letter-spacing: .06em; color: #ffd9de; text-shadow: 0 0 14px rgba(255, 51, 85, .55); }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--mist); letter-spacing: .04em; }
.status-dot { width: 7px; height: 7px; background: var(--ok); box-shadow: 0 0 8px var(--ok); rotate: 45deg; }
.status[data-state="typing"] .status-dot { background: var(--ember); box-shadow: 0 0 10px var(--ember); animation: blink-dot 1s ease-in-out infinite; }
.status[data-state="offline"] .status-dot { background: #7a6a70; box-shadow: none; }
@keyframes blink-dot { 50% { opacity: .35; } }
.header-avatar { width: 62px; height: 62px; filter: drop-shadow(0 0 10px rgba(255, 51, 85, .5)); }
.pill { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; min-height: 30px; padding: 0 14px; font-size: 13px; font-weight: 600; letter-spacing: .03em; color: #ffd0d6; background: rgba(120, 10, 30, .45); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); white-space: nowrap; }
.pill[data-level="warn"] { color: #1a0a05; background: var(--warn); }
.pill:empty { display: none; }

.messages-wrap { position: relative; display: flex; flex: 1; min-height: 0; }
.messages {
  /* Containing block for the absolutely positioned .sr-only labels: without
     it they escape the scroller and make the whole page scroll. */
  position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0;
  padding: 16px 18px 18px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: rgba(255, 51, 85, .35) transparent;
}
.messages > * { flex-shrink: 0; }
.thread { margin-top: auto; }
.older-row { display: flex; justify-content: center; margin-bottom: 8px; }
.empty { display: grid; justify-items: center; gap: 8px; margin: auto; padding: 24px; text-align: center; }
.empty-avatar { width: 84px; height: 84px; filter: drop-shadow(0 0 16px rgba(255, 51, 85, .5)); margin-bottom: 6px; }
.empty > p:first-of-type { font: 600 22px var(--font-name); color: #ffd9de; }
.day { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 10px; font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--mist); }
.day::before, .day::after { content: ""; width: 54px; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 51, 85, .5)); }
.day::after { transform: scaleX(-1); }

.group { display: flex; align-items: flex-end; gap: 12px; margin-top: 16px; }
.group--assistant { justify-content: flex-end; }
.group--user { justify-content: flex-start; }
.group-body { display: grid; gap: 6px; min-width: 0; max-width: min(560px, 82%); }
.group--assistant .group-body { justify-items: end; }
.group--user .group-body { justify-items: start; }
.bubbles { display: grid; gap: 6px; min-width: 0; }
.group--assistant .bubbles, .group--assistant .msg { justify-items: end; }
.group--user .bubbles, .group--user .msg { justify-items: start; }
.msg { display: grid; gap: 4px; min-width: 0; max-width: 100%; }
.group-avatar { width: 56px; height: 56px; filter: drop-shadow(0 0 8px rgba(255, 51, 85, .35)); }
.group-name { font: 600 13px/1.2 var(--font-name); letter-spacing: .05em; color: #e8c8cf; padding-inline: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.group--assistant .group-name { color: #ffb3bf; }
.group-time { font-size: 11.5px; color: var(--mist); letter-spacing: .05em; padding-inline: 6px; opacity: .85; }
.group--assistant .bubbles { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .55)) drop-shadow(0 0 10px rgba(255, 40, 70, .22)); }
.group--user .bubbles { filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .55)); }

/* Angular speech bubbles: tail on the last bubble of a group only. */
.bubble {
  --c: 12px; --t: 14px; --b: 1.5px;
  position: relative; isolation: isolate; min-width: 64px; max-width: 100%;
  padding: 11px 16px 12px; overflow-wrap: anywhere; clip-path: var(--shape); background: var(--edge);
}
.bubble::before { content: ""; position: absolute; inset: var(--b); z-index: -1; clip-path: var(--shape); background: var(--fill); }
.group--assistant .bubble, .typing-row .bubble {
  --edge: var(--lila-edge); --fill: var(--lila-fill);
  --shape: polygon(var(--c) 0, calc(100% - var(--t) - var(--c)) 0, calc(100% - var(--t)) var(--c), calc(100% - var(--t)) calc(100% - 22px), 100% 100%, calc(100% - var(--t) - 20px) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c));
  padding-right: calc(16px + var(--t));
}
.group--user .bubble {
  --edge: var(--user-edge); --fill: var(--user-fill);
  --shape: polygon(calc(var(--t) + var(--c)) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, calc(var(--t) + 20px) 100%, 0 100%, var(--t) calc(100% - 22px), var(--t) var(--c));
  padding-left: calc(16px + var(--t));
}
.group--assistant .msg:not(:last-child) .bubble { --shape: polygon(var(--c) 0, calc(100% - var(--t) - var(--c)) 0, calc(100% - var(--t)) var(--c), calc(100% - var(--t)) calc(100% - var(--c)), calc(100% - var(--t) - var(--c)) 100%, var(--c) 100%, 0 calc(100% - var(--c)), 0 var(--c)); }
.group--user .msg:not(:last-child) .bubble { --shape: polygon(calc(var(--t) + var(--c)) 0, calc(100% - var(--c)) 0, 100% var(--c), 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, calc(var(--t) + var(--c)) 100%, var(--t) calc(100% - var(--c)), var(--t) var(--c)); }
.bubble p + p { margin-top: 6px; }
.bubble .action { font-style: italic; font-size: .95em; color: #ffb3bf; }
.group--user .bubble .action { color: #c9b6d6; }
.bubble em { color: #ffd0d7; }
.emote { height: 1.55em; width: auto; vertical-align: -.35em; margin: 0 .08em; filter: drop-shadow(0 0 4px rgba(255, 60, 90, .45)); }
.group .bubble.bubble--jumbo { clip-path: none; background: none; padding: 2px 4px; }
.bubble--jumbo::before { display: none; }
.bubble--jumbo .emote { height: 64px; vertical-align: middle; filter: drop-shadow(0 0 12px rgba(255, 60, 90, .5)); }
.bubble--media { padding-top: 6px; padding-bottom: 6px; }
.bubble-images { display: grid; gap: 6px; }
.bubble p + .bubble-images { margin-top: 10px; }
.attachment { display: block; width: 260px; max-width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px); }
.attachment img { display: block; width: 100%; height: auto; }
.attachment::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 1px rgba(255, 90, 110, .55), inset 0 -40px 40px -20px rgba(40, 0, 10, .6); pointer-events: none; }
.attachment:hover img { filter: brightness(1.08); }
.attachment-missing { display: grid; place-items: center; width: 200px; max-width: 100%; aspect-ratio: 3 / 4; font-size: 13px; color: var(--mist); border: 1px dashed rgba(255, 90, 110, .4); }
.sticker { display: block; width: 168px; max-width: 60vw; height: auto; margin-top: 2px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .6)) drop-shadow(0 0 14px rgba(255, 40, 70, .3)); transform-origin: 80% 100%; }
.sticker--pop { animation: sticker-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.group--user .sticker { transform-origin: 20% 100%; }
@keyframes sticker-pop { from { opacity: 0; transform: scale(.6) rotate(-6deg); } }
.user-avatar { width: 56px; height: 56px; border: 0; cursor: pointer; background: var(--user-edge); }
.user-avatar:hover, .user-avatar:focus-visible, .user-avatar.is-drop { background: var(--lila-edge); filter: drop-shadow(0 0 8px rgba(255, 51, 85, .55)); outline: none; }
.avatar-edit { display: grid; justify-items: center; gap: 14px; }
.avatar-preview { width: 120px; height: 120px; filter: drop-shadow(0 0 16px rgba(255, 51, 85, .4)); }
.avatar-preview .initial { font-size: 44px; }
.dropzone { display: grid; gap: 4px; width: 100%; padding: 18px 14px; border: 1.5px dashed rgba(255, 51, 85, .5); background: rgba(255, 255, 255, .03); color: var(--bone); text-align: center; cursor: pointer; }
.dropzone strong { font: 600 18px var(--font-name); color: #ffd9de; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-over { border-color: var(--crimson); background: rgba(255, 51, 85, .12); outline: none; }
.msg--pending .bubble { opacity: .6; }
.msg--failed .bubble { --edge: linear-gradient(160deg, #ff3355, #ff3355); opacity: .8; }
.msg-error { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--error); }
.notice { align-self: center; margin: 12px auto 4px; padding: 6px 18px; max-width: 90%; font-size: 13px; text-align: center; color: #e6d0f0; background: rgba(70, 30, 90, .45); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
.notice[data-level="error"] { color: #ffc2ca; background: rgba(120, 10, 30, .45); }

.typing-row { display: flex; justify-content: flex-end; align-items: flex-end; gap: 12px; margin-top: 16px; filter: drop-shadow(0 0 10px rgba(255, 40, 70, .22)); }
.bubble--typing { padding-block: 14px; }
.dots { display: inline-flex; gap: 6px; }
.dots span { width: 8px; height: 8px; rotate: 45deg; background: var(--ember); box-shadow: 0 0 10px var(--ember); animation: ember 1.2s ease-in-out infinite; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ember { 0%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.new-pill { position: absolute; left: 50%; bottom: 12px; translate: -50% 0; min-height: 40px; padding: 0 20px; border: 0; cursor: pointer; font-weight: 600; color: #fff; background: linear-gradient(160deg, #ff3355, #a10f2a); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); }
.access-banner { --c: 10px; --edge: linear-gradient(160deg, #ffb36b, #a85a1a); --fill: linear-gradient(170deg, #2a1206, #1a0a05); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 16px 10px; padding: 8px 10px 8px 16px; font-size: 14px; color: var(--warn); }

/* ---------------- composer ---------------- */
.composer { position: relative; display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px 14px; border-top: 1px solid var(--line); background: linear-gradient(0deg, rgba(20, 5, 9, .95), rgba(20, 5, 9, .7)); }
.composer-box { position: relative; flex: 1; min-width: 0; padding: 1.5px; background: linear-gradient(90deg, #5a1424, #ff3355 50%, #5a1424); clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.composer-box:focus-within { background: linear-gradient(90deg, #ff3355, #ff8a3d 50%, #ff3355); }
.composer textarea { display: block; width: 100%; min-height: 46px; max-height: 160px; margin: 0; padding: 12px 14px; resize: none; border: 0; font-size: 16px; line-height: 1.4; color: var(--bone); background: #12070a; clip-path: polygon(11px 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%, 0 11px); }
.composer textarea:focus { outline: none; background: #170a0e; }
.counter { position: absolute; right: 16px; bottom: 6px; font-size: 11px; line-height: 1; color: var(--mist); pointer-events: none; }
.counter[data-level="warn"] { color: var(--warn); }
.counter[data-level="over"] { color: var(--error); }
.emote-btn, .send { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border: 0; cursor: pointer; clip-path: var(--hex); }
.emote-btn { color: #ffb3bf; background: rgba(255, 255, 255, .06); }
.emote-btn:hover, .emote-btn[aria-expanded="true"] { color: #fff; background: rgba(255, 51, 85, .25); }
.send { color: #fff; background: linear-gradient(160deg, #ff3355, #a10f2a); }
.send:not(:disabled):hover { background: linear-gradient(160deg, #ff5a6e, #c4122f); }
.send:active { transform: translateY(1px); }
.send:disabled { color: #6e4a52; background: #2a1217; cursor: default; }

.emote-picker { --c: 16px; position: absolute; left: 12px; bottom: calc(100% + 8px); z-index: 10; display: flex; flex-direction: column; gap: 8px; width: min(400px, calc(100% - 24px)); max-height: min(300px, 45dvh); padding: 12px; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .7)); }
.emote-filter { flex: none; }
.emote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.emote-tile { display: grid; place-items: center; height: 52px; border: 0; cursor: pointer; background: rgba(255, 255, 255, .04); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.emote-tile:hover, .emote-tile:focus-visible { outline: none; background: rgba(255, 51, 85, .28); }
.emote-tile img { width: 36px; height: 36px; }
.emote-empty { font-size: 14px; color: var(--mist); text-align: center; padding: 8px; }

/* ---------------- dialogs ---------------- */
.dialog {
  --c: 20px; --shape: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
  width: calc(100% - 32px); max-width: 460px; max-height: calc(100dvh - 32px); margin: auto; padding: 1.5px; overflow: auto;
  border: 0; color: var(--bone); background: var(--panel-edge); clip-path: var(--shape);
}
.dialog::backdrop { background: rgba(5, 1, 3, .8); backdrop-filter: blur(6px); }
.dialog[open] { animation: rise .2s ease-out; }
.dialog-inner { display: grid; gap: 14px; min-height: 100%; padding: 22px; background: var(--panel-fill); clip-path: polygon(calc(var(--c) - 1px) 0, 100% 0, 100% calc(100% - var(--c) + 1px), calc(100% - var(--c) + 1px) 100%, 0 100%, 0 calc(var(--c) - 1px)); }
.dialog-inner > h2, .dialog-head h2 { font: 600 24px/1.2 var(--font-name); letter-spacing: .04em; color: #ffd9de; text-shadow: 0 0 12px rgba(255, 51, 85, .45); }
.dialog-inner > p { color: #e6c9cf; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.warning { color: #ffc2ca; }
.stack { display: grid; gap: 10px; }
.price { font: 600 20px/1.35 var(--font-name); color: #ffd9de; }
.paywall-redeem { padding-top: 14px; border-top: 1px solid var(--line); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* Menu drawer: slides in from the left, where the menu button lives. */
.drawer { --shape: polygon(0 0, 100% 0, 100% calc(100% - 28px), calc(100% - 28px) 100%, 0 100%); width: min(100%, 380px); max-width: none; height: 100dvh; max-height: none; margin: 0 auto 0 0; }
.drawer[open] { animation: slide-in .22s ease-out; }
.drawer .dialog-inner { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 27px), calc(100% - 27px) 100%, 0 100%); padding-top: calc(22px + env(safe-area-inset-top, 0px)); align-content: start; }
@keyframes slide-in { from { transform: translateX(-30px); opacity: 0; } }
.menu-user { color: var(--mist); }
.menu-user strong { color: var(--bone); }
.menu-section { display: grid; gap: 10px; padding: 14px 0; border-block: 1px solid var(--line); }
.menu-section h3 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #d9b4bc; }
.menu-list { display: grid; gap: 6px; }
.menu-item { --c: 9px; --edge: linear-gradient(160deg, #4a1a26, #1c0b10); --fill: linear-gradient(170deg, #16080d, #0e0407); display: block; width: 100%; min-height: 46px; padding: 0 16px; border: 0; text-align: left; cursor: pointer; font-weight: 600; color: var(--bone); }
.menu-item:hover { --edge: linear-gradient(160deg, #ff3355, #5a1424); }
.menu-item--danger { color: #ff9aa8; }

/* Picture viewer */
.dialog.lightbox { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; background: transparent; clip-path: none; overflow: hidden; }
.lightbox::backdrop { background: rgba(5, 1, 3, .9); backdrop-filter: blur(8px); }
.lightbox-inner { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; height: 100%; padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
.lightbox-img { max-width: min(92vw, 760px); max-height: calc(100dvh - 150px); width: auto; height: auto; clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px); filter: drop-shadow(0 0 30px rgba(255, 40, 70, .35)); }
.lightbox-caption { max-width: 60ch; text-align: center; font-size: 14px; font-style: italic; color: var(--mist); }
.lightbox-close { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); right: 16px; color: #fff; background: rgba(255, 51, 85, .25); }
.lightbox-close:hover { background: rgba(255, 51, 85, .5); }

/* ---------------- admin ---------------- */
.admin { min-height: 100dvh; padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 40px; }
.admin-inner { width: min(940px, 100%); margin: 0 auto; display: grid; gap: 20px; }
.admin-header { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.admin-header h1 { font: 600 32px var(--font-name); letter-spacing: .06em; color: #ffd9de; text-shadow: 0 0 14px rgba(255, 51, 85, .5); }
.admin-section { display: grid; gap: 12px; }
.admin-section h2 { font: 600 20px var(--font-name); color: #ffd9de; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stat { --c: 10px; padding: 14px 16px; display: grid; gap: 2px; }
.stat-value { font: 600 24px/1.2 var(--font-name); color: #fff; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.stat-hint { font-size: 12px; color: #d9b4bc; }
.code-list { display: grid; gap: 6px; margin: 4px 0 10px; padding: 0; list-style: none; }
.code-list li, .secret { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 14px; background: rgba(255, 255, 255, .04); border-left: 2px solid var(--crimson); }
.code-list code, .secret code { font: 600 15px ui-monospace, Consolas, monospace; letter-spacing: .06em; color: #ffd9de; overflow-wrap: anywhere; }
.code-list .btn, .secret .btn { flex: none; }

/* ---------------- legal pages ---------------- */
.doc-inner { width: min(760px, calc(100% - 32px)); margin: 32px auto 48px; padding: 28px 26px; background: linear-gradient(170deg, rgba(26, 10, 16, .92), rgba(15, 5, 8, .95)); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.doc-inner h1 { font: 600 34px/1.2 var(--font-name); color: #ffd9de; text-shadow: 0 0 14px rgba(255, 51, 85, .45); margin-bottom: 6px; }
.doc-inner h2 { font: 600 21px var(--font-name); color: #ffd9de; margin: 26px 0 8px; }
.doc-inner p, .doc-inner ul { color: #e6d6da; margin: 0 0 12px; }
.doc-inner ul { padding-left: 22px; }
.doc-inner li { margin-bottom: 6px; }
.doc-back { display: inline-block; margin-bottom: 18px; color: var(--mist); }
.doc-meta { color: var(--mist); font-size: 14px; }
.placeholder-note { padding: 10px 14px; border-left: 2px solid var(--warn); background: rgba(255, 179, 107, .08); color: var(--warn); }

/* ---------------- roleplay tools ---------------- */
/* Mood: a meter under her name and a buff badge on her portrait. */
.chat-header { position: relative; z-index: 5; }
.mood-meter, .mood-badge, .mood-tip { --mood-color: var(--mood-neutral); }
[data-mood="furious"] { --mood-color: var(--mood-furious); }
[data-mood="annoyed"] { --mood-color: var(--mood-annoyed); }
[data-mood="neutral"] { --mood-color: var(--mood-neutral); }
[data-mood="pleased"] { --mood-color: var(--mood-pleased); }
[data-mood="delighted"] { --mood-color: var(--mood-delighted); }
.mood-meter { display: inline-flex; align-items: center; gap: 7px; margin-top: 3px; }
.mood-bar { position: relative; width: 66px; height: 6px; background: rgba(255, 255, 255, .09); clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.mood-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 50) * 1%); background: var(--mood-color); box-shadow: 0 0 8px var(--mood-color); transition: width .7s cubic-bezier(.2, .8, .2, 1), background-color .4s; }
.mood-label { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--mood-color); }
.mood { position: relative; display: block; padding: 0; border: 0; background: none; cursor: pointer; }
.mood:hover .header-avatar, .mood:focus-visible .header-avatar { filter: drop-shadow(0 0 14px rgba(255, 51, 85, .8)); }
.mood:focus-visible { outline-offset: 4px; }
.mood-badge { position: absolute; left: -7px; bottom: -5px; width: 30px; height: 30px; background: var(--mood-color); filter: drop-shadow(0 0 6px var(--mood-color)); transition: background-color .4s; }
.mood-badge img { background: #1a0a10; }
.mood.is-hit .header-avatar { animation: mood-hit .6s ease-out; }
.mood-pop { position: absolute; left: -14px; top: 6px; z-index: 2; font: 700 17px/1 var(--font-name); letter-spacing: .02em; opacity: 0; pointer-events: none; text-shadow: 0 0 8px currentColor, 0 1px 2px #000; }
.mood-pop[data-dir="up"] { color: #ffd36b; }
.mood-pop[data-dir="down"] { color: #ff5a5a; }
.mood-pop.is-showing { animation: mood-pop 1.6s ease-out both; }
@keyframes mood-pop { 0% { opacity: 0; transform: translateY(8px) scale(.7); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-26px) scale(1); } }
@keyframes mood-hit { 30% { transform: scale(1.08); } }
.mood-tip { --c: 10px; position: absolute; top: calc(100% + 6px); right: 12px; z-index: 20; width: min(300px, calc(100vw - 24px)); padding: 12px 14px; display: grid; gap: 6px; font-size: 14px; color: #ead2d8; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .7)); }
.mood-tip-head strong { font: 600 18px var(--font-name); color: var(--mood-color); }

/* Dice tray */
.dice-btn { color: #ffb3bf; }
.dice-tray { --c: 16px; position: absolute; left: 66px; bottom: calc(100% + 8px); z-index: 10; display: grid; gap: 10px; width: min(360px, calc(100% - 24px)); padding: 14px; filter: drop-shadow(0 12px 30px rgba(0, 0, 0, .7)); }
.dice-title { font: 600 18px var(--font-name); color: #ffd9de; }
.dice-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.dice-option { display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 0; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--bone); background: rgba(255, 255, 255, .05); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.dice-option:hover, .dice-option:focus-visible { outline: none; background: rgba(255, 51, 85, .3); color: #fff; }
.dice-glyph { font-size: 21px; line-height: 1.1; color: #ffb3bf; }
.dice-tray .hint { margin: 0; }

/* A die or coin Lila hands over when luck decides something */
.chance-offer { display: inline-flex; align-items: center; gap: 12px; margin-top: 4px; padding: 10px 16px 10px 12px; border: 0; cursor: pointer; color: var(--bone); background: linear-gradient(160deg, #3a0a16, #1a060c); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); box-shadow: inset 0 0 0 1.5px rgba(255, 51, 85, .55); filter: drop-shadow(0 0 12px rgba(255, 51, 85, .35)); animation: offer-in .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.chance-offer:hover, .chance-offer:focus-visible { outline: none; background: linear-gradient(160deg, #5a0f22, #2a0710); box-shadow: inset 0 0 0 1.5px var(--crimson); }
.chance-offer:disabled { opacity: .55; cursor: default; }
.chance-offer-icon { display: grid; place-items: center; width: 46px; height: 46px; font-size: 30px; line-height: 1; animation: offer-wobble 2.4s ease-in-out infinite; }
.chance-offer--coin .chance-offer-icon { border-radius: 50%; font-size: 26px; color: #5a3a06; background: radial-gradient(circle at 35% 30%, #fff1b8, #f2c14e 45%, #b8861a 80%); box-shadow: 0 0 12px rgba(242, 193, 78, .55), inset 0 -3px 0 rgba(0, 0, 0, .25); }
.chance-offer--die .chance-offer-icon { color: #ffd0d7; text-shadow: 0 0 10px rgba(255, 51, 85, .8); }
.chance-offer-text { display: grid; gap: 1px; text-align: left; }
.chance-offer-hint { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--crimson); }
.chance-offer-text strong { font: 600 16px var(--font-name); color: #ffd9de; }
@keyframes offer-in { from { opacity: 0; transform: translateY(6px) scale(.9); } }
@keyframes offer-wobble { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-14deg) translateY(-2px); } 86% { transform: rotate(10deg); } 93% { transform: rotate(-5deg); } }

/* Picker tabs: emotes go into the text, stickers are sent at once. */
.picker-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: none; }
.picker-tab { min-height: 34px; border: 0; cursor: pointer; font-weight: 600; font-size: 14px; letter-spacing: .04em; color: var(--mist); background: rgba(255, 255, 255, .04); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.picker-tab:hover { color: var(--bone); }
.picker-tab[aria-selected="true"] { color: #fff; background: linear-gradient(160deg, #ff3355, #8a0c24); }
.sticker-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
.emote-picker[data-tab="stickers"] { max-height: min(430px, 62dvh); }
.sticker-grid .emote-tile { height: 78px; }
.sticker-grid .emote-tile img { width: 64px; height: 64px; object-fit: contain; }

/* Reroll and swipe between versions of her newest reply */
.reroll { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; color: var(--mist); touch-action: pan-y; }
.reroll-nav, .reroll-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 30px; height: 30px; padding: 0 8px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px; color: #ffb3bf; background: rgba(255, 255, 255, .05); clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px); }
.reroll-btn { font-size: 13px; letter-spacing: .04em; }
.reroll-nav:hover:not(:disabled), .reroll-btn:hover { color: #fff; background: rgba(255, 51, 85, .32); }
.reroll-nav:disabled { opacity: .35; cursor: default; }
.reroll-count { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .06em; }

/* Scene banner (a scenario start or a typed "Scene:" line) */
.scene-card { --c: 12px; --edge: linear-gradient(90deg, rgba(255, 51, 85, .15), rgba(255, 51, 85, .75), rgba(255, 51, 85, .15)); --fill: linear-gradient(180deg, rgba(48, 8, 20, .92), rgba(24, 6, 12, .92)); align-self: center; display: grid; justify-items: center; gap: 4px; width: min(560px, 94%); margin: 20px auto 6px; padding: 12px 20px 14px; text-align: center; }
.scene-label { font-size: 11px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: var(--crimson); }
.scene-text { font: italic 16px/1.45 var(--font-name); color: #f3dce1; }

/* Album and sticker gallery */
.dialog--wide { max-width: 760px; }
.album-tabs { margin-bottom: 0; }
.album-count { margin-left: 6px; font-size: 12px; font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; }
.album-grid { display: grid; gap: 8px; max-height: min(56dvh, 520px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.album-grid--pictures { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.album-grid--stickers { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.album-item { position: relative; display: grid; place-items: center; padding: 0; border: 0; cursor: zoom-in; background: rgba(255, 255, 255, .04); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.album-grid--pictures .album-item { aspect-ratio: 3 / 4; }
.album-grid--stickers .album-item { aspect-ratio: 1; }
.album-item img { width: 100%; height: 100%; object-fit: cover; }
.album-grid--stickers .album-item img { object-fit: contain; padding: 8px; }
.album-item:hover:not(.is-locked), .album-item:focus-visible { outline: none; background: rgba(255, 51, 85, .28); }
.album-item:hover img { filter: brightness(1.08); }
.album-item.is-locked { cursor: default; background: repeating-linear-gradient(135deg, rgba(255, 51, 85, .05) 0 8px, rgba(0, 0, 0, .15) 8px 16px); box-shadow: inset 0 0 0 1px rgba(255, 51, 85, .18); }
.album-lock { font: 600 30px var(--font-name); color: rgba(255, 140, 160, .35); }
.new-badge { margin-left: 8px; padding: 1px 7px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #1a0a05; background: var(--warn); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); }
#btn-menu.has-new { position: relative; }
#btn-menu.has-new::after { content: ""; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--warn); box-shadow: 0 0 8px var(--warn); rotate: 45deg; }

/* Scenario starters on an empty chat */
.scenarios { display: grid; gap: 10px; width: min(640px, 100%); margin-top: 18px; }
.scenarios-title { font: 600 19px var(--font-name); letter-spacing: .04em; color: #ffd9de; }
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; text-align: left; }
.scenario { --c: 12px; --edge: linear-gradient(160deg, #6b2a3a, #2c1219); --fill: linear-gradient(170deg, #1d0b11, #12070a); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; cursor: pointer; color: var(--bone); text-align: left; transition: transform .15s; }
.scenario:hover, .scenario:focus-visible { --edge: linear-gradient(160deg, #ff8a3d, #ff3355 50%, #a10f2a); outline: none; transform: translateY(-1px); }
.scenario-icon { flex: none; width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(255, 51, 85, .4)); }
.scenario-body { display: grid; gap: 2px; min-width: 0; }
.scenario-title { font-weight: 700; color: #ffd9de; }
.scenario-teaser { font-size: 13.5px; line-height: 1.35; color: var(--mist); }
.empty .link-btn { font-size: 14px; }

/* ---------------- phone ---------------- */
@media (max-width: 720px) {
  .chat { border-inline: 0; background: linear-gradient(180deg, rgba(10, 4, 7, .55), rgba(10, 4, 7, .35) 45%, rgba(10, 4, 7, .7)); }
  .chat-header { padding-inline: 12px; gap: 10px; }
  .who h1 { font-size: 23px; }
  .header-avatar { width: 52px; height: 52px; }
  .messages { padding: 12px 10px 12px; }
  .group-body { max-width: 86%; }
  .group-avatar, .user-avatar { width: 44px; height: 44px; }
  .group { gap: 8px; }
  .group-body { max-width: 80%; }
  .sticker { width: 140px; }
  .bubble { --c: 10px; --t: 12px; padding-block: 10px 11px; }
  .composer { padding: 10px 10px 12px; gap: 8px; }
  .emote-btn, .send { width: 44px; height: 44px; }
  .dice-tray { left: 10px; width: calc(100% - 20px); }
  .bd-moon { left: 5vw; top: 4vh; width: 58px; height: 58px; box-shadow: inset -13px 5px 0 0 #f4d5db; }
  .bd-sun { width: 200px; height: 200px; }
  .mood-bar { width: 52px; }
  .mood-badge { width: 26px; height: 26px; left: -6px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .scenario { padding: 10px 12px; }
  .scenario-icon { width: 40px; height: 40px; }
  .reroll-text { display: none; }
  .access-banner { margin-inline: 10px; }
  .bd-shade { right: -18vw; height: 72vh; opacity: .45; }
  .bd-circle { width: 150vw; top: 42%; opacity: .08; }
  .hero h1 { font-size: 44px; }
}
@media (max-width: 1100px) and (min-width: 721px) { .bd-shade { opacity: .5; right: -8vw; } }
@media (max-width: 360px) { .pill { padding: 0 10px; font-size: 12px; } }
@media (max-width: 340px) { .mood-label { display: none; } .who h1 { font-size: 20px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
