/* =====================
   RESET & BASE
===================== */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    background: #0f0f0f;
    color: #ffffff;
}

body.room {
    height: 100vh;
    overflow: hidden;
}

body.home,
body.home-landing {
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* =====================
   GLOBAL BACKGROUND
===================== */
.page-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, #1f2a44, transparent 40%),
        radial-gradient(circle at 80% 30%, #2c1f44, transparent 40%),
        radial-gradient(circle at 50% 80%, #1f4433, transparent 40%),
        #0f0f0f;
    z-index: -1;
    filter: blur(40px);
    opacity: 0.5;
    pointer-events: none;
}

/* =====================
   SCROLLBAR
===================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #2f3542;
    border-radius: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* =====================
   HOME PAGE
===================== */
.home {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.card {
    background: #1c1c1c;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    width: 320px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card h1 {
    margin: 0 0 8px;
}

.card p {
    opacity: 0.7;
    margin-bottom: 20px;
}

.card button {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: #2f3542;
    color: white;
    font-size: 14px;
    transition: background 0.2s;
}

.card button:hover {
    background: #3d4455;
}

.join {
    margin-top: 18px;
}

.join input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    margin-bottom: 8px;
    outline: none;
    background: #0f0f0f;
    color: white;
}

/* =====================
   TOP BAR
===================== */
.topbar {
    height: 52px;
    min-height: 52px;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid #222;
}

.topbar-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    font-size: 22px;
}

.brand {
    font-weight: 600;
    line-height: 1;
}

.brand-subtitle {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 2px;
}

.room-pill {
    background: #1f1f1f;
    padding: 6px 10px;
    border-radius: 999px;
    display: flex;
    gap: 6px;
    font-size: 12px;
    align-items: center;
    max-width: 220px;
}

.room-pill-label {
    opacity: 0.6;
    white-space: nowrap;
}

.room-id {
    opacity: 0.85;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#copyLinkBtn,
.icon-btn {
    border: none;
    background: #2f3542;
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#copyLinkBtn:hover,
.icon-btn:hover {
    background: #3d4455;
    transform: translateY(-1px);
}

/* =====================
   LAYOUT
===================== */
.layout {
    display: flex;
    height: calc(100vh - 52px);
    min-height: 0;
    overflow: hidden;
}

/* =====================
   VIDEO AREA
===================== */
.video {
    flex: 3;
    min-width: 0;
    min-height: 0;
    position: relative;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.video-shell {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
}

.video-wrapper {
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: black;
    border-radius: 14px;
}

/* overlays */
.video-overlay {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 12px;
    pointer-events: none;
}

.video-overlay.top {
    top: 0;
}

.video-overlay.bottom {
    bottom: 0;
}

.video-hint {
    font-size: 12px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.28);
    padding: 6px 10px;
    border-radius: 999px;
    backdrop-filter: blur(10px);
}

.video-hint .dot {
    width: 6px;
    height: 6px;
    background: #2ed573;
    border-radius: 50%;
}

/* LIVE BADGE */
.live {
    position: absolute;
    top: 14px;
    left: 14px;
    background: #ff4757;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.6);
}

.hidden {
    display: none !important;
}

.video-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.video-status.hidden {
    display: none !important;
}

/* =====================
   CONTROLS
===================== */
.controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 10px;
    z-index: 5;
}

.controls.glass {
    backdrop-filter: blur(10px);
    background: rgba(20, 20, 20, 0.5);
    border-radius: 12px;
    padding: 10px;
}

.controls button {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    background: #2f3542;
    color: white;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.controls button:hover {
    background: #3d4455;
    transform: translateY(-1px);
}

.controls button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.controls button.danger {
    background: #ff4757;
}

.controls button.danger:hover {
    background: #ff6b81;
}

/* =====================
   SIDEBAR
===================== */
.sidebar {
    flex: 1;
    min-width: 320px;
    max-width: 420px;
    background: #141414;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #222;
    min-height: 0;
    overflow: hidden;
}

/* =====================
   PANELS
===================== */
.panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-bottom: 1px solid #222;
}

.panel-header {
    padding: 10px 12px;
    background: #161616;
    border-bottom: 1px solid #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.panel-title {
    font-weight: 600;
    font-size: 14px;
}

.panel-subtitle {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 2px;
}

.panel-meta {
    background: #2f3542;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    flex-shrink: 0;
}

/* =====================
   USERS
===================== */
.users {
    flex: 0 0 auto;
    max-height: 36%;
    min-height: 140px;
}

#userList {
    list-style: none;
    padding: 8px;
    margin: 0;
    overflow-y: auto;
    min-height: 0;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.user-item.offline {
    opacity: 0.55;
}

.username {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    word-break: break-word;
}

.badge.host {
    background: #1e90ff;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.badge.status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 6px;
    flex-shrink: 0;
}

.badge.status.online {
    background: #2ed573;
    color: #111;
}

.badge.status.offline {
    background: #57606f;
    color: white;
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.actions button {
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #2f3542;
    color: white;
}

.actions button.danger {
    background: #ff4757;
}

.actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =====================
   CHAT PANEL
===================== */
.chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #141414;
    overflow: hidden;
}

.chat-input-wrap {
    padding: 8px;
    border-top: 1px solid #222;
    background: #161616;
    flex-shrink: 0;
}

/* =====================
   MESSAGES
===================== */
.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    scroll-behavior: smooth;
}

/* CHAT BUBBLE */
.chat-message {
    max-width: 85%;
    padding: 8px 10px;
    border-radius: 10px;
    background: #1f1f1f;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    align-self: flex-start;
    animation: fadeIn 0.15s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chat-message .user {
    font-size: 11px;
    opacity: 0.6;
    margin-bottom: 2px;
}

.chat-message.self {
    background: #2f3542;
    align-self: flex-end;
    box-shadow: 0 2px 10px rgba(50, 100, 255, 0.2);
}

.messages .system {
    align-self: center;
    font-size: 12px;
    opacity: 0.7;
    padding: 6px 10px;
    border-radius: 8px;
    background: #1a1a1a;
    margin: 8px 0;
}

/* =====================
   CHAT IMAGE
===================== */
.chat-message.image {
    padding: 6px;
}

.chat-message.image img.chat-image {
    max-width: 220px;
    max-height: 220px;
    width: auto;
    height: auto;
    border-radius: 10px;
    display: block;
    cursor: pointer;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.chat-message.image img.chat-image:hover {
    opacity: 0.92;
}

.chat-message.image.self img.chat-image {
    margin-left: auto;
}

.chat-message.image .caption {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

/* =====================
   IMAGE PREVIEW
===================== */
.image-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin: 0 0 8px;
    background: #1c1c1c;
    border-radius: 10px;
    max-width: 220px;
}

.image-preview.hidden {
    display: none;
}

.image-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

.image-preview .remove-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 18px;
    cursor: pointer;
}

/* =====================
   CHAT INPUT
===================== */
.chat-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 10px 12px;
    border-radius: 10px;
    background: #0f0f0f;
    color: white;
    outline: none;
    font-size: 14px;
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.chat-input button {
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.chat-input button:hover {
    transform: translateY(-1px);
}

#imageBtn {
    background: none;
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 8px 10px;
}

#imageBtn.active {
    color: #2ed573;
    font-weight: bold;
}

.send-btn,
#sendBtn {
    background: #1e90ff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    cursor: pointer;
    flex-shrink: 0;
}

.send-btn:hover,
#sendBtn:hover {
    background: #3aa0ff;
}

/* =====================
   TOAST
===================== */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 24px));
}

.toast {
    background: rgba(20, 20, 20, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    word-break: break-word;
}

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

.toast-success {
    border-left: 4px solid #2ed573;
}

.toast-error {
    border-left: 4px solid #ff4757;
}

.toast-info {
    border-left: 4px solid #1e90ff;
}

/* =====================
   ULTRA POLISH
===================== */

.topbar {
    position: relative;
    z-index: 20;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

.topbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.brand-copy {
    display: flex;
    flex-direction: column;
}

.header-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.82);
}

.header-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #2ed573;
    box-shadow: 0 0 12px rgba(46, 213, 115, 0.7);
}

.video-shell {
    padding: 4px;
}

.video-card {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 12px;
}

.video-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to bottom, rgba(0,0,0,0.18), transparent 18%),
        linear-gradient(to top, rgba(0,0,0,0.18), transparent 18%);
    pointer-events: none;
    z-index: 1;
}

.video-wrapper > * {
    position: relative;
    z-index: 2;
}

.video-top-left,
.video-top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill.subtle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(10px);
    font-size: 12px;
    color: rgba(255,255,255,0.82);
    border: 1px solid rgba(255,255,255,0.08);
}

.live {
    animation: livePulse 1.8s infinite ease-in-out;
}

@keyframes livePulse {
    0% { box-shadow: 0 0 0 rgba(255, 71, 87, 0.55); }
    50% { box-shadow: 0 0 18px rgba(255, 71, 87, 0.85); }
    100% { box-shadow: 0 0 0 rgba(255, 71, 87, 0.55); }
}

.video-status {
    backdrop-filter: blur(6px);
}

.video-status-inner {
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.video-status-icon {
    font-size: 32px;
    opacity: 0.95;
}

.video-status-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.video-status-subtitle {
    font-size: 13px;
    opacity: 0.72;
    line-height: 1.45;
}

.controls {
    gap: 8px;
}

.controls button {
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

.controls .btn-primary,
#shareBtn {
    background: linear-gradient(135deg, #1e90ff, #4ea8ff);
    color: white;
}

.controls .btn-primary:hover,
#shareBtn:hover {
    background: linear-gradient(135deg, #3aa0ff, #6ab5ff);
}

.sidebar {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        #141414;
}

.panel {
    background: transparent;
}

.panel-header {
    backdrop-filter: blur(8px);
}

#userList {
    padding-top: 10px;
    padding-bottom: 10px;
}

.user-item {
    border: 1px solid transparent;
}

.user-item:hover {
    border-color: rgba(255,255,255,0.06);
}

.username {
    font-weight: 500;
}

.actions button {
    transition: all 0.18s ease;
}

.actions button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

.messages {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0));
}

.chat-message {
    border: 1px solid rgba(255,255,255,0.03);
}

.chat-message.self {
    border: 1px solid rgba(90, 140, 255, 0.18);
}

.chat-message .user {
    font-weight: 600;
    letter-spacing: 0.2px;
}

.chat-input-wrap {
    background: linear-gradient(180deg, rgba(22,22,22,0.9), rgba(22,22,22,1));
}

.chat-input {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 14px;
    padding: 8px;
}

.chat-input input {
    background: transparent;
}

.send-btn,
#sendBtn {
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(30, 144, 255, 0.22);
}

.image-preview {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

#toast-container {
    top: 18px;
    right: 18px;
}

.toast {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
}

/* nicer user count badge */
#userCountBadge {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
}

/* =====================
   HOME PAGE GG
===================== */
.home {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
}

.home-shell {
    width: 100%;
    max-width: 980px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-card {
    width: 100%;
    max-width: 560px;
    padding: 32px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
        rgba(20, 20, 20, 0.78);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(14px);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: rgba(255,255,255,0.82);
    margin-bottom: 18px;
}

.hero-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: linear-gradient(135deg, #1e90ff, #7b61ff);
    box-shadow: 0 16px 30px rgba(50, 90, 255, 0.22);
    flex-shrink: 0;
}

.hero-brand h1 {
    margin: 0 0 6px;
    font-size: 34px;
    line-height: 1.05;
}

.hero-brand p {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255,255,255,0.72);
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hero-create-btn {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, #1e90ff, #4ea8ff);
    color: white;
    font-size: 15px;
    font-weight: 700;
    transition: transform 0.15s ease, filter 0.2s ease;
    box-shadow: 0 16px 30px rgba(30, 144, 255, 0.22);
}

.hero-create-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.join-box {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
}

.join-label {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.62);
    letter-spacing: 0.2px;
}

.join-row {
    display: flex;
    gap: 10px;
}

.join-row input {
    flex: 1;
    min-width: 0;
    padding: 13px 14px;
    border-radius: 12px;
    border: none;
    outline: none;
    background: #0f0f0f;
    color: white;
    font-size: 14px;
}

.join-row input::placeholder {
    color: rgba(255,255,255,0.4);
}

.join-row button {
    padding: 0 18px;
    border-radius: 12px;
    border: none;
    background: #2f3542;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.join-row button:hover {
    background: #3d4455;
    transform: translateY(-1px);
}

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.hero-feature {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
    color: rgba(255,255,255,0.82);
}

.hero-feature-icon {
    opacity: 0.95;
}

/* mobile */
@media (max-width: 768px) {
    .home {
        padding: 16px;
    }

    .hero-card {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .hero-brand {
        align-items: flex-start;
    }

    .hero-brand h1 {
        font-size: 28px;
    }

    .hero-brand p {
        font-size: 14px;
    }

    .hero-icon {
        width: 56px;
        height: 56px;
        font-size: 26px;
        border-radius: 16px;
    }

    .join-row {
        flex-direction: column;
    }

    .join-row button {
        height: 44px;
    }

    .hero-features {
        gap: 8px;
    }

    .hero-feature {
        font-size: 12px;
    }
}

/* =====================
   HOME LANDING GG
===================== */
.home-landing {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.landing-grid {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
    opacity: 0.16;
    pointer-events: none;
}

.landing-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
}

.orb-1 {
    width: 320px;
    height: 320px;
    left: 8%;
    top: 12%;
    background: rgba(30, 144, 255, 0.22);
}

.orb-2 {
    width: 360px;
    height: 360px;
    right: 10%;
    bottom: 8%;
    background: rgba(123, 97, 255, 0.18);
}

.landing-shell {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

.landing-hero {
    width: min(1280px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 48px;
    align-items: center;
}

.landing-copy {
    max-width: 640px;
    justify-self: center;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
    color: rgba(255,255,255,0.84);
    margin-bottom: 18px;
    backdrop-filter: blur(10px);
}

.landing-title {
    margin: 0;
    font-size: clamp(42px, 6vw, 76px);
    line-height: 0.96;
    letter-spacing: -0.04em;
    font-weight: 800;
    max-width: 9.5ch;
}

.landing-title span {
    display: block;
    color: rgba(255,255,255,0.78);
}

.landing-desc {
    margin: 22px 0 0;
    max-width: 560px;
    font-size: 16px;
    line-height: 1.75;
    color: rgba(255,255,255,0.72);
}

.landing-actions {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 560px;
}

.landing-create-btn {
    width: 100%;
    min-height: 58px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    background: linear-gradient(135deg, #1e90ff, #7b61ff);
    color: white;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow:
        0 20px 40px rgba(50, 90, 255, 0.24),
        inset 0 1px 0 rgba(255,255,255,0.18);
    transition: transform 0.18s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.landing-create-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow:
        0 24px 46px rgba(50, 90, 255, 0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.landing-join-card {
    width: 100%;
    max-width: 560px;
    padding: 18px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
        rgba(20, 20, 20, 0.78);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 18px 50px rgba(0,0,0,0.24),
        inset 0 1px 0 rgba(255,255,255,0.04);
    backdrop-filter: blur(16px);
}

.landing-join-label {
    display: block;
    margin-bottom: 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.62);
    letter-spacing: 0.02em;
}

.landing-join-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.landing-join-row input {
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    outline: none;
    background: rgba(10,10,10,0.85);
    color: white;
    font-size: 14px;
    box-sizing: border-box;
}

.landing-join-row input::placeholder {
    color: rgba(255,255,255,0.4);
}

.landing-join-row button {
    width: auto;
    min-width: 110px;
    height: 52px;
    padding: 0 18px;
    border-radius: 16px;
    border: none;
    background: #2f3542;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.landing-join-row button:hover {
    background: #3d4455;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .landing-join-card {
        padding: 14px;
        border-radius: 18px;
    }

    .landing-join-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .landing-join-row input,
    .landing-join-row button {
        width: 100%;
        min-width: 0;
        height: 48px;
        border-radius: 14px;
    }
}

.landing-stats {
    margin-top: 26px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.landing-stat {
    min-width: 150px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
}

.landing-stat strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.landing-stat span {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.62);
}

.landing-preview {
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-window {
    width: min(560px, 100%);
    border-radius: 28px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02)),
        rgba(18,18,18,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 28px 90px rgba(0,0,0,0.36),
        inset 0 1px 0 rgba(255,255,255,0.05);
    backdrop-filter: blur(16px);
}

.preview-topbar {
    height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.preview-dots {
    display: flex;
    gap: 6px;
}

.preview-dots span {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: block;
}

.preview-dots span:nth-child(1) { background: #ff5f57; }
.preview-dots span:nth-child(2) { background: #febc2e; }
.preview-dots span:nth-child(3) { background: #28c840; }

.preview-label {
    font-size: 12px;
    color: rgba(255,255,255,0.65);
}

.preview-video {
    position: relative;
    height: 300px;
    background:
        radial-gradient(circle at 30% 20%, rgba(30,144,255,0.22), transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(123,97,255,0.24), transparent 30%),
        linear-gradient(180deg, #111, #090909);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-live {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #ff4757;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 999px;
    box-shadow: 0 0 16px rgba(255, 71, 87, 0.6);
}

.preview-status {
    text-align: center;
    max-width: 320px;
    padding: 0 20px;
}

.preview-status-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.preview-status-title {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 8px;
}

.preview-status-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.68);
    line-height: 1.5;
}

.preview-panels {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    gap: 0;
    min-height: 220px;
}

.preview-users,
.preview-chat {
    padding: 18px;
}

.preview-users {
    border-right: 1px solid rgba(255,255,255,0.05);
}

.preview-panel-title {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.64);
    margin-bottom: 14px;
    letter-spacing: 0.03em;
}

.preview-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-size: 14px;
}

.preview-user.host {
    font-weight: 700;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e90ff, #7b61ff);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.mini-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #1e90ff;
    color: white;
}

.mini-dot {
    margin-left: auto;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.mini-dot.online {
    background: #2ed573;
    box-shadow: 0 0 10px rgba(46, 213, 115, 0.7);
}

.preview-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.45;
}

.preview-bubble.self {
    margin-left: auto;
    background: rgba(30,144,255,0.18);
}

/* better centering on medium screens */
@media (max-width: 1100px) {
    .landing-hero {
        grid-template-columns: 1fr;
        gap: 28px;
        justify-items: center;
        text-align: center;
    }

    .landing-copy {
        max-width: 760px;
    }

    .landing-title {
        max-width: none;
        margin-left: auto;
        margin-right: auto;
    }

    .landing-desc {
        margin-left: auto;
        margin-right: auto;
    }

    .landing-actions,
    .landing-stats {
        margin-left: auto;
        margin-right: auto;
    }

    .landing-preview {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .landing-shell {
        padding: 24px 16px;
    }

    .landing-title {
        font-size: clamp(34px, 10vw, 52px);
    }

    .landing-desc {
        font-size: 14px;
        line-height: 1.65;
    }

    .landing-join-row {
        flex-direction: column;
    }

    .landing-join-row button {
        width: 100%;
    }

    .landing-stats {
        justify-content: center;
    }

    .preview-video {
        height: 220px;
    }

    .preview-panels {
        grid-template-columns: 1fr;
    }

    .preview-users {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }

    .header-status {
        display: none;
    }
}

/* better desktop spacing */
@media (min-width: 1024px) {
    .layout {
        gap: 0;
    }

    .video {
        padding: 16px;
    }

    .sidebar {
        max-width: 430px;
    }
}

/* tablet */
@media (max-width: 900px) {
    .topbar-center {
        display: none;
    }

    .header-status {
        display: none;
    }

    .video-card {
        padding: 10px;
    }
}

/* mobile polish */
@media (max-width: 768px) {
    .video-card {
        border-radius: 0;
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .video-shell {
        padding: 0;
    }

    .video-status-title {
        font-size: 16px;
    }

    .video-status-subtitle {
        font-size: 12px;
    }

    .chat-input {
        padding: 6px;
    }

    .send-btn,
    #sendBtn {
        padding: 10px 12px;
    }
}

/* =====================
   ANIMATIONS
===================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================
   MOBILE RESPONSIVE
===================== */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
        height: calc(100vh - 52px);
        min-height: 0;
    }

    .video {
        flex: none;
        height: 54vh;
        padding: 0;
        min-height: 0;
    }

    .video-shell,
    .video-wrapper {
        border-radius: 0;
    }

    .sidebar {
        flex: none;
        height: 46vh;
        max-width: none;
        min-width: 0;
        border-left: none;
        border-top: 1px solid #222;
        min-height: 0;
        overflow: hidden;
    }

    .users {
        max-height: 40%;
        min-height: 120px;
    }

    .chat {
        min-height: 0;
        overflow: hidden;
    }

    .messages {
        min-height: 0;
        overflow-y: auto;
    }

    .controls {
        bottom: 12px;
        right: 12px;
        left: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .controls.glass {
        bottom: 10px;
    }

    .chat-message.image img.chat-image {
        max-width: 160px;
        max-height: 160px;
    }

    .topbar-right {
        gap: 8px;
    }

    .room-pill {
        max-width: 150px;
    }

    .brand-subtitle {
        display: none;
    }
}

/* =====================
   SMALL SCREEN TWEAKS
===================== */
@media (max-width: 480px) {
    .topbar {
        padding: 0 10px;
    }

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

    .brand {
        font-size: 14px;
    }

    .room-pill {
        font-size: 11px;
        padding: 5px 8px;
    }

    .controls button {
        font-size: 13px;
        padding: 9px 12px;
    }

    .panel-header {
        padding: 10px;
    }

    .messages {
        padding: 10px;
    }
}

/* =====================
   RESPONSIVE PATCH
===================== */

/* safer sizing */
html,
body {
    width: 100%;
    max-width: 100%;
}

body {
    overflow-x: hidden;
}

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

/* prevent flex/grid overflow */
.topbar,
.layout,
.video,
.video-shell,
.video-card,
.video-wrapper,
.sidebar,
.panel,
.chat,
.messages,
.chat-input,
.landing-hero,
.landing-copy,
.landing-preview,
.preview-window,
.preview-panels {
    min-width: 0;
}

/* =====================
   TOPBAR IMPROVEMENTS
===================== */
.topbar {
    gap: 12px;
}

.topbar-left,
.topbar-center,
.topbar-right {
    min-width: 0;
}

.brand-wrap {
    min-width: 0;
}

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

.brand,
.brand-subtitle,
.room-id {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================
   VIDEO / SIDEBAR SAFETY
===================== */
.video-card {
    display: flex;
    flex-direction: column;
}

.video-wrapper {
    flex: 1;
    min-height: 0;
}

.video video {
    display: block;
}

.sidebar {
    overflow: hidden;
}

.users,
.chat,
#userList,
.messages {
    min-height: 0;
}

/* =====================
   BUTTONS / INPUTS
===================== */
button,
input {
    font: inherit;
}

.controls {
    max-width: calc(100% - 24px);
}

.controls button {
    white-space: nowrap;
}

.chat-input {
    flex-wrap: nowrap;
}

.chat-input input {
    width: 100%;
}

.landing-create-btn,
.landing-join-row button,
.join-row button,
.hero-create-btn,
.send-btn,
#sendBtn,
.controls button,
.icon-btn {
    min-height: 44px;
}

/* =====================
   LARGE DESKTOP
===================== */
@media (min-width: 1280px) {
    .landing-hero {
        gap: 56px;
    }

    .sidebar {
        max-width: 440px;
    }

    .video {
        padding: 18px;
    }
}

/* =====================
   LAPTOP / SMALL DESKTOP
===================== */
@media (max-width: 1200px) {
    .landing-hero {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
        justify-items: center;
    }

    .landing-copy,
    .landing-actions,
    .landing-desc,
    .landing-stats {
        margin-left: auto;
        margin-right: auto;
    }

    .landing-title {
        max-width: none;
    }

    .landing-preview {
        width: 100%;
    }

    .preview-window {
        width: min(720px, 100%);
    }
}

/* =====================
   TABLET
===================== */
@media (max-width: 992px) {
    .topbar {
        padding: 0 12px;
    }

    .topbar-center {
        display: none;
    }

    .header-status {
        display: none;
    }

    .layout {
        flex-direction: column;
        height: calc(100vh - 52px);
    }

    .video {
        flex: none;
        height: 52vh;
        padding: 10px;
    }

    .sidebar {
        flex: none;
        height: 48vh;
        max-width: none;
        min-width: 0;
        width: 100%;
        border-left: none;
        border-top: 1px solid #222;
    }

    .users {
        max-height: 38%;
        min-height: 120px;
    }

    .controls {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .controls.glass {
        padding: 8px;
    }

    .controls button {
        flex: 0 1 auto;
    }

    .landing-shell {
        padding: 28px 20px;
    }

    .landing-title {
        font-size: clamp(34px, 8vw, 56px);
        line-height: 1.02;
    }

    .landing-desc {
        font-size: 15px;
    }

    .preview-video {
        height: 260px;
    }

    .preview-panels {
        grid-template-columns: 1fr;
    }

    .preview-users {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
}

/* =====================
   MOBILE
===================== */
@media (max-width: 768px) {
    html,
    body {
        overflow: hidden;
    }

    .topbar {
        height: 56px;
        min-height: 56px;
        padding: 0 10px;
    }

    .brand-subtitle {
        display: none;
    }

    .brand {
        font-size: 14px;
    }

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

    .topbar-right {
        gap: 6px;
    }

    .icon-btn,
    #copyLinkBtn {
        padding: 8px 10px;
    }

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

    .video {
        height: 48vh;
        padding: 0;
    }

    .video-shell {
        padding: 0;
    }

    .video-card {
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        background: transparent;
    }

    .video-wrapper,
    .video video {
        border-radius: 0;
    }

    .video-status {
        padding: 18px;
    }

    .video-status-title {
        font-size: 16px;
    }

    .video-status-subtitle {
        font-size: 12px;
        line-height: 1.5;
    }

    .pill.subtle,
    .video-hint {
        font-size: 11px;
    }

    .sidebar {
        height: 52vh;
    }

    .panel-header {
        padding: 10px;
    }

    .panel-title {
        font-size: 13px;
    }

    .panel-subtitle {
        font-size: 10px;
    }

    #userList {
        padding: 6px;
    }

    .user-item {
        padding: 8px 6px;
    }

    .username {
        font-size: 12px;
    }

    .messages {
        padding: 10px;
        gap: 8px;
    }

    .chat-message {
        max-width: 92%;
        font-size: 13px;
        padding: 8px 10px;
    }

    .chat-message.image img.chat-image {
        max-width: 180px;
        max-height: 180px;
    }

    .chat-input-wrap {
        padding: 8px;
    }

    .chat-input {
        gap: 6px;
        padding: 6px;
        border-radius: 12px;
    }

    .chat-input input {
        padding: 10px;
        font-size: 13px;
    }

    #imageBtn {
        padding: 8px;
        font-size: 16px;
    }

    .send-btn,
    #sendBtn {
        padding: 10px 12px;
        font-size: 13px;
    }

    .controls {
        left: 10px;
        right: 10px;
        bottom: 10px;
        gap: 6px;
    }

    .controls button {
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .landing-shell {
        padding: 20px 14px;
    }

    .landing-badge {
        font-size: 12px;
        padding: 8px 12px;
    }

    .landing-title {
        font-size: clamp(30px, 11vw, 44px);
        line-height: 1.04;
        letter-spacing: -0.03em;
    }

    .landing-desc {
        font-size: 14px;
        line-height: 1.7;
        margin-top: 16px;
    }

    .landing-actions {
        margin-top: 22px;
        gap: 14px;
    }

    .landing-create-btn {
        min-height: 52px;
        border-radius: 16px;
        font-size: 15px;
    }

    .landing-join-card {
        padding: 14px;
        border-radius: 18px;
    }

    .landing-join-row {
        flex-direction: column;
        gap: 10px;
    }

    .landing-join-row input,
    .landing-join-row button {
        width: 100%;
        min-height: 48px;
        border-radius: 14px;
    }

    .landing-stats {
        gap: 10px;
        justify-content: center;
    }

    .landing-stat {
        flex: 1 1 100%;
        min-width: 0;
        text-align: left;
    }

    .preview-window {
        border-radius: 20px;
    }

    .preview-topbar {
        height: 42px;
        padding: 0 12px;
    }

    .preview-label {
        font-size: 11px;
    }

    .preview-video {
        height: 210px;
    }

    .preview-status-icon {
        font-size: 34px;
    }

    .preview-status-title {
        font-size: 18px;
    }

    .preview-status-subtitle {
        font-size: 12px;
    }

    .preview-users,
    .preview-chat {
        padding: 14px;
    }

    .preview-bubble {
        max-width: 92%;
        font-size: 12px;
        padding: 9px 10px;
    }
}

/* =====================
   SMALL MOBILE
===================== */
@media (max-width: 480px) {
    .topbar {
        padding: 0 8px;
        gap: 8px;
    }

    .room-pill {
        max-width: 110px;
        padding: 5px 8px;
        font-size: 11px;
    }

    .room-id {
        font-size: 12px;
    }

    .brand {
        font-size: 13px;
    }

    .video {
        height: 44vh;
    }

    .sidebar {
        height: 56vh;
    }

    .controls {
        left: 8px;
        right: 8px;
        bottom: 8px;
    }

    .controls button {
        flex: 1 1 100%;
        min-width: 0;
    }

    .users {
        max-height: 34%;
        min-height: 110px;
    }

    .messages {
        padding: 8px;
    }

    .chat-message {
        max-width: 95%;
        font-size: 12.5px;
    }

    .chat-message.image img.chat-image {
        max-width: 140px;
        max-height: 140px;
    }

    .chat-input {
        align-items: stretch;
    }

    .chat-input input {
        font-size: 12px;
    }

    #imageBtn,
    #sendBtn {
        min-width: auto;
    }

    .landing-shell {
        padding: 16px 12px;
    }

    .landing-title {
        font-size: clamp(28px, 12vw, 38px);
    }

    .landing-desc {
        font-size: 13px;
    }

    .landing-stat {
        padding: 12px 14px;
        border-radius: 16px;
    }

    .preview-window {
        border-radius: 18px;
    }

    .preview-video {
        height: 180px;
    }

    .preview-status-title {
        font-size: 16px;
    }

    .preview-status-subtitle {
        font-size: 11px;
    }

    .avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

/* =====================
   VERY SHORT HEIGHT
===================== */
@media (max-height: 700px) and (min-width: 769px) {
    .topbar {
        height: 48px;
        min-height: 48px;
    }

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

    .panel-header {
        padding: 8px 10px;
    }

    .controls button {
        padding: 8px 12px;
    }

    .users {
        max-height: 32%;
    }

    .preview-video {
        height: 220px;
    }
}

/* =====================
   FIX RESPONSIVE FINAL
===================== */

/* anti overflow */
* {
    box-sizing: border-box;
}

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

.topbar,
.layout,
.video,
.video-shell,
.video-card,
.video-wrapper,
.sidebar,
.panel,
.chat,
.messages,
.chat-input,
.landing-shell,
.landing-hero,
.landing-copy,
.landing-preview,
.preview-window,
.preview-panels {
    min-width: 0;
}

/* =====================
   HOME FIX
===================== */
.home,
.home-landing {
    display: block;
    width: 100%;
}

.landing-shell {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.landing-hero {
    width: min(1280px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 40px;
    align-items: center;
}

.landing-copy,
.landing-preview {
    min-width: 0;
}

.landing-copy {
    max-width: 640px;
}

.landing-title {
    max-width: 10ch;
    word-break: break-word;
}

.landing-desc,
.landing-actions,
.landing-stats {
    max-width: 560px;
}

.preview-window {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
}

/* supaya tombol create room selalu kelihatan */
.landing-actions {
    position: relative;
    z-index: 2;
}

.landing-create-btn,
.landing-join-row button,
.landing-join-row input {
    width: 100%;
}

/* tablet ke bawah: home stack */
@media (max-width: 1100px) {
    .landing-shell {
        padding: 28px 18px;
        align-items: flex-start;
    }

    .landing-hero {
        grid-template-columns: 1fr;
        gap: 28px;
        text-align: center;
    }

    .landing-copy {
        max-width: 760px;
        margin: 0 auto;
    }

    .landing-title {
        max-width: none;
        font-size: clamp(34px, 8vw, 58px);
    }

    .landing-desc,
    .landing-actions,
    .landing-stats {
        margin-left: auto;
        margin-right: auto;
    }

    .landing-stats {
        justify-content: center;
    }

    .landing-preview {
        width: 100%;
    }

    .preview-window {
        max-width: 760px;
    }
}

@media (max-width: 768px) {
    .landing-shell {
        padding: 20px 14px 28px;
    }

    .landing-badge {
        font-size: 12px;
        padding: 8px 12px;
    }

    .landing-title {
        font-size: clamp(28px, 10vw, 42px);
        line-height: 1.05;
        letter-spacing: -0.03em;
    }

    .landing-desc {
        margin-top: 14px;
        font-size: 14px;
        line-height: 1.65;
    }

    .landing-actions {
        margin-top: 20px;
        gap: 14px;
    }

    .landing-create-btn {
        min-height: 50px;
        border-radius: 14px;
        font-size: 15px;
    }

    .landing-join-card {
        padding: 14px;
        border-radius: 18px;
    }

    .landing-join-row {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .landing-join-row input,
    .landing-join-row button {
        min-height: 48px;
        border-radius: 14px;
    }

    .landing-stats {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .landing-stat {
        min-width: 0;
        text-align: left;
    }

    .preview-window {
        border-radius: 20px;
    }

    .preview-video {
        height: 210px;
    }

    .preview-panels {
        grid-template-columns: 1fr;
    }

    .preview-users {
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
}

@media (max-width: 480px) {
    .landing-shell {
        padding: 16px 12px 24px;
    }

    .landing-title {
        font-size: clamp(26px, 11vw, 36px);
    }

    .landing-desc {
        font-size: 13px;
    }

    .preview-video {
        height: 170px;
    }

    .preview-status-title {
        font-size: 16px;
    }

    .preview-status-subtitle {
        font-size: 11px;
    }
}

/* =====================
   ROOM FIX
===================== */
body.room {
    height: 100vh;
}

.topbar {
    position: relative;
    z-index: 10;
    height: 52px;
    min-height: 52px;
}

.layout {
    display: flex;
    height: calc(100vh - 52px);
    min-height: 0;
    overflow: hidden;
}

.video {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    padding: 14px;
}

.video-shell,
.video-card {
    width: 100%;
    height: 100%;
    min-height: 0;
}

.video-card {
    display: flex;
    flex-direction: column;
}

.video-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
}

.video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar {
    flex: 0 0 380px;
    width: 380px;
    max-width: 380px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.users {
    flex: 0 0 auto;
    max-height: 35%;
    min-height: 120px;
}

.chat {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* controls aman */
.controls {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: calc(100% - 32px);
    z-index: 5;
}

.controls button {
    white-space: nowrap;
}

/* tablet */
@media (max-width: 992px) {
    .topbar-center,
    .header-status {
        display: none;
    }

    .layout {
        flex-direction: column;
        height: calc(100vh - 52px);
    }

    .video {
        flex: 0 0 50%;
        height: 50%;
        padding: 10px;
    }

    .sidebar {
        flex: 1 1 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        border-left: none;
        border-top: 1px solid #222;
    }

    .users {
        max-height: 34%;
    }

    .controls {
        left: 12px;
        right: 12px;
        bottom: 12px;
        justify-content: center;
    }
}

/* mobile */
@media (max-width: 768px) {
    .topbar {
        height: 56px;
        min-height: 56px;
        padding: 0 10px;
    }

    .layout {
        height: calc(100vh - 56px);
        display: grid;
        grid-template-rows: 44vh minmax(0, 1fr);
    }

    .video {
        height: auto;
        min-height: 0;
        padding: 0;
    }

    .video-shell,
    .video-card,
    .video-wrapper,
    .video video {
        border-radius: 0;
    }

    .video-card {
        border: none;
        box-shadow: none;
        padding: 0;
        background: transparent;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        max-width: none;
        min-height: 0;
        height: auto;
    }

    .users {
        flex: 0 0 auto;
        max-height: 120px;
        min-height: 100px;
    }

    .chat {
        flex: 1 1 auto;
        min-height: 0;
    }

    .messages {
        min-height: 0;
        padding: 10px;
    }

    .chat-message {
        max-width: 92%;
        font-size: 13px;
    }

    .chat-input-wrap {
        padding: 8px;
    }

    .chat-input {
        padding: 6px;
        gap: 6px;
        align-items: center;
    }

    .chat-input input {
        min-width: 0;
        padding: 10px;
        font-size: 13px;
    }

    .controls {
        left: 10px;
        right: 10px;
        bottom: 10px;
        gap: 6px;
    }

    .controls button {
        flex: 1 1 calc(50% - 6px);
        min-width: 110px;
        font-size: 13px;
        padding: 10px 12px;
    }

    .brand-subtitle {
        display: none;
    }

    .room-pill {
        max-width: 130px;
    }
}

/* very small mobile */
@media (max-width: 480px) {
    .layout {
        grid-template-rows: 40vh minmax(0, 1fr);
    }

    .topbar {
        padding: 0 8px;
    }

    .brand {
        font-size: 13px;
    }

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

    .room-pill {
        max-width: 100px;
        font-size: 11px;
        padding: 4px 8px;
    }

    .users {
        max-height: 100px;
        min-height: 90px;
    }

    .messages {
        padding: 8px;
    }

    .chat-message {
        max-width: 95%;
        font-size: 12px;
    }

    .chat-message.image img.chat-image {
        max-width: 140px;
        max-height: 140px;
    }

    .controls button {
        flex: 1 1 100%;
        min-width: 0;
    }
}