/* =========================================================================
   Zixun — design tokens
   Concept: a paper telegram dispatch sent across an ink-dark wire.
   Dark mode: words printed on paper (light bubble), sent into a dark wire.
   Light mode: words stamped in ink (dark bubble), on the paper page itself.
   The dispatch-code chip (public_id) stays literal "paper" in both modes —
   it's a physical ticket, not part of the UI chrome.
   ========================================================================= */

:root,
[data-theme="dark"] {
  --bg: #12151b;
  --bg-grad: #1c2230;
  --surface-base: #212632;
  --surface-2-base: #191d25;
  --border-base: #3a4256;
  --border-dim: #2b3140;
  --text: #e8e4d9;
  --text-dim: #9aa0b0;
  --accent-base: #c48a45;
  --accent-bright-base: #dba15c;
  --accent-ink: #201304;
  --accent2: #6fa39a;
  --accent2-ink: #0c1b17;
  --danger: #c1573f;
  --danger-bright: #de6b50;
  --bubble-sent-bg: #eee7d8;
  --bubble-sent-text: #241d10;
  --bubble-received-bg: #2b3140;
  --bubble-received-text: var(--text);
  --shadow-card: 0 12px 30px -14px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f2ecdf;
  --bg-grad: #f8f2e4;
  --surface-base: #fbf7ec;
  --surface-2-base: #efe7d4;
  --border-base: #d9cdae;
  --border-dim: #e6dcc2;
  --text: #241d10;
  --text-dim: #7c7156;
  --accent-base: #a8712f;
  --accent-bright-base: #8a5c22;
  --accent-ink: #fff8ea;
  --accent2: #3f7d74;
  --accent2-ink: #eaf5f2;
  --danger: #b14a34;
  --danger-bright: #963926;
  --bubble-sent-bg: #232733;
  --bubble-sent-text: #eee7d8;
  --bubble-received-bg: var(--surface-2);
  --bubble-received-text: var(--text);
  --shadow-card: 0 12px 26px -16px rgba(90, 74, 40, 0.35);
  color-scheme: light;
}

/* the physical "paper ticket" — intentionally constant across themes */
:root {
  --chip-bg: #eee7d8;
  --chip-dim: #d9d0ba;
  --chip-text: #2a2113;
  --chip-label: #6b5c33;
  --chip-border: #8a7c56;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-s: 6px;
  --radius-m: 12px;
  --radius-l: 20px;

  /* Pass-through layer: everyday chrome (accent / border / surfaces) reads
     these, not the *-base tokens directly. A custom theme fill (see
     ThemeEngine.applyAccent in js/theme.js) overrides just these on the
     root element's inline style; removing that override falls straight
     back to the day/night *-base values above with no JS bookkeeping. */
  --accent: var(--accent-base);
  --accent-bright: var(--accent-bright-base);
  --border: var(--border-base);
  --surface: var(--surface-base);
  --surface-2: var(--surface-2-base);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(circle at 20% -10%, var(--bg-grad) 0%, var(--bg) 55%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 0 0 8px;
  color: var(--text);
}

p { margin: 0 0 12px; color: var(--text-dim); }

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  min-height: 100%;
}
.container.wide { max-width: 720px; }
.container.has-nav { padding-bottom: 110px; }
.container.has-dock { padding-bottom: 96px; }

/* ---- brand ---- */
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .mark { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--accent-bright); }
.brand .tagline { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }

/* ---- theme toggle ---- */
.theme-toggle {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-bright); }

.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0; z-index: 35;
  margin: 0 -20px 20px; padding: 20px 20px 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-dim);
}

/* ---- card / surfaces ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 28px 0 10px;
}

.divider { border: none; border-top: 1px dashed var(--border); margin: 18px 0; }

/* ---- forms ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }

.input, .textarea, select.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-s);
  padding: 11px 13px;
  font-size: 15px;
  font-family: var(--font-body);
}
.textarea { resize: vertical; min-height: 80px; }
.input::placeholder { color: var(--text-dim); opacity: 0.7; }
.input:focus, .textarea:focus { border-color: var(--accent); }

.input-file { display: block; font-size: 13px; color: var(--text-dim); }
.color-swatch-btn {
  width: 44px; height: 44px; border-radius: var(--radius-s);
  border: 1px solid var(--border); cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 3px var(--surface);
}
.color-swatch-btn:hover { border-color: var(--accent); }

/* ---- custom color picker dialog (js/ui-dialog.js) ---- */
.cp-modal { max-width: 300px; }
.cp-preview-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.cp-swatch { width: 40px; height: 40px; border-radius: var(--radius-s); border: 1px solid var(--border); flex-shrink: 0; }
.cp-sv { width: 100%; height: auto; border-radius: var(--radius-s); cursor: crosshair; display: block; touch-action: none; }
.cp-hue {
  width: 100%; margin-top: 12px; -webkit-appearance: none; appearance: none;
  height: 12px; border-radius: 6px;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}
.cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid #222; cursor: pointer;
}
.cp-hue::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #222; cursor: pointer; }
.cp-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cp-preset { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.char-count { font-size: 11px; color: var(--text-dim); text-align: right; margin-top: 4px; font-family: var(--font-mono); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-bright); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-bright); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger-bright); }
.btn-danger:hover { background: var(--danger); color: var(--accent-ink); }
.btn-accept { background: var(--accent2); color: var(--accent2-ink); }
.btn-sm { width: auto; padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { width: auto; flex: 1; }
.btn-icon { width: 36px; padding: 0; flex-shrink: 0; }

/* ---- nav (top, legacy single-line) ---- */
.navbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.navbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.navbar .who .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar .actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-link { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 7px 10px; }
.icon-link:hover { color: var(--accent-bright); border-color: var(--accent); text-decoration: none; }

/* ---- avatar ---- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 600;
  overflow: hidden; flex-shrink: 0; border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl { width: 92px; height: 92px; font-size: 32px; border-width: 3px; }

/* ---- dispatch code chip (signature element, theme-constant) ---- */
.dispatch-chip {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 15px; letter-spacing: 0.12em;
  background: repeating-linear-gradient(90deg, var(--chip-bg) 0 4px, var(--chip-dim) 4px 5px);
  background-color: var(--chip-bg);
  color: var(--chip-text);
  border-radius: var(--radius-s);
  padding: 8px 12px;
  border: 1px dashed var(--chip-border);
}
.dispatch-chip .label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--chip-label); }
.dispatch-chip button { border: none; background: none; cursor: pointer; font-family: var(--font-mono); font-size: 11px; color: var(--chip-label); text-decoration: underline; }

/* ---- title badge (admin / other future titles) ---- */
.title-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--accent-bright);
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---- alerts / status banners ---- */
.alert { border-radius: var(--radius-m); padding: 16px 18px; border: 1px solid var(--border); margin-bottom: 20px; }
.alert.pending { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.alert.rejected { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.alert.banned { border-color: var(--danger-bright); background: color-mix(in srgb, var(--danger) 18%, transparent); }
.alert.approved { border-color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, transparent); }
.alert .title { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.alert p:last-child { margin-bottom: 0; }

.error-text { color: var(--danger-bright); font-size: 13px; margin-top: 8px; min-height: 1em; }
.success-text { color: var(--accent2); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* ---- lists: friends / requests / admin / chat ---- */
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--border-dim); color: var(--text); }
.list-item:last-child { border-bottom: none; }
.list-item .meta { flex: 1; min-width: 0; }
.list-item .meta .name-row { display: flex; align-items: center; gap: 6px; }
.list-item .meta .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta .sub { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.list-item .arrow { color: var(--text-dim); font-family: var(--font-mono); flex-shrink: 0; }
a.list-item:hover { text-decoration: none; border-color: var(--border); }

/* ---- swipeable list rows (home screen: friends / groups / notices) ---- */
.swipe-row { position: relative; overflow: hidden; border-bottom: 1px solid var(--border-dim); }
.swipe-row:last-child { border-bottom: none; }
.swipe-row .swipe-actions {
  position: absolute; top: 0; right: 0; bottom: 0;
  display: flex; align-items: stretch;
  transform: translateX(100%);
  transition: transform 0.18s ease;
}
.swipe-row.is-open .swipe-actions { transform: translateX(0); }
.swipe-row .swipe-actions button {
  border: none; color: #fff; font-size: 11px; font-weight: 600;
  width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
}
.swipe-row .swipe-actions .act-pin { background: var(--accent2); }
.swipe-row .swipe-actions .act-archive { background: #6b7280; }
.swipe-row .swipe-actions .act-mute { background: var(--danger); }
.swipe-row .swipe-content {
  display: flex; background: var(--bg, transparent);
  transition: transform 0.18s ease;
  touch-action: pan-y;
}
.swipe-row .swipe-content > .list-item,
.swipe-row .swipe-content > .chat-list-item { flex: 1; border-bottom: none; }
.swipe-row.is-open .swipe-content { transform: translateX(-192px); }
.swipe-row .pinned-flag { color: var(--accent2); font-size: 12px; margin-right: 4px; }

.empty-state { text-align: center; padding: 32px 16px; color: var(--text-dim); font-size: 14px; }

/* ---- chat list (home) ---- */
.chat-list-item { position: relative; }
.chat-list-item .preview { font-size: 13px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.chat-list-item .time { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); flex-shrink: 0; }
.chat-list-item .right-col { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.unread-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  position: absolute; top: 6px; right: 4px;
}

/* ---- chat ---- */
.chat-header { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--border-dim); }
.chat-header .name-row { display: flex; align-items: center; gap: 6px; }
.chat-header .name { font-weight: 600; }
.chat-header .code { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

.msg-scroll { display: flex; flex-direction: column; gap: 10px; min-height: 50vh; max-height: 60vh; overflow-y: auto; padding: 6px 2px 12px; }

.msg-row { display: flex; }
.msg-row.sent { justify-content: flex-end; }
.msg-row.received { justify-content: flex-start; }

.msg-bubble {
  max-width: 78%; padding: 10px 13px; border-radius: var(--radius-m);
  font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  animation: rise 0.18s ease;
}
.msg-row.received .msg-bubble { background: var(--bubble-received-bg); color: var(--bubble-received-text); border-bottom-left-radius: 4px; }
.msg-row.sent .msg-bubble { background: var(--bubble-sent-bg); color: var(--bubble-sent-text); border-bottom-right-radius: 4px; }
.msg-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.05em; color: var(--text-dim); margin-top: 3px; text-align: right; }
.msg-row.received .msg-meta { text-align: left; }

@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Group chat composer: pinned to the bottom, no longer drifting with message count ---- */
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; border-top: 1px solid var(--border-dim); padding-top: 14px; }
.chat-input-row .textarea { flex: 1; min-height: 44px; max-height: 120px; }
.chat-input-row .btn { width: auto; padding: 12px 18px; }

.gc-dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--bg);
  border-top: 1px solid var(--border-dim);
  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
}
.gc-dock-inner { max-width: 480px; margin: 0 auto; }
.gc-dock #mentionPicker { margin-bottom: 8px; }
.gc-dock .chat-input-row { margin-top: 0; border-top: none; padding-top: 0; }
.msg-scroll.gc-scroll {
  min-height: 0; max-height: none; flex: 1;
  padding-bottom: 14px;
}
.gc-chat-body {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - 220px);
}
@supports not (height: 1dvh) {
  .gc-chat-body { min-height: calc(100vh - 220px); }
}


/* ---- profile page / profile-view (cover + avatar overlap) ---- */
.profile-cover {
  position: relative;
  height: 150px;
  border-radius: var(--radius-l);
  background: var(--surface-2);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  margin-bottom: 46px;
  overflow: visible;
}
.profile-cover .cover-edit-btn {
  position: absolute; top: 10px; right: 10px;
  font-family: var(--font-mono); font-size: 11px;
  background: rgba(18,21,27,0.55); color: #fff;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 20px;
  padding: 6px 12px; cursor: pointer;
}
.profile-cover .avatar-wrap {
  position: absolute; left: 20px; bottom: -36px;
}
.profile-cover .avatar-wrap .avatar { border: 4px solid var(--bg); }
.profile-cover .avatar-edit-btn {
  position: absolute; bottom: -4px; right: -4px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--bg);
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.profile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.profile-bio { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.profile-bio.empty { color: var(--text-dim); font-style: italic; }

/* ---- admin table ---- */
.admin-row { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border-dim); }
.admin-row .top { display: flex; align-items: center; gap: 10px; }
.status-tag {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border);
}
.status-tag.pending { color: var(--accent-bright); border-color: var(--accent); }
.status-tag.approved { color: var(--accent2); border-color: var(--accent2); }
.status-tag.rejected { color: var(--danger-bright); border-color: var(--danger); }
.status-tag.banned { color: var(--danger-bright); border-color: var(--danger-bright); background: color-mix(in srgb, var(--danger) 15%, transparent); }
.status-tag.muted { color: var(--text-dim); border-color: var(--border); }
.status-tag.open { color: var(--danger-bright); border-color: var(--danger); }
.status-tag.reviewed { color: var(--accent2); border-color: var(--accent2); }
.status-tag.dismissed { color: var(--text-dim); border-color: var(--border); }

.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn {
  font-family: var(--font-mono); font-size: 12px; padding: 7px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer;
}
.tab-btn.active { color: var(--accent-bright); border-color: var(--accent); }

/* ---- admin: category bar + grouped sub-tabs + nicer row cards (group admin polish) ---- */
.admin-section-label {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim); margin: 4px 0 8px;
}
.category-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.category-tabs .cat-btn {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.category-tabs .cat-btn.active {
  color: var(--accent-ink); border-color: var(--accent); background: var(--accent);
}
.tab-group { margin-bottom: 16px; }
.tab-group[hidden] { display: none; }
.tab-group .tabs { margin-bottom: 4px; }

/* Admin list cards: each record becomes its own rounded card instead of one long underlined list */
#adminList.card { padding: 0; background: transparent; border: none; box-shadow: none; }
#adminList .admin-row,
#doorList .admin-row {
  background: var(--surface); border: 1px solid var(--border-dim); border-radius: var(--radius-m);
  padding: 16px; margin-bottom: 12px; gap: 10px;
}
#adminList .admin-row:last-child,
#doorList .admin-row:last-child { margin-bottom: 0; }
.admin-row .meta { flex: 1; min-width: 0; }
.admin-row .name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row .sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.admin-row .hint { margin: 0; line-height: 1.5; }
.admin-row .top { align-items: flex-start; }
.admin-row .top .status-tag { flex-shrink: 0; }

/* Action buttons no longer stretch to equal widths — left-aligned at their natural size */
.admin-row .btn-row.compact { flex-wrap: wrap; gap: 8px; }
.admin-row .btn-row.compact .btn { flex: none; width: auto; padding: 7px 14px; font-size: 12.5px; }


.loading-line { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); text-align: center; padding: 20px 0; }

.avatar-picker { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }

/* ---- modal (report dialog) ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,0.6);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 50; padding: 0;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  padding: 22px 20px 28px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-card);
}
@media (min-width: 540px) {
  .modal-overlay { align-items: center; }
  .modal-card { border-radius: var(--radius-l); }
}

/* ---- Notice (announcement) cards ---- */
.notice-board { margin-bottom: 20px; }
.notice-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--accent2);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.notice-card.is-pinned { border-color: var(--accent); }
.notice-card.is-unread { box-shadow: var(--shadow-card), 0 0 0 1px var(--accent2) inset; }
.notice-card-head .unread-dot { position: static; display: inline-block; }
.notice-card-image {
  display: block; width: 100%; aspect-ratio: 16 / 7;
  background: var(--surface-2) center/cover no-repeat;
  border-bottom: 1px solid var(--border-dim);
}
.notice-card-body { padding: 14px 16px 16px; }
.notice-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.notice-card-tag {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent2-ink); background: var(--accent2);
  border-radius: 20px; padding: 3px 9px; white-space: nowrap;
}
.notice-card.is-pinned .notice-card-tag { color: var(--accent-ink); background: var(--accent); }
.notice-dismiss {
  border: none; background: none; cursor: pointer;
  color: var(--text-dim); font-size: 19px; line-height: 1;
  padding: 0 2px; flex-shrink: 0;
}
.notice-dismiss:hover { color: var(--danger-bright); }
.notice-card-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; margin-bottom: 4px; color: var(--text); }
.notice-card-text { font-size: 13.5px; color: var(--text-dim); white-space: pre-wrap; margin: 0 0 10px; }
.notice-card .btn { width: auto; }

/* ---- RMWfans sub-site shortcut ---- */
.site-shortcut {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  margin-bottom: 20px;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.site-shortcut:hover { border-color: var(--accent2); text-decoration: none; }
.site-shortcut .site-shortcut-icon {
  width: 40px; height: 40px; border-radius: var(--radius-s); flex-shrink: 0;
  background: color-mix(in srgb, var(--accent2) 16%, transparent);
  color: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
}
.site-shortcut .meta { flex: 1; min-width: 0; }
.site-shortcut .name { font-weight: 600; font-size: 14.5px; }
.site-shortcut .sub { font-size: 12.5px; color: var(--text-dim); }
.site-shortcut .arrow { color: var(--text-dim); font-family: var(--font-mono); flex-shrink: 0; }

/* ---- bottom navigation ---- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-dim);
  padding: 4px 18px;
  position: relative;
}
.nav-item:hover { text-decoration: none; color: var(--text-dim); }
.nav-item.active { color: var(--accent-bright); }
.nav-item svg { width: 22px; height: 22px; }
.nav-item .nav-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.03em; }
.nav-icon-wrap { position: relative; display: inline-flex; }
.nav-dot {
  display: none;
  position: absolute; top: -2px; right: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--surface);
}

@media (min-width: 480px) {
  .container.has-nav { max-width: 480px; }
}
