:root {
    color-scheme: light;
    --ink: #17202a;
    --text: #1d2630;
    --muted: #667382;
    --paper: #f5f7f4;
    --surface: #ffffff;
    --surface-soft: #eef3ef;
    --line: #dbe3df;
    --coral: #e85d4f;
    --green: #18a875;
    --blue: #1f6fb2;
    --yellow: #f4b942;
    --header: rgba(255, 255, 255, 0.88);
    --shadow: 0 18px 46px rgba(23, 32, 42, 0.09);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    color: var(--text);
    background: var(--paper);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.theme-switch {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.theme-switch:checked ~ .page-shell {
    color-scheme: dark;
    --ink: #f6f1e8;
    --text: #f4f0e8;
    --muted: #aeb7b5;
    --paper: #121714;
    --surface: #1b211d;
    --surface-soft: #252c27;
    --line: #354038;
    --coral: #ff7769;
    --green: #38c990;
    --blue: #75b7ff;
    --yellow: #ffd166;
    --header: rgba(18, 23, 20, 0.9);
    --shadow: 0 22px 54px rgba(0, 0, 0, 0.32);
}

.page-shell {
    min-height: 100vh;
    color: var(--text);
    background: var(--paper);
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto minmax(280px, 560px) auto auto auto;
    gap: 18px;
    align-items: center;
    min-height: 72px;
    padding: 12px clamp(16px, 3vw, 38px);
    background: var(--header);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 850;
    letter-spacing: 0;
}

.brand-mark,
.room-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    color: #ffffff;
    background: var(--ink);
    border-radius: 8px;
    font-weight: 850;
}

.room-avatar {
    color: var(--surface);
    background: var(--blue);
}

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

.search {
    display: grid;
    grid-template-columns: 1fr 42px;
    min-height: 46px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.search input {
    min-width: 0;
    padding: 0 16px;
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
    font-weight: 650;
}

.search button {
    display: grid;
    place-items: center;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.search svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

.nav-links a:hover,
.panel-heading a:hover {
    color: var(--text);
}

.theme-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 62px;
    height: 34px;
    padding: 3px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
}

.theme-toggle span {
    display: grid;
    height: 26px;
    place-items: center;
    color: color-mix(in srgb, var(--muted) 76%, var(--ink));
    border-radius: 6px;
    font-size: 0.92rem;
}

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

.theme-toggle .moon svg {
    fill: none;
}

.theme-switch:not(:checked) ~ .page-shell .sun,
.theme-switch:checked ~ .page-shell .moon {
    color: var(--surface);
    background: var(--ink);
}

.nav-action,
.button,
.waitlist button,
.composer button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    color: var(--surface);
    background: var(--ink);
    border: 0;
    border-radius: 8px;
    font-weight: 850;
    cursor: pointer;
}

.app-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(420px, 720px) minmax(260px, 360px);
    gap: 22px;
    align-items: start;
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 22px clamp(16px, 3vw, 38px) 56px;
}

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

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

.panel {
    padding: 18px;
}

.eyebrow {
    margin: 0 0 10px;
    color: var(--coral);
    font-size: 0.74rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.intro-panel h1 {
    margin-bottom: 12px;
    color: var(--ink);
    font-size: 2rem;
    line-height: 1.02;
    letter-spacing: 0;
}

.intro-panel p,
.join-panel p {
    color: var(--muted);
    line-height: 1.55;
    font-weight: 650;
}

.intro-panel .button {
    width: 100%;
    margin-top: 6px;
}

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

.panel-heading h2,
.join-panel h2 {
    margin: 0;
    color: var(--ink);
    font-size: 1.05rem;
    line-height: 1.2;
}

.panel-heading a,
.panel-heading span {
    color: var(--green);
    font-size: 0.82rem;
    font-weight: 850;
}

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

.room-link {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
    padding: 10px;
    background: var(--surface-soft);
    border-radius: 8px;
}

.room-link strong,
.room-link small {
    display: block;
}

.room-link strong {
    color: var(--ink);
    line-height: 1.25;
}

.room-link small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 680;
}

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

.composer {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 14px;
}

.composer button {
    justify-content: flex-start;
    color: var(--muted);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    font-weight: 720;
}

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

.feed-tabs a {
    display: inline-flex;
    justify-content: center;
    min-width: 104px;
    padding: 10px 14px;
    color: var(--muted);
    border-radius: 6px;
    font-weight: 850;
}

.feed-tabs .active {
    color: var(--surface);
    background: var(--ink);
}

.thread-card {
    padding: 0;
    overflow: hidden;
}

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

.thread-header strong,
.thread-header small {
    display: block;
}

.thread-header strong {
    color: var(--ink);
}

.thread-header small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 650;
}

.thread-header button,
.thread-actions button {
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-weight: 850;
}

.thread-card h2 {
    margin: 18px 20px 10px;
    color: var(--ink);
    font-size: clamp(1.2rem, 2vw, 1.55rem);
    line-height: 1.24;
    letter-spacing: 0;
}

.thread-card p {
    margin: 0 20px 18px;
    color: var(--text);
    line-height: 1.52;
    font-weight: 570;
}

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

.thread-actions a,
.thread-actions button {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    color: var(--muted);
    background: var(--surface);
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 820;
}

.thread-actions a {
    color: var(--blue);
}

.thread-actions button:last-child {
    margin-left: auto;
}

.hot-panel {
    padding-bottom: 10px;
}

.hot-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.hot-item span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--surface);
    background: var(--coral);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 850;
}

.hot-item strong {
    color: var(--ink);
    font-size: 0.96rem;
    line-height: 1.3;
}

.visual-panel {
    position: relative;
    overflow: hidden;
    min-height: 220px;
}

.visual-panel img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.visual-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(18, 23, 20, 0.04), rgba(18, 23, 20, 0.7));
}

.visual-panel div {
    position: absolute;
    inset: auto 16px 16px;
    z-index: 1;
    color: #ffffff;
}

.visual-panel h2 {
    max-width: 280px;
    margin: 0;
    font-size: 1.24rem;
    line-height: 1.22;
    letter-spacing: 0;
}

.join-panel p {
    margin-bottom: 14px;
}

.waitlist {
    display: grid;
    gap: 10px;
}

.waitlist input {
    min-width: 0;
    min-height: 44px;
    padding: 0 13px;
    color: var(--text);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: 0;
    font-weight: 680;
}

.waitlist button {
    width: 100%;
    background: var(--coral);
}

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

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

    .nav-links {
        display: none;
    }

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

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

    .intro-panel h1 {
        max-width: 680px;
    }
}

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

    .search {
        grid-column: 1 / -1;
        grid-row: 2;
    }

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

    .app-layout {
        padding-bottom: 112px;
    }

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

    .feed-column {
        order: 1;
    }

    .right-rail {
        order: 2;
    }

    .left-rail {
        order: 3;
    }

    .feed-tabs {
        overflow-x: auto;
    }

    .feed-tabs a {
        min-width: 96px;
    }

    .mobile-bottom-nav {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 30;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
        min-height: 66px;
        padding: 7px;
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
        backdrop-filter: blur(18px);
    }

    .mobile-bottom-nav a {
        display: grid;
        place-items: center;
        gap: 3px;
        min-width: 0;
        color: var(--muted);
        border-radius: 8px;
        font-size: 0.7rem;
        font-weight: 800;
    }

    .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);
        background: var(--surface-soft);
    }

    .mobile-bottom-nav .create {
        color: var(--surface);
        background: var(--ink);
    }

    .mobile-bottom-nav .create svg {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 560px) {
    .site-header {
        min-height: 64px;
        padding: 10px 12px;
    }

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

    .nav-action {
        min-height: 38px;
        padding-inline: 12px;
    }

    .theme-toggle {
        width: 58px;
    }

    .app-layout {
        gap: 14px;
        padding: 14px 12px 42px;
    }

    .panel,
    .thread-header {
        padding-inline: 14px;
    }

    .intro-panel h1 {
        font-size: 1.8rem;
    }

    .thread-card h2,
    .thread-card p {
        margin-inline: 14px;
    }

    .thread-actions {
        overflow-x: auto;
    }
}
