@font-face {
  font-family: "Pretendard Variable";
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
  src: url("/fonts/PretendardVariable.woff2") format("woff2-variations");
}

/* ──────────────────────────────────────────
   Design tokens — light mode
────────────────────────────────────────── */

:root {
  color-scheme: light;
  --text-scale: 1;
  --bg: #f3f0e9;
  --panel: #fdfaf5;
  --sidebar-bg: #ece6d8;
  --ink: #1b1916;
  --ink-2: #38352f;
  --muted: #7d786f;
  --line: #dad3c3;
  --accent: #1d6c5e;
  --accent-hover: #155049;
  --accent-bg: #e3eeea;
  --accent-bg-hover: #cfe4dd;
  --gold: #b97f22;
  --gold-bg: #fdf2df;
  --shadow-xs: 0 1px 3px rgba(20, 17, 10, 0.07);
  --shadow-sm: 0 2px 10px rgba(20, 17, 10, 0.09);
  --shadow-md: 0 6px 24px rgba(20, 17, 10, 0.11);
  --shadow-lg: 0 14px 44px rgba(20, 17, 10, 0.14);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-pill: 999px;
  --t: 140ms ease;

  /* Typography scale — all respect --text-scale */
  --text-xs:   calc(11px * var(--text-scale));
  --text-sm:   calc(13px * var(--text-scale));
  --text-base: calc(15px * var(--text-scale));
  --text-lg:   calc(18px * var(--text-scale));
  --text-xl:   calc(22px * var(--text-scale));
  --text-2xl:  calc(28px * var(--text-scale));
  --text-3xl:  clamp(26px, calc(38px * var(--text-scale)), 48px);

  /* Surface semantic aliases */
  --surface-0: var(--bg);
  --surface-1: var(--panel);
  --surface-2: var(--sidebar-bg);
  --surface: var(--surface-0);
  --border:       var(--line);
  --border-strong: var(--hover-border);

  /* Panel elevation — subtle depth cue */
  --panel-shadow: var(--shadow-xs);

  /* Component-level tokens (converted from hardcoded) */
  --brand-hover-overlay: rgba(0, 0, 0, 0.05);
  --tag-bg: rgba(255, 253, 250, 0.6);
  --term-hover-bg: rgba(253, 250, 245, 0.6);
  --term-hover-border: rgba(218, 211, 195, 0.8);
  --hover-bg: #ece6da;
  --hover-border: #bbb4a5;
  --code-bg: rgba(0, 0, 0, 0.04);
  --danger-bg: #fae8ec;
  --danger-color: #8b2232;
  --danger-border: #f3cdd5;
  --danger-hover-bg: #f5d4db;
  --danger-hover-border: #e8b8c2;
  --missing-bg: #fceedd;
  --missing-color: #8a5810;
}

/* ──────────────────────────────────────────
   Dark mode — system preference
────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --panel-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, var(--shadow-xs);
    --bg: #18150f;
    --panel: #252118;
    --sidebar-bg: #1e1b14;
    --ink: #f0ece2;
    --ink-2: #cdc7ba;
    --muted: #978f86;
    --line: #3c362c;
    --accent: #2a9a87;
    --accent-hover: #33b89e;
    --accent-bg: #1b3832;
    --accent-bg-hover: #1f4038;
    --gold: #d49830;
    --gold-bg: #2e2211;
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.36);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.52);

    --brand-hover-overlay: rgba(255, 255, 255, 0.08);
    --tag-bg: rgba(255, 255, 255, 0.06);
    --term-hover-bg: rgba(255, 255, 255, 0.05);
    --term-hover-border: rgba(82, 73, 58, 0.9);
    --hover-bg: #2f2a22;
    --hover-border: #524a3e;
    --code-bg: rgba(255, 255, 255, 0.09);
    --danger-bg: #2a1219;
    --danger-color: #f28898;
    --danger-border: #4c1e28;
    --danger-hover-bg: #381826;
    --danger-hover-border: #5c2635;
    --missing-bg: #2a1d09;
    --missing-color: #d4a048;
  }
}

/* ──────────────────────────────────────────
   Dark mode — manual override
────────────────────────────────────────── */

html[data-theme="dark"] {
  color-scheme: dark;
  --panel-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, var(--shadow-xs);
  --bg: #18150f;
  --panel: #252118;
  --sidebar-bg: #1e1b14;
  --ink: #f0ece2;
  --ink-2: #cdc7ba;
  --muted: #978f86;
  --line: #3c362c;
  --accent: #2a9a87;
  --accent-hover: #33b89e;
  --accent-bg: #1b3832;
  --accent-bg-hover: #1f4038;
  --gold: #d49830;
  --gold-bg: #2e2211;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.36);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 14px 44px rgba(0, 0, 0, 0.52);

  --brand-hover-overlay: rgba(255, 255, 255, 0.08);
  --tag-bg: rgba(255, 255, 255, 0.06);
  --term-hover-bg: rgba(255, 255, 255, 0.05);
  --term-hover-border: rgba(82, 73, 58, 0.9);
  --hover-bg: #2f2a22;
  --hover-border: #524a3e;
  --code-bg: rgba(255, 255, 255, 0.09);
  --danger-bg: #2a1219;
  --danger-color: #f28898;
  --danger-border: #4c1e28;
  --danger-hover-bg: #381826;
  --danger-hover-border: #5c2635;
  --missing-bg: #2a1d09;
  --missing-color: #d4a048;
}

/* ──────────────────────────────────────────
   Base
────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

html[data-text-size="sm"] { --text-scale: 0.9; }
html[data-text-size="md"] { --text-scale: 1; }
html[data-text-size="lg"] { --text-scale: 1.12; }
html[data-text-size="xl"] { --text-scale: 1.25; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: calc(15px * var(--text-scale));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t), color var(--t);
}

button, input, textarea, select {
  font: inherit;
}

h1, h2, h3, h4, p {
  margin: 0;
}

/* ──────────────────────────────────────────
   Layout
────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: minmax(272px, 360px) 1fr;
  min-height: 100vh;
}

/* ──────────────────────────────────────────
   Sidebar
────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  padding: 20px 16px;
  overflow: hidden;
  transition: background var(--t), border-color var(--t);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin: -6px -8px;
  transition: background var(--t);
}

.brand:hover {
  background: var(--brand-hover-overlay);
}

.brand:hover h1 {
  color: var(--accent-hover);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  transition: background var(--t);
}

.brand-mark img {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1);
}

h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: color var(--t);
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

/* Search */
.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Inputs */
input, textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 144, 127, 0.18);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

/* Tag strip */
.tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--tag-bg);
  color: var(--muted);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), color var(--t), box-shadow var(--t);
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-bg);
}

.tag.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

/* Term list */
.term-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 1px;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.term-item {
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.term-item:hover {
  border-color: var(--term-hover-border);
  background: var(--term-hover-bg);
}

.term-item.active {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
}

.term-item strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.term-item span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* ──────────────────────────────────────────
   Workspace
────────────────────────────────────────── */

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: 100vh;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: background var(--t), border-color var(--t);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.header-nav-menu {
  position: relative;
  flex-shrink: 0;
}

.header-nav-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  gap: 7px;
  min-width: 180px;
  padding: 8px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.header-nav-popover .secondary {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding-inline: 11px;
  background: var(--bg);
}

.header-nav-popover .menu-beta-badge {
  margin-left: auto;
}


.eyebrow, .meta, .form-message {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.meta {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  margin-bottom: 5px;
}

.form-message {
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.toolbar h2 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 3px;
}

/* ──────────────────────────────────────────
   Buttons
────────────────────────────────────────── */

button, .icon-button {
  border: 0;
  border-radius: var(--radius-sm);
  color: inherit;
  font: inherit;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background var(--t), color var(--t), box-shadow var(--t), border-color var(--t), transform 80ms ease;
}

button:active, .icon-button:active {
  transform: scale(0.965);
}

.primary, .secondary, .danger {
  min-height: 36px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs);
}

.primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-sm);
}

.secondary {
  background: var(--bg);
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  font-weight: 600;
}

.secondary:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

.danger {
  margin-right: auto;
  background: var(--danger-bg);
  color: var(--danger-color);
  border: 1.5px solid var(--danger-border);
  font-weight: 600;
}

.danger:hover {
  background: var(--danger-hover-bg);
  border-color: var(--danger-hover-border);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 17px;
  border: 1.5px solid var(--line);
}

.icon-button:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

/* Auth avatar button */
.auth-avatar-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  transition: opacity var(--t), box-shadow var(--t);
  flex-shrink: 0;
}

.auth-avatar-btn:hover {
  opacity: 0.85;
  box-shadow: 0 0 0 2px var(--accent);
}

.mini-avatar {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  user-select: none;
}


.text-size-control {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  flex-shrink: 0;
}

.text-size-button, .text-size-reset {
  display: grid;
  place-items: center;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-2);
  font-weight: 800;
  line-height: 1;
}

.text-size-button {
  width: 36px;
  font-size: 12px;
}

.text-size-reset {
  min-width: 48px;
  padding: 0 8px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.text-size-reset.active {
  color: var(--accent-hover);
  background: var(--accent-bg);
}

.text-size-button:hover, .text-size-reset:hover {
  background: var(--hover-bg);
}

.text-size-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.mobile-pref-menu {
  display: none;
  position: relative;
  flex-shrink: 0;
}

html.web-push-available .mobile-pref-menu {
  display: block;
}

.mobile-pref-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  display: grid;
  gap: 10px;
  width: min(270px, calc(100vw - 28px));
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.mobile-theme-row, .mobile-text-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-theme-row {
  width: 100%;
  min-height: 38px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-2);
  padding: 0 12px;
  font-weight: 750;
}

.mobile-theme-row:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

.mobile-theme-row span:first-child {
  display: grid;
  place-items: center;
}

.mobile-text-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}


/* Theme toggle button */
#themeButton {
  font-size: 15px;
  line-height: 1;
}

/* Tinted button — accent-bg emphasis (e.g. thread button) */
.btn-tinted {
  background: var(--accent-bg);
  color: var(--accent-hover);
  border-color: var(--accent-bg-hover);
  font-weight: 700;
}

.btn-tinted:hover {
  background: var(--accent-bg-hover);
  border-color: var(--accent);
}

/* Ghost button — borderless, hover-only bg */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--hover-bg);
  border-color: transparent;
  color: var(--ink-2);
}

/* Button with icon + text */
.icon-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-label svg {
  flex-shrink: 0;
  opacity: 0.85;
}

.json-transfer-action {
  display: none !important;
}

.auth-status {
  max-width: 140px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(20, 17, 10, 0.42);
  padding: 18px;
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.auth-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-heading h2 {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.auth-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.auth-actions {
  padding-top: 0;
}

/* ──────────────────────────────────────────
   Notification badge & panel
────────────────────────────────────────── */

.notif-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: #e03a50;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  padding: 0 3px;
  pointer-events: none;
}

.bn-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 14px);
  min-width: 15px;
  height: 15px;
  border-radius: var(--radius-pill);
  background: #e03a50;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  padding: 0 3px;
  pointer-events: none;
}

.notif-panel {
  position: fixed;
  inset: 0;
  z-index: 290;
  background: rgba(20, 17, 10, 0.28);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 62px 12px 12px;
}

.notif-card {
  display: flex;
  flex-direction: column;
  width: min(380px, 100%);
  max-height: calc(100vh - 80px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.notif-header h3 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.notif-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.danger-lite {
  color: #b22d3a;
}

.danger-lite:hover {
  border-color: #d58a94;
  background: #f7e7e9;
}

.notif-list {
  overflow-y: auto;
  flex: 1;
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  position: relative;
  transition: background var(--t);
}

.notif-item:last-child {
  border-bottom: 0;
}

.notif-item:hover {
  background: var(--term-hover-bg);
}

.notif-item.unread {
  background: var(--accent-bg);
}

.notif-item.unread:hover {
  background: var(--accent-bg-hover);
}

.notif-item-avatar {
  flex-shrink: 0;
  padding-top: 1px;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.notif-item-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}

.notif-item-preview {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin: 0;
}

.notif-item-time {
  font-size: 11.5px;
  color: var(--muted);
}

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}

.notif-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-delete {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  transition: background var(--t), color var(--t);
}

.notif-delete:hover {
  background: rgba(178, 45, 58, 0.12);
  color: #b22d3a;
}

/* notif 540px rules merged into main mobile block below */

/* Profile panel */
.profile-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(20, 17, 10, 0.42);
  padding: 18px;
}

.profile-card {
  display: grid;
  gap: 18px;
  width: min(380px, 100%);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.profile-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-heading h2 {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.profile-avatar-area {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar-preview {
  flex-shrink: 0;
}

.profile-avatar-img {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--line);
}

.profile-avatar-placeholder {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  display: grid;
  place-items: center;
  text-transform: uppercase;
  user-select: none;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-nickname-row {
  display: grid;
  gap: 6px;
}

.profile-field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-nickname-input-wrap {
  display: flex;
  gap: 8px;
}

.profile-nickname-input-wrap input {
  flex: 1;
  min-width: 0;
}

.profile-upload-label {
  min-height: 36px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  background: var(--bg);
  color: var(--ink-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--t), background var(--t);
}

.profile-upload-label:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

/* Video upload progress */
.video-progress-panel {
  position: fixed;
  inset: 0;
  z-index: 330;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 17, 10, 0.5);
}

.video-progress-card {
  display: grid;
  gap: 16px;
  width: min(460px, 100%);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  box-shadow: var(--shadow-lg);
}

.video-progress-card h2 {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 900;
}

.video-progress-status {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.55;
}

.video-progress-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--soft);
}

.video-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.video-progress-track > span.indeterminate {
  animation: video-progress-slide 1.15s ease-in-out infinite;
}

@keyframes video-progress-slide {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}

.video-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-progress-actions {
  padding-top: 0;
}

.video-progress-actions .danger {
  min-width: 112px;
}

@media (max-width: 540px) {
  .video-progress-panel {
    align-items: end;
    padding: 0;
  }

  .video-progress-card {
    width: 100%;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }
}

/* Release panel */
.release-panel {
  position: fixed;
  inset: 0;
  z-index: 310;
  display: grid;
  place-items: center;
  background: rgba(20, 17, 10, 0.42);
  padding: 18px;
}

.release-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  width: min(520px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.release-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.release-heading h2 {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.release-list {
  display: grid;
  gap: 12px;
  min-height: 0;
  margin: 0;
  padding: 0 4px 0 0;
  color: var(--ink-2);
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.release-group {
  display: grid;
  gap: 7px;
}

.release-group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
}

.release-group-heading strong {
  font-size: 14px;
  font-weight: 900;
}

.release-group-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.release-group ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 19px;
}

.release-actions {
  padding-top: 0;
}

/* ──────────────────────────────────────────
   Detail / Content area
────────────────────────────────────────── */

.detail, .editor {
  width: 100%;
  max-width: 860px;
}

.detail {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 30px 32px;
}

.editor {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 30px 32px;
}

.empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 50vh;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  line-height: 1.8;
}

/* Term detail */
.term-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.term-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.definition {
  border-left: 4px solid var(--gold);
  background: var(--gold-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px;
  font-size: 18px;
  font-weight: 450;
  line-height: 1.65;
  box-shadow: var(--shadow-xs);
  transition: background var(--t);
}

.section {
  display: grid;
  gap: 9px;
}

.section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.section p, .section li {
  color: var(--ink-2);
  line-height: 1.7;
  font-size: 15px;
}



.history-section > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.history-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-summary-main {
  font-weight: 800;
  color: var(--ink);
}

.history-summary-sub {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.history-snapshot {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.history-meta-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
}

.history-meta-grid div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
}

.history-meta-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-meta-grid dd {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.6;
}

.history-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.history-preview h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--muted);
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Wiki links */
.wiki-link, .backlink {
  border: 0;
  border-radius: 5px;
  background: var(--accent-bg);
  color: var(--accent-hover);
  padding: 1px 7px;
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
  transition: background var(--t);
}

.wiki-link:hover, .backlink:hover {
  background: var(--accent-bg-hover);
}

.external-link {
  color: var(--accent-hover);
  font-weight: 650;
  text-underline-offset: 3px;
}

.external-link:hover {
  color: var(--accent);
}

.wiki-link.missing {
  background: var(--missing-bg);
  color: var(--missing-color);
  text-decoration: underline dashed;
  text-underline-offset: 3px;
}

.chips .wiki-link, .chips .backlink {
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
}

code {
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: var(--code-bg);
  padding: 1px 6px;
  font-size: 0.87em;
}

/* Wiki content */
.wiki-content {
  display: grid;
  gap: 10px;
}

.wiki-content p, .wiki-content ul {
  margin: 0;
}

.wiki-content ul {
  padding-left: 20px;
}

.wiki-content h3, .wiki-content h4 {
  margin: 4px 0 0;
}

.yt-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ──────────────────────────────────────────
   Editor
────────────────────────────────────────── */

.editor label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.editor-shell {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 400px);
  gap: 18px;
  align-items: start;
}

.write-pane {
  display: grid;
  gap: 12px;
}

.editor-tools, .preview-heading {
  display: flex;
  align-items: center;
  gap: 5px;
}

.editor-tools {
  flex-wrap: wrap;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  padding: 6px;
}

.tool-button {
  min-width: 32px;
  height: 30px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink-2);
  padding: 0 8px;
  font-weight: 800;
  font-size: 12px;
  transition: border-color var(--t), color var(--t), background var(--t);
}

.tool-button:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-bg);
}

.editor-tools select {
  width: auto;
  min-width: 136px;
  height: 30px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink-2);
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}

.editor-tools select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(39, 144, 127, 0.18);
}

.wiki-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
  tab-size: 2;
  font-size: 14px;
}

.preview-pane {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.preview-heading {
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.preview-card {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 380px;
  max-height: calc(100vh - 160px);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
  overflow: auto;
  box-shadow: var(--shadow-sm);
}

.preview-title {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-title h3 {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.preview-card .definition {
  box-shadow: none;
  font-size: 16px;
  padding: 14px 18px;
}

/* ──────────────────────────────────────────
   Dashboard
────────────────────────────────────────── */

.dashboard {
  display: grid;
  gap: 20px;
  max-width: 860px;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.dashboard-hero h2 {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-tile {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 18px;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}

.stat-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.stat-tile span {
  display: block;
  color: var(--accent-hover);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-tile p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr);
  gap: 10px;
}

.dashboard-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px 18px;
  box-shadow: var(--panel-shadow);
  transition: background var(--t), border-color var(--t), box-shadow var(--t);
}

.dashboard-panel.wide {
  grid-column: 1 / -1;
}

.panel-heading h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.panel-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.daily-term-card,
.related-thread-card {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.daily-term-card:hover,
.daily-term-card:focus-visible,
.related-thread-card:hover,
.related-thread-card:focus-visible {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: var(--shadow-xs);
}

.daily-term-card strong,
.related-thread-card strong {
  display: block;
  color: var(--ink);
  font-weight: 900;
  line-height: 1.35;
}

.daily-term-card p,
.related-thread-card p {
  margin: 7px 0;
  color: var(--ink-2);
  line-height: 1.55;
}

.daily-term-card span,
.related-thread-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.related-thread-list {
  display: grid;
  gap: 8px;
}

.dashboard-list {
  display: grid;
  gap: 3px;
}

.dashboard-row, .linked-card {
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
}

.dashboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 11px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dashboard-row strong,
.dashboard-row > :first-child {
  color: var(--ink);
}

.dashboard-row:hover, .linked-card:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: var(--shadow-xs);
}

.dashboard-row span, .linked-card span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}

.dashboard-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.linked-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.linked-card {
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 13px 14px;
}

.linked-card strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}



/* ──────────────────────────────────────────
   Stats
────────────────────────────────────────── */

.stats-view {
  display: grid;
  gap: 20px;
  max-width: 960px;
}

.stats-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stats-metric-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}


@media (max-width: 960px) {
  .stats-metric-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stats-metric-group {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
}

.stats-category-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-panel {
  overflow: hidden;
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}

.stats-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-table td {
  color: var(--ink-2);
  font-size: 13px;
}

.stats-table td:first-child {
  color: var(--ink);
}

.stats-table td:first-child span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.status-pill.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-hover);
}

.visit-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 2px;
}

.visit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 11px 12px;
}

.visit-row div {
  min-width: 0;
}

.visit-row strong,
.visit-row time {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.visit-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ──────────────────────────────────────────
   Thread — Twitter style
────────────────────────────────────────── */

.thread-view {
  display: grid;
  gap: 16px;
  max-width: 620px;
}

.thread-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.thread-hero h2 {
  margin-top: 4px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.thread-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* User profile view */
.user-profile-view {
  display: grid;
  gap: 14px;
  max-width: 980px;
}

.profile-top-actions {
  display: flex;
  justify-content: flex-start;
}

.user-profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 18px;
}

.user-profile-title {
  min-width: 0;
}

.user-profile-title h2 {
  margin: 2px 0 4px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.user-profile-title p:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-stat-grid .stat-tile {
  padding: 14px 16px;
}

.profile-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.profile-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.profile-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.profile-tab-panel {
  display: grid;
  gap: 12px;
}

.profile-card-list,
.profile-activity-list {
  display: grid;
  gap: 10px;
}

.profile-content-card,
.profile-activity-item {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  padding: 14px 16px;
  text-align: left;
}

.profile-content-card {
  display: grid;
  gap: 10px;
}

.profile-content-card strong,
.profile-activity-item strong {
  display: block;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
}

.profile-content-card p,
.profile-activity-item p,
.profile-card-open p {
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.profile-content-card span,
.profile-activity-item time,
.profile-activity-item span,
.profile-card-open span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.profile-card-open,
.profile-activity-item {
  cursor: pointer;
}

.profile-card-open {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.profile-content-card:hover,
.profile-activity-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.profile-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.profile-photo-item {
  display: grid;
  gap: 7px;
}

.profile-photo-open {
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  aspect-ratio: 1;
  padding: 0;
}

.profile-photo-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t);
}

.profile-photo-open:hover img {
  transform: scale(1.04);
}

/* Compose box */
.thread-compose {
  display: flex;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px 16px;
  transition: box-shadow var(--t);
}

.thread-compose:focus-within {
  box-shadow: var(--shadow-sm);
}

.tc-compose-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 10px;
}

.thread-compose-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.thread-counter {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.thread-search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.thread-search input {
  width: 100%;
  min-height: 42px;
}

/* Thread list container */
.thread-list {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  display: grid;
  gap: 0;
}

/* Thread item */
.thread-item,
.thread-comment {
  scroll-margin: 88px;
}

.thread-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t);
}

.thread-item:last-child {
  border-bottom: 0;
}

.thread-item:hover {
  background: var(--term-hover-bg);
}

.thread-focus {
  animation: threadFocusPulse 1.8s ease;
}

@keyframes threadFocusPulse {
  0%, 100% { background: transparent; }
  20%, 70% { background: color-mix(in srgb, var(--accent) 14%, transparent); }
}

/* Left avatar column */
.ti-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding-top: 1px;
}

/* Thread connector line */
.ti-line {
  width: 2px;
  flex: 1;
  min-height: 12px;
  background: var(--line);
  border-radius: 1px;
  margin-top: 5px;
}

/* Avatar image support */
img.ti-avatar {
  object-fit: cover;
}

/* Avatar */
.ti-avatar {
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  text-transform: uppercase;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.01em;
  user-select: none;
}

.ti-avatar--md {
  width: 38px;
  height: 38px;
  font-size: 15px;
}

.ti-avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.ti-avatar--xl {
  width: 82px;
  height: 82px;
  font-size: 30px;
}

.profile-link-avatar,
.profile-name-link {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  text-align: inherit;
}

.profile-link-avatar {
  display: inline-grid;
  place-items: flex-start;
  border-radius: 50%;
}

.profile-link-avatar:hover .ti-avatar,
.profile-link-avatar:focus-visible .ti-avatar {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-name-link,
.auth-status[data-profile-user] {
  cursor: pointer;
}

.profile-name-link:hover,
.profile-name-link:focus-visible,
.auth-status[data-profile-user]:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Main content */
.ti-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ti-header {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  line-height: 1.3;
}

.ti-name {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.ti-sep {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
}

.ti-time {
  color: var(--muted);
  font-size: 13px;
}

.ti-body {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  margin: 0;
}

.thread-edit-form {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

.thread-edit-form textarea {
  min-height: 92px;
  resize: vertical;
}

.ti-edited {
  display: inline-block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.ti-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}


.youtube-embeds {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.youtube-embed {
  display: grid;
  gap: 6px;
}

.youtube-embed iframe {
  width: 100%;
  max-width: 620px;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #000;
}

.youtube-embed a {
  width: fit-content;
  color: var(--accent-hover);
  font-size: 12.5px;
  font-weight: 700;
}

.thread-comment .youtube-embed iframe {
  max-width: 420px;
}

.thread-attachment-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.thread-attachment-bar.compact {
  justify-content: flex-start;
}

.thread-compose-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.emoji-picker-wrap {
  position: relative;
  flex: 0 0 auto;
}

.emoji-toggle {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.emoji-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(8, 36px);
  gap: 5px;
  max-height: min(360px, 48vh);
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.emoji-panel button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 19px;
  line-height: 1;
}

.emoji-panel button:hover {
  background: var(--soft);
}

.thread-video-editor {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.thread-video-editor video,
.thread-video-player video {
  display: block;
  width: 100%;
  max-height: min(640px, 72vh);
  border-radius: var(--radius-sm);
  background: #000;
}

.thread-video-editor video {
  max-height: min(420px, 52vh);
}

.thread-video-trim {
  display: grid;
  gap: 8px;
}

.thread-video-trim-heading,
.thread-video-editor-footer,
.thread-video-trim label span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.thread-video-trim-heading strong {
  font-size: 13px;
}

.thread-video-trim-heading span,
.thread-video-trim label span,
.thread-video-editor-footer,
.thread-video-player figcaption {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.thread-video-trim label {
  display: grid;
  gap: 4px;
}

.thread-video-trim input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.thread-video-player {
  display: grid;
  gap: 5px;
  margin: 4px 0 0;
}

.thread-video-player figcaption {
  overflow-wrap: anywhere;
}

.thread-image-grid {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
}

.thread-image-grid.image-count-1 {
  grid-template-columns: minmax(0, 1fr);
}

.thread-image-grid.image-count-2,
.thread-image-grid.image-count-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.thread-image-grid.image-count-3 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 16 / 9;
}

.thread-image-grid.image-count-3 .thread-image-item {
  aspect-ratio: unset;
  min-height: 0;
}

.thread-image-grid.image-count-3 .thread-image-item:first-child {
  grid-row: 1 / span 2;
}

.thread-image-item {
  position: relative;
  overflow: hidden;
  background: var(--bg);
  aspect-ratio: 1 / 1;
  margin: 0;
}

.thread-image-grid.image-count-1 .thread-image-item {
  aspect-ratio: var(--image-aspect, 16 / 9);
}

.thread-image-grid.image-count-2 .thread-image-item {
  aspect-ratio: 8 / 9;
}

.thread-image-grid.image-count-4 .thread-image-item {
  aspect-ratio: 1 / 1;
}

.thread-image-open {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}

.thread-image-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform var(--t), filter var(--t);
}

.thread-image-grid.image-count-1 .thread-image-item img {
  object-fit: contain;
}

.thread-image-open:hover img {
  filter: brightness(0.94);
  transform: scale(1.015);
}

.thread-image-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: rgba(20, 17, 10, 0.72);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
}

.thread-comment .thread-image-grid {
  max-width: 260px;
}

.lightbox-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.9);
  touch-action: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
}

.lightbox-stage {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  justify-items: center;
  max-width: min(94vw, 1120px);
  max-height: 92vh;
  margin: 0;
}

.lightbox-image-wrap {
  display: grid;
  place-items: center;
  width: min(94vw, 1120px);
  height: 84vh;
  overflow: hidden;
  border-radius: var(--radius-sm);
  touch-action: none;
}

.lightbox-stage img {
  max-width: min(94vw, 1120px);
  max-height: 84vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
  transform-origin: center center;
  transition: transform 120ms ease-out;
  user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
}

.lightbox-stage img.is-zoomed {
  cursor: grab;
}

.lightbox-panel.is-panning .lightbox-stage img.is-zoomed {
  cursor: grabbing;
}

.lightbox-stage figcaption {
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.lightbox-close,
.lightbox-nav {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.65);
  color: #fff;
  backdrop-filter: blur(4px);
  transition: background var(--t), border-color var(--t);
}

.lightbox-tools {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(15, 15, 15, 0.68);
  color: #fff;
  backdrop-filter: blur(4px);
  transform: translateX(-50%);
}

.lightbox-tools button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.lightbox-tools button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-tools span {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(15, 15, 15, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-close:active {
  opacity: 0.7;
}

.lightbox-nav:active {
  transform: translateY(-50%);
  opacity: 0.7;
}

.lightbox-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
}

.lightbox-nav {
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
}

.lightbox-nav.prev {
  left: 16px;
}

.lightbox-nav.next {
  right: 16px;
}

.ti-reply-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.thread-react {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  transition: border-color var(--t), background var(--t), color var(--t);
}

.thread-react-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.thread-react.active .thread-react-icon {
  fill: currentColor;
}

.thread-react strong {
  font-size: 12px;
  font-weight: 800;
}

.thread-react:hover,
.thread-react.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-hover);
}


.thread-reaction-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thread-reaction-count {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px 5px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.thread-reaction-count:disabled {
  cursor: default;
  opacity: 0.55;
}

.thread-reaction-count:not(:disabled):hover,
.thread-reaction-count[aria-expanded="true"] {
  color: var(--accent-hover);
}

.reaction-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 190px;
  max-width: min(260px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reaction-popover::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  background: var(--panel);
  transform: rotate(45deg);
}

.reaction-popover-head {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.reaction-popover-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.reaction-person {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  padding: 6px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
}

.reaction-person:hover,
.reaction-person:focus-visible {
  background: var(--accent-bg);
  color: var(--accent-hover);
}

/* Thread tag (hashtag) */
.thread-tag {
  color: var(--accent-hover);
  font-weight: 700;
}

/* Delete button */
.thread-delete {
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  transition: border-color var(--t), background var(--t), color var(--t);
}

.thread-delete:hover {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-color);
}

/* Empty state */
.thread-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 24px 16px;
  text-align: center;
}

.thread-load-more {
  display: flex;
  justify-content: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.thread-load-more .secondary {
  min-width: 118px;
}

/* Comments section */
.thread-comments {
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 10px;
  display: grid;
  gap: 10px;
}

.thread-comment {
  display: flex;
  gap: 10px;
}

.tc-content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.tc-header {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tc-header strong {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.tc-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  margin: 0;
}

/* Comment compose */
.comment-compose {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.cc-content {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
}

/* Mobile */
@media (max-width: 680px) {
  .thread-video-editor-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .thread-video-editor-footer .thread-delete {
    align-self: flex-end;
  }

  .thread-view {
    max-width: 100%;
  }

  .user-profile-hero {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .profile-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-tabs {
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .thread-attachment-bar {
    align-items: center;
  }

  .thread-compose .thread-attachment-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .thread-compose-tools {
    flex-wrap: wrap;
  }

  .emoji-picker-wrap {
    position: static;
  }

  .emoji-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
    font-size: 19px;
  }

  .emoji-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 260;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    width: auto;
    max-width: none;
    max-height: min(340px, 48vh);
    padding: 10px;
    border-radius: 16px;
  }

  .emoji-panel button {
    width: 100%;
    height: 40px;
    min-width: 0;
    border-radius: 10px;
    font-size: 21px;
  }
}

.comment-compose textarea {
  min-height: 68px;
  resize: vertical;
}



/* ──────────────────────────────────────────
   Design refresh 2026-06-04
────────────────────────────────────────── */
.thread-view {
  max-width: 760px;
  gap: 14px;
}

.thread-hero {
  align-items: flex-start;
  padding: 18px 18px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 42%),
    var(--panel);
  box-shadow: var(--shadow-sm);
}

.thread-hero h2 {
  margin-top: 3px;
  font-size: 24px;
  line-height: 1.18;
}

.thread-hero-actions .secondary,
.profile-top-actions .secondary {
  min-height: 36px;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--accent-hover);
  font-weight: 850;
}

.thread-mode-tabs {
  position: relative;
  z-index: 0;
  padding: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}

.thread-mode-tab {
  border-radius: 999px;
}

.thread-search {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.thread-compose {
  gap: 14px;
  border-radius: var(--radius);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.thread-compose textarea,
.comment-compose textarea {
  border-color: color-mix(in srgb, var(--line) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 48%, var(--panel));
}

.thread-compose:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent), var(--shadow-sm);
}

.thread-list {
  display: grid;
  gap: 12px;
}

.thread-item {
  gap: 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
  transition: border-color var(--t), background var(--t), box-shadow var(--t), transform var(--t);
}

.thread-item:last-child {
  border-bottom: 1.5px solid var(--line);
}

.thread-item:hover {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
  background: color-mix(in srgb, var(--panel) 86%, var(--accent-soft));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.ti-line {
  display: none;
}

.ti-main {
  gap: 8px;
}

.ti-header {
  gap: 7px;
}

.ti-name,
.profile-name-link {
  font-weight: 900;
}

.ti-time {
  font-size: 12px;
}

.ti-body {
  font-size: 17px;
  line-height: 1.72;
}

.ti-footer {
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.thread-react,
.thread-delete,
.ti-reply-count {
  min-height: 30px;
  border-radius: 999px;
}

.thread-react {
  border-color: var(--line);
  background: color-mix(in srgb, var(--bg) 56%, var(--panel));
  padding: 4px 10px;
}

.ti-reply-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--bg) 56%, var(--panel));
  font-weight: 750;
}

.thread-delete {
  padding-inline: 10px;
}

.thread-comments {
  margin-top: 10px;
  padding-top: 12px;
  border-top-style: dashed;
}

.thread-comment {
  padding: 8px 0 8px 6px;
}

.comment-compose {
  margin-top: 4px;
  padding: 12px 0 0;
}

.user-profile-view {
  max-width: 980px;
  gap: 16px;
}

.user-profile-hero {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  box-shadow: var(--shadow-sm);
}

.profile-tabs {
  padding: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}

.profile-tab {
  flex: 1 0 auto;
  justify-content: center;
}

.notif-card,
.release-card,
.profile-card {
  box-shadow: var(--shadow-lg);
}

.notif-item {
  border-radius: 10px;
  margin: 3px 6px;
}

.notif-item.unread {
  box-shadow: inset 3px 0 0 var(--accent);
}

@media (max-width: 680px) {
  .thread-view {
    gap: 12px;
  }

  .thread-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px;
    border-radius: var(--radius-sm);
  }

  .thread-hero > div:first-child {
    min-width: 0;
  }

  .thread-hero h2 {
    max-width: 11em;
    font-size: 22px;
    line-height: 1.2;
    word-break: keep-all;
    overflow-wrap: anywhere;
  }

  .thread-hero-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .thread-hero-actions .secondary,
  .thread-count-badge {
    min-height: 34px;
  }

  .thread-mode-tabs {
    border-radius: var(--radius-sm);
  }

  .thread-item {
    border-radius: var(--radius-sm);
    padding: 14px;
  }

  .thread-compose {
    border-radius: var(--radius-sm);
    padding: 14px;
  }

  .ti-body {
    font-size: 15px;
  }

  .profile-tabs {
    border-radius: var(--radius-sm);
  }
}

/* ──────────────────────────────────────────
   Utilities
────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ──────────────────────────────────────────
   Sidebar drawer backdrop
────────────────────────────────────────── */

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Toggle button — hidden on desktop */
.sidebar-toggle {
  display: none;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────
   Bottom nav (mobile only — hidden by default)
────────────────────────────────────────── */

.bottom-nav {
  display: none;
}

/* ──────────────────────────────────────────
   Responsive — wide editor
────────────────────────────────────────── */

@media (max-width: 1080px) {
  .editor-shell {
    grid-template-columns: 1fr;
  }

  .preview-pane {
    position: static;
  }
}

.identity-grid {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
}

.editor .form-grid:not(.identity-grid) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ──────────────────────────────────────────
   Responsive — tablet / iPad (≤ 1100px)
────────────────────────────────────────── */

@media (max-width: 1100px) {
  .stats-metric-groups {
    grid-template-columns: 1fr;
  }

  .app {
    grid-template-columns: 1fr;
  }

  /* ── 사이드바 드로어 ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: none;
    min-height: 0;
    width: min(320px, 86vw);
    z-index: 50;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.4, 0, 0.2, 1), background var(--t), border-color var(--t);
    overflow-y: auto;
    gap: 14px;
    padding: 18px 16px;
  }

  html.sidebar-open .sidebar {
    transform: translateX(0);
  }

  html.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .sidebar-toggle {
    display: grid;
  }

  .tag-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: thin;
  }

  .tag-strip .tag {
    flex: 0 0 auto;
  }

  .term-list {
    min-height: 80px;
    overflow-y: auto;
    flex: 1;
  }

  .toolbar {
    padding: 10px 16px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-wrap: wrap;
  }

  .toolbar > div:first-child {
    flex: 1;
    min-width: 0;
  }

  .toolbar-actions {
    flex: 1 1 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  .toolbar-actions .secondary,
  .toolbar-actions .primary {
    padding-inline: 12px;
  }

  .desktop-pref-control {
    display: none !important;
  }

  .mobile-pref-menu {
    display: block;
  }

  .apkDownloadButton,
  #apkDownloadButton {
    display: none;
  }

  .toolbar h2 {
    font-size: 18px;
  }

  .detail, .editor {
    padding: 18px 16px;
  }

  .term-header {
    flex-direction: column;
    align-items: stretch;
  }

  .term-title {
    font-size: 28px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-hero h2 {
    font-size: 22px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid,
  .linked-grid {
    grid-template-columns: 1fr 1fr;
  }

  .visit-row {
    grid-template-columns: 1fr;
  }

  .definition {
    font-size: 16px;
  }

  .thread-hero h2,
  .dashboard-hero h2 {
    font-size: 22px;
  }

  .thread-hero,
  .stats-hero,
  .dashboard-hero,
  .user-profile-hero {
    align-items: stretch;
  }

  .thread-view,
  .dashboard,
  .detail,
  .editor {
    max-width: min(860px, 100%);
  }

  .thread-view {
    max-width: min(680px, 100%);
  }

  .stats-table-wrap,
  .stats-member-table-wrap,
  .visit-list {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.new-choice-popover {
  display: none;
}

@media (max-width: 540px) {
  .new-choice-popover:not(.hidden) {
    display: block;
  }
}

/* ──────────────────────────────────────────
   Responsive — mobile phone (≤ 540px)
────────────────────────────────────────── */

@media (max-width: 540px) {
  /* 하단 네비게이션 표시 */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--panel);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  }

  .bn-item {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 6px;
    min-height: 52px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
    transition: color var(--t);
    -webkit-tap-highlight-color: transparent;
    letter-spacing: 0.01em;
  }

  .bn-item.active {
    color: var(--accent);
  }

  .bn-item.bn-new {
    color: var(--accent);
  }

  .bn-item.bn-new svg {
    stroke-width: 2.5;
  }

  .bn-item.has-apk-update::after {
    content: "";
    position: absolute;
    top: 7px;
    right: calc(50% - 18px);
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
  }

  .bn-item.has-apk-update svg {
    color: var(--accent);
  }

  .new-choice-popover {
    position: fixed;
    left: 50%;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px));
    z-index: 230;
    width: min(320px, calc(100vw - 24px));
    transform: translateX(-50%);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    padding: 14px;
    box-shadow: var(--shadow-lg);
  }

  .new-choice-popover p {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .new-choice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .new-choice-actions button {
    min-height: 42px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--ink);
    font-weight: 900;
  }

  .new-choice-actions button:hover,
  .new-choice-actions button:focus-visible {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent-hover);
  }

  /* 하단 네비 영역만큼 콘텐츠 패딩 */
  .workspace {
    padding-bottom: calc(52px + env(safe-area-inset-bottom, 0px));
  }

  /* 툴바에서 새 글 버튼 숨기기 (하단 네비 #bnNew로 이동) */
  #newButton {
    display: none;
  }

  .auth-status {
    font-size: 12px;
    max-width: 70px;
  }

  h1 {
    font-size: 15px;
  }

  .brand p {
    font-size: 11px;
  }

  /* 툴바 타이틀 작게 */
  .toolbar h2 {
    font-size: 16px;
  }

  .eyebrow {
    font-size: 10px;
  }

  /* 콘텐츠 패딩 줄이기 */
  .detail, .editor {
    padding: 14px 14px;
  }

  .term-title {
    font-size: 26px;
  }

  .definition {
    font-size: 15px;
    padding: 14px 16px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-tile span {
    font-size: 24px;
  }

  .dashboard-grid,
  .linked-grid {
    grid-template-columns: 1fr;
  }

  .identity-grid,
  .editor .form-grid:not(.identity-grid) {
    grid-template-columns: 1fr;
  }

  .stats-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* 모달 — bottom-sheet 스타일 */
  .auth-panel,
  .release-panel {
    padding: 0;
    align-items: flex-end;
  }

  .auth-card,
  .release-card {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    width: 100%;
    max-height: 92dvh;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .auth-card {
    overflow-y: auto;
  }

  .release-card {
    overflow: hidden;
  }

  /* 스레드 */
  .thread-item {
    padding: 12px 14px;
  }

  .ti-avatar--md {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  /* 알림 패널 — bottom-sheet */
  .notif-panel {
    padding: 0;
    align-items: flex-end;
  }

  .notif-card {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 0;
    width: 100%;
    max-height: 80dvh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* 툴바 타이포 */
  .toolbar h2 { font-size: calc(16px * var(--text-scale)); }

  /* 설정 팝오버 */
  .mobile-pref-popover {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .header-nav-popover {
    left: 12px;
    right: 12px;
    width: auto;
  }

  /* 스레드 카운트 배지 */
  .thread-count-badge {
    justify-self: start;
  }

  /* 갤러리 */
  .thread-gallery-panel {
    padding: 8px;
  }

  .thread-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
}


@media (min-width: 821px) and (max-width: 1100px) {
  .toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding: 12px 20px;
  }

  .toolbar > div:first-child {
    min-width: 0;
  }

  .toolbar h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .auth-status {
    max-width: 110px;
  }

  .detail,
  .editor {
    padding: 22px 20px;
  }

  .dashboard-grid,
  .linked-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-grid,
  .stats-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thread-gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ──────────────────────────────────────────
   Text scale — apply --text-scale tokens
────────────────────────────────────────── */

.toolbar h2                                         { font-size: var(--text-xl); }
.primary, .secondary, .danger                       { font-size: var(--text-sm); }
.search input, input, textarea, select              { font-size: var(--text-sm); }
.term-item strong                                   { font-size: var(--text-sm); }
.term-item p, .meta                                 { font-size: var(--text-xs); }
.term-title                                         { font-size: var(--text-3xl); }
.definition                                         { font-size: var(--text-lg); }
.section p, .section li                             { font-size: var(--text-base); }
.chip, .chips .wiki-link, .chips .backlink          { font-size: var(--text-xs); }
.empty                                              { font-size: var(--text-sm); }
.thread-title h2, .stats-title h2                   { font-size: var(--text-2xl); }
.thread-title p, .stats-title p, .thread-empty      { font-size: var(--text-sm); }
.ti-name                                           { font-size: var(--text-base); }
.ti-body                                           { font-size: var(--text-lg); }
.ti-time, .ti-reply-count, .thread-react, .thread-delete { font-size: var(--text-xs); }
.thread-comment p, .tc-header strong                { font-size: var(--text-sm); }
.preview-card                                       { font-size: var(--text-base); }

@media (max-width: 760px) {
  .toolbar h2 { font-size: calc(18px * var(--text-scale)); }
  .term-title { font-size: clamp(26px, calc(30px * var(--text-scale)), 38px); }
  .text-size-control { height: 34px; }
  .text-size-button { width: 32px; height: 32px; }
  .text-size-reset { min-width: 43px; height: 32px; padding: 0 6px; }
}


@media (max-width: 700px) {
  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .toolbar > div:first-child {
    width: 100%;
    min-width: 0;
  }

  .toolbar h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .toolbar-actions {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .toolbar-actions::-webkit-scrollbar {
    display: none;
  }

  .toolbar-actions > * {
    flex: 0 0 auto;
  }

  .desktop-pref-control {
    display: none !important;
  }

  .mobile-pref-menu {
    display: block;
  }

  .mobile-pref-popover {
    position: fixed;
    top: auto;
    left: auto;
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: 260;
    width: min(300px, calc(100vw - 24px));
  }

  .header-nav-popover {
    position: fixed;
    top: auto;
    left: auto;
    right: 12px;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: 260;
    width: min(220px, calc(100vw - 24px));
  }
}

/* toolbar/pref 540px rules merged into main mobile block below */

.thread-count-badge {
  align-self: center;
  justify-self: end;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
  padding: 5px 11px;
  font-size: calc(12.5px * var(--text-scale));
  font-weight: 800;
  white-space: nowrap;
}

/* thread-count-badge 540px merged into main mobile block below */

.thread-mode-tabs {
  display: inline-flex;
  width: fit-content;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.thread-mode-tab {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  font-size: calc(13px * var(--text-scale));
  font-weight: 800;
}

.thread-mode-tab.active {
  background: var(--accent-bg);
  color: var(--accent-hover);
}

.thread-gallery-panel {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.thread-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  gap: 10px;
}

.thread-gallery-item {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.thread-gallery-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
  padding: 0;
  cursor: zoom-in;
}

.thread-gallery-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform var(--t), filter var(--t);
}

.thread-gallery-image:hover img {
  filter: brightness(0.94);
  transform: scale(1.02);
}

.thread-gallery-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.thread-gallery-meta strong {
  color: var(--ink);
  font-size: calc(12.5px * var(--text-scale));
}

.thread-gallery-meta time, .thread-gallery-meta p {
  color: var(--muted);
  font-size: calc(11.5px * var(--text-scale));
  line-height: 1.35;
}

.thread-gallery-meta p {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.thread-gallery-meta .thread-delete {
  width: fit-content;
  margin-top: 2px;
}

/* thread-gallery 540px merged into main mobile block below */

.thread-view-gallery {
  max-width: 920px;
}
/* Design refresh fix: keep thread tabs in normal document flow. */
.thread-mode-tabs {
  position: relative;
  top: auto;
  z-index: 0;
}



/* Baton touch */
.baton-status {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-bg) 34%, var(--panel));
  box-shadow: var(--shadow-xs);
}

.baton-status-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.baton-status-main .eyebrow {
  width: 100%;
}

.baton-status-main h3 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
}

.baton-status-main span {
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 850;
}

.baton-status > p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

.baton-status-order {
  display: flex;
  display: none;
  gap: 7px;
  flex-wrap: wrap;
}

.baton-member {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.baton-member b {
  color: var(--accent);
  font-size: 12px;
}

.baton-member.active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-hover);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.thread-compose.locked {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 72%, var(--bg));
  box-shadow: none;
}

.thread-compose.locked textarea {
  color: var(--muted);
}

.baton-compose-lock {
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 800;
}

.icon-label.disabled,
button:disabled {
  cursor: not-allowed;
}

@media (max-width: 680px) {
  .baton-status {
    padding: 14px;
    border-radius: var(--radius-sm);
  }

  .baton-status-main h3 {
    font-size: 20px;
  }

  .baton-status-order {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .baton-member {
    flex: 0 0 auto;
  }
}


/* Threaded comments */
.thread-comments {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.thread-comment,
.thread-reply-compose {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
}

.thread-comment {
  padding: 0 0 12px;
}

.tc-side {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
}

.tc-side .ti-avatar--sm {
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--panel);
}

.tc-line {
  width: 2px;
  flex: 1;
  min-height: 14px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--line);
}

.thread-comment:not(.has-next) .tc-line {
  background: linear-gradient(to bottom, var(--line), transparent);
}

.tc-content {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 0 0 2px;
}

.tc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.tc-header strong {
  color: var(--ink);
  font-size: var(--text-base);
}

.tc-content > p {
  color: var(--ink);
  font-size: var(--text-lg);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thread-comment .thread-delete {
  font-size: var(--text-sm);
}

.thread-reply-compose {
  margin-top: 2px;
  padding-top: 2px;
}

.reply-side .ti-avatar--md {
  width: 30px;
  height: 30px;
  font-size: 12px;
  box-shadow: 0 0 0 3px var(--panel);
}

.thread-reply-compose .cc-content {
  min-width: 0;
  display: grid;
  gap: 8px;
}

@media (max-width: 680px) {
  .thread-comment,
  .thread-reply-compose {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
  }

  .tc-content > p {
    font-size: 14px;
  }
}


/* Distinct stats categories */
.stats-metric-group {
  position: relative;
  overflow: hidden;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}

.stats-metric-group::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--stats-accent, var(--accent));
}

.stats-metric-group-docs {
  --stats-accent: var(--gold);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold-bg) 58%, transparent), var(--panel) 56%);
}

.stats-metric-group-thread {
  --stats-accent: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-bg) 62%, transparent), var(--panel) 56%);
}

.stats-metric-group-baton {
  --stats-accent: #6d5bd0;
  background: linear-gradient(135deg, color-mix(in srgb, #6d5bd0 14%, transparent), var(--panel) 56%);
}

.stats-metric-heading {
  display: grid;
  gap: 4px;
  padding-left: 2px;
}

.stats-metric-heading h3 {
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.stats-metric-heading p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.stats-type-chip {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--stats-accent) 55%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--stats-accent) 13%, var(--panel));
  color: var(--stats-accent);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 900;
}

.stats-metric-group .stat-tile {
  border-color: color-mix(in srgb, var(--stats-accent) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 82%, var(--bg));
}

.stats-metric-group .stat-tile span {
  color: var(--stats-accent);
}

@media (max-width: 700px) {
  .stats-metric-group {
    padding: 13px;
  }

  .stats-metric-heading h3 {
    font-size: 16px;
  }
}




/* Baton completion rate in stats */
.baton-stat-cell {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.baton-stat-cell > strong {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.35;
}

.baton-rate-list {
  display: flex;
  gap: 4px;
}

.baton-rate-list span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  border: 1px solid color-mix(in srgb, #6d5bd0 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, #6d5bd0 8%, var(--panel));
  color: var(--ink-2);
  padding: 0 7px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
}

.baton-rate-list b {
  color: #8f7cff;
  font-size: 10px;
}

.stats-table {
  min-width: 760px;
}


/* Stats table column stability */
.stats-table th:nth-child(4),
.stats-table td:nth-child(4) {
  min-width: 64px;
  width: 72px;
  white-space: nowrap;
  text-align: center;
}

.stats-table .status-pill {
  min-width: 42px;
  justify-content: center;
  white-space: nowrap;
  word-break: keep-all;
}

.stats-table th:nth-child(5),
.stats-table td:nth-child(5) {
  min-width: 150px;
}

.stats-table th:nth-child(6),
.stats-table td:nth-child(6) {
  min-width: 210px;
}

.stats-table {
  min-width: 900px;
}

.android-apk-link {
  position: relative;
  text-decoration: none;
}

.android-apk-link.has-apk-update {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line));
  color: var(--accent);
}

.apk-update-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 28px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--panel);
  pointer-events: none;
}

.mobile-pref-popover .android-apk-link {
  color: var(--ink-2);
}

.mobile-pref-popover .apk-update-badge {
  position: static;
  margin-left: 8px;
  box-shadow: none;
}

.mobile-pref-popover .android-apk-link.has-apk-update {
  color: var(--accent);
}

/* ──────────────────────────────────────────
   SweetAlert2 — themed to match app design
────────────────────────────────────────── */

.app-swal-popup {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

.app-swal-title {
  color: var(--ink);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.02em;
  padding-top: 4px;
}

.app-swal-text {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.app-swal-actions {
  gap: 8px;
  margin-top: 18px;
}

.app-swal-btn {
  min-height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--t), border-color var(--t), box-shadow var(--t), color var(--t);
}

.app-swal-confirm {
  background: var(--accent);
  color: #fff;
}

.app-swal-confirm:hover {
  background: var(--accent-hover);
}

.app-swal-cancel {
  background: var(--bg);
  color: var(--ink-2);
  border-color: var(--line);
}

.app-swal-cancel:hover {
  border-color: var(--hover-border);
  background: var(--hover-bg);
}

.app-swal-deny {
  background: var(--danger-bg);
  color: var(--danger-color);
  border-color: var(--danger-border);
}

.app-swal-deny:hover {
  background: var(--danger-hover-bg);
  border-color: var(--danger-hover-border);
}

.app-swal-popup .swal2-icon {
  margin-top: 6px;
  margin-bottom: 4px;
}

.app-swal-popup .swal2-icon.swal2-warning {
  border-color: var(--gold);
  color: var(--gold);
}

.app-swal-popup .swal2-icon.swal2-error {
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.app-swal-popup .swal2-icon.swal2-error [class^="swal2-x-mark-line"] {
  background-color: var(--danger-color);
}

.app-swal-popup .swal2-icon.swal2-success {
  border-color: var(--accent);
  color: var(--accent);
}

.app-swal-popup .swal2-icon.swal2-success [class^="swal2-success-line"] {
  background-color: var(--accent);
}

.app-swal-popup .swal2-icon.swal2-success .swal2-success-ring {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.app-swal-popup .swal2-icon.swal2-info {
  border-color: var(--accent);
  color: var(--accent);
}

.swal2-container {
  background: rgba(20, 17, 10, 0.42);
}

.swal2-timer-progress-bar {
  background: var(--accent);
}

.pull-refresh-indicator {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 260;
  transform: translate(-50%, -120%);
  min-width: 104px;
  padding: 9px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: var(--radius-pill);
  background: var(--panel);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: 800;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: opacity 160ms ease, transform 160ms ease, color var(--t), border-color var(--t), background var(--t);
  opacity: 1;
  pointer-events: none;
}

.pull-refresh-indicator.hidden {
  opacity: 0;
}

.pull-refresh-indicator.ready,
.pull-refresh-indicator.refreshing {
  border-color: var(--accent);
  color: var(--accent);
}

@media (min-width: 541px) {
  .pull-refresh-indicator {
    display: none;
  }
}


.thread-gallery-filters,
.profile-insight-strip,
.admin-record-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.thread-gallery-filters {
  margin-bottom: 14px;
}

.profile-insight-strip {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-bg) 44%, var(--panel));
  color: var(--ink-2);
}

.profile-insight-strip span {
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--muted);
}

.profile-insight-strip b,
.admin-record-strip span {
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
}

.baton-history-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.baton-history-card {
  display: flex;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  flex-direction: column;
}

.baton-history-card > span {
  width: fit-content;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 900;
}

.baton-history-card.missed > span {
  background: var(--danger-bg);
  color: var(--danger-color);
}

.baton-history-card.current > span {
  background: var(--gold-bg);
  color: var(--gold);
}

.baton-history-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
}

.baton-history-card time {
  color: var(--muted);
  font-size: var(--text-xs);
}

.admin-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.admin-export-link {
  width: fit-content;
  margin-top: 12px;
  text-decoration: none;
}

.thread-compose.drag-over,
.thread-edit-form.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow-sm);
}

.thread-edit-form.drag-over {
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel));
  padding: 10px;
}

.thread-image-grid.reorderable .thread-image-item {
  cursor: grab;
}

.thread-image-grid.reorderable .thread-image-item:active {
  cursor: grabbing;
}

.thread-image-grid.reorderable .thread-image-item.dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.thread-image-grid.reorderable .thread-image-item.drop-target {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.baton-status.resting {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
}

.baton-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  padding: 8px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, var(--panel));
  color: var(--accent);
  font-weight: 900;
}

.baton-round-board {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.baton-round-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.baton-round-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.baton-round-member {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  gap: 4px;
  min-height: 82px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--panel) 84%, var(--bg));
}

.baton-round-member::after {
  content: "";
  position: absolute;
  left: -35%;
  right: -35%;
  bottom: 0;
  height: var(--rate, 0%);
  min-height: 3px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100' preserveAspectRatio='none'%3E%3Cpath d='M0 18 Q 20 10 40 18 T 80 18 T 120 18 T 160 18 V100 H0 Z' fill='rgba(24,130,111,0.38)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 100' preserveAspectRatio='none'%3E%3Cpath d='M0 20 Q 20 13 40 20 T 80 20 T 120 20 T 160 20 V100 H0 Z' fill='rgba(24,130,111,0.24)'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-size: 128px 100%, 168px 100%;
  background-position: 0 0, 24px 3px;
  filter: drop-shadow(0 -1px 0 color-mix(in srgb, var(--accent) 48%, var(--panel)));
  animation: batonWavePrimary 4.8s linear infinite, batonWaveFloat 7.2s ease-in-out infinite alternate;
}

@keyframes batonWavePrimary {
  from { background-position-x: 0, 24px; }
  to { background-position-x: 128px, -144px; }
}

@keyframes batonWaveFloat {
  from { transform: translateY(0); }
  to { transform: translateY(1px); }
}
.baton-round-member > * {
  position: relative;
  z-index: 1;
}

.baton-round-member b {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip);
  color: var(--muted);
  font-size: 0.78rem;
}

.baton-round-member em {
  font-style: normal;
  font-weight: 800;
}

.baton-round-member small {
  color: var(--muted);
  font-weight: 700;
}

.baton-round-member.completed {
  border-color: color-mix(in srgb, #10b981 52%, var(--line));
}

.baton-round-member.current,
.baton-round-member.next {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent);
}

.baton-round-member.missed {
  border-color: color-mix(in srgb, #ef4444 48%, var(--line));
}

.baton-notif-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.baton-notif-settings strong {
  margin-right: 2px;
}

.baton-notif-settings label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.baton-notif-settings label > span {
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .baton-round-member::after {
    animation: none;
  }
}


/* Appointments */
.appointment-view {
  display: grid;
  gap: 16px;
}

.appointment-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.appointment-hero h2,
.appointment-detail-head h3,
.appointment-create-panel h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.appointment-hero p,
.appointment-detail-head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.appointment-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.appointment-view,
.appointment-list,
.appointment-main,
.appointment-create-panel,
.appointment-create-panel form,
.appointment-create-panel label,
.appointment-movie-field,
.movie-crawl-meta {
  min-width: 0;
  max-width: 100%;
}

.appointment-create-panel input,
.appointment-create-panel select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#appointmentMovie {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-list,
.appointment-main,
.appointment-create-panel,
.appointment-detail-panel,
.appointment-response-form,
.appointment-responses {
  display: grid;
  gap: 12px;
}

.appointment-list {
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  align-content: start;
}

.appointment-card {
  display: grid;
  gap: 5px;
  width: 100%;
  text-align: left;
  padding: 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.appointment-card.active,
.appointment-card:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: var(--accent-bg);
}

.appointment-card strong {
  font-size: 15px;
}

.appointment-card p,
.appointment-card span,
.appointment-type {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.appointment-type {
  color: var(--accent);
  font-weight: 900;
}

.appointment-detail-panel,
.appointment-create-panel {
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.appointment-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.appointment-movie-search-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 8px;
  text-decoration: none;
}

.appointment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.appointment-confirmed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
}

.appointment-confirmed div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.appointment-confirmed span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.appointment-confirmed strong {
  color: var(--accent);
  font-size: 16px;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.appointment-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.appointment-result-grid section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.appointment-result-grid h4,
.appointment-response-form h4,
.appointment-responses h4 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.appointment-date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appointment-date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1;
}

.appointment-date-chip strong,
.appointment-date-chip b {
  font-size: inherit;
  line-height: 1;
}

.appointment-date-chip b {
  color: var(--accent);
}

.appointment-rank,
.selected-place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13px;
}

.selected-place {
  border: 1.5px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent);
}

.appointment-response-form,
.appointment-create-panel form {
  display: grid;
  gap: 10px;
}

.appointment-type-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.appointment-type-choice {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.appointment-type-choice strong {
  font-size: 17px;
  line-height: 1.25;
}

.appointment-type-choice span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.appointment-type-choice.active {
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: var(--accent-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.appointment-type-choice:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}

.appointment-response-form label,
.appointment-create-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.appointment-calendar {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.appointment-calendar-head {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 8px;
}

.appointment-calendar-head strong {
  color: var(--ink);
  font-size: 15px;
  text-align: center;
  letter-spacing: 0;
}

.appointment-calendar-weekdays,
.appointment-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.appointment-calendar-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.appointment-calendar-day,
.appointment-calendar-empty {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 7px;
}

.appointment-calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.appointment-calendar-day small {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  color: var(--accent);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.appointment-calendar-day.today {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

.appointment-calendar-day.selected {
  background: var(--accent);
  color: var(--accent-contrast);
}

.appointment-calendar-day.selected > span {
  color: #fff;
}

.appointment-calendar-day.selected small {
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
}

.appointment-selected-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  align-items: center;
}

.appointment-selected-dates button,
.appointment-selected-dates span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.appointment-selected-dates button {
  cursor: pointer;
}

.appointment-dates-field {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.appointment-place-input {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 46px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
}

.appointment-place-chips {
  display: contents;
}

.appointment-place-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 8px 5px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.appointment-place-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-place-chip b {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.appointment-place-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

#appointmentPlaceDraft {
  flex: 1 1 160px;
  min-width: 120px;
  height: 32px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#appointmentPlaceDraft:focus {
  outline: none;
  box-shadow: none;
}

.appointment-places-field {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.appointment-response-card {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.appointment-response-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.appointment-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
}

@media (max-width: 760px) {
  .appointment-hero,
  .appointment-detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .appointment-layout,
  .appointment-result-grid,
  .appointment-confirmed {
    grid-template-columns: 1fr;
  }

  .appointment-type-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .appointment-type-choice {
    min-height: 82px;
    padding: 12px 10px;
  }

  .appointment-type-choice strong {
    font-size: 15px;
  }

  .appointment-type-choice span {
    font-size: 11px;
  }
}

.menu-beta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
}

#appointmentButton {
  position: relative;
}

#appointmentButton .menu-beta-badge {
  margin-left: 2px;
}

#appointmentButton .menu-beta-badge,
#bnAppointments .menu-beta-badge {
  display: none;
}

.bn-beta-badge {
  min-width: 25px;
  height: 13px;
  padding: 0 4px;
  font-size: 7px;
  vertical-align: 1px;
}

.movie-crawl-meta {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

.movie-crawl-meta button {
  justify-self: start;
}

.movie-crawl-meta p {
  margin: 0;
  color: var(--danger, #b3261e);
  line-height: 1.5;
}
