* {
    box-sizing: border-box;
}

:root {
    --background: #090909;
    --panel: #141414;
    --panel-raised: #191919;
    --panel-soft: #1e1e1e;
    --text: #f7f7f7;
    --muted: #a9a9a9;
    --accent: #ff9500;
    --accent-hover: #ffad33;
    --accent-soft: rgba(255, 149, 0, 0.12);
    --border: #2c2c2c;
    --border-light: #3b3b3b;
    --danger: #e05252;
    --success: #75ce89;
    --radius: 14px;
    --shadow: 0 14px 38px rgba(0, 0, 0, 0.28);
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
            radial-gradient(circle at 50% -20%, rgba(255, 149, 0, 0.10), transparent 32rem),
            var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

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

a:hover {
    color: var(--accent-hover);
}

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

h1, h2, h3 {
    line-height: 1.18;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.35rem);
    margin-bottom: 10px;
}

h2 {
    font-size: 1.35rem;
    margin-bottom: 14px;
}

h3 {
    font-size: 1.08rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(9, 9, 9, 0.90);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 66px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 850;
    letter-spacing: -0.02em;
}

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

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #111;
    font-weight: 950;
    box-shadow: 0 0 24px rgba(255, 149, 0, 0.22);
}

.main-nav,
.account-nav,
.owner-actions,
.vote-strip,
.form-button-row,
.section-heading-row,
.thread-action-bar,
.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-nav {
    gap: 18px;
}

.nav-link {
    color: #d8d8d8;
    font-weight: 650;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: var(--panel);
    font-weight: 700;
}

.profile-chip-dot {
    width: 27px;
    height: 27px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
}

.nav-button,
.text-action {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 7px 4px;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
}

.nav-button:hover,
.text-action:hover {
    color: var(--text);
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 36px auto 72px;
}

.thread-page-shell,
.profile-page-shell {
    max-width: 980px;
}

.hero-panel {
    min-height: 220px;
    margin-bottom: 34px;
    padding: clamp(28px, 5vw, 54px);
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    background:
            linear-gradient(115deg, rgba(255, 149, 0, 0.10), transparent 48%),
            linear-gradient(180deg, #171717, #111);
    box-shadow: var(--shadow);
}

.hero-copy {
    max-width: 650px;
    margin-bottom: 0;
    color: #c8c8c8;
    font-size: 1.05rem;
}

.eyebrow {
    margin-bottom: 7px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.14em;
}

.forum-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 28px;
    align-items: start;
}

.forum-main,
.forum-sidebar {
    min-width: 0;
}

.forum-sidebar {
    position: sticky;
    top: 92px;
}

.card {
    margin-bottom: 18px;
    padding: 22px;
    background: linear-gradient(180deg, var(--panel-raised), var(--panel));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.18);
}

.sidebar-card {
    padding: 20px;
}

.create-card {
    border-color: rgba(255, 149, 0, 0.30);
}

.section-heading-row {
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-heading-row h2,
.section-heading-row p {
    margin-bottom: 0;
}

.result-count,
.heading-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 750;
}

.thread-card {
    transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}

.thread-card:hover {
    border-color: #404040;
    background: #181818;
    transform: translateY(-1px);
}

.thread-card-top,
.reply-layout {
    display: flex;
    align-items: flex-start;
    gap: 13px;
}

.thread-card-copy,
.reply-content {
    flex: 1;
    min-width: 0;
}

.thread-title {
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.thread-title a,
.mini-thread-card h3 a {
    color: var(--text);
}

.thread-title a:hover,
.mini-thread-card h3 a:hover {
    color: var(--accent);
}

.byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    color: var(--muted);
    font-size: 0.82rem;
}

.byline a {
    font-weight: 700;
}

.message-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.thread-preview {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 17px 0 18px 65px;
    color: #d9d9d9;
}

.thread-footer,
.thread-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    border-top: 1px solid #242424;
}

.icon-button,
.stat-pill {
    min-height: 34px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
    color: #cfcfcf;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 750;
}

.icon-button {
    cursor: pointer;
}

.icon-button:hover,
.icon-button.active-vote {
    border-color: rgba(255, 149, 0, 0.55);
    background: var(--accent-soft);
    color: var(--accent);
}

.reply-pill:hover {
    color: var(--text);
    border-color: var(--border-light);
}

.read-thread,
.login-to-vote,
.text-action {
    font-size: 0.86rem;
    font-weight: 750;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.compact-form {
    gap: 9px;
}

label {
    color: #d8d8d8;
    font-size: 0.86rem;
    font-weight: 750;
}

input,
textarea,
button,
.button-link {
    font: inherit;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    padding: 11px 12px;
    color: var(--text);
    background: #0d0d0d;
    border: 1px solid #383838;
    border-radius: 9px;
}

input[type="file"] {
    padding: 9px;
    color: var(--muted);
}

textarea {
    min-height: 125px;
    resize: vertical;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

button:not(.nav-button):not(.text-action):not(.icon-button),
.button-link {
    width: fit-content;
    min-height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid var(--accent);
    border-radius: 9px;
    background: var(--accent);
    color: #111;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
}

button:not(.nav-button):not(.text-action):not(.icon-button):hover,
.button-link:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    color: #111;
}

.secondary-button {
    border-color: var(--border-light) !important;
    background: var(--panel-soft) !important;
    color: var(--text) !important;
}

.secondary-button:hover {
    background: #292929 !important;
}

.danger-button {
    border-color: rgba(224, 82, 82, 0.55) !important;
    background: rgba(224, 82, 82, 0.12) !important;
    color: #ff8c8c !important;
}

.danger-button:hover {
    background: rgba(224, 82, 82, 0.22) !important;
}

.small-button {
    min-height: 34px !important;
    padding: 6px 11px !important;
    font-size: 0.84rem !important;
}

.full-button {
    width: 100% !important;
}

.form-button-row {
    flex-wrap: wrap;
}

.end-row {
    justify-content: flex-end;
}

.inline-form {
    margin: 0;
}

.search-status {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

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

.stats-grid div,
.profile-stats div {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: #101010;
    border: 1px solid #262626;
    border-radius: 9px;
}

.stats-grid strong,
.profile-stats strong {
    color: var(--accent);
    font-size: 1.2rem;
}

.stats-grid span,
.profile-stats span {
    color: var(--muted);
    font-size: 0.72rem;
}

.stack-actions {
    display: grid;
    gap: 9px;
}

.empty-state {
    text-align: center;
    padding: 42px 24px;
}

.compact-empty {
    padding: 24px;
}

.empty-icon {
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.small-avatar,
.small-default-avatar,
.medium-avatar,
.medium-default-avatar,
.profile-avatar,
.default-avatar {
    border-radius: 50%;
    border: 2px solid rgba(255, 149, 0, 0.75);
    background: var(--panel-soft);
}

.small-avatar,
.small-default-avatar {
    width: 48px;
    height: 48px;
}

.medium-avatar,
.medium-default-avatar {
    width: 60px;
    height: 60px;
}

.small-avatar,
.medium-avatar,
.profile-avatar {
    object-fit: cover;
}

.small-default-avatar,
.medium-default-avatar,
.default-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-weight: 900;
}

.profile-avatar,
.default-avatar {
    width: 132px;
    height: 132px;
    border-width: 3px;
}

.default-avatar {
    font-size: 3rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

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

.main-thread-card {
    padding: clamp(22px, 4vw, 32px);
}

.main-thread-card h1 {
    margin-bottom: 7px;
    font-size: clamp(1.8rem, 4vw, 2.65rem);
}

.thread-body {
    margin: 28px 0;
    color: #e3e3e3;
    font-size: 1.02rem;
}

.thread-action-bar {
    flex-wrap: wrap;
}

.replies-heading {
    margin: 32px 0 14px;
}

.replies-heading h2,
.replies-heading p {
    margin-bottom: 0;
}

.reply-card {
    padding: 18px 20px;
}

.reply-header {
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.reply-message {
    margin: 10px 0 0;
    color: #dedede;
}

.danger-text {
    color: #dd7777;
}

.reply-form-card {
    margin-top: 28px;
}

.horizontal-prompt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.horizontal-prompt p {
    margin-bottom: 0;
}

.profile-hero-card {
    padding: clamp(24px, 5vw, 38px);
}

.profile-heading {
    display: flex;
    align-items: center;
    gap: 28px;
}

.profile-summary h1 {
    margin-bottom: 5px;
}

.profile-stats {
    grid-template-columns: repeat(2, minmax(90px, 120px));
    margin-top: 16px;
}

.profile-about {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.profile-about p:last-child {
    margin-bottom: 0;
}

.profile-edit-grid,
.profile-content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.edit-panel {
    padding: 18px;
    background: #101010;
    border: 1px solid #282828;
    border-radius: 11px;
}

.edit-panel h3,
.edit-panel p {
    margin-bottom: 4px;
}

.profile-content-grid {
    margin-top: 32px;
    gap: 28px;
}

.mini-thread-card,
.mini-reply-card {
    padding: 18px;
}

.mini-thread-card .thread-preview,
.mini-reply-card .thread-preview {
    margin: 12px 0;
    -webkit-line-clamp: 3;
}

.reply-target {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-page {
    width: min(480px, calc(100% - 28px));
    margin: 60px auto;
}

.auth-card {
    padding: clamp(24px, 6vw, 36px);
}

.auth-heading {
    margin-bottom: 24px;
    text-align: center;
}

.auth-heading h1 {
    font-size: 2.1rem;
}

.auth-mark {
    margin-bottom: 18px;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
}

.alert {
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 0.9rem;
}

.error-message {
    color: #ff9696;
    background: rgba(224, 82, 82, 0.09);
    border: 1px solid rgba(224, 82, 82, 0.25);
}

.success-message {
    color: var(--success);
    background: rgba(117, 206, 137, 0.08);
    border: 1px solid rgba(117, 206, 137, 0.22);
}

.muted,
small {
    color: var(--muted);
}

.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;
}

@media (max-width: 900px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }

    .forum-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .forum-sidebar .card {
        margin-bottom: 0;
    }

    .stats-card {
        grid-column: 1 / -1;
    }

    .profile-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .header-inner {
        width: min(100% - 22px, 1180px);
        min-height: auto;
        padding: 10px 0;
        align-items: flex-start;
    }

    .brand span:last-child {
        display: none;
    }

    .main-nav {
        gap: 9px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .main-nav > .nav-link:first-child {
        display: none;
    }

    .account-nav {
        gap: 7px;
    }

    .profile-chip {
        padding-right: 7px;
    }

    .profile-chip span:last-child {
        max-width: 95px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .page-shell {
        width: min(100% - 22px, 1180px);
        margin-top: 22px;
    }

    .hero-panel {
        min-height: 0;
        padding: 26px 22px;
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-panel h1 {
        font-size: 2.3rem;
    }

    .forum-sidebar {
        grid-template-columns: 1fr;
    }

    .stats-card {
        grid-column: auto;
    }

    .card {
        padding: 17px;
        border-radius: 12px;
    }

    .thread-preview {
        margin-left: 0;
    }

    .thread-footer,
    .thread-action-bar,
    .horizontal-prompt {
        align-items: flex-start;
        flex-direction: column;
    }

    .read-thread {
        align-self: flex-end;
    }

    .profile-heading {
        align-items: flex-start;
        gap: 18px;
    }

    .profile-avatar,
    .default-avatar {
        width: 92px;
        height: 92px;
    }

    .default-avatar {
        font-size: 2.25rem;
    }

    .profile-edit-grid {
        grid-template-columns: 1fr;
    }

    .reply-layout {
        gap: 10px;
    }

    .reply-header {
        flex-direction: column;
    }
}

@media (max-width: 460px) {
    .profile-heading {
        flex-direction: column;
    }

    .thread-card-top .small-avatar,
    .thread-card-top .small-default-avatar {
        width: 42px;
        height: 42px;
    }

    .vote-strip {
        gap: 6px;
        flex-wrap: wrap;
    }

    .section-heading-row {
        align-items: flex-start;
    }
}

.narrow-shell {
    max-width: 680px;
}

/* =========================================================
   SMARTPHONE OPTIMIZATION
   Keeps the desktop design intact while improving phones.
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

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

.thread-title,
.thread-title a,
.main-thread-card h1,
.profile-summary h1,
.byline,
.reply-target,
.message-text {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Prevent iOS Safari from zooming when a form field receives focus. */
@media (max-width: 680px) {
    input[type="text"],
    input[type="password"],
    input[type="file"],
    textarea,
    select {
        font-size: 16px;
    }

    body {
        line-height: 1.48;
        -webkit-text-size-adjust: 100%;
    }

    .site-header {
        position: sticky;
        top: 0;
    }

    .header-inner {
        width: 100%;
        padding: 9px 12px;
        gap: 8px;
        align-items: center;
    }

    .brand {
        flex: 0 0 auto;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .main-nav {
        min-width: 0;
        flex: 1;
        justify-content: flex-end;
        gap: 6px;
    }

    .account-nav {
        min-width: 0;
        gap: 5px;
    }

    .profile-chip {
        min-height: 44px;
        max-width: 145px;
        padding: 6px 8px;
    }

    .profile-chip-dot {
        flex: 0 0 28px;
    }

    .nav-button,
    .nav-link,
    .text-action {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px 7px;
    }

    .page-shell,
    .thread-page-shell,
    .profile-page-shell,
    .narrow-shell {
        width: 100%;
        max-width: none;
        margin: 18px auto 48px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .hero-panel {
        margin-bottom: 22px;
        padding: 22px 18px;
        border-radius: 14px;
        gap: 18px;
    }

    .hero-panel h1 {
        font-size: clamp(2rem, 10vw, 2.5rem);
    }

    .hero-copy {
        font-size: 0.98rem;
    }

    .hero-button {
        width: 100%;
        min-height: 46px;
    }

    .section-heading-row {
        gap: 10px;
        flex-wrap: wrap;
    }

    .section-heading-row h2 {
        font-size: 1.2rem;
    }

    .card,
    .main-thread-card,
    .profile-hero-card,
    .auth-card {
        padding: 16px;
        margin-bottom: 14px;
        border-radius: 12px;
    }

    .thread-card-top {
        gap: 10px;
    }

    .small-avatar,
    .small-default-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }

    .medium-avatar,
    .medium-default-avatar {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
    }

    .thread-title {
        font-size: 1.08rem;
        line-height: 1.25;
    }

    .byline {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .thread-preview {
        margin: 14px 0;
        -webkit-line-clamp: 5;
    }

    .thread-footer {
        width: 100%;
        gap: 10px;
        padding-top: 12px;
    }

    .vote-strip,
    .owner-actions,
    .form-button-row {
        width: 100%;
        flex-wrap: wrap;
    }

    .icon-button,
    .stat-pill {
        min-height: 44px;
        padding: 8px 11px;
    }

    button:not(.nav-button):not(.text-action):not(.icon-button),
    .button-link {
        min-height: 44px;
        padding: 10px 15px;
    }

    .thread-action-bar .owner-actions > *,
    .horizontal-prompt .form-button-row > *,
    .owner-actions > .button-link,
    .owner-actions > form {
        flex: 1 1 auto;
    }

    .owner-actions > form button,
    .horizontal-prompt .button-link {
        width: 100%;
    }

    input[type="text"],
    input[type="password"],
    input[type="file"],
    textarea {
        min-height: 46px;
        padding: 12px;
        border-radius: 10px;
    }

    textarea {
        min-height: 140px;
    }

    .forum-sidebar {
        gap: 14px;
    }

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

    .stats-grid div {
        padding: 10px 4px;
    }

    .profile-heading {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .profile-avatar,
    .default-avatar {
        width: 96px;
        height: 96px;
    }

    .profile-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .profile-summary {
        width: 100%;
    }

    .profile-about {
        margin-top: 20px;
        padding-top: 18px;
    }

    .profile-edit-grid,
    .profile-content-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .edit-panel {
        padding: 14px;
    }

    .reply-layout {
        align-items: flex-start;
    }

    .reply-header {
        width: 100%;
        gap: 6px;
    }

    .reply-header .owner-actions {
        width: auto;
    }

    .reply-message {
        margin-top: 8px;
    }

    .horizontal-prompt {
        gap: 14px;
    }

    .auth-page {
        width: 100%;
        padding: 18px 12px 40px;
    }

    .auth-card {
        width: 100%;
        max-width: 100%;
    }

    .auth-heading h1 {
        font-size: 1.85rem;
    }

    .auth-footer {
        flex-wrap: wrap;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .header-inner {
        flex-wrap: wrap;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }

    .brand span:last-child {
        display: inline;
    }

    .main-nav {
        width: 100%;
        flex-basis: 100%;
        justify-content: center;
    }

    .account-nav {
        max-width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .profile-chip {
        max-width: 180px;
    }

    .hero-panel h1 {
        font-size: 2rem;
    }

    .thread-card-top .avatar-link,
    .reply-layout > .avatar-link {
        flex: 0 0 auto;
    }

    .vote-strip {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vote-strip .inline-form,
    .vote-strip .icon-button,
    .vote-strip .stat-pill {
        width: 100%;
    }

    .vote-strip .login-to-vote {
        grid-column: 1 / -1;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

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

    .stats-grid div {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 12px;
    }

    .profile-stats {
        gap: 6px;
    }

    .empty-state {
        padding: 28px 16px;
    }
}

/* Respect device safe areas on iPhones with notches/home indicators. */
@supports (padding: max(0px)) {
    @media (max-width: 680px) {
        .header-inner {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }

        .page-shell,
        .thread-page-shell,
        .profile-page-shell,
        .narrow-shell,
        .auth-page {
            padding-left: max(12px, env(safe-area-inset-left));
            padding-right: max(12px, env(safe-area-inset-right));
        }

        body {
            padding-bottom: env(safe-area-inset-bottom);
        }
    }
}

/* =========================
   ADMIN CONTROLS
   ========================= */
.admin-nav-link {
    color: #ff9d2f;
    font-weight: 800;
}

.role-badge,
.you-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
}

.admin-badge {
    color: #111;
    background: #ff9d2f;
}

.user-badge {
    color: #d9d9d9;
    background: #343434;
}

.active-badge {
    color: #d9ffe3;
    background: #1f6131;
}

.banned-badge {
    color: #ffe7e7;
    background: #8f2525;
}

.you-label {
    margin-left: 6px;
    color: #ffbd6a;
    border: 1px solid rgba(255, 157, 47, 0.45);
}

.profile-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-name-row h1 {
    margin: 0;
}

.admin-profile-shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.admin-page-shell {
    max-width: 1220px;
}

.admin-hero {
    margin-bottom: 20px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.admin-stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 18px;
}

.admin-stat-card span {
    color: #aaa;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.admin-stat-card strong {
    font-size: 1.7rem;
}

.admin-section {
    margin-bottom: 20px;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.09);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    color: #aaa;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.admin-user-link {
    font-weight: 800;
}

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

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

.admin-thread-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.09);
}

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

.admin-thread-copy {
    min-width: 0;
    flex: 1;
}

.admin-thread-copy h3 {
    margin: 0 0 6px;
}

.admin-thread-actions {
    flex: 0 0 auto;
}

.notice {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 700;
}

.success-notice {
    background: rgba(36, 135, 68, 0.18);
    border: 1px solid rgba(71, 207, 111, 0.42);
}

.error-notice {
    background: rgba(166, 43, 43, 0.18);
    border: 1px solid rgba(233, 74, 74, 0.45);
}

@media (max-width: 900px) {
    .admin-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .admin-profile-shortcut,
    .admin-thread-row {
        flex-direction: column;
        align-items: stretch;
    }

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

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tr {
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.13);
    }

    .admin-table td {
        display: grid;
        grid-template-columns: 90px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 7px 0;
        border-bottom: 0;
    }

    .admin-table td::before {
        content: attr(data-label);
        color: #999;
        font-size: 0.72rem;
        font-weight: 800;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    .admin-actions,
    .admin-thread-actions {
        width: 100%;
    }

    .admin-actions .inline-form,
    .admin-actions button,
    .admin-thread-actions .button-link,
    .admin-thread-actions .inline-form,
    .admin-thread-actions button {
        width: 100%;
    }
}

/* =========================
   CONTENT REPORTING
   ========================= */
.thread-link-actions,
.content-actions,
.reply-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.report-button,
.report-link,
.report-text {
    color: #ffb15a;
}

.report-button {
    border: 1px solid rgba(255, 157, 47, 0.34);
    background: rgba(255, 157, 47, 0.06);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.report-button:hover,
.report-button:focus-visible,
.report-link:hover,
.report-text:hover {
    color: #ffd19b;
    border-color: rgba(255, 157, 47, 0.7);
}

.report-link {
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
}

.report-text {
    font-weight: 700;
}

.report-stat-card {
    border-color: rgba(255, 157, 47, 0.35);
}

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

.report-message {
    padding: 16px;
    border: 1px solid rgba(255, 157, 47, 0.28);
    border-left: 4px solid #ff9d2f;
    border-radius: 12px;
    background: rgba(255, 157, 47, 0.045);
}

.report-message.resolved-report {
    opacity: 0.68;
    border-left-color: #4da96b;
    border-color: rgba(77, 169, 107, 0.25);
}

.report-message-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.report-message h3 {
    margin: 7px 0 5px;
}

.report-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.report-type-badge {
    color: #111;
    background: #ff9d2f;
}

.report-snapshot {
    margin: 14px 0 8px;
    padding: 12px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.22);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.report-link-preview {
    margin: 0 0 12px;
    color: #9e9e9e;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

@media (min-width: 901px) {
    .admin-stats-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .thread-link-actions,
    .content-actions,
    .reply-actions,
    .report-message-top {
        align-items: stretch;
    }

    .thread-link-actions,
    .content-actions,
    .report-message-top {
        flex-direction: column;
    }

    .thread-link-actions .inline-form,
    .thread-link-actions .report-button,
    .thread-link-actions .report-link,
    .thread-link-actions .read-thread,
    .content-actions > .inline-form,
    .content-actions > .inline-form .report-button,
    .content-actions > .report-link,
    .report-message-top > .button-link {
        width: 100%;
    }

    .report-button,
    .report-link,
    .read-thread {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .reply-actions {
        justify-content: flex-start;
    }
}
