﻿:root {
    --bg: #070b16;
    --bg-soft: #0c1222;
    --surface: #101827;
    --surface-strong: #141f33;
    --border: rgba(148, 163, 184, 0.18);
    --text: #f8fafc;
    --muted: #94a3b8;
    --subtle: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: rgba(37, 99, 235, 0.16);
    --success: #16a34a;
    --danger: #ef4444;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    --radius: 14px;
    --font: Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: var(--font);
    letter-spacing: 0;
    background:
        radial-gradient(circle at 18% 10%, rgba(37, 99, 235, 0.24), transparent 28rem),
        radial-gradient(circle at 86% 84%, rgba(20, 184, 166, 0.12), transparent 24rem),
        linear-gradient(180deg, #070b16 0%, #09101f 100%);
}

button,
input {
    font: inherit;
}

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

.home-shell,
.chat-shell {
    width: min(1160px, calc(100% - 28px));
    margin: 0 auto;
}

.home-hero {
    min-height: 100vh;
    padding: 28px 0 48px;
}

.home-nav,
.brand-lockup,
.feature-row,
.nav-badge,
.btn,
.room-code-row,
.online-heading,
.chat-header,
.chat-status,
.icon-button {
    display: flex;
    align-items: center;
}

.home-nav {
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 56px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-lockup {
    gap: 1px;
}

.brand-mark {
    display: inline-grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: #ffffff;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), #14b8a6);
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.28);
}

.brand-name,
.brand-kicker,
.eyebrow,
.form-message,
.action-panel h2,
.action-panel p,
.returning-user h2,
.returning-user p,
.hero-copy h1,
.hero-copy p {
    margin: 0;
}

.brand-name {
    font-size: 1rem;
    font-weight: 900;
}

.brand-kicker {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.nav-badge,
.eyebrow {
    color: #bfdbfe;
    font-weight: 850;
}

.nav-badge {
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.78fr) minmax(0, 0.92fr);
    gap: 42px;
    align-items: center;
}

.hero-copy h1 {
    max-width: 720px;
    margin-top: 18px;
    font-size: clamp(2.35rem, 5.2vw, 4.7rem);
    line-height: 0.98;
    font-weight: 900;
}

.hero-copy > p {
    max-width: 620px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

.feature-row {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.feature-row span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    color: #dbeafe;
    font-size: 0.88rem;
    font-weight: 800;
    background: rgba(16, 24, 39, 0.74);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.home-card,
.returning-user,
.action-panel,
.room-sidebar,
.chat-container,
.room-code-card,
.online-card {
    background: rgba(16, 24, 39, 0.82);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.home-card {
    position: relative;
    display: grid;
    gap: 18px;
    padding: 22px;
    border-radius: 22px;
}

.returning-user {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-radius: var(--radius);
}

.returning-user[hidden] {
    display: none;
}

.returning-user h2,
.action-panel h2 {
    margin-top: 6px;
    font-size: 1.16rem;
    font-weight: 900;
}

.returning-user p,
.action-panel p {
    margin-top: 7px;
    color: var(--muted);
    line-height: 1.55;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    color: #dbeafe;
    font-size: 0.84rem;
    font-weight: 850;
}

input {
    width: 100%;
    min-height: 50px;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(7, 11, 22, 0.76);
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: 0;
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

input::placeholder {
    color: var(--subtle);
}

input:focus {
    border-color: rgba(37, 99, 235, 0.72);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.action-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius);
}

.divider {
    height: 1px;
    background: var(--border);
}

.btn {
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    padding: 0 16px;
    color: #ffffff;
    font-weight: 900;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition:
        transform 180ms ease,
        box-shadow 180ms ease,
        background-color 180ms ease,
        opacity 180ms ease;
}

.btn:hover,
.icon-button:hover {
    transform: translateY(-1px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.btn-soft {
    flex: 0 0 auto;
    color: #bfdbfe;
    background: var(--primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.form-message {
    min-height: 20px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 750;
}

.form-message.error {
    color: #fecaca;
}

.form-message.success {
    color: #bbf7d0;
}

.flash-toast {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 50;
    max-width: min(380px, calc(100% - 28px));
    padding: 13px 15px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 850;
    background: rgba(16, 24, 39, 0.96);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 14px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition:
        opacity 180ms ease,
        transform 180ms ease;
}

.flash-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.flash-toast.success {
    border-left-color: var(--success);
}

.flash-toast.error {
    border-left-color: var(--danger);
}

.chat-shell {
    display: grid;
    grid-template-columns: 310px minmax(0, 1fr);
    gap: 18px;
    min-height: 100vh;
    padding: 18px 0;
}

.room-sidebar,
.chat-container {
    border-radius: 22px;
}

.room-sidebar {
    display: flex;
    min-height: calc(100vh - 36px);
    flex-direction: column;
    gap: 16px;
    padding: 18px;
}

.sidebar-brand {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.room-code-card,
.online-card {
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: none;
}

.room-code-row {
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}

.room-code-row strong {
    overflow-wrap: anywhere;
    font-size: 1.55rem;
    letter-spacing: 0.08em;
}

.icon-button {
    width: 42px;
    height: 42px;
    justify-content: center;
    color: #bfdbfe;
    background: var(--primary-soft);
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 180ms ease;
}

.room-code-card p:not(.eyebrow) {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
}

.online-heading {
    justify-content: space-between;
    gap: 12px;
}

#online-count {
    color: #bbf7d0;
    font-size: 0.82rem;
    font-weight: 900;
}

.online-users {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.online-users p {
    margin: 0;
    padding: 10px 12px;
    color: #dbeafe;
    font-size: 0.9rem;
    font-weight: 800;
    background: rgba(7, 11, 22, 0.48);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.chat-container {
    display: flex;
    min-height: calc(100vh - 36px);
    overflow: hidden;
    flex-direction: column;
}

.chat-header {
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.chat-header h1 {
    margin: 4px 0 0;
    font-size: 1.25rem;
    font-weight: 900;
}

.chat-status {
    gap: 8px;
    padding: 8px 10px;
    color: #bbf7d0;
    font-size: 0.82rem;
    font-weight: 900;
    background: rgba(22, 163, 74, 0.12);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: 999px;
}

.chat-status span {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 999px;
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.12);
}

.messages {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 20px;
    scrollbar-color: rgba(37, 99, 235, 0.5) rgba(15, 23, 42, 0.7);
    scrollbar-width: thin;
}

.empty-chat-state {
    display: grid;
    place-items: center;
    margin: auto;
    color: var(--muted);
    text-align: center;
}

.empty-chat-state.is-hidden {
    display: none;
}

.empty-chat-state i {
    display: inline-grid;
    width: 58px;
    height: 58px;
    place-items: center;
    color: #bfdbfe;
    font-size: 1.45rem;
    background: var(--primary-soft);
    border-radius: 18px;
}

.empty-chat-state h2 {
    margin: 14px 0 5px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
}

.empty-chat-state p {
    margin: 0;
}

.message {
    width: fit-content;
    max-width: min(72%, 560px);
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 16px;
    word-wrap: break-word;
}

.message strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.78rem;
    font-weight: 900;
}

.message p {
    margin: 0;
    line-height: 1.5;
}

.message small {
    display: block;
    margin-top: 6px;
    color: rgba(248, 250, 252, 0.62);
    font-size: 0.7rem;
    text-align: right;
}

.my-message {
    align-self: flex-end;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: rgba(96, 165, 250, 0.28);
    border-bottom-right-radius: 6px;
}

.other-message {
    align-self: flex-start;
    background: #111827;
    border-bottom-left-radius: 6px;
}

.system-message {
    align-self: center;
    max-width: 86%;
    padding: 8px 11px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.typing-indicator {
    min-height: 28px;
    padding: 0 20px;
    color: var(--muted);
    font-size: 0.84rem;
    font-style: italic;
}

.chat-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

#message-input {
    min-height: 52px;
}

.chat-form button {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 18px;
    color: #ffffff;
    font-weight: 900;
    background: var(--primary);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
}

@media (max-width: 900px) {
    .hero-grid,
    .chat-shell {
        grid-template-columns: 1fr;
    }

    .home-nav {
        margin-bottom: 36px;
    }

    .room-sidebar {
        min-height: auto;
    }

    .chat-container {
        min-height: 72vh;
    }
}

@media (max-width: 620px) {
    .home-shell,
    .chat-shell {
        width: min(100% - 18px, 1160px);
    }

    .home-hero {
        padding: 18px 0 30px;
    }

    .home-nav,
    .nav-actions,
    .returning-user,
    .chat-header {
        align-items: flex-start;
        flex-direction: column;
    }
    #install-app {
        width: 100%;
    }

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

    .home-card,
    .room-sidebar {
        padding: 16px;
        border-radius: 18px;
    }

    .feature-row span {
        width: 100%;
    }

    .chat-shell {
        padding: 9px 0;
    }

    .messages {
        padding: 14px;
    }

    .message {
        max-width: 88%;
    }

    .chat-form {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .chat-form button {
        width: 100%;
    }

    .flash-toast {
        top: 10px;
        right: 9px;
        left: 9px;
        max-width: none;
    }
}

