/* Fredoka is SIL Open Font License 1.1 — see /fonts/OFL.txt */
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-variable.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Playful cartoon / bright pink. Contrast notes are in the branding preview. */
  --bg: #fff3f7;
  --bg-raise: #ffffff;
  --bg-card: #ffe6f0;
  --line: rgba(43, 18, 32, 0.10);
  --line-strong: rgba(43, 18, 32, 0.18);
  --text: #2b1220;
  --muted: #6d3d50;
  --accent: #d6106c;            /* hot pink primary — WCAG AA with white and on blush */
  --accent-hover: #b40e5c;
  --accent-soft: rgba(214, 16, 108, 0.14);
  --accent-ink: #ffffff;
  --accent-2: #7a3ab0;          /* grape, secondary links and nicknames */
  --pink-bright: #ff4f9a;       /* logo / decorative only — not for small text */
  --pink-soft: #ffd0e6;
  --shadow: 0 18px 44px rgba(214, 16, 108, 0.14);
  --shadow-card: 0 1px 2px rgba(43, 18, 32, 0.04), 0 8px 24px rgba(214, 16, 108, 0.10);
  --overlay: rgba(43, 18, 32, 0.45);
  --thumb-bg: #ffd0e6;
  --video-bg: #1a1016;
  --hover-fill: rgba(214, 16, 108, 0.08);
  --radius: 18px;
  /* 2.5 × previous 372px default, capped so the gallery keeps ~360px
     or the pane stays at most 60% of the viewport. JS may override with
     a remembered width under --chat-width (imsadlol_chat_width_v2). */
  --chat-width: min(930px, 60vw, calc(100vw - 360px));
  --head-height: 93px;
  --sans: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --display: "Fredoka", "Segoe UI", system-ui, sans-serif;
  --serif: var(--display);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(ellipse at 0% -10%, rgba(255, 79, 154, 0.16), transparent 42%),
    radial-gradient(ellipse at 100% 0%, rgba(122, 58, 176, 0.08), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  margin: 0;
  text-decoration: none;
  line-height: 0;
}
.brand__logo {
  display: block;
  height: 42px;
  width: auto;
}
.brand--lg .brand__logo {
  height: 72px;
  margin: 0 auto 0.85rem;
}
/* Kept for any leftover text wordmarks (admin fallback, etc.). */
.wordmark {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.wordmark span { color: var(--accent); }
.wordmark--lg { font-size: 2.4rem; margin: 0 0 0.6rem; }

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--hover-fill); }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}
.icon-btn:hover { color: var(--text); }

/* Age gate */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.5rem max(1.5rem, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(ellipse at 16% 0%, rgba(255, 79, 154, 0.34), transparent 55%),
    radial-gradient(ellipse at 88% 100%, rgba(122, 58, 176, 0.16), transparent 52%),
    var(--bg);
}
.age-gate[hidden] { display: none; }
.age-gate__card {
  width: min(440px, 100%);
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 2.25rem 2rem 2rem;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  box-shadow: var(--shadow);
  text-align: center;
}
.age-gate__card h1 {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.age-gate__theme {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.age-gate__body {
  color: var(--muted);
  margin: 0 0 1.75rem;
}
.age-gate__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.username-gate {
  position: fixed;
  inset: 0;
  z-index: 78;
  display: grid;
  place-items: center;
  padding: max(1.5rem, env(safe-area-inset-top, 0px)) 1.5rem max(1.5rem, env(safe-area-inset-bottom, 0px));
  background: var(--overlay);
}
.username-gate[hidden] { display: none; }
.username-gate__card {
  width: min(440px, 100%);
  background: var(--bg-raise);
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
  border-radius: 28px;
  padding: 2.25rem 2rem 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.username-gate__card h1 {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.username-gate__body {
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.username-gate__row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.username-gate__row input {
  flex: 1 1 10rem;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
.username-gate__row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.username-gate__row .btn { flex: 0 0 auto; }
.username-gate__hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: left;
}
.username-gate__error {
  margin: 0.65rem 0 0;
  color: #9b123f;
  font-size: 0.9rem;
}
.username-gate__card #username-submit {
  margin-top: 1.1rem;
  min-width: 8rem;
}

/* App shell */
.app { min-height: 100%; display: flex; flex-direction: column; }
.app[hidden] { display: none; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.85rem;
  row-gap: 0.2rem;
  padding: 0.85rem 1.25rem 0.7rem;
}
.tagline {
  margin: 0;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  min-width: 0;
}
.topbar__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  min-width: 0;
}
.topbar__tools .btn,
.user-chip,
.head-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
.user-menu,
.online-wrap {
  position: relative;
  flex: 0 0 auto;
}
.user-chip,
.head-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line-strong);
  background: var(--bg-raise);
  color: var(--text);
  cursor: pointer;
  max-width: 13rem;
  line-height: 1.2;
}
.user-chip:hover,
.head-btn:hover {
  background: var(--hover-fill);
}
.user-chip:focus-visible,
.head-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.user-chip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.user-menu__pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 25;
  min-width: 11.5rem;
  padding: 0.35rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.user-menu__item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.user-menu__item:hover,
.user-menu__item:focus-visible {
  background: var(--accent-soft);
  outline: none;
}
.online-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 25;
  width: min(16.5rem, 86vw);
  max-height: min(22rem, 70vh);
  overflow: auto;
  padding: 0.65rem 0.7rem 0.75rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.online-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.online-panel__head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
}
.online-panel__head .icon-btn {
  font-size: 1.3rem;
  padding: 0.1rem 0.3rem;
}
.online-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.online-panel__list li {
  font-size: 0.88rem;
  color: var(--text);
  padding: 0.28rem 0.45rem;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.online-panel__list li.is-me {
  background: var(--accent-soft);
  font-weight: 600;
  color: var(--accent-2);
}
.online-panel__empty {
  margin: 0.35rem 0.2rem 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.online-backdrop[hidden] { display: none; }
.head-btn__badge { display: none; }

.gallery-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.75rem;
  margin: 0 0 1rem;
}
.search {
  flex: 1 1 200px;
  min-width: 0;
}
.search input {
  width: 100%;
  min-height: 44px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.search input:focus-visible,
.sort select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sort select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  min-height: 44px;
  font-family: inherit;
  font-size: 0.95rem;
}
.gallery-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.gallery-filter__label {
  color: var(--muted);
  font-size: 0.82rem;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  min-height: 32px;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg-raise);
  cursor: pointer;
}
.chip:hover, .chip:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.chip--active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.chip-clear {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 32px;
  padding: 0.2rem 0.35rem;
}
.chip-clear:hover, .chip-clear:focus-visible { text-decoration: underline; }

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-width);
  min-height: 0;
  transition: grid-template-columns 0.28s ease;
}
.layout.is-chat-hidden {
  grid-template-columns: minmax(0, 1fr) 0px;
}
.layout.is-resizing-chat {
  transition: none;
}

.gallery-pane {
  padding: 1.1rem 1.25rem 8rem;
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  padding: 0;
  color: inherit;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.card:hover, .card:focus-within {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.card__open {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.card__open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.card,
.card__open,
.card__thumb,
.card__thumb img,
.card__title {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.card,
.card__open,
.card__thumb {
  touch-action: manipulation;
}
.card__thumb {
  aspect-ratio: 16 / 9;
  background: var(--video-bg);
  position: relative;
  overflow: hidden;
}
.card__thumb--portrait {
  aspect-ratio: 2 / 3;
}
.card__thumb img,
.card__thumb video.card__preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.card__thumb video.card__preview {
  position: absolute;
  inset: 0;
  background: var(--video-bg);
  opacity: 0;
  transition: opacity 0.08s linear;
  pointer-events: none;
}
.card__thumb.is-previewing video.card__preview {
  opacity: 1;
}
.card__preview-hint {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  z-index: 1;
  background: var(--accent);
  color: #fff;
  font-family: var(--display);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.14rem 0.42rem;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(43, 18, 32, 0.28);
}
.card__thumb.is-previewing .card__preview-hint {
  opacity: 0;
}
.card__duration {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 1;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.75rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
}
.card__title {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0;
  padding: 0.75rem 0.85rem 0.2rem;
  font-weight: 600;
}
.card__meta { padding: 0 0.85rem 0.9rem; }
.card__tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.card__views, .player__views {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.player__views { font-size: 0.85rem; }

.status { color: var(--muted); text-align: center; padding: 1rem 0; }
.status--empty {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  padding: 3.25rem 1rem;
}

.sentinel { height: 1px; }

/* Chat */
.chat-pane {
  border-left: 1px solid var(--line);
  background: var(--bg-raise);
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--head-height));
  max-height: calc(100vh - var(--head-height));
  position: sticky;
  top: var(--head-height);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s, border-color 0.28s;
}
.layout.is-chat-hidden .chat-pane {
  overflow: hidden;
  min-width: 0;
  border-left-color: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(20px);
}
.chat-pane__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.5rem 0.32rem 0.6rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  min-height: 2.35rem;
}
.chat-pane__header h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.86rem;
  margin: 0;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.28rem;
  font-stretch: 90%;
  white-space: nowrap;
}
.chat-pane__heading {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-pane__sep { color: var(--muted); font-weight: 500; flex: 0 0 auto; }
.chat-pane__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.chat-hint {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.28rem 0.6rem;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.74rem;
  line-height: 1.3;
  border-bottom: 1px solid var(--line);
}
.chat-hint span { flex: 1; min-width: 0; }
.chat-hint__dismiss {
  flex-shrink: 0;
  margin: 0;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-raise);
  color: var(--accent);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}
.chat-hint__dismiss:hover,
.chat-hint__dismiss:focus-visible {
  background: #fff;
  border-color: var(--accent);
  outline: none;
}
.chat-pane__subbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  flex-wrap: wrap;
}
.chat-pane__subbar:has(.most-wanted.is-expanded) {
  flex-wrap: wrap;
  align-items: flex-start;
}
#chat-close { display: none; }

.chat-hide {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.22rem 0.45rem 0.22rem 0.32rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-hide:hover,
.chat-hide:focus-visible {
  color: var(--text);
  background: var(--hover-fill);
  border-color: var(--accent);
}
.chat-hide:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.chat-hide__icon { display: block; }

.chat-dock {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.7rem 0.9rem 0.7rem 1rem;
  border: 0;
  border-radius: 14px 0 0 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, transform 0.2s ease;
  animation: chat-dock-in 0.28s ease;
}
.chat-dock:hover { background: var(--accent-hover); }
.chat-dock:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@keyframes chat-dock-in {
  from { transform: translateY(-50%) translateX(110%); opacity: 0; }
  to { transform: translateY(-50%) translateX(0); opacity: 1; }
}

.chat-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.3rem;
  padding: 0;
  border-bottom: 0;
  flex: 0 0 auto;
  margin-left: auto;
}
.chat-sort {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 auto;
}
.chat-sort__btn {
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.16rem 0.48rem;
  min-height: 24px;
  cursor: pointer;
}
.chat-sort__btn + .chat-sort__btn { border-left: 1px solid var(--line); }
.chat-sort__btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-window { margin-left: 0; min-width: 0; }
.chat-window select {
  font: inherit;
  font-size: 0.7rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.16rem 0.35rem;
  min-height: 24px;
  max-width: 4.6rem;
}

.nick-form { padding: 0.85rem 1rem; }
.nick-form label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.nick-form__row { display: flex; gap: 0.5rem; align-items: center; }
.composer__row { display: flex; gap: 0.4rem; align-items: flex-end; }
.nick-form input, .composer textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.95rem;
}
.chat-pane__compose {
  position: relative;
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--bg-raise);
}
.composer { position: relative; padding: 0.4rem 0.55rem 0.3rem; }
.composer textarea {
  resize: none;
  min-height: 36px;
  height: 36px;
  max-height: 6.2rem;
  overflow-y: auto;
  padding: 0.4rem 0.55rem;
  font-size: 0.86rem;
  line-height: 1.35;
  border-radius: 12px;
}
.composer .btn {
  flex: 0 0 auto;
  padding: 0.4rem 0.75rem;
  min-height: 36px;
  font-size: 0.82rem;
}
.char-count {
  position: absolute;
  right: 4.7rem;
  bottom: 0.08rem;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.composer:focus-within .char-count,
.char-count.is-hot { opacity: 1; }
.chat-notices {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: calc(100% + 0.25rem);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  pointer-events: none;
}
.chat-notices > :not([hidden]) { pointer-events: auto; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
}
.msg { font-size: 0.86rem; }
.msg--card {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.28rem 0.5rem 0.3rem 0.2rem;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.msg--card.is-trending { border-color: rgba(214, 16, 108, 0.35); }
.msg--card[data-status="animated"] { background: linear-gradient(180deg, #fff, #fff6fa); }
.msg--card.is-flash { box-shadow: 0 0 0 3px var(--accent-soft); }
.msg__main { flex: 1; min-width: 0; }
.msg__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.28rem 0.35rem;
  flex-wrap: wrap;
}
.msg__meta { color: var(--muted); font-size: 0.68rem; margin-bottom: 0; min-width: 0; }
.msg__nick { color: var(--accent-2); font-weight: 500; }
.msg__body { word-break: break-word; line-height: 1.35; font-size: 0.84rem; }
.msg__badges { display: inline-flex; flex-wrap: wrap; gap: 0.2rem; justify-content: flex-start; align-items: center; }
.pitch-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.06rem 0.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pitch-badge--medal { font-size: 0.82rem; padding: 0; line-height: 1; }
.pitch-badge--trending { background: #fff0e0; color: #8a3a00; border-color: rgba(138, 58, 0, 0.18); }
.pitch-badge--review { background: #f1e8fb; color: #5b2a8a; border-color: rgba(91, 42, 138, 0.18); }
.pitch-badge--animated {
  background: #e3f6ea;
  color: #155c32;
  border-color: rgba(21, 92, 50, 0.25);
  cursor: pointer;
  min-height: 0;
}
.pitch-badge--animated:hover, .pitch-badge--animated:focus-visible {
  background: #d0efdc;
  outline: 2px solid rgba(21, 92, 50, 0.35);
  outline-offset: 1px;
}
.vote {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 28px;
  min-height: 0;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 0.12rem 0 0.08rem;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.vote:hover, .vote:focus-visible {
  color: var(--accent);
  background: var(--hover-fill);
  outline: none;
}
.vote[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.vote__icon { font-size: 0.62rem; line-height: 1; }
.vote__count { font-size: 0.78rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.vote.is-bounce { animation: vote-bounce 0.42s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes vote-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) translateY(-3px); }
  65% { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.msg--system { color: var(--muted); font-size: 0.82rem; font-style: italic; text-align: center; }

.chat-presence {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  flex: 0 0 auto;
  white-space: nowrap;
}
.chat-presence::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a55a;
  box-shadow: 0 0 0 2px rgba(34, 165, 90, 0.18);
}

.most-wanted {
  margin: 0;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), #ff4f9a);
  color: #fff;
  box-shadow: none;
  flex: 1 1 9rem;
  min-width: 0;
  min-height: 1.6rem;
  display: flex;
  align-items: center;
}
.most-wanted:has(#most-wanted-item[hidden]) {
  background: var(--hover-fill);
  color: var(--muted);
}
.most-wanted__empty {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.most-wanted__item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.most-wanted__item:focus-visible { outline: 2px solid #fff; outline-offset: 1px; border-radius: 8px; }
.most-wanted__line {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  overflow: hidden;
  white-space: nowrap;
}
.most-wanted__label { flex: 0 0 auto; font-size: 0.7rem; font-weight: 600; }
.most-wanted__body {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.3;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.most-wanted__nick {
  display: none;
  font-size: 0.65rem;
  opacity: 0.9;
  flex: 0 0 auto;
}
.most-wanted {
  transition:
    padding 0.28s ease,
    border-radius 0.28s ease,
    min-height 0.28s ease,
    width 0.28s ease,
    box-shadow 0.28s ease,
    flex-basis 0.28s ease;
}
.most-wanted.is-expanded,
.most-wanted:has(.most-wanted__item.is-expanded) {
  position: relative;
  z-index: 8;
  flex: 1 1 100%;
  width: min(var(--wanted-expanded-w, 100%), 100%);
  min-height: var(--wanted-expanded-min-h, 5rem);
  max-height: min(
    70dvh,
    var(--wanted-expanded-max-h, 70dvh),
    calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
  );
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 16px;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  box-shadow: var(--shadow);
}
.most-wanted__item.is-expanded {
  align-items: flex-start;
}
.most-wanted__item.is-expanded .most-wanted__line {
  flex-wrap: wrap;
  white-space: normal;
  overflow: visible;
}
.most-wanted__item.is-expanded .most-wanted__body {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  flex: 1 1 100%;
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 500;
}
.most-wanted__item.is-expanded .most-wanted__label {
  font-size: 1.75rem;
  line-height: 1.3;
}
.most-wanted__item.is-expanded .most-wanted__nick {
  display: inline;
  font-size: 1.15rem;
}
.most-wanted__item.is-expanded .most-wanted__votes {
  font-size: 1.15rem;
  padding: 0.2rem 0.55rem;
  margin-top: 0.15rem;
}
.most-wanted__votes {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.68rem;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  white-space: nowrap;
}

.composer-prompt {
  position: absolute;
  left: 0.55rem;
  right: 0.55rem;
  bottom: calc(100% - 0.08rem);
  margin: 0;
  padding: 0.12rem 0.15rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: linear-gradient(180deg, transparent, var(--bg-raise) 35%);
  pointer-events: none;
  z-index: 2;
}
.composer-prompt span {
  display: inline-block;
  min-width: 2.2em;
  border-bottom: 2px dashed var(--accent);
  color: transparent;
  line-height: 1;
}

.chat-quip {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  margin: 0;
}
.chat-quip__mascot { width: 28px; height: 28px; flex: 0 0 auto; }
.chat-quip__bubble {
  position: relative;
  margin: 0;
  padding: 0.3rem 0.55rem;
  background: var(--bg-card);
  border: 1px solid rgba(214, 16, 108, 0.25);
  border-radius: 12px 12px 12px 4px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.chat-quip.is-animated .chat-quip__mascot { animation: quip-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.chat-quip.is-animated .chat-quip__bubble { animation: quip-bubble 0.35s ease-out 0.12s both; }
@keyframes quip-pop {
  0% { transform: translateY(24px) scale(0.6); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes quip-bubble {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .vote.is-bounce,
  .chat-quip.is-animated .chat-quip__mascot,
  .chat-quip.is-animated .chat-quip__bubble,
  .chat-dock,
  .ticker.is-scrolling .ticker__track,
  .mascot.is-giggle .mascot__face,
  .mascot.is-cry .mascot__face,
  .mascot.is-peek,
  .mascot.is-happy .mascot__face,
  .mascot.is-shocked .mascot__face,
  .mascot__tear { animation: none !important; }
  .msg--card, .vote, .chat-pane, .layout, .chat-dock, .card__thumb video.card__preview, .card__preview-hint,
  .online-panel, .user-menu__pop, .most-wanted, .pitch-rules__backdrop, .pitch-rules__dialog { transition: none !important; }
}
.chat-error {
  margin: 0;
  padding: 0.28rem 0.5rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid rgba(214, 16, 108, 0.28);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.footer-note {
  margin: 0;
  padding: 0.12rem 0.6rem 0.32rem;
  border-top: 0;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.3;
}

/* Player */
.player {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(920px, 94vw);
  width: 100%;
}
.player--portrait {
  max-width: min(420px, 94vw);
}
.player::backdrop { background: var(--overlay); }
.player__frame {
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 96vh;
}
.player video {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 900px);
  margin: 0 auto;
  background: var(--video-bg);
  object-fit: contain;
}
.player__meta { padding: 1rem 1.15rem 1.25rem; }
.player__meta h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
}
.player__meta p { margin: 0 0 0.7rem; color: var(--muted); }
.player__close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  z-index: 2;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: 999px;
}
.tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tags .chip { background: var(--bg-card); }

.chat-backdrop[hidden] { display: none; }
.chat-toggle { display: none; }
.chat-toggle__short { display: none; }

.chat-pane__handle { display: none; }
.chat-pane__resize { display: none; }
.chat-pane__handle-bar {
  width: 2.5rem;
  height: 0.28rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 58%, #fff);
}

@media (min-width: 861px) {
  .chat-pane__resize {
    display: block;
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 10px;
    z-index: 3;
    cursor: ew-resize;
    touch-action: none;
    background: transparent;
  }
  .chat-pane__resize:hover,
  .chat-pane__resize:focus-visible {
    background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
    outline: none;
  }
}

body.is-sheet-open {
  overflow: hidden;
  overscroll-behavior: none;
}
/* Mobile only: keep header tools (Online, Pitch) tappable above the sheet backdrop. */
@media (max-width: 860px) {
  body.is-sheet-open .site-head {
    z-index: 25;
  }
}

@media (max-width: 860px) {
  .layout,
  .layout.is-chat-hidden { grid-template-columns: 1fr; transition: none; }
  .layout.is-chat-hidden .chat-pane {
    overflow: visible;
    min-width: 0;
    border-left-color: transparent;
    opacity: 1;
    transform: translateY(110%);
    visibility: hidden;
    pointer-events: none;
  }
  .layout.is-chat-hidden .chat-pane.is-open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }
  .chat-toggle { display: inline-flex; }
  .chat-hide,
  .chat-dock { display: none !important; }
  .chat-pane {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--sheet-bottom, 0px);
    top: auto;
    height: var(--sheet-height, min(70dvh, 640px));
    max-height: var(--sheet-max-height, calc(100dvh - env(safe-area-inset-top, 0px) - 8px));
    min-height: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    z-index: 30;
    transform: translateY(110%);
    transition: transform 0.22s ease, visibility 0.22s, height 0.28s ease, bottom 0.28s ease;
    visibility: hidden;
    pointer-events: none;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    flex-direction: column;
  }
  .chat-pane.is-open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }
  .chat-pane.is-dragging {
    transition: none;
    cursor: grabbing;
  }
  .chat-pane.is-keyboard {
    padding-bottom: 0;
  }
  .chat-pane__handle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 2.25rem;
    padding: 0.45rem 0 0.2rem;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    position: relative;
    z-index: 2;
  }
  .chat-pane__handle:active { cursor: grabbing; }
  .chat-pane__handle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  .chat-pane__header { touch-action: none; -webkit-user-select: none; user-select: none; }
  .chat-pane__header button,
  .chat-pane__header a,
  .chat-pane__header input,
  .chat-pane__header label {
    touch-action: manipulation;
    position: relative;
    z-index: 3;
  }
  .chat-pane.is-snap-collapsed .chat-pane__subbar,
  .chat-pane.is-snap-collapsed .messages,
  .chat-pane.is-snap-collapsed .chat-pane__compose,
  .chat-pane.is-snap-collapsed .chat-hint {
    visibility: hidden;
    pointer-events: none;
  }
  .chat-pane__compose {
    flex: 0 0 auto;
    padding-bottom: 0.15rem;
  }
  .messages { overscroll-behavior: contain; }
  .chat-pane__header { padding: 0.3rem 0.5rem 0.3rem 0.6rem; }
  .chat-pane__header h2 { font-size: 0.82rem; }
  .chat-pane__subbar { padding: 0.25rem 0.5rem; flex-wrap: nowrap; }
  .most-wanted { flex: 1 1 auto; min-width: 0; }
  .chat-tools { width: auto; flex-shrink: 0; }
  .chat-presence { margin-top: 0; }
  #chat-close { display: inline; }
  .chat-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 20;
  }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Phone-only breathing room for the pitch panel. Desktop is unchanged. */
@media (max-width: 600px) {
  .chat-pane__header {
    padding: 0.42rem 0.7rem 0.42rem 0.8rem;
    min-height: 2.75rem;
  }
  .chat-pane__header h2 { font-size: 0.92rem; }
  #chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
  }

  .chat-pane__subbar {
    padding: 0.4rem 0.65rem;
    gap: 0.5rem;
  }
  .most-wanted {
    padding: 0.28rem 0.6rem;
    min-height: 2rem;
  }
  .most-wanted:has(.most-wanted__item.is-expanded),
  .most-wanted.is-expanded {
    padding: 0.8rem 0.9rem;
  }
  .most-wanted__label,
  .most-wanted__body { font-size: 0.8rem; }
  .most-wanted__item.is-expanded .most-wanted__label,
  .most-wanted__item.is-expanded .most-wanted__body { font-size: 2rem; }
  .most-wanted__votes { font-size: 0.75rem; padding: 0.1rem 0.45rem; }
  .most-wanted__item.is-expanded .most-wanted__votes { font-size: 1.25rem; }
  .chat-sort__btn {
    padding: 0.28rem 0.62rem;
    min-height: 32px;
    font-size: 0.78rem;
  }
  .chat-window select {
    min-height: 32px;
    font-size: 0.78rem;
    padding: 0.28rem 0.45rem;
    max-width: 5rem;
  }

  .messages {
    padding: 0.6rem 0.7rem;
    gap: 0.65rem;
  }
  .msg--card {
    padding: 13px 12px 13px 6px;
    gap: 0.5rem;
    border-radius: 12px;
  }
  .msg__top { gap: 0.3rem 0.4rem; }
  .msg__meta {
    font-size: 13px;
    margin-bottom: 0.3rem;
    line-height: 1.35;
  }
  .msg__body {
    font-size: 16px;
    line-height: 1.45;
  }
  .pitch-badge {
    font-size: 0.72rem;
    padding: 0.12rem 0.4rem;
  }

  .vote {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0.2rem 0;
    border-radius: 10px;
  }
  .vote__icon { font-size: 0.78rem; }
  .vote__count { font-size: 0.92rem; }

  .composer { padding: 0.5rem 0.7rem 0.4rem; }
  .composer textarea {
    min-height: 60px;
    height: 60px;
    font-size: 16px;
    line-height: 1.4;
    padding: 0.5rem 0.7rem;
    border-radius: 14px;
  }
  .composer .btn {
    min-height: 44px;
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
  }
  .footer-note {
    padding: 0.2rem 0.7rem 0.4rem;
    font-size: 0.72rem;
  }
  .chat-hint {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    line-height: 1.4;
  }
  .chat-hint__dismiss {
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    min-height: 32px;
  }
}

/* Pitch rules modal: mounted on document.body so it is not trapped by
   the header or sheet containing block (backdrop-filter / transform). */
.pitch-rules {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding:
    max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  pointer-events: auto;
}
.pitch-rules[hidden] { display: none !important; }
.pitch-rules__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 0.22s ease;
}
.pitch-rules.is-open .pitch-rules__backdrop { opacity: 1; }
.pitch-rules__dialog {
  position: relative;
  z-index: 1;
  width: min(26rem, 100%);
  max-height: min(32rem, calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-raise);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.3rem 1.25rem;
  color: var(--text);
  transform: translateY(14px) scale(0.96);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.pitch-rules.is-open .pitch-rules__dialog {
  transform: none;
  opacity: 1;
}
.pitch-rules__dialog h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  margin: 0 0 0.55rem;
  color: var(--text);
}
.pitch-rules__dialog p {
  margin: 0 0 1.15rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
}
.pitch-rules__got-it {
  min-height: 44px;
  min-width: 44px;
  width: 100%;
  font-size: 1rem;
}
body.is-pitch-rules-open {
  overflow: hidden;
  overscroll-behavior: none;
}
@media (max-width: 860px) {
  .pitch-rules__dialog p {
    font-size: 1.0625rem; /* 17px — stays readable on iPhone */
    line-height: 1.5;
  }
  .pitch-rules__dialog h2 { font-size: 1.5rem; }
}

/* Public upload dialog + site footer */
.site-footer {
  margin-top: 2.25rem;
  padding-top: 1rem;
  padding-left: 6.75rem; /* keep the rules readable beside the corner mascot */
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.site-footer p { margin: 0 0 0.4rem; max-width: 62ch; }
.site-footer a { color: var(--accent-2); }
.site-footer__tools { margin-top: 0.65rem; }
.mascot-toggle {
  border: 1px solid var(--line-strong);
  background: var(--bg-raise);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
}
.mascot-toggle:hover,
.mascot-toggle:focus-visible {
  border-color: var(--accent);
  color: var(--accent-hover);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.upload-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(480px, 94vw);
  max-height: 96vh;
  overflow: visible;
}
.upload-dialog::backdrop { background: var(--overlay); }
.upload-dialog__frame {
  position: relative;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.25rem 1.2rem;
  max-height: 94vh;
  overflow-y: auto;
  color: var(--text);
}
.upload-dialog__frame h2 {
  margin: 0 2rem 0.3rem 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.7rem;
}
.upload-dialog__close { position: absolute; top: 0.5rem; right: 0.6rem; }
.upload-dialog__lead { margin: 0 0 1rem; color: var(--muted); font-size: 0.88rem; }
.upload-fields { display: grid; gap: 0.8rem; }
.upload-fields[hidden], .uprogress[hidden], .upload-error[hidden], .upload-done[hidden] { display: none; }
.ufield { display: grid; gap: 0.3rem; font-size: 0.88rem; color: var(--muted); }
.ufield em { font-style: normal; opacity: 0.8; }
.ufield input[type="text"], .ufield textarea, .ufield input[type="file"] {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  min-height: 44px;
  width: 100%;
}
.ufield textarea { resize: vertical; min-height: 4.5rem; }
.uconfirm {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.65rem;
  align-items: start;
  font-size: 0.86rem;
  line-height: 1.45;
  padding: 0.7rem 0.8rem;
  background: var(--bg-card);
  border-radius: 12px;
}
.uconfirm input { width: 20px; height: 20px; margin-top: 0.1rem; accent-color: var(--accent); }
.uprogress { margin: 0.4rem 0 0.6rem; }
.uprogress__track { height: 10px; border-radius: 999px; background: var(--bg-card); overflow: hidden; }
.uprogress__bar { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s linear; }
.uprogress__label { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.88rem; }
.upload-error { margin: 0.75rem 0 0; color: #a10f3a; font-size: 0.9rem; }
.upload-done {
  margin: 0.9rem 0 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}
.upload-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.1rem; }
.upload-actions .btn { min-height: 44px; }

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0.7rem 0.9rem 0.65rem;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .topbar__tools { grid-column: 2; grid-row: 1; }
  .tagline {
    grid-column: 1 / -1;
    grid-row: 2;
    white-space: normal;
    max-width: none;
    font-size: 0.75rem;
  }
}

@media (max-width: 860px) {
  .brand__logo { height: 34px; }
  .topbar__tools { gap: 0.35rem; }
  .user-chip,
  .head-btn,
  .topbar__tools .btn {
    padding: 0.45rem 0.62rem;
    font-size: 0.82rem;
  }
  .user-chip { max-width: 7.5rem; }
  .head-btn__label { display: none; }
  .head-btn#online-open {
    position: relative;
    min-width: 2.6rem;
    justify-content: center;
    padding-right: 0.7rem;
  }
  .head-btn__badge {
    display: block;
    position: absolute;
    top: -0.3rem;
    right: -0.2rem;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.22rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.05rem;
    text-align: center;
  }
  /* The panel is reparented to document.body on mobile so position:fixed
     is not trapped by .site-head's z-index / backdrop-filter containing block. */
  .online-panel {
    position: fixed;
    top: var(--online-panel-top, calc(env(safe-area-inset-top, 0px) + 4.5rem));
    right: max(0.7rem, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    width: min(16.5rem, calc(100vw - 1.4rem - env(safe-area-inset-right, 0px) - env(safe-area-inset-left, 0px)));
    max-height: min(22rem, calc(100dvh - var(--online-panel-top, 5rem) - env(safe-area-inset-bottom, 0px) - 0.75rem));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: 16px;
    background: var(--bg-raise);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    z-index: 40;
    transform: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s;
    padding: 0.65rem 0.7rem 0.75rem;
  }
  .online-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  .online-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: var(--overlay);
  }
  body.is-online-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
  .chat-toggle { padding-left: 0.7rem; padding-right: 0.7rem; }
}

@media (max-width: 640px) {
  .brand__logo { height: 30px; }
  .topbar { padding: 0.6rem 0.7rem 0.55rem; }
  .topbar__tools { gap: 0.28rem; }
  .user-chip__name { display: none; }
  .user-chip { max-width: none; padding: 0.42rem 0.48rem; }
  .topbar__tools .btn { padding: 0.42rem 0.58rem; font-size: 0.8rem; }
  .chat-toggle__full { display: none; }
  .chat-toggle__short { display: inline; }
  .gallery-tools { gap: 0.5rem; }
  .search { flex: 1 1 100%; }
  .sort select { max-width: 100%; }
}


/* Live activity ticker */
.ticker {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--pink-soft) 55%, var(--bg-raise));
  color: var(--text);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  min-height: 1.9rem;
}
.ticker__presence {
  flex: 0 0 auto;
  margin: 0;
  display: flex;
  align-items: center;
  padding: 0.28rem 0.85rem;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--accent-soft) 80%, transparent);
}
.ticker__presence[hidden] { display: none !important; }
.ticker__viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0.28rem 0;
  mask-image: linear-gradient(90deg, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}
.ticker__track {
  display: flex;
  align-items: center;
  gap: 2.2rem;
  width: max-content;
  padding: 0 1.25rem;
  --ticker-duration: 24s;
}
.ticker.is-scrolling .ticker__track {
  animation: ticker-scroll var(--ticker-duration) linear infinite;
}
.ticker.is-scrolling:hover .ticker__track,
.ticker.is-scrolling:focus-within .ticker__track {
  animation-play-state: paused;
}
.ticker__item {
  white-space: nowrap;
  color: var(--text);
}
.ticker__item::before {
  content: "✦";
  color: var(--accent);
  margin-right: 0.55rem;
}
.ticker__item--idle::before { content: "♡"; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Reacting mascot */
.mascot {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 14;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
  overflow: visible;
}
.mascot[hidden] { display: none !important; }
.mascot__dismiss,
.mascot__face { pointer-events: auto; }
.mascot__dismiss {
  position: absolute;
  top: -10px;
  right: -10px;
  left: auto;
  z-index: 3;
  box-sizing: border-box;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  line-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  overflow: visible;
  flex: none;
  box-shadow: 0 2px 8px rgba(43, 18, 32, 0.28);
}
.mascot__dismiss:hover,
.mascot__dismiss:focus-visible {
  background: var(--accent-hover);
  color: #fff;
  border-color: #fff;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.mascot__frame {
  position: relative;
  width: 88px;
  height: 88px;
  pointer-events: auto;
  overflow: visible;
}
.mascot__face {
  position: relative;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 28px;
  filter: drop-shadow(0 8px 18px rgba(214, 16, 108, 0.28));
}
.mascot__face:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.mascot__img {
  display: block;
  width: 88px;
  height: 88px;
}
.mascot__tears {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.mascot__tear {
  position: absolute;
  top: 68%;
  width: 9px;
  height: 12px;
  border-radius: 0 70% 70% 70%;
  background: #e8f6ff;
  border: 1.5px solid #5ba8d0;
  opacity: 0;
  transform: rotate(45deg);
}
.mascot__tear:first-child { left: 14px; }
.mascot__tear:last-child { right: 14px; }
.mascot__bubble {
  margin: 0 0 0.4rem;
  max-width: 180px;
  padding: 0.4rem 0.6rem;
  background: var(--bg-raise);
  border: 1px solid rgba(214, 16, 108, 0.25);
  border-radius: 14px 14px 14px 4px;
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  order: -1;
  pointer-events: none;
}
@keyframes mascot-giggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-8px) rotate(-6deg); }
  50% { transform: translateY(0) rotate(5deg); }
  75% { transform: translateY(-5px) rotate(-3deg); }
}
@keyframes mascot-happy {
  0%, 100% { transform: rotate(0) scale(1); }
  30% { transform: rotate(-8deg) scale(1.06); }
  60% { transform: rotate(8deg) scale(1.06); }
}
@keyframes mascot-cry {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(3px); }
  70% { transform: translateY(-1px); }
}
@keyframes mascot-tear {
  0% { opacity: 0; transform: rotate(45deg) translateY(0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: rotate(45deg) translateY(18px); }
}
@keyframes mascot-peek {
  0%, 100% { transform: translate(0, 0); }
  18% { transform: translate(-78%, 42%); }
  55% { transform: translate(-78%, 42%); }
  72% { transform: translate(0, 0); }
}
@keyframes mascot-shock {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.12) translateY(-4px); }
  60% { transform: scale(0.96); }
}
.mascot.is-giggle .mascot__face { animation: mascot-giggle 0.7s ease; }
.mascot.is-happy .mascot__face { animation: mascot-happy 0.7s ease; }
.mascot.is-cry .mascot__face { animation: mascot-cry 0.8s ease; }
.mascot.is-cry .mascot__tear { animation: mascot-tear 0.9s ease-out both; }
.mascot.is-cry .mascot__tear:last-child { animation-delay: 0.12s; }
.mascot.is-peek { animation: mascot-peek 4s ease; }
.mascot.is-shocked .mascot__face { animation: mascot-shock 0.55s ease; }

/* Hide the mascot over player controls, the mobile composer, and the chat tab. */
body.is-player-open .mascot,
body.is-sheet-open .mascot {
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 860px) {
  .ticker { font-size: 0.72rem; }
  .ticker__presence { padding: 0.28rem 0.65rem; }
  .ticker__viewport {
    mask-image: linear-gradient(90deg, transparent, #000 1rem, #000 calc(100% - 1rem), transparent);
  }
  .ticker__track { padding: 0 0.9rem; gap: 1.6rem; }
  .mascot { left: 8px; bottom: 8px; width: auto; }
  .mascot__frame, .mascot__face, .mascot__img { width: 72px; height: 72px; }
  .mascot__bubble { max-width: 150px; font-size: 0.72rem; }
  .site-footer { padding-left: 5.5rem; }
}
