:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-dark: #16181d;
    --text: #15171b;
    --muted: #6d7280;
    --border: #e5e8ef;
    --brand: #5b5cf0;
    --brand-dark: #4546d8;
    --danger: #e5484d;
    --success: #2e9f6b;
    --shadow: 0 24px 80px rgba(24, 29, 45, .12);
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

button, input {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

.site-header,
.meeting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 5vw;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    text-decoration: none;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.03em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(145deg, #7778ff, #4f50de);
    color: white;
    box-shadow: 0 9px 22px rgba(91, 92, 240, .28);
}

.free-badge {
    padding: 9px 13px;
    border: 1px solid #dfe2f3;
    border-radius: 999px;
    color: #565b6a;
    background: rgba(255,255,255,.72);
    font-size: 13px;
    font-weight: 700;
}

.landing-body {
    background:
        radial-gradient(circle at 12% 18%, rgba(120, 121, 255, .14), transparent 27%),
        radial-gradient(circle at 85% 82%, rgba(55, 192, 151, .12), transparent 29%),
        #f7f8fc;
}

.landing-main {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
    padding: 40px 5vw 70px;
}

.hero {
    width: min(1160px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    align-items: center;
    gap: clamp(48px, 8vw, 110px);
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .16em;
}

.hero h1 {
    max-width: 720px;
    margin: 0;
    font-size: clamp(48px, 7vw, 82px);
    line-height: .98;
    letter-spacing: -.065em;
}

.hero-text {
    max-width: 620px;
    margin: 28px 0 0;
    color: var(--muted);
    font-size: clamp(17px, 2vw, 20px);
    line-height: 1.65;
}

.feature-row {
    display: flex;
    flex-wrap: wrap;
    gap: 13px 22px;
    margin-top: 30px;
    color: #4d5260;
    font-size: 14px;
    font-weight: 700;
}

.entry-card {
    padding: 28px;
    border: 1px solid rgba(225, 228, 238, .9);
    border-radius: 28px;
    background: rgba(255,255,255,.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px;
    margin-bottom: 24px;
    border-radius: 14px;
    background: #f1f2f7;
}

.tab {
    border: 0;
    border-radius: 11px;
    padding: 11px 14px;
    color: #737887;
    background: transparent;
    cursor: pointer;
    font-weight: 800;
}

.tab.active {
    color: var(--text);
    background: white;
    box-shadow: 0 3px 12px rgba(28, 33, 45, .08);
}

.meeting-form {
    display: grid;
    gap: 18px;
}

.meeting-form label {
    display: grid;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
}

.optional {
    color: #a2a6b1;
    font-weight: 600;
}

.meeting-form input {
    width: 100%;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: 14px;
    outline: none;
    padding: 0 15px;
    background: #fcfcfd;
    transition: .2s ease;
}

.meeting-form input:focus {
    border-color: var(--brand);
    background: white;
    box-shadow: 0 0 0 4px rgba(91, 92, 240, .10);
}

.primary-button,
.secondary-button,
.ghost-button,
.code-button,
.control-button {
    border: 0;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, opacity .18s ease;
}

.primary-button {
    min-height: 52px;
    border-radius: 14px;
    padding: 0 20px;
    color: white;
    background: var(--brand);
    font-weight: 850;
    box-shadow: 0 12px 28px rgba(91, 92, 240, .25);
}

.primary-button:hover {
    background: var(--brand-dark);
    transform: translateY(-1px);
}

.primary-button:disabled {
    opacity: .6;
    cursor: wait;
}

.form-message {
    min-height: 20px;
    margin: 15px 0 0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
}

.site-footer {
    padding: 18px 5vw 30px;
    text-align: center;
    color: #989ca8;
    font-size: 13px;
}

/* Meeting room */
.meeting-body {
    height: 100vh;
    overflow: hidden;
    background: #101216;
    color: white;
}

.meeting-header {
    height: 74px;
    padding: 13px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: #15171b;
}

.meeting-brand {
    color: white;
}

.meeting-code-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8f95a2;
    font-size: 12px;
    font-weight: 700;
}

.code-button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 11px;
    color: white;
    background: rgba(255,255,255,.05);
}

.code-button span {
    color: #aeb3bf;
    font-size: 11px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #a8adb8;
    font-size: 12px;
    font-weight: 750;
}

.connection-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d4a72c;
}

.connection-status.online::before {
    background: #36b37e;
}

.ghost-button {
    min-height: 38px;
    padding: 0 15px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 11px;
    color: white;
    background: transparent;
    font-weight: 750;
}

.meeting-layout {
    height: calc(100vh - 74px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
}

.stage {
    position: relative;
    min-width: 0;
    padding: 18px 18px 104px;
    overflow: auto;
}

.video-grid {
    min-height: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    grid-auto-rows: minmax(240px, 1fr);
    gap: 12px;
    align-content: center;
}

.video-tile {
    position: relative;
    min-height: 240px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
    background: #1c1f25;
    box-shadow: 0 20px 50px rgba(0,0,0,.15);
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    background: #17191e;
}

.video-tile:not(.local-tile) video {
    transform: none;
}

.video-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 40% 30%, rgba(108,109,255,.22), transparent 36%),
        #1a1d22;
}

.video-tile.has-video .video-placeholder {
    display: none;
}

.avatar {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    color: white;
    background: linear-gradient(145deg, #6f70f8, #4748bd);
    font-size: 32px;
    font-weight: 850;
}

.tile-footer {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    background: rgba(12,14,18,.72);
    backdrop-filter: blur(12px);
    font-size: 12px;
    font-weight: 750;
}

.media-indicator {
    margin-left: auto;
    color: #aeb4c0;
    font-size: 10px;
}

.host-chip {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    color: #d9d9ff;
    background: rgba(105,106,255,.24);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.participants-panel {
    padding: 20px 14px;
    border-left: 1px solid rgba(255,255,255,.08);
    background: #15171b;
    overflow: auto;
}

.panel-heading {
    padding: 4px 7px 16px;
}

.panel-heading h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.03em;
}

.panel-heading h2 span {
    color: #858b98;
}

.participant-list {
    display: grid;
    gap: 5px;
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px;
    border-radius: 12px;
}

.participant-row:hover {
    background: rgba(255,255,255,.04);
}

.participant-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: white;
    background: #343842;
    font-size: 13px;
    font-weight: 850;
}

.participant-name {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 750;
}

.participant-name small {
    margin-left: 5px;
    color: #8f95a2;
    font-weight: 600;
}

.control-dock {
    position: fixed;
    left: calc(50% - 150px);
    bottom: 22px;
    z-index: 20;
    display: flex;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(25,28,34,.9);
    box-shadow: 0 20px 60px rgba(0,0,0,.38);
    backdrop-filter: blur(18px);
    transform: translateX(-50%);
}

.control-button {
    display: grid;
    place-items: center;
    gap: 3px;
    min-width: 68px;
    min-height: 58px;
    padding: 7px 10px;
    border-radius: 12px;
    color: #d6dae2;
    background: rgba(255,255,255,.06);
    font-size: 10px;
    font-weight: 750;
}

.control-button:hover {
    background: rgba(255,255,255,.11);
}

.control-button.active {
    color: white;
    background: rgba(91,92,240,.25);
}

.control-button.danger {
    color: #ffb7ba;
}

.control-button.danger.solid {
    color: white;
    background: var(--danger);
}

.control-icon {
    font-size: 18px;
}

.permission-panel {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 25;
    width: min(390px, calc(100vw - 44px));
    padding: 18px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 16px;
    background: #22252b;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.permission-panel h2 {
    margin: 0 0 8px;
    font-size: 16px;
}

.permission-panel p {
    margin: 0 0 14px;
    color: #a9afbb;
    font-size: 12px;
    line-height: 1.55;
}

.secondary-button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    color: white;
    background: var(--brand);
    font-weight: 800;
}

.toast {
    position: fixed;
    top: 88px;
    left: 50%;
    z-index: 60;
    max-width: calc(100vw - 30px);
    padding: 11px 15px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 11px;
    background: #292c33;
    color: white;
    box-shadow: 0 12px 36px rgba(0,0,0,.3);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -10px);
    transition: .2s ease;
    font-size: 12px;
    font-weight: 750;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(6,7,10,.78);
    backdrop-filter: blur(12px);
}

.modal-card {
    width: min(420px, 100%);
    padding: 34px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 24px;
    background: #1b1e24;
    text-align: center;
    box-shadow: 0 30px 90px rgba(0,0,0,.45);
}

.modal-card h2 {
    margin: 14px 0 8px;
    font-size: 28px;
}

.modal-card p {
    margin: 0 0 24px;
    color: #a9afba;
}

.ended-icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto;
    border-radius: 50%;
    color: white;
    background: var(--success);
    font-size: 25px;
    font-weight: 900;
}

.link-button {
    display: inline-grid;
    place-items: center;
    text-decoration: none;
    width: 100%;
}

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

    .hero-copy {
        text-align: center;
    }

    .hero-text {
        margin-left: auto;
        margin-right: auto;
    }

    .feature-row {
        justify-content: center;
    }

    .entry-card {
        width: min(520px, 100%);
        margin: 0 auto;
    }

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

    .participants-panel {
        display: none;
    }

    .control-dock {
        left: 50%;
    }
}

@media (max-width: 640px) {
    .site-header {
        padding: 16px;
    }

    .free-badge {
        display: none;
    }

    .landing-main {
        padding: 28px 16px 50px;
        align-items: start;
    }

    .hero {
        gap: 36px;
    }

    .hero h1 {
        font-size: 48px;
    }

    .entry-card {
        padding: 20px;
        border-radius: 22px;
    }

    .meeting-header {
        height: 66px;
        padding: 10px 12px;
    }

    .meeting-brand span:last-child,
    .meeting-code-wrap > span,
    .connection-status,
    .header-actions .ghost-button {
        display: none;
    }

    .meeting-layout {
        height: calc(100vh - 66px);
    }

    .stage {
        padding: 10px 10px 92px;
    }

    .video-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(210px, 1fr);
    }

    .video-tile {
        min-height: 210px;
        border-radius: 15px;
    }

    .control-dock {
        right: 8px;
        left: 8px;
        bottom: 8px;
        justify-content: center;
        padding: 6px;
        border-radius: 16px;
        transform: none;
    }

    .control-button {
        min-width: 0;
        flex: 1;
        min-height: 54px;
        padding: 6px 5px;
        font-size: 9px;
    }

    .control-icon {
        font-size: 16px;
    }

    .permission-panel {
        left: 10px;
        bottom: 82px;
        width: calc(100vw - 20px);
    }
}


.public-nav, .account-menu, .hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.nav-link, .secondary-link {
    color: #555b68;
    text-decoration: none;
    font-weight: 750;
}
.small-primary, .ghost-light {
    display: inline-grid;
    place-items: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 11px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}
.small-primary { color: white; background: var(--brand); }
.ghost-light { color: #525866; background: #f0f2f7; }
.hero-actions { margin-top: 32px; flex-wrap: wrap; }
.hero-button { width: auto; padding: 0 24px; }
.preview-card {
    padding: 18px;
    border: 1px solid rgba(225,228,238,.9);
    border-radius: 28px;
    background: #17191e;
    box-shadow: var(--shadow);
}
.preview-top {
    display: flex; align-items: center; gap: 9px;
    padding: 2px 3px 16px; color: #d9dde5; font-size: 12px; font-weight: 750;
}
.preview-dot { width: 8px; height: 8px; border-radius: 50%; background: #36b37e; }
.preview-live { margin-left: auto; color: #ffadb0; font-size: 10px; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.preview-person {
    position: relative; min-height: 180px; display: grid; place-items: center;
    border-radius: 17px; background: radial-gradient(circle at 35% 25%, #595bd2, #262936 68%);
}
.preview-person.alt { background: radial-gradient(circle at 35% 25%, #2c8e84, #252a31 68%); }
.preview-person.third { background: radial-gradient(circle at 35% 25%, #af6a49, #2d2828 68%); }
.preview-person.fourth { background: radial-gradient(circle at 35% 25%, #7f5aa5, #292631 68%); }
.preview-person span {
    display: grid; place-items: center; width: 64px; height: 64px;
    border-radius: 50%; color: white; background: rgba(255,255,255,.13);
    font-size: 24px; font-weight: 850;
}
.preview-person small {
    position: absolute; left: 10px; bottom: 10px; padding: 5px 8px;
    border-radius: 8px; color: white; background: rgba(0,0,0,.4); font-weight: 700;
}

.auth-body {
    min-height: 100vh;
    background:
      radial-gradient(circle at 10% 15%, rgba(120,121,255,.15), transparent 27%),
      radial-gradient(circle at 90% 85%, rgba(55,192,151,.12), transparent 29%),
      #f7f8fc;
}
.auth-shell { width: min(500px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 60px; }
.auth-brand { margin-bottom: 28px; }
.auth-card {
    padding: 34px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow);
}
.auth-card.compact { margin-top: 5vh; }
.auth-card h1 { margin: 0; font-size: 35px; letter-spacing: -.045em; }
.auth-subtitle { margin: 10px 0 25px; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 800; }
.auth-form input {
    width: 100%; height: 50px; padding: 0 14px;
    border: 1px solid var(--border); border-radius: 13px; outline: none; background: #fcfcfd;
}
.auth-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(91,92,240,.1); }
.alert-error {
    margin-bottom: 18px; padding: 12px 14px; border: 1px solid #ffd3d5;
    border-radius: 12px; color: #b4232a; background: #fff1f1; font-size: 13px; font-weight: 700;
}
.auth-switch { margin: 22px 0 0; text-align: center; color: var(--muted); font-size: 14px; }
.auth-switch a { color: var(--brand); font-weight: 800; text-decoration: none; }

.dashboard-body { background: #f5f7fb; }
.dashboard-header {
    height: 76px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 5vw; border-bottom: 1px solid var(--border); background: white;
}
.account-avatar {
    display: grid; place-items: center; width: 38px; height: 38px;
    border-radius: 50%; color: white; background: var(--brand); font-weight: 850;
}
.account-copy { display: grid; line-height: 1.15; }
.account-copy strong { font-size: 13px; }
.account-copy small { color: var(--muted); font-size: 11px; }
.dashboard-main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 80px; }
.dashboard-intro h1 { margin: 0; font-size: clamp(38px, 5vw, 57px); letter-spacing: -.055em; }
.dashboard-intro p:last-child { color: var(--muted); font-size: 17px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 34px; }
.dashboard-card {
    padding: 26px; border: 1px solid var(--border); border-radius: 22px;
    background: white; box-shadow: 0 14px 40px rgba(24,29,45,.06);
}
.dashboard-card h2 { margin: 15px 0 7px; font-size: 22px; }
.dashboard-card > p { min-height: 44px; margin: 0 0 21px; color: var(--muted); line-height: 1.5; }
.card-icon {
    display: grid; place-items: center; width: 46px; height: 46px;
    border-radius: 14px; color: white; background: var(--brand); font-size: 24px; font-weight: 500;
}
.card-icon.join { background: #1e9a71; }
.dashboard-message { margin: 14px 0 0; }
.recent-section { margin-top: 45px; }
.section-heading h2 { margin: 0 0 18px; font-size: 25px; letter-spacing: -.035em; }
.meeting-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: white; }
.meeting-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.meeting-table th, .meeting-table td { padding: 15px 18px; border-bottom: 1px solid #edf0f5; text-align: left; font-size: 13px; }
.meeting-table th { color: var(--muted); background: #fafbfc; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.meeting-table tbody tr:last-child td { border-bottom: 0; }
.meeting-table code { color: var(--brand-dark); font-weight: 800; }
.status-pill {
    display: inline-flex; padding: 5px 8px; border-radius: 999px;
    color: #656b78; background: #edf0f4; font-size: 10px; font-weight: 850; text-transform: uppercase;
}
.status-pill.active { color: #147551; background: #dff5eb; }
.empty-state {
    padding: 48px 20px; border: 1px dashed #d6dbe5; border-radius: 18px;
    text-align: center; color: var(--muted); background: rgba(255,255,255,.65);
}
.empty-state span { font-size: 33px; }
.empty-state h3 { margin: 10px 0 5px; color: var(--text); }

@media (max-width: 760px) {
    .action-grid { grid-template-columns: 1fr; }
    .account-copy { display: none; }
    .dashboard-header { padding: 0 16px; }
    .auth-card { padding: 24px; }
    .preview-grid { grid-template-columns: 1fr 1fr; }
    .preview-person { min-height: 135px; }
}
