:root {
    color-scheme: light;
    --ink: #0f1614;
    --text: #1f2a26;
    --muted: #6b7770;
    --subtle: #98a39d;
    --paper: #f7f6f1;
    --surface: #ffffff;
    --surface-soft: #f1efe8;
    --surface-hover: #ebe9e1;
    --line: rgba(15, 22, 20, 0.08);
    --line-strong: rgba(15, 22, 20, 0.14);
    --border: rgba(15, 22, 20, 0.14);
    --accent: #e8553f;
    --accent-soft: rgba(232, 85, 63, 0.10);
    --accent-ink: #b73a26;
    --header-bg: rgba(247, 246, 241, 0.78);
    --shadow-sm: 0 1px 0 rgba(15, 22, 20, 0.04);
    --shadow-pop: 0 12px 32px rgba(15, 22, 20, 0.10);
    --radius-card: 14px;
    --radius-tight: 10px;
    --radius-pill: 9999px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --ink: #f3efe7;
    --text: #e8e3d8;
    --muted: #8a948e;
    --subtle: #6a736e;
    --paper: #0d1210;
    --surface: #161c19;
    --surface-soft: #1c2320;
    --surface-hover: #232b27;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.12);
    --border: rgba(255, 255, 255, 0.16);
    --accent: #ff7a6b;
    --accent-soft: rgba(255, 122, 107, 0.14);
    --accent-ink: #ff9485;
    --header-bg: rgba(13, 18, 16, 0.78);
    --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
    overflow-x: clip;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--paper);
    font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-feature-settings: "ss01", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.5;
}

img, svg, video { max-width: 100%; }

[hidden] { display: none !important; }

.page-shell { width: 100%; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

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

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(240px, 480px) 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    height: 60px;
    padding: 0 clamp(16px, 3vw, 32px);
    background: var(--header-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: saturate(140%) blur(18px);
    -webkit-backdrop-filter: saturate(140%) blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
}

.brand-word { display: inline-flex; align-items: baseline; }
.brand-dot { color: var(--accent); }

.search {
    position: relative;
    display: flex;
    align-items: center;
    height: 38px;
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    transition: background 120ms ease, border-color 120ms ease;
}

.search:focus-within {
    background: var(--surface);
    border-color: var(--line-strong);
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    color: var(--muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.search input {
    width: 100%;
    height: 100%;
    padding: 0 16px 0 38px;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 0.92rem;
}

.search input::placeholder { color: var(--muted); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a {
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    transition: color 120ms ease, background 120ms ease;
}

.nav-links a:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
}

.theme-toggle:hover { color: var(--ink); background: var(--surface-soft); }

.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }

html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

.notification-action {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    transition: color 120ms ease, background 120ms ease;
}

.notification-action:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.notification-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-badge,
.mobile-notification-dot {
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    color: #fff;
    background: var(--accent);
    border: 2px solid var(--header-bg);
    border-radius: var(--radius-pill);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -4px;
}

.nav-action {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    color: var(--surface);
    background: var(--ink);
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 120ms ease, opacity 120ms ease;
}

.nav-action:hover { opacity: 0.9; }
.nav-action:active { transform: scale(0.97); }

.nav-account {
    gap: 8px;
    padding: 0 12px 0 4px;
    background: var(--surface-alt, transparent);
    color: var(--ink);
    border: 1px solid var(--border, rgba(0,0,0,0.08));
}
.nav-account .avatar {
    width: 28px;
    height: 28px;
    font-size: 13px;
}
.nav-account-handle { font-weight: 500; }

.text-button {
    padding: 0;
    color: var(--accent);
    background: transparent;
    border: 0;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.text-button:hover { color: var(--accent-ink); }
.text-button.danger { color: #b42318; }
.text-button.danger:hover { color: #7a271a; }
.form-error {
    color: #b42318;
    background: #fee4e2;
    border: 1px solid #fda29b;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 8px 0 0;
    font-size: 14px;
}

.form-success {
    color: #067647;
    background: #dcfae6;
    border: 1px solid #75e0a7;
    padding: 10px 12px;
    border-radius: 8px;
    margin: 8px 0 0;
    font-size: 14px;
}

.composer-panel { display: flex; flex-direction: column; gap: 14px; }
.composer-context {
    display: flex;
    align-items: center;
    gap: 10px;
}
.composer-context strong { display: block; line-height: 1.2; }
.composer-context small { color: var(--muted, #6b7280); }

.composer-form { display: flex; flex-direction: column; gap: 12px; }
.composer-form textarea {
    width: 100%;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 12px;
    padding: 14px 16px;
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    resize: vertical;
    min-height: 140px;
    background: var(--surface, #fff);
    color: var(--ink);
}
.composer-form textarea:focus,
.composer-form input[type=text]:focus,
.composer-form input[type=url]:focus,
.composer-form select:focus {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 1px;
    border-color: transparent;
}

.mention-suggest {
    display: grid;
    gap: 2px;
    width: min(100%, 360px);
    margin-top: -4px;
    padding: 6px;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 8px;
    background: var(--surface, #fff);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
    z-index: 20;
}

.mention-suggest[hidden] {
    display: none;
}

.mention-suggest-option {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    border: 0;
    border-radius: 6px;
    padding: 7px 8px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.mention-suggest-option:hover,
.mention-suggest-option.active {
    background: var(--surface-hover, rgba(0,0,0,0.05));
}

.mention-suggest-option img,
.mention-suggest-option .avatar {
    width: 32px;
    height: 32px;
}

.mention-suggest-option strong,
.mention-suggest-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mention-suggest-option strong {
    font-size: 0.92rem;
    line-height: 1.2;
}

.mention-suggest-option small {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.2;
}

.composer-form > input[type=text],
.composer-form > input[type=url],
.composer-form > select,
.composer-form > input[type=file] {
    width: 100%;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    background: var(--surface, #fff);
    color: var(--ink);
}

.composer-form > input[type=file] {
    padding: 10px 12px;
    font-weight: 500;
}

.image-dropzone {
    display: grid;
    gap: 10px;
    border: 1px dashed var(--border, rgba(0,0,0,0.18));
    border-radius: 12px;
    padding: 14px;
    background: color-mix(in srgb, var(--surface, #fff) 88%, var(--accent, #2563eb) 12%);
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.image-dropzone.is-dragging,
.image-dropzone:focus-within {
    border-color: var(--accent, #2563eb);
    background: color-mix(in srgb, var(--surface, #fff) 78%, var(--accent, #2563eb) 22%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #2563eb) 18%, transparent);
}
.image-dropzone .image-input {
    width: 100%;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-weight: 500;
    background: var(--surface, #fff);
    color: var(--ink);
}
.image-dropzone .image-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
}
.image-dropzone-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: var(--muted, #6b7280);
    font-size: 0.9rem;
}
.image-dropzone-copy strong {
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.35;
}
.image-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 10px;
    padding: 9px 10px 9px 12px;
    background: var(--surface, #fff);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
}
.image-selected[hidden] { display: none; }
.image-clear-button {
    flex: 0 0 auto;
    padding: 6px 10px;
    font-size: 0.85rem;
}
.edit-image-block {
    display: grid;
    gap: 10px;
    margin-top: 2px;
}
.edit-image-heading {
    display: block;
}
.edit-image-heading .composer-field-label {
    margin: 0;
}
.edit-image-dropzone {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
}
.edit-image-upload {
    display: grid;
    gap: 10px;
}
.edit-image-upload[hidden] {
    display: none;
}
.edit-image-dropzone .image-dropzone-copy {
    min-width: 0;
}
.image-pick-button {
    align-self: center;
    white-space: nowrap;
}
.image-remove-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    width: fit-content;
    color: var(--muted, #6b7280);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}
.image-remove-option input {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    accent-color: var(--danger, #b91c1c);
}
.form-error-inline {
    color: var(--danger, #b91c1c) !important;
    font-weight: 700;
}

.composer-destination {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.composer-destination-row {
    display: grid;
    grid-template-columns: auto minmax(180px, 1fr);
    gap: 10px;
    align-items: center;
}
.composer-destination label {
    color: var(--muted, #6b7280);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}
.room-picker {
    position: relative;
}
.room-picker input {
    width: 100%;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: var(--radius-pill, 999px);
    padding: 9px 14px;
    font: inherit;
    font-size: 14px;
    background: var(--surface, #fff);
    color: var(--ink);
}
.room-picker-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 14px;
    background: var(--surface, #fff);
    box-shadow: var(--shadow-lg, 0 18px 45px rgba(15, 22, 20, 0.14));
}
.room-picker-option {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.room-picker-option:hover,
.room-picker-option:focus {
    outline: none;
    background: var(--surface-soft, #f7f7f5);
}
.room-picker-option span {
    font-weight: 700;
    line-height: 1.2;
}
.room-picker-option small {
    color: var(--muted, #6b7280);
    font-size: 0.82rem;
}
.room-picker-empty {
    margin: 0;
    padding: 10px 12px;
    color: var(--muted, #6b7280);
    font-size: 0.86rem;
}
.composer-room-suggestions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.composer-room-suggestions > span {
    color: var(--muted, #6b7280);
    font-size: 0.82rem;
}
.composer-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.composer-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: var(--radius-pill, 999px);
    background: var(--surface, #fff);
    color: var(--muted, #6b7280);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.composer-chip:hover,
.composer-chip.active {
    border-color: var(--ink);
    color: var(--ink);
}

.composer-field-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted, #6b7280);
    margin-bottom: 2px;
}
.composer-field-label .label-hint {
    font-weight: 500;
    color: var(--muted, #9ca3af);
}
.slug-field-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
    border-radius: 10px;
    background: var(--surface, #fff);
    overflow: hidden;
}
.slug-field-wrap .slug-prefix {
    padding: 12px 0 12px 14px;
    color: var(--muted, #6b7280);
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}
.slug-field-wrap input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 12px 14px 12px 4px;
    font: inherit;
    font-size: 16px;
    background: transparent;
    color: var(--ink);
}
.slug-field-wrap:focus-within {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 1px;
}
.field-help {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--muted, #6b7280);
    line-height: 1.4;
}
.composer-panel .muted-block {
    margin: 0;
    font-size: 0.96rem;
    color: var(--muted, #6b7280);
    line-height: 1.5;
}
.composer-panel .muted-block strong {
    color: var(--ink);
}
.composer-footer-plain {
    margin-top: 4px;
}

.create-room-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
    gap: 18px;
    align-items: start;
}

.create-room-form {
    min-width: 0;
}

.create-room-side {
    display: grid;
    gap: 12px;
}

.create-room-preview,
.room-suggestions-panel {
    display: grid;
    gap: 10px;
    padding: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-tight);
}

.create-room-preview .eyebrow,
.room-suggestions-panel .eyebrow {
    margin: 0;
}

.create-room-preview-card {
    padding: 0;
    background: transparent;
}

.create-room-preview-card:hover {
    background: transparent;
}

.create-room-preview h2 {
    margin: 2px 0 0;
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1.3;
}

.create-room-preview p,
.room-suggestions-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.room-suggestions-list {
    display: grid;
    gap: 6px;
}

.room-suggestion-link {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    color: inherit;
    text-decoration: none;
    border-radius: 8px;
}

.room-suggestion-link:hover {
    background: var(--surface-hover);
}

.room-suggestion-link strong {
    color: var(--ink);
    font-size: 0.93rem;
}

.room-suggestion-link small,
.room-suggestions-empty {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.composer-footer {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.composer-actions { display: flex; gap: 8px; }
.button-ghost {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 14px;
    border-radius: var(--radius-pill, 999px);
    color: var(--muted, #6b7280);
    text-decoration: none;
    font-weight: 500;
}
.button-ghost:hover { color: var(--ink); }

.back-link {
    justify-self: start;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
}
.back-link:hover { color: var(--ink); }

.reply-panel {
    display: grid;
    gap: 12px;
}
.reply-form {
    display: grid;
    gap: 10px;
}
.reply-form textarea {
    width: 100%;
    min-height: 88px;
    resize: vertical;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface-soft, #f7f7f5);
    color: var(--muted);
    font: inherit;
}
.reply-form .button,
.reply-login .button {
    justify-self: end;
}
.reply-login {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.reply-list {
    display: grid;
    gap: 10px;
}
.reply-card {
    display: grid;
    gap: 10px;
}
.reply-card header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.reply-card header small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}
.reply-card p {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

/* ---------- Layout ---------- */

.app-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(420px, 640px) minmax(260px, 340px);
    gap: 28px;
    align-items: start;
    width: min(1380px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 32px) 64px;
}

.left-rail, .right-rail {
    position: sticky;
    top: 80px;
    display: grid;
    gap: 16px;
}

/* ---------- Panels & cards ---------- */

.panel, .thread-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
}

.panel { padding: 18px; }

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

.join-panel p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.muted-copy {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.search-post-results {
    display: grid;
    gap: 12px;
}

.search-empty-inline {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding: 4px 0 2px;
}

.search-empty-inline h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1.35;
}

.search-empty-inline p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.search-empty-inline .button {
    height: 36px;
    padding-inline: 14px;
    font-size: 0.88rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 18px;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.93rem;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease;
}

.button:hover { opacity: 0.92; }
.button:active { transform: scale(0.98); }
.button:disabled {
    cursor: wait;
    opacity: 0.72;
    transform: none;
}

.submit-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 40;
    width: min(420px, calc(100vw - 32px));
    transform: translateX(-50%);
    padding: 12px 16px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-pop);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-heading:last-child {
    margin-bottom: 0;
}

.panel-heading h2, .join-panel h2 {
    margin: 0;
    color: var(--ink);
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

.panel-heading > a {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 120ms ease;
}

.panel-heading > a:hover { color: var(--ink); }

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

.metric-card {
    display: grid;
    gap: 6px;
    min-height: 132px;
}

.metric-card span, .metric-card small {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.metric-card strong {
    color: var(--ink);
    font-size: 1.9rem;
    line-height: 1;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

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

.admin-list {
    display: grid;
    gap: 10px;
}

.admin-list.compact { gap: 8px; }

.admin-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0;
    color: inherit;
    border-top: 1px solid var(--line);
}

.admin-list-row:first-child { border-top: 0; }

.admin-list-row div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.admin-list-row strong {
    color: var(--ink);
    font-size: 0.94rem;
    font-weight: 600;
    line-height: 1.35;
}

.admin-list-row span, .admin-list-row small {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.4;
}

.admin-list-row small {
    flex: 0 0 auto;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------- Avatars ---------- */

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    color: #fff;
    background: var(--ink);
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-accent { background: var(--accent); }

/* ---------- Rooms list ---------- */

.room-stack { display: grid; gap: 2px; }

.room-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: var(--radius-tight);
    transition: background 120ms ease;
}

.room-link:hover { background: var(--surface-soft); }

.room-link .avatar { width: 32px; height: 32px; font-size: 0.82rem; }

.room-meta { min-width: 0; }
.room-meta strong, .room-meta small { display: block; }

.room-meta strong {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-meta small {
    margin-top: 1px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

/* ---------- Feed ---------- */

.feed-column { display: grid; gap: 14px; min-width: 0; }

.composer {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 10px 10px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:hover {
    border-color: var(--line-strong);
    box-shadow: 0 4px 18px rgba(15, 22, 20, 0.06);
}

html[data-theme="dark"] .composer:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.composer-input {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 14px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: var(--radius-pill);
    font-size: 0.93rem;
    font-weight: 400;
    transition: color 120ms ease;
}

.composer:hover .composer-input { color: var(--ink); }

.composer-send {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    color: #fff;
    background: var(--accent);
    border-radius: var(--radius-pill);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.composer-send svg {
    width: 17px;
    height: 17px;
    transform: translate(-1px, 1px);
}

.composer:hover .composer-send {
    transform: translateX(2px);
    box-shadow: 0 6px 14px rgba(232, 85, 63, 0.32);
}

.composer:active .composer-send { transform: translateX(0) scale(0.96); }

.feed-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    border-bottom: 1px solid var(--line);
}

.feed-tabs a {
    position: relative;
    padding: 12px 14px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 120ms ease;
}

.feed-tabs a:hover { color: var(--ink); }

.feed-tabs .active { color: var(--ink); font-weight: 600; }

.feed-tabs .active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

/* ---------- Thread card ---------- */

.thread-card {
    padding: 0;
    overflow: hidden;
    transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.thread-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(15, 22, 20, 0.06);
}

html[data-theme="dark"] .thread-card:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.thread-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 16px 18px 0;
}

.thread-meta { min-width: 0; }
.thread-meta strong, .thread-meta small { display: block; }

.thread-meta strong {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
}

.thread-meta small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.thread-meta .dot { margin: 0 3px; color: var(--subtle); }

.thread-meta-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
}

.thread-meta-primary .handle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-meta-primary .handle-user { flex: 0 1 auto; }
.thread-meta-primary .handle-room { flex: 1 1 auto; }

.thread-meta-primary .meta-separator {
    flex: 0 0 auto;
    color: var(--subtle);
    font-weight: 500;
}

.handle {
    color: inherit;
    font-variant-numeric: tabular-nums;
    transition: color 120ms ease;
}

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

.handle-room { font-weight: 600; }
.handle-user { font-weight: 500; }

.thread-meta-primary .handle-room {
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.2;
}

.thread-meta-primary .handle-user { color: var(--ink); }

/* @mentions in plain text — brand orange/coral accent */
a.mention {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    transition: color 120ms ease;
}

a.mention:hover {
    color: var(--accent-ink);
    text-decoration: underline;
}

a.mention:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
}

.icon-btn:hover { color: var(--ink); background: var(--surface-soft); }

.icon-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: none;
}

.post-menu {
    position: relative;
}

.post-menu summary {
    list-style: none;
}

.post-menu summary::-webkit-details-marker {
    display: none;
}

.post-menu-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 160px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(15, 22, 20, 0.14);
}

.post-menu-popover form {
    margin: 0;
}

.post-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.post-menu-item:hover {
    color: var(--ink);
    background: var(--surface-soft);
}

.post-menu-item svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.thread-card h2 {
    margin: 12px 18px 8px;
    color: var(--ink);
    font-size: 1.12rem;
    line-height: 1.32;
    letter-spacing: -0.01em;
    font-weight: 600;
}

.thread-card p {
    margin: 0 18px 16px;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.55;
    white-space: pre-wrap;
}

.thread-excerpt.is-clamped {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.read-more {
    display: block;
    margin: -10px 18px 14px;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.thread-card-body {
    display: block;
    color: inherit;
    text-decoration: none;
}

/* Preview cards (home / room lists): excerpt may include <a class="mention"> — cannot nest inside outer <a>. */
.thread-card-body--linked {
    position: relative;
}

.thread-card-stretched-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.thread-card-readable {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.thread-card-readable h2 a {
    pointer-events: auto;
    color: inherit;
    text-decoration: none;
}

.thread-card-readable .read-more,
.thread-card-readable a.mention {
    pointer-events: auto;
}

.thread-card-body:hover h2 {
    color: var(--accent);
}

.thread-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 36px);
    margin: -4px 18px 16px;
    padding: 0;
    height: clamp(280px, 62vw, 420px);
    overflow: hidden;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: zoom-in;
}

.thread-image-wrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: top center;
    background: var(--surface-soft);
}

.thread-card-detail .thread-image-wrap {
    height: auto;
}

.thread-card-detail .thread-image-wrap img {
    height: auto;
    object-fit: contain;
}

.thread-embed {
    width: calc(100% - 36px);
    margin: -4px 18px 16px;
    overflow: hidden;
}

.thread-embed iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--surface-soft);
}

.thread-embed-youtube {
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 10px;
}

.thread-embed-youtube iframe {
    width: 100%;
    height: 100%;
}

.thread-embed blockquote {
    margin: 0 !important;
}

.thread-embed a {
    color: var(--accent);
    font-weight: 700;
}

.thread-embed-fallback {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
    text-decoration: none;
}

.thread-embed-fallback span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
}

.thread-embed-fallback strong,
.thread-embed-fallback small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-embed-fallback strong {
    color: var(--text);
}

.thread-embed-fallback small {
    color: var(--muted);
    font-weight: 500;
}

.has-lightbox {
    overflow: hidden;
}

.image-lightbox {
    --lightbox-gutter-x: 14px;
    --lightbox-gutter-y: 20px;
    position: fixed;
    inset: 0;
    z-index: 1000;
    box-sizing: border-box;
    display: none;
    place-items: center;
    padding: max(var(--lightbox-gutter-y), env(safe-area-inset-top, 0px)) var(--lightbox-gutter-x) max(var(--lightbox-gutter-y), env(safe-area-inset-bottom, 0px));
    overflow: hidden;
    background: rgba(0, 0, 0, 0.94);
}

.image-lightbox[aria-hidden="false"] {
    display: grid;
}

.image-lightbox-img {
    display: block;
    max-width: calc(100vw - (var(--lightbox-gutter-x) * 2));
    max-height: calc(100vh - (var(--lightbox-gutter-y) * 2));
    max-height: calc(100dvh - (var(--lightbox-gutter-y) * 2));
    width: auto;
    height: auto;
    object-fit: contain;
}

.image-lightbox-close {
    position: fixed;
    top: max(14px, env(safe-area-inset-top, 0px));
    left: 14px;
    z-index: 1001;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    border: 0;
    border-radius: var(--radius-pill);
    cursor: pointer;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.image-lightbox-close svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.thread-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
}

.thread-actions .action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: color 120ms ease, background 120ms ease;
}

.thread-actions .action:hover { color: var(--ink); background: var(--surface-soft); }
.thread-actions .action:active { transform: scale(0.94); }

.thread-actions .action[aria-pressed="true"] {
    color: var(--accent);
    background: var(--accent-soft);
}

.thread-actions .action[aria-pressed="true"] svg {
    fill: var(--accent);
    stroke: var(--accent);
}

.thread-actions .vote-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border-radius: var(--radius-pill);
}

.thread-actions .vote-group .action.vote {
    padding: 0 8px;
    gap: 0;
}

.thread-actions .vote-group .count {
    min-width: 1.5ch;
    padding: 0 2px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-align: center;
    transition: color 120ms ease;
}

.thread-actions .vote-group:has(.vote-up[aria-pressed="true"]) .count { color: var(--accent); }
.thread-actions .vote-group:has(.vote-down[aria-pressed="true"]) .count { color: var(--ink); }

.thread-actions .vote-down[aria-pressed="true"] {
    color: var(--ink);
    background: var(--surface-soft);
}

.thread-actions .vote-down[aria-pressed="true"] svg {
    fill: none;
    stroke: var(--ink);
}

.thread-actions .action.pulse svg {
    animation: votePulse 360ms cubic-bezier(0.2, 0.8, 0.2, 1.4);
}

@keyframes votePulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.28); }
    100% { transform: scale(1); }
}

.thread-actions .action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.thread-actions .save { margin-left: auto; padding: 0 9px; }
.thread-actions .action-form { display: inline-flex; margin: 0; }
.reply-card .action-form { margin-top: 10px; }
.reply-actions {
    margin-top: 10px;
    padding: 0;
    border-top: 0;
}
.reply-actions .post-menu {
    margin-left: auto;
}

/* ---------- Trending ---------- */

.live-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px 3px 8px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 0 var(--accent);
    animation: livePulse 1.8s ease-out infinite;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(232, 85, 63, 0.5); }
    100% { box-shadow: 0 0 0 8px rgba(232, 85, 63, 0); }
}

.hot-stack { display: grid; gap: 2px; }

.hot-item {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border-radius: var(--radius-tight);
    transition: background 120ms ease;
}

.hot-item:hover { background: var(--surface-soft); }

.hot-item small {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.hot-item strong {
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.35;
}

/* ---------- Join panel ---------- */

.join-panel h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    line-height: 1.25;
}

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

.join-actions .button {
    width: 100%;
}

/* ---------- Mobile bottom nav ---------- */

.mobile-bottom-nav { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .site-header {
        grid-template-columns: auto minmax(200px, 1fr) auto auto auto;
    }

    .nav-links { display: none; }

    .app-layout {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
        gap: 22px;
    }

    .left-rail {
        position: static;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    }

}

@media (max-width: 820px) {
    .site-header {
        grid-template-columns: auto 1fr auto auto auto;
        gap: 10px;
        height: 56px;
    }

    .search { display: none; }

    .app-layout, .left-rail {
        grid-template-columns: 1fr;
    }

    .create-room-layout {
        grid-template-columns: 1fr;
    }

    .app-layout {
        gap: 16px;
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .right-rail, .left-rail { position: static; }

    .feed-column { order: 1; }
    .right-rail { order: 2; }
    .left-rail { order: 3; }

    .feed-tabs { overflow-x: auto; scrollbar-width: none; }
    .feed-tabs::-webkit-scrollbar { display: none; }

    .mobile-bottom-nav {
        position: fixed;
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        left: 12px;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: center;
        height: 60px;
        padding: 0 6px;
        background: color-mix(in srgb, var(--surface) 90%, transparent);
        border: 1px solid var(--line);
        border-radius: var(--radius-pill);
        box-shadow: var(--shadow-pop);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .mobile-bottom-nav a {
        display: grid;
        place-items: center;
        gap: 2px;
        color: var(--muted);
        font-size: 0.65rem;
        font-weight: 500;
        transition: color 120ms ease;
    }

    .mobile-bottom-nav a:hover { color: var(--ink); }

    .mobile-bottom-nav svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .mobile-bottom-nav .active { color: var(--ink); }

    .mobile-nav-icon {
        position: relative;
        display: grid;
        place-items: center;
    }

    .mobile-notification-dot {
        position: absolute;
        top: -8px;
        right: -14px;
        border-color: var(--surface);
    }

    .mobile-bottom-nav .create {
        justify-self: center;
        align-self: center;
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        color: #fff;
        background: var(--accent);
        border-radius: var(--radius-pill);
        box-shadow: 0 6px 14px rgba(232, 85, 63, 0.35);
    }

    .mobile-bottom-nav .create svg { width: 22px; height: 22px; }
    .mobile-bottom-nav .create span { display: none; }

    .submit-toast {
        bottom: calc(88px + env(safe-area-inset-bottom, 0px));
        z-index: 50;
        width: min(420px, calc(100vw - 24px));
    }
}

@media (max-width: 560px) {
    .edit-image-dropzone {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .image-pick-button {
        justify-self: start;
    }

    .site-header {
        grid-template-columns: minmax(0, 1fr) auto auto auto;
        gap: 8px;
        padding: 0 12px;
    }

    .brand {
        min-width: 0;
        gap: 8px;
        font-size: 0.95rem;
    }

    .brand-word {
        display: inline-flex;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-action { padding: 0 14px; }
    .nav-account {
        width: 36px;
        padding: 0;
        justify-content: center;
    }
    .nav-account .avatar {
        width: 30px;
        height: 30px;
    }
    .nav-account-handle { display: none; }

    .app-layout { padding: 16px 12px 96px; }

    .panel { padding: 16px; }
    .thread-header { padding: 14px 14px 0; }
    .thread-card h2, .thread-card p, .read-more { margin-inline: 14px; }
    .thread-image-wrap {
        width: calc(100% - 28px);
        height: clamp(340px, 82vw, 460px);
        margin-inline: 14px;
    }
    .thread-actions { padding: 6px 8px; }
    .composer-destination-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

}

/* ---------- Narrow page layout (Cari / Ruang / Buat / Saya) ---------- */

.page-narrow {
    width: min(720px, 100%);
    margin: 0 auto;
    padding: 24px clamp(16px, 4vw, 32px) 64px;
    display: grid;
    gap: 16px;
}

.page-hero {
    padding: 8px 4px;
}

.page-hero.compact { padding-bottom: 0; }

.page-hero h1,
.search-hero h1,
.signin-hero h1 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    line-height: 1.18;
    letter-spacing: -0.02em;
    font-weight: 700;
}

.page-hero p,
.search-hero p,
.signin-hero p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.button.ghost {
    color: var(--ink);
    background: transparent;
    border: 1px solid var(--line-strong);
}

.button.ghost:hover { background: var(--surface-soft); }

.link-button {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0;
    color: var(--accent);
    background: transparent;
    border: 0;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
}

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

/* ---------- Search page ---------- */

.search-hero { padding: 8px 4px 0; }

.search-big {
    position: relative;
    display: flex;
    align-items: center;
    height: 52px;
    margin-bottom: 14px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-pill);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.search-big:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-big .search-icon {
    position: absolute;
    left: 18px;
    width: 18px;
    height: 18px;
    color: var(--muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.search-big input {
    flex: 1;
    height: 100%;
    padding: 0 48px 0 46px;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 0.98rem;
    color: var(--text);
}

.search-clear {
    position: absolute;
    right: 12px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: var(--radius-pill);
    font-size: 1rem;
}

.search-clear:hover { color: var(--ink); background: var(--surface-hover); }

.room-search {
    margin: -2px 0 6px;
}

/* ---------- Chip rows ---------- */

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 4px;
}

.chip-row.scroll-x {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -4px;
    padding-inline: 4px;
}

.chip-row.scroll-x::-webkit-scrollbar { display: none; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}

.chip:hover { color: var(--ink); background: var(--surface-hover); }

.chip.active {
    color: var(--surface);
    background: var(--ink);
    border-color: var(--ink);
}

.chip.ghost {
    background: transparent;
    border-color: var(--line-strong);
}

.chip-icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.recent-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ---------- Trending: ranked & strip ---------- */

.hot-item.ranked {
    grid-template-columns: 28px 1fr;
    align-items: start;
    gap: 10px;
}

.hot-item .rank {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-top: 2px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hot-item:hover .rank { color: var(--accent); background: var(--accent-soft); }

.hot-body { display: grid; gap: 2px; min-width: 0; }

.trending-strip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px 14px;
    overflow: hidden;
    min-width: 0;
}

.trending-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.trending-strip-head a {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}

.trending-strip-head a:hover { color: var(--ink); }

.trending-strip-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -14px;
    padding-inline: 14px;
    padding-bottom: 2px;
}

.trending-strip-scroll::-webkit-scrollbar { display: none; }

.trending-chip {
    flex: 0 0 auto;
    display: grid;
    gap: 4px;
    width: 220px;
    padding: 10px 12px;
    background: var(--surface-soft);
    border-radius: var(--radius-tight);
    transition: background 120ms ease, transform 120ms ease;
}

.trending-chip:hover { background: var(--surface-hover); transform: translateY(-1px); }

.trending-chip small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.trending-chip strong {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.32;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mobile-only { display: none; }

/* ---------- Rooms page ---------- */

.room-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.room-grid.wide {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.room-card-mini {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-soft);
    border-radius: var(--radius-tight);
    transition: background 120ms ease;
}

.room-card-mini:hover { background: var(--surface-hover); }

.room-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    transition: border-color 160ms ease, transform 160ms ease;
}

.room-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.room-card header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
}

.room-card h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.02rem;
    font-weight: 600;
    line-height: 1.2;
}

.room-card header small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.room-card p {
    margin: 0;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.5;
}

.room-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.avatar.large { width: 44px; height: 44px; font-size: 1rem; }
.avatar.xlarge { width: 64px; height: 64px; font-size: 1.6rem; }

.room-follow .follow-active { display: none; }
.room-follow[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.room-follow[aria-pressed="true"] .follow-default { display: none; }
.room-follow[aria-pressed="true"] .follow-active { display: inline; }

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

/* ---------- Compose form ---------- */

.compose-form {
    display: grid;
    gap: 16px;
    padding: 18px;
    position: relative;
}

.field { display: grid; gap: 6px; }

.field-label {
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.field input,
.field textarea,
.select-wrap select {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-tight);
    outline: 0;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.field input:focus,
.field textarea:focus,
.select-wrap select:focus {
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-hint {
    color: var(--muted);
    font-size: 0.78rem;
}

.select-wrap {
    position: relative;
}

.select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.select-wrap svg {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted);
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.compose-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.compose-foot .muted { color: var(--muted); font-size: 0.85rem; }

.compose-actions { display: flex; gap: 8px; }

.auth-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--accent-soft);
    border-radius: var(--radius-tight);
    color: var(--accent-ink);
    font-size: 0.88rem;
}

.auth-banner strong { color: var(--accent-ink); }
.auth-banner span { color: var(--text); flex: 1 1 220px; }
.auth-banner .button { background: var(--accent); color: #fff; }

/* ---------- Profile / signed-out ---------- */

.signin-hero {
    text-align: center;
    padding: 28px 22px;
}

.signin-hero .avatar.xlarge {
    margin: 0 auto 14px;
}

.signin-hero .eyebrow { justify-self: center; }

.account-summary {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 20px 18px;
}

.account-summary .avatar.xlarge {
    width: 76px;
    height: 76px;
    margin: 0;
    font-size: 1.85rem;
}

.account-summary-copy {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-width: 0;
}

.account-summary-copy .eyebrow {
    margin: 0;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.08em;
}

.account-summary-copy h1 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(1.45rem, 5vw, 1.85rem);
    line-height: 1.18;
}

.account-summary-copy p:not(.eyebrow) {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.account-summary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.account-summary-actions form {
    margin: 0;
}

.account-summary-actions .button {
    height: 38px;
    padding-inline: 16px;
    font-size: 0.9rem;
}

.signin-form {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin: 6px auto 8px;
}

.signin-form input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    outline: 0;
    font-size: 0.95rem;
    text-align: center;
    transition: background 120ms ease, border-color 120ms ease;
}

.signin-form input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
}

.signin-form .composer-field-label,
.signin-form .field-help {
    text-align: left;
}

.register-form {
    gap: 7px;
}

.register-form .composer-field-label {
    margin: 5px 4px -2px;
}

.register-form input {
    text-align: left;
}

.signin-form .field-help {
    margin: -2px 4px 2px;
}

.signin-form input:focus {
    background: var(--surface);
    border-color: var(--accent);
}

.signin-form .remember-me {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 32px;
    color: var(--muted);
    font-size: 0.84rem;
}

.signin-form .remember-me input {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    accent-color: var(--accent);
}

.signin-fineprint {
    margin: 0;
    color: var(--subtle);
    font-size: 0.8rem;
}

.signin-fineprint a {
    color: var(--accent);
    font-weight: 700;
}

.signin-fineprint a:hover {
    color: var(--accent-ink);
}

.feature-list,
.settings-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
}

.feature-list li {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    align-items: center;
    padding: 8px 4px;
}

.feature-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
}

.feature-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.feature-list strong,
.settings-list strong {
    display: block;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 600;
}

.feature-list small,
.settings-list small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.settings-list li {
    padding: 10px 4px;
    border-top: 1px solid var(--line);
}

.settings-list li:first-child { border-top: 0; }

.notification-list {
    gap: 0;
}

.notification-list li {
    padding: 0;
}

.notification-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 12px 4px;
    border-radius: var(--radius-tight);
}

.notification-row:hover {
    background: var(--surface-soft);
}

.notification-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: var(--radius-pill);
}

.notification-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-copy {
    min-width: 0;
}

.settings-list li.notification-unread strong::after {
    content: "Baru";
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
}

.notification-list li.notification-unread .notification-icon {
    color: var(--accent);
    background: var(--accent-soft);
}

.settings-panel {
    display: grid;
    gap: 14px;
}

.settings-form {
    display: grid;
    gap: 10px;
}

.settings-form input:not([type="checkbox"]):not([type="radio"]),
.settings-form select,
.settings-form textarea {
    width: 100%;
    border: 1px solid var(--border, rgba(0,0,0,0.1));
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    font-size: 16px;
    background: var(--surface, #fff);
    color: var(--ink);
}
.settings-form textarea {
    min-height: 112px;
    resize: vertical;
    line-height: 1.5;
}

.settings-form input:not([type="checkbox"]):not([type="radio"]):focus,
.settings-form select:focus,
.settings-form textarea:focus {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 1px;
    border-color: transparent;
}

.settings-form .button {
    justify-self: start;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.avatar-setting {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-setting small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
}

.reply-edit-form {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

/* ---------- Profile / Room hero (shared) ---------- */

.profile-hero {
    padding: 18px;
}

.profile-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.profile-hero h1 {
    margin: 0 0 4px;
    color: var(--ink);
    font-size: clamp(1.4rem, 3vw, 1.7rem);
    line-height: 1.2;
    letter-spacing: -0.015em;
    font-weight: 700;
}

.profile-hero .handle {
    display: block;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.profile-bio {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.5;
}

.profile-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}

.profile-stats strong {
    color: var(--ink);
    font-weight: 600;
}

.profile-stats .dot { color: var(--subtle); }

/* ---------- Profile AMA nudge ---------- */
.profile-ama-nudge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--ink);
    transition: border-color 140ms ease, transform 140ms ease;
}

.profile-ama-nudge:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    transform: translateY(-1px);
}

.profile-ama-nudge span:first-child {
    display: grid;
    gap: 3px;
}

.profile-ama-nudge strong {
    font-size: 1rem;
}

.profile-ama-nudge small {
    color: var(--muted);
    font-size: 0.92rem;
}

.profile-ama-nudge-action {
    flex: 0 0 auto;
    color: var(--accent);
    font-weight: 800;
}

/* ---------- Profile questions ---------- */
.question-composer-panel {
    display: grid;
    gap: 12px;
}

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

.question-card {
    display: grid;
    gap: 12px;
}

.question-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.question-meta .avatar.small {
    flex: 0 0 auto;
}

.question-meta a {
    color: var(--ink);
    font-weight: 700;
}

.question-handle {
    color: var(--muted);
}

.question-meta .dot {
    color: var(--subtle);
}

.question-body {
    margin: 0;
    color: var(--ink);
    font-size: 1.04rem;
    line-height: 1.58;
    overflow-wrap: anywhere;
}

.question-answer {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    background: var(--surface-alt, rgba(0,0,0,0.03));
    border-radius: 8px;
}

.question-answer strong {
    font-size: 0.9rem;
}

.question-answer p {
    margin: 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.question-answer-form {
    padding-top: 4px;
}

.question-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-action-form {
    display: inline-flex;
    justify-self: start;
}

.room-card h2 a:hover { color: var(--accent); }
.room-card header small { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

/* ---------- Empty / feed-end ---------- */

.empty-panel { text-align: center; }
.empty-panel h2 { margin: 0 0 8px; }
.empty-panel p { margin: 0; color: var(--muted); }

.feed-end {
    display: grid;
    place-items: center;
    padding: 28px 14px;
    color: var(--subtle);
    font-size: 0.85rem;
}

/* ---------- Active nav link in header ---------- */

.nav-links a.active {
    color: var(--ink);
    background: var(--surface-soft);
}

/* ---------- Mobile adjustments ---------- */

@media (max-width: 820px) {
    .mobile-only { display: block; }
    .right-rail .hot-panel { display: none; }
}

@media (max-width: 560px) {
    .page-narrow { padding: 16px 12px calc(110px + env(safe-area-inset-bottom, 0px)); }
    .compose-foot { flex-direction: column; align-items: stretch; }
    .compose-actions { justify-content: flex-end; }
    .room-grid.wide { grid-template-columns: 1fr; }
    .admin-metrics, .admin-grid { grid-template-columns: 1fr; }
    .admin-list-row { align-items: flex-start; flex-direction: column; }
    .admin-list-row small { text-align: left; }
}

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