/* Material You Theme - Material Design 3 with Dark Mode & Themes */

/* === Catppuccin Mocha (Default Dark) === */
:root[data-theme="mocha"] {
    --md-sys-color-primary: #cba6f7;
    --md-sys-color-primary-rgb: 203, 166, 247;
    --md-sys-color-on-primary: #11111b;
    --md-sys-color-primary-container: #45475a;
    --md-sys-color-on-primary-container: #cdd6f4;
    --md-sys-color-secondary: #f5c2e7;
    --md-sys-color-secondary-rgb: 245, 194, 231;
    --md-sys-color-on-secondary: #11111b;
    --md-sys-color-secondary-container: #45475a;
    --md-sys-color-on-secondary-container: #cdd6f4;
    --md-sys-color-tertiary: #94e2d5;
    --md-sys-color-tertiary-rgb: 148, 226, 213;
    --md-sys-color-on-tertiary: #11111b;
    --md-sys-color-tertiary-container: #45475a;
    --md-sys-color-on-tertiary-container: #cdd6f4;
    --md-sys-color-error: #f38ba8;
    --md-sys-color-error-rgb: 243, 139, 168;
    --md-sys-color-on-error: #11111b;
    --md-sys-color-error-container: #45475a;
    --md-sys-color-on-error-container: #f38ba8;
    --md-sys-color-success: #a6e3a1;
    --md-sys-color-success-rgb: 166, 227, 161;
    --md-sys-color-warning: #f9e2af;
    --md-sys-color-warning-rgb: 249, 226, 175;
    --md-sys-color-background: #1e1e2e;
    --md-sys-color-background-rgb: 30, 30, 46;
    --md-sys-color-on-background: #cdd6f4;
    --md-sys-color-surface: #1e1e2e;
    --md-sys-color-surface-rgb: 30, 30, 46;
    --md-sys-color-on-surface: #cdd6f4;
    --md-sys-color-on-surface-rgb: 205, 214, 244;
    --md-sys-color-surface-variant: #45475a;
    --md-sys-color-on-surface-variant: #bac2de;
    --md-sys-color-surface-container: #1e1e2e;
    --md-sys-color-surface-container-low: #181825;
    --md-sys-color-surface-container-high: #313244;
    --md-sys-color-surface-container-highest: #45475a;
    --md-sys-color-outline: #585b70;
    --md-sys-color-outline-variant: #45475a;
}

/* === Catppuccin Macchiato === */
:root[data-theme="macchiato"] {
    --md-sys-color-primary: #c6a0f6;
    --md-sys-color-primary-rgb: 198, 160, 246;
    --md-sys-color-on-primary: #181926;
    --md-sys-color-primary-container: #494d64;
    --md-sys-color-on-primary-container: #cad3f5;
    --md-sys-color-secondary: #f0c6c6;
    --md-sys-color-secondary-rgb: 240, 198, 198;
    --md-sys-color-on-secondary: #181926;
    --md-sys-color-secondary-container: #494d64;
    --md-sys-color-on-secondary-container: #cad3f5;
    --md-sys-color-tertiary: #8bd5ca;
    --md-sys-color-tertiary-rgb: 139, 213, 202;
    --md-sys-color-on-tertiary: #181926;
    --md-sys-color-tertiary-container: #494d64;
    --md-sys-color-on-tertiary-container: #cad3f5;
    --md-sys-color-error: #ed8796;
    --md-sys-color-error-rgb: 237, 135, 150;
    --md-sys-color-on-error: #181926;
    --md-sys-color-error-container: #494d64;
    --md-sys-color-on-error-container: #ed8796;
    --md-sys-color-success: #a6da95;
    --md-sys-color-success-rgb: 166, 218, 149;
    --md-sys-color-warning: #eed49f;
    --md-sys-color-warning-rgb: 238, 212, 159;
    --md-sys-color-background: #24273a;
    --md-sys-color-background-rgb: 36, 39, 58;
    --md-sys-color-on-background: #cad3f5;
    --md-sys-color-surface: #24273a;
    --md-sys-color-surface-rgb: 36, 39, 58;
    --md-sys-color-on-surface: #cad3f5;
    --md-sys-color-on-surface-rgb: 202, 211, 245;
    --md-sys-color-surface-variant: #494d64;
    --md-sys-color-on-surface-variant: #b8c0e0;
    --md-sys-color-surface-container: #24273a;
    --md-sys-color-surface-container-low: #1e2030;
    --md-sys-color-surface-container-high: #363a4f;
    --md-sys-color-surface-container-highest: #494d64;
    --md-sys-color-outline: #5b6078;
    --md-sys-color-outline-variant: #494d64;
}

/* === Catppuccin Frappe === */
:root[data-theme="frappe"] {
    --md-sys-color-primary: #ca9ee6;
    --md-sys-color-primary-rgb: 202, 158, 230;
    --md-sys-color-on-primary: #232634;
    --md-sys-color-primary-container: #51576d;
    --md-sys-color-on-primary-container: #c6d0f5;
    --md-sys-color-secondary: #eebebe;
    --md-sys-color-secondary-rgb: 238, 190, 190;
    --md-sys-color-on-secondary: #232634;
    --md-sys-color-secondary-container: #51576d;
    --md-sys-color-on-secondary-container: #c6d0f5;
    --md-sys-color-tertiary: #81c8be;
    --md-sys-color-tertiary-rgb: 129, 200, 190;
    --md-sys-color-on-tertiary: #232634;
    --md-sys-color-tertiary-container: #51576d;
    --md-sys-color-on-tertiary-container: #c6d0f5;
    --md-sys-color-error: #e78284;
    --md-sys-color-error-rgb: 231, 130, 132;
    --md-sys-color-on-error: #232634;
    --md-sys-color-error-container: #51576d;
    --md-sys-color-on-error-container: #e78284;
    --md-sys-color-success: #a6d189;
    --md-sys-color-success-rgb: 166, 209, 137;
    --md-sys-color-warning: #e5c890;
    --md-sys-color-warning-rgb: 229, 200, 144;
    --md-sys-color-background: #303446;
    --md-sys-color-background-rgb: 48, 52, 70;
    --md-sys-color-on-background: #c6d0f5;
    --md-sys-color-surface: #303446;
    --md-sys-color-surface-rgb: 48, 52, 70;
    --md-sys-color-on-surface: #c6d0f5;
    --md-sys-color-on-surface-rgb: 198, 208, 245;
    --md-sys-color-surface-variant: #51576d;
    --md-sys-color-on-surface-variant: #b5bfe2;
    --md-sys-color-surface-container: #303446;
    --md-sys-color-surface-container-low: #292c3c;
    --md-sys-color-surface-container-high: #414559;
    --md-sys-color-surface-container-highest: #51576d;
    --md-sys-color-outline: #626880;
    --md-sys-color-outline-variant: #51576d;
}

/* === Catppuccin Latte (Light Theme) === */
:root[data-theme="latte"] {
    --md-sys-color-primary: #8839ef;
    --md-sys-color-primary-rgb: 136, 57, 239;
    --md-sys-color-on-primary: #eff1f5;
    --md-sys-color-primary-container: #e6e9ef;
    --md-sys-color-on-primary-container: #4c4f69;
    --md-sys-color-secondary: #ea76cb;
    --md-sys-color-secondary-rgb: 234, 118, 203;
    --md-sys-color-on-secondary: #eff1f5;
    --md-sys-color-secondary-container: #e6e9ef;
    --md-sys-color-on-secondary-container: #4c4f69;
    --md-sys-color-tertiary: #179299;
    --md-sys-color-tertiary-rgb: 23, 146, 153;
    --md-sys-color-on-tertiary: #eff1f5;
    --md-sys-color-tertiary-container: #e6e9ef;
    --md-sys-color-on-tertiary-container: #4c4f69;
    --md-sys-color-error: #d20f39;
    --md-sys-color-error-rgb: 210, 15, 57;
    --md-sys-color-on-error: #eff1f5;
    --md-sys-color-error-container: #e6e9ef;
    --md-sys-color-on-error-container: #d20f39;
    --md-sys-color-success: #40a02b;
    --md-sys-color-success-rgb: 64, 160, 43;
    --md-sys-color-warning: #df8e1d;
    --md-sys-color-warning-rgb: 223, 142, 29;
    --md-sys-color-background: #eff1f5;
    --md-sys-color-background-rgb: 239, 241, 245;
    --md-sys-color-on-background: #4c4f69;
    --md-sys-color-surface: #eff1f5;
    --md-sys-color-surface-rgb: 239, 241, 245;
    --md-sys-color-on-surface: #4c4f69;
    --md-sys-color-on-surface-rgb: 76, 79, 105;
    --md-sys-color-surface-variant: #e6e9ef;
    --md-sys-color-on-surface-variant: #5c5f77;
    --md-sys-color-surface-container: #eff1f5;
    --md-sys-color-surface-container-low: #e6e9ef;
    --md-sys-color-surface-container-high: #ccd0da;
    --md-sys-color-surface-container-highest: #bcc0cc;
    --md-sys-color-outline: #9ca0b0;
    --md-sys-color-outline-variant: #ccd0da;
}

/* === Dracula Theme === */
:root[data-theme="dracula"] {
    --md-sys-color-primary: #bd93f9;
    --md-sys-color-primary-rgb: 189, 147, 249;
    --md-sys-color-on-primary: #282a36;
    --md-sys-color-primary-container: #44475a;
    --md-sys-color-on-primary-container: #f8f8f2;
    --md-sys-color-secondary: #ff79c6;
    --md-sys-color-secondary-rgb: 255, 121, 198;
    --md-sys-color-on-secondary: #282a36;
    --md-sys-color-secondary-container: #44475a;
    --md-sys-color-on-secondary-container: #f8f8f2;
    --md-sys-color-tertiary: #8be9fd;
    --md-sys-color-tertiary-rgb: 139, 233, 253;
    --md-sys-color-on-tertiary: #282a36;
    --md-sys-color-tertiary-container: #44475a;
    --md-sys-color-on-tertiary-container: #f8f8f2;
    --md-sys-color-error: #ff5555;
    --md-sys-color-error-rgb: 255, 85, 85;
    --md-sys-color-on-error: #282a36;
    --md-sys-color-error-container: #44475a;
    --md-sys-color-on-error-container: #ff5555;
    --md-sys-color-success: #50fa7b;
    --md-sys-color-success-rgb: 80, 250, 123;
    --md-sys-color-warning: #f1fa8c;
    --md-sys-color-warning-rgb: 241, 250, 140;
    --md-sys-color-background: #282a36;
    --md-sys-color-background-rgb: 40, 42, 54;
    --md-sys-color-on-background: #f8f8f2;
    --md-sys-color-surface: #282a36;
    --md-sys-color-surface-rgb: 40, 42, 54;
    --md-sys-color-on-surface: #f8f8f2;
    --md-sys-color-on-surface-rgb: 248, 248, 242;
    --md-sys-color-surface-variant: #44475a;
    --md-sys-color-on-surface-variant: #f8f8f2;
    --md-sys-color-surface-container: #282a36;
    --md-sys-color-surface-container-low: #21222c;
    --md-sys-color-surface-container-high: #44475a;
    --md-sys-color-surface-container-highest: #6272a4;
    --md-sys-color-outline: #6272a4;
    --md-sys-color-outline-variant: #44475a;
}

/* Elevation shadows */
:root {
    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
    --md-sys-elevation-4: 0 2px 3px rgba(0, 0, 0, 0.3), 0 6px 10px 4px rgba(0, 0, 0, 0.15);
    --md-sys-typescale-display-large: 57px;
    --md-sys-typescale-headline-large: 32px;
    --md-sys-typescale-headline-medium: 28px;
    --md-sys-typescale-title-large: 22px;
    --md-sys-typescale-title-medium: 16px;
    --md-sys-typescale-body-large: 16px;
    --md-sys-typescale-body-medium: 14px;
    --md-sys-typescale-body-small: 12px;
    --md-sys-typescale-label-large: 14px;
    --md-sys-typescale-label-small: 11px;
    --md-sys-typescale-headline-small: 24px;
}

/* =============================================
   Focus States
   ============================================= */

*:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible {
    outline: 3px solid var(--md-sys-color-primary);
    outline-offset: 3px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 0;
    box-shadow: 0 0 0 4px var(--md-sys-color-primary-container);
}

/* =============================================
   Typography
   ============================================= */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2 {
    font-size: var(--md-sys-typescale-headline-medium);
    margin-bottom: 8px;
}

h3 {
    font-size: var(--md-sys-typescale-title-large);
    margin-bottom: 16px;
    margin-top: 32px;
}

/* =============================================
   Reset
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', Arial, sans-serif;
    background: var(--md-sys-color-background);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    transition: background 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* =============================================
   Utility Classes
   ============================================= */

.mobile-only {
    display: none !important;
}

@media (max-width: 968px) {
    .mobile-only {
        display: flex !important;
    }
}

/* Better touch feedback for all interactive elements */
button, select, input[type="button"], input[type="submit"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Active state feedback for touch */
@media (hover: none) and (pointer: coarse) {
    button:active:not(:disabled) {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* =============================================
   Room Top Bar (Discord-inspired compact bar)
   ============================================= */

.room-top-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 52px;
    background: var(--md-sys-color-surface-container-low);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    top: 0;
    z-index: 100;
}

.room-top-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

.room-top-bar-center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 480px;
    margin: 0 auto;
}

.room-top-bar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.room-nav-home {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.room-nav-home:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

/* =============================================
   Room Name Switcher
   ============================================= */

.room-name-switcher {
    position: relative;
    min-width: 0;
}

.room-name-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 0;
}

.room-name-btn:hover {
    background: var(--md-sys-color-surface-container-high);
}

.room-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-name-arrow {
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.room-name-btn.open .room-name-arrow {
    transform: rotate(180deg);
}

/* Reposition the room-switcher-dropdown under the new name btn */
.room-name-switcher .room-switcher-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    max-width: 300px;
}

/* =============================================
   Room Switcher Dropdown
   ============================================= */

.room-switcher-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 200;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.room-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-medium);
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.room-switcher-item:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.room-switcher-item.active {
    background: rgba(var(--md-sys-color-primary-rgb), 0.15);
    color: var(--md-sys-color-primary);
    font-weight: 500;
}

.room-switcher-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-switcher-item-users {
    font-size: var(--md-sys-typescale-label-small);
    font-weight: 600;
    color: var(--md-sys-color-primary);
    background: rgba(var(--md-sys-color-primary-rgb), 0.12);
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    margin-left: 8px;
}

.room-switcher-divider {
    height: 1px;
    background: var(--md-sys-color-outline-variant);
    margin: 4px 8px;
}

/* =============================================
   Top Bar Action Buttons (icon buttons)
   ============================================= */

.top-bar-action-btn {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    position: relative;
}

.top-bar-action-btn:hover {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.top-bar-search-icon {
    width: 18px;
    height: 18px;
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
    opacity: 0.7;
}

/* User Count Pip */
.user-count-pip {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* =============================================
   Users Dropdown
   ============================================= */

.users-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

.users-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(var(--md-sys-color-surface-rgb), 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--md-sys-color-on-surface-rgb), 0.1);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.users-dropdown-container.active .users-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.users-list {
    padding: 8px;
}

.user-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--md-sys-color-on-surface);
    border-radius: 8px;
    transition: background 0.2s;
}

.user-item:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 500;
}

.users-list-empty {
    padding: 16px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium);
}

/* =============================================
   Webhook Panel
   ============================================= */

.webhook-url-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 6px;
    font-size: var(--md-sys-typescale-body-small);
}

.webhook-url-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

/* =============================================
   Room Menu (3-dot menu dropdown)
   ============================================= */

.room-menu-container {
    position: relative;
}

.room-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 10px;
    box-shadow: var(--md-sys-elevation-3);
    min-width: 200px;
    padding: 4px;
    z-index: 200;
}

.room-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-medium);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.room-menu-item:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.room-menu-item svg {
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
}

.room-menu-danger {
    color: var(--md-sys-color-error);
}

.room-menu-danger:hover {
    background: rgba(var(--md-sys-color-error-rgb), 0.1);
}

.room-menu-danger svg {
    color: var(--md-sys-color-error);
}

.room-menu-webhook-panel {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
    margin-top: 4px;
}

.room-menu-webhook-panel .webhook-url-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 6px;
    font-size: var(--md-sys-typescale-body-small);
}

.room-menu-webhook-panel .webhook-url-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

/* =============================================
   Room Content (main area below top bar)
   ============================================= */

#roomView {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.room-content {
    flex: 1;
    padding: 24px;
    min-height: calc(100vh - 52px);
}

/* =============================================
   Settings Sidebar Panel
   ============================================= */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--md-sys-color-surface-container);
    border-left: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
    z-index: 310;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel.open {
    transform: translateX(0);
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.settings-panel-header h3 {
    font-size: var(--md-sys-typescale-headline-small);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin: 0;
}

.settings-panel-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    transition: all 0.15s;
}

.settings-panel-close:hover {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.settings-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-panel-section {
    margin-bottom: 28px;
}

.settings-panel-section h4 {
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 12px 0;
}

.settings-panel-section .webhook-url-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    font-size: var(--md-sys-typescale-body-small);
    margin-top: 8px;
}

.settings-panel-section .webhook-url-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}

.settings-panel-section .toggle-label {
    margin-bottom: 4px;
}

.settings-panel-danger {
    padding-top: 20px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* =============================================
   Stream URL Input
   ============================================= */

.stream-url-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(var(--md-sys-color-primary-rgb), 0.12);
    color: var(--md-sys-color-on-surface);
    border: 1px solid rgba(var(--md-sys-color-primary-rgb), 0.3);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.stream-url-input:hover {
    background: rgba(var(--md-sys-color-primary-rgb), 0.15);
    border-color: rgba(var(--md-sys-color-primary-rgb), 0.4);
}

.stream-url-input:focus {
    outline: none;
    background: rgba(var(--md-sys-color-primary-rgb), 0.18);
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px rgba(var(--md-sys-color-primary-rgb), 0.2);
}

.stream-url-input::placeholder {
    color: rgba(var(--md-sys-color-on-surface-rgb), 0.6);
}

/* =============================================
   Subtitle
   ============================================= */

.subtitle {
    font-size: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
}

/* =============================================
   Password Option / Modal Buttons / Error
   ============================================= */

.password-option {
    margin: 16px 0;
    display: flex;
    align-items: center;
}

.password-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
}

.password-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

.modal-buttons button {
    flex: 1;
}

.error-message {
    margin-top: 12px;
    padding: 12px;
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border-radius: 8px;
    font-size: var(--md-sys-typescale-body-medium);
    border-left: 4px solid var(--md-sys-color-error);
}

/* =============================================
   Delete Room Modal Styles
   ============================================= */

.delete-room-info {
    margin-bottom: 24px;
}

.delete-room-name {
    font-size: var(--md-sys-typescale-headline-small);
    font-weight: 600;
    padding: 16px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: 8px;
    text-align: center;
    margin-bottom: 16px;
}

.delete-room-warning {
    font-size: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.6;
    padding: 16px;
    background: rgba(var(--md-sys-color-error-rgb), 0.1);
    border-left: 4px solid var(--md-sys-color-error);
    border-radius: 8px;
}

.admin-password-section {
    margin: 16px 0;
}

.admin-password-prompt {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 8px;
}

.delete-confirm-btn {
    background: var(--md-sys-color-error) !important;
    color: var(--md-sys-color-on-error) !important;
}

.delete-confirm-btn:hover {
    filter: brightness(1.2);
}

/* =============================================
   Password Modal Specific Styles
   ============================================= */

.password-modal-content {
    max-width: 450px !important;
    text-align: center;
    position: relative;
}

.password-modal-content .close {
    position: absolute;
    top: 16px;
    right: 16px;
    float: none;
}

.password-modal-header {
    margin-bottom: 32px;
}

.password-lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-primary);
}

.password-lock-icon svg {
    width: 48px;
    height: 48px;
}

.password-lock-icon.warning-icon {
    color: var(--md-sys-color-error);
}

.password-modal-header h2 {
    font-size: var(--md-sys-typescale-headline-medium);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
}

.password-modal-header .subtitle {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large);
}

.password-server-name {
    display: none;
}

.password-input-section {
    margin-bottom: 24px;
}

.password-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 12px;
    font-size: var(--md-sys-typescale-body-large);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    text-align: center;
    letter-spacing: 2px;
}

.password-input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: 0 0 0 4px var(--md-sys-color-primary-container);
}

/* Password Toggle Button */
.password-input-container {
    position: relative;
    width: 100%;
}

.password-input-container input {
    width: 100%;
    padding-right: 50px;
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
}

.password-toggle-btn:hover {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.password-toggle-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.password-toggle-icon {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.password-modal-buttons button {
    flex: 1;
    max-width: 180px;
}

/* =============================================
   Add Stream Section
   ============================================= */

.add-stream-section {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.add-stream-section input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background: rgba(var(--md-sys-color-primary-rgb), 0.08);
    color: var(--md-sys-color-on-surface);
    border: 1px solid rgba(var(--md-sys-color-primary-rgb), 0.2);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

.add-stream-section input[type="text"]:focus {
    outline: none;
    background: rgba(var(--md-sys-color-primary-rgb), 0.12);
    border-color: rgba(var(--md-sys-color-primary-rgb), 0.4);
    box-shadow: 0 0 0 3px rgba(var(--md-sys-color-primary-rgb), 0.1);
}

.add-stream-section input[type="text"]::placeholder {
    color: rgba(var(--md-sys-color-on-surface-rgb), 0.5);
}

/* =============================================
   Input Fields
   ============================================= */

input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 16px;
    border: none;
    border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
    border-radius: 4px 4px 0 0;
    font-size: var(--md-sys-typescale-body-large);
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

input[type="text"]:hover {
    background: var(--md-sys-color-surface-container-high);
}

input[type="text"]:focus {
    outline: none;
    border-bottom: 2px solid var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-highest);
}

/* =============================================
   Primary Button Styles
   ============================================= */

button.primary-btn,
#createServerBtn,
#addStreamBtn,
#saveNameBtn,
#unlockServerBtn,
#confirmDeleteBtn {
    padding: 12px 24px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 20px;
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    white-space: nowrap;
    box-shadow: var(--md-sys-elevation-1);
    letter-spacing: 0.1px;
}

button.primary-btn:hover,
#createServerBtn:hover,
#addStreamBtn:hover,
#saveNameBtn:hover,
#unlockServerBtn:hover,
#confirmDeleteBtn:hover:not(.delete-confirm-btn) {
    box-shadow: var(--md-sys-elevation-2);
    filter: brightness(1.1);
}

/* Secondary Button Styles */
button.secondary-btn {
    padding: 12px 24px;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border: 2px solid var(--md-sys-color-outline);
    border-radius: 20px;
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

button.secondary-btn:hover {
    background: var(--md-sys-color-surface-container-highest);
    border-color: var(--md-sys-color-on-surface);
}

/* =============================================
   Stream Grid
   ============================================= */

.stream-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
    grid-auto-rows: minmax(min(350px, 45vh), auto);
    max-height: calc(100vh - 200px);
    overflow: visible;
}

/* Single stream layout - large and centered */
.stream-grid.single-stream {
    grid-template-columns: 1fr;
    max-width: min(1800px, calc(80vh * 16 / 9));
    margin: 0 auto 40px;
    gap: 0;
}

/* Focus Mode - Contained within viewport, no scrolling */
.stream-grid.has-focus {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-template-rows: 1fr;
    grid-auto-rows: 200px;
    height: calc(100vh - 180px);
    gap: 12px;
}

/* Focused stream - fills first row, spans all columns */
.stream-card.focused {
    order: -1;
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
}

.stream-card.focused .stream-embed {
    aspect-ratio: auto;
    flex: 1;
}

.stream-card.focused .stream-embed iframe {
    position: static;
    width: 100%;
    height: 100%;
}

/* Unfocused streams - small previews filling implicit rows */
.stream-grid.has-focus .stream-card:not(.focused) .stream-embed {
    aspect-ratio: auto;
    flex: 1;
}

/* Compact headers for unfocused streams */
.stream-grid.has-focus .stream-card:not(.focused) .stream-header {
    padding: 6px 10px;
    min-height: 36px;
}

.stream-grid.has-focus .stream-card:not(.focused) .streamer-name {
    font-size: var(--md-sys-typescale-body-small);
}

.stream-grid.has-focus .stream-card:not(.focused) .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 16px;
}

/* =============================================
   Stream Card
   ============================================= */

.stream-card {
    position: relative;
    background: var(--md-sys-color-surface-container);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.stream-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stream-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(var(--md-sys-color-surface-rgb), 0.9), rgba(var(--md-sys-color-surface-rgb), 0.6));
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stream-card:hover .stream-header {
    opacity: 1;
}

.stream-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.streamer-name {
    font-weight: 500;
    font-size: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
}

.stream-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    width: 40px;
    height: 40px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
    padding: 0;
    box-shadow: none;
}

.icon-btn:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.stream-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #000;
}

.stream-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =============================================
   Empty State
   ============================================= */

.empty-state {
    text-align: center;
    padding: 80px 32px;
    color: var(--md-sys-color-on-surface-variant);
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--md-sys-color-surface-container-low);
    border-radius: 20px;
    max-width: 600px;
    margin: 80px auto;
    border: 2px dashed var(--md-sys-color-outline-variant);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.empty-state-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.6;
    filter: grayscale(20%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
}

.empty-state-icon svg {
    width: 72px;
    height: 72px;
}

.empty-state h2 {
    font-size: var(--md-sys-typescale-headline-medium);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 12px;
    font-weight: 500;
}

.empty-state p {
    font-size: var(--md-sys-typescale-body-large);
    margin-bottom: 32px;
    opacity: 0.8;
    line-height: 1.6;
}

.primary-btn {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--md-sys-typescale-label-large);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(var(--md-sys-color-primary-rgb), 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--md-sys-color-primary-rgb), 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

/* Secondary Button */
.secondary-btn {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline);
    padding: 12px 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--md-sys-typescale-label-large);
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.secondary-btn:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
}

/* =============================================
   Modal
   ============================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show,
.modal.active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background: var(--md-sys-color-surface-container-low);
    margin: auto;
    padding: 32px;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-content,
.modal.active .modal-content {
    transform: scale(1);
}

.close {
    color: var(--md-sys-color-on-surface-variant);
    float: right;
    font-size: 28px;
    font-weight: 400;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    transition: background 0.2s;
}

.close:hover {
    background: var(--md-sys-color-surface-container-highest);
}

/* =============================================
   Setup Steps / OBS Guide Tabs
   ============================================= */

.setup-steps h2 {
    color: var(--md-sys-color-primary);
    margin-bottom: 24px;
    font-size: var(--md-sys-typescale-headline-medium);
    font-weight: 400;
}

.setup-steps h3 {
    color: var(--md-sys-color-on-primary-container);
    background: var(--md-sys-color-primary-container);
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: var(--md-sys-typescale-title-large);
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 12px;
    border-left: 4px solid var(--md-sys-color-primary);
}

.setup-steps ol, .setup-steps ul {
    margin-left: 24px;
    line-height: 2;
    color: var(--md-sys-color-on-surface);
}

.setup-steps li {
    margin-bottom: 14px;
    font-size: var(--md-sys-typescale-body-large);
    padding-left: 8px;
}

.setup-steps li::marker {
    color: var(--md-sys-color-primary);
    font-weight: 600;
}

.setup-steps p {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-large);
    margin-bottom: 16px;
    line-height: 1.7;
}

.setup-steps code {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid var(--md-sys-color-outline-variant);
    white-space: nowrap;
}

.setup-steps a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: all 0.2s;
}

.setup-steps a:hover {
    color: var(--md-sys-color-tertiary);
    text-decoration-thickness: 2px;
}

.setup-steps strong {
    color: var(--md-sys-color-on-surface);
    font-weight: 700;
}

/* =============================================
   Tip Styles
   ============================================= */

.tip {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    border-left: 4px solid var(--md-sys-color-tertiary);
    padding: 16px;
    margin-top: 24px;
    border-radius: 12px;
    font-size: var(--md-sys-typescale-body-medium);
}

.tip strong {
    font-weight: 600;
    color: var(--md-sys-color-on-tertiary-container);
}

.tip-warning {
    background: linear-gradient(135deg, rgba(var(--md-sys-color-error-rgb), 0.15) 0%, rgba(var(--md-sys-color-error-rgb), 0.05) 100%);
    color: var(--md-sys-color-on-surface);
    border-left: 6px solid var(--md-sys-color-error);
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(var(--md-sys-color-error-rgb), 0.2), 0 4px 12px rgba(var(--md-sys-color-error-rgb), 0.1);
    position: relative;
    padding: 20px 20px 20px 56px;
    margin: 20px 0;
    line-height: 1.7;
}

.tip-warning::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--md-sys-color-error);
    background-color: var(--md-sys-color-error);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    -webkit-mask-size: 18px 18px;
    mask-size: 18px 18px;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.tip-warning strong {
    color: var(--md-sys-color-error);
    font-weight: 700;
}

.tip-warning a {
    color: var(--md-sys-color-error);
    text-decoration: underline;
    font-weight: 600;
}

.tip-warning a:hover {
    color: var(--md-sys-color-on-surface);
}

.tip-info {
    background: linear-gradient(135deg, rgba(var(--md-sys-color-primary-rgb), 0.15) 0%, rgba(var(--md-sys-color-primary-rgb), 0.05) 100%);
    color: var(--md-sys-color-on-surface);
    border-left: 6px solid var(--md-sys-color-primary);
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(var(--md-sys-color-primary-rgb), 0.2), 0 4px 12px rgba(var(--md-sys-color-primary-rgb), 0.1);
    position: relative;
    padding: 20px 20px 20px 56px;
    margin: 20px 0;
    line-height: 1.7;
}

.tip-info::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
    -webkit-mask-size: 18px 18px;
    mask-size: 18px 18px;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.tip-info strong {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.tip-info a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
    font-weight: 600;
}

.tip-info a:hover {
    color: var(--md-sys-color-on-surface);
}

.tip-small {
    padding: 16px 16px 16px 52px;
    margin: 16px 0;
    font-size: var(--md-sys-typescale-body-medium);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-left: 4px solid var(--md-sys-color-primary);
    border-radius: 8px;
    line-height: 1.7;
    position: relative;
}

.tip-small::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 16px;
    width: 20px;
    height: 20px;
    background-color: var(--md-sys-color-primary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 22h4'/%3E%3Cpath d='M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 22h4'/%3E%3Cpath d='M15.09 14c.18-.98.65-1.74 1.41-2.5A4.65 4.65 0 0 0 18 8 6 6 0 0 0 6 8c0 1 .23 2.23 1.5 3.5A4.61 4.61 0 0 1 8.91 14'/%3E%3C/svg%3E");
    -webkit-mask-size: 20px 20px;
    mask-size: 20px 20px;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.tip-small strong {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.tip-small a {
    color: var(--md-sys-color-primary);
    text-decoration: underline;
}

.tip-small a:hover {
    color: var(--md-sys-color-tertiary);
}

/* Better styling for nested lists and code in tips */
.tip ol, .tip ul {
    margin: 12px 0 8px 20px;
    padding-left: 0;
}

.tip li {
    margin-bottom: 8px;
}

.tip code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid rgba(var(--md-sys-color-on-surface-rgb), 0.1);
}

/* =============================================
   Setup Tabs
   ============================================= */

.setup-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
}

.setup-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-medium);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.setup-tab-btn:hover {
    color: var(--md-sys-color-on-surface);
    background: var(--md-sys-color-surface-container-highest);
}

.setup-tab-btn.active {
    color: var(--md-sys-color-primary);
    border-bottom-color: var(--md-sys-color-primary);
}

.setup-tab-content {
    display: none;
}

.setup-tab-content.active {
    display: block;
}

/* =============================================
   Scrollbar
   ============================================= */

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--md-sys-color-surface-container);
}

::-webkit-scrollbar-thumb {
    background: var(--md-sys-color-outline);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--md-sys-color-on-surface-variant);
}

/* =============================================
   Admin Settings Modal
   ============================================= */

.admin-modal-content {
    max-width: 900px !important;
}

.admin-password-prompt-section {
    text-align: center;
}

.admin-panel {
    text-align: left;
}

.admin-panel-header {
    text-align: center;
    margin-bottom: 32px;
}

.admin-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--md-sys-color-primary);
}

.admin-header-icon svg {
    width: 48px;
    height: 48px;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.admin-stat-card {
    background: var(--md-sys-color-surface-container-high);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.stat-label {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
}

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

.admin-section h3 {
    font-size: var(--md-sys-typescale-title-large);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
}

.admin-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.admin-room-item {
    background: var(--md-sys-color-surface-container);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: all 0.2s;
}

.admin-room-item:hover {
    background: var(--md-sys-color-surface-container-high);
    border-color: var(--md-sys-color-primary);
}

.admin-room-info {
    flex: 1;
}

.admin-room-name {
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.admin-room-meta {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-room-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--md-sys-typescale-label-small);
    color: var(--md-sys-color-primary);
    background: var(--md-sys-color-primary-container);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
}

.admin-room-actions {
    display: flex;
    gap: 8px;
}

.admin-delete-btn {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-error);
    border: 1px solid var(--md-sys-color-error);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: var(--md-sys-typescale-body-small);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-delete-btn:hover {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.admin-rooms-empty {
    text-align: center;
    padding: 40px;
    color: var(--md-sys-color-on-surface-variant);
}

/* =============================================
   Notification System
   ============================================= */

.notification-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    pointer-events: none;
}

.notification {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    pointer-events: all;
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--md-sys-color-primary);
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification.error {
    border-left-color: var(--md-sys-color-error);
    background: linear-gradient(135deg, rgba(var(--md-sys-color-error-rgb), 0.15) 0%, var(--md-sys-color-surface-container-high) 100%);
}

.notification.success {
    border-left-color: var(--md-sys-color-success);
    background: linear-gradient(135deg, rgba(var(--md-sys-color-success-rgb), 0.15) 0%, var(--md-sys-color-surface-container-high) 100%);
}

.notification.info {
    border-left-color: var(--md-sys-color-primary);
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
}

.notification-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-title {
    font-weight: 600;
    font-size: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
}

.notification-message {
    font-size: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.5;
    word-break: break-word;
}

.notification-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.notification-btn {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: var(--md-sys-typescale-body-small);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
}

.notification-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.notification-btn.copy-btn {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.notification-close {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 20px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
    box-shadow: none;
}

.notification-close:hover {
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

/* =============================================
   Utility Classes
   ============================================= */

.u-hidden { display: none !important; }
.u-no-scroll { overflow: hidden; }
.u-dim { opacity: 0.5; }
.copy-success {
    background: var(--md-sys-color-primary) !important;
    color: var(--md-sys-color-on-primary) !important;
}
.obs-setup-list { margin-top: 8px; margin-left: 20px; }
.obs-setup-sublist { margin-top: 5px; list-style-type: disc; }

/* =============================================
   Landing Page
   ============================================= */

.view {
    width: 100%;
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.view.view-entering {
    opacity: 0;
    transform: translateY(8px);
}

.view.view-visible {
    opacity: 1;
    transform: translateY(0);
}

.view.view-exiting {
    opacity: 0;
    transform: translateY(-8px);
}

#landingView {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    background: var(--md-sys-color-background);
}

.landing-container {
    max-width: 1200px;
    width: 100%;
    padding: 48px 24px;
    margin: 0 auto;
}

.landing-header {
    text-align: center;
    margin-bottom: 48px;
}

.landing-title {
    font-size: var(--md-sys-typescale-display-large);
    font-weight: 700;
    color: var(--md-sys-color-primary);
    margin-bottom: 12px;
}

.landing-subtitle {
    font-size: var(--md-sys-typescale-title-large);
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.8;
}

.landing-section {
    margin-bottom: 48px;
}

.landing-section:last-child {
    margin-bottom: 0;
}

.landing-section h2 {
    font-size: var(--md-sys-typescale-headline-small);
    color: var(--md-sys-color-on-surface);
    margin-bottom: 16px;
}

/* =============================================
   Room Card Grid (Steam-inspired landing)
   ============================================= */

.room-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.room-card {
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.room-card:hover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-highest);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

.room-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.room-card-name {
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 6px;
    word-break: break-word;
}

.room-card-lock {
    font-size: 14px;
    opacity: 0.7;
}

.room-card-users {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
}

.room-card-empty {
    border-style: dashed;
    cursor: default;
    opacity: 0.7;
}

.room-card-empty:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-high);
}

.room-card-empty p {
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

.room-card-empty span {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

/* =============================================
   Room Browser Toolbar (search + create btn)
   ============================================= */

.room-browser-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.room-browser-search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 10px;
    padding: 10px 14px;
    transition: all 0.2s;
}

.room-browser-search-wrap:hover {
    border-color: var(--md-sys-color-outline);
}

.room-browser-search-wrap:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 3px var(--md-sys-color-primary-container);
}

.room-browser-search-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
}

.room-browser-search {
    width: 100%;
    padding: 0;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    border: none;
    font-size: var(--md-sys-typescale-body-medium);
}

.room-browser-search:focus {
    outline: none;
}

.room-browser-search::placeholder {
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.6;
}

.create-room-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    border: none;
    border-radius: 10px;
    font-size: var(--md-sys-typescale-body-medium);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: var(--md-sys-elevation-1);
}

.create-room-btn:hover {
    filter: brightness(1.1);
    box-shadow: var(--md-sys-elevation-2);
}

/* =============================================
   Quick Start (horizontal steps)
   ============================================= */

.quick-start {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 20px 24px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
}

.quick-start-step {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-start-number {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.quick-start-step strong {
    display: block;
    font-size: var(--md-sys-typescale-body-medium);
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
}

.quick-start-step span {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
}

.quick-start-divider {
    width: 1px;
    height: 32px;
    background: var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

/* =============================================
   Landing Actions (OBS Guide + Settings)
   ============================================= */

.landing-actions {
    display: flex;
    gap: 16px;
}

.landing-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.landing-action-btn:hover {
    border-color: var(--md-sys-color-primary);
    background: var(--md-sys-color-surface-container-highest);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-2);
}

.landing-action-btn svg {
    flex-shrink: 0;
    color: var(--md-sys-color-primary);
}

.landing-action-btn strong {
    display: block;
    font-size: var(--md-sys-typescale-body-large);
    font-weight: 600;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 2px;
}

.landing-action-btn span {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
}

/* =============================================
   Room Search Dropdown (Landing page)
   ============================================= */

.room-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 200;
    padding: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.room-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-medium);
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.room-search-item:hover {
    background: var(--md-sys-color-surface-container-highest);
}

.room-search-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.room-search-item-users {
    font-size: var(--md-sys-typescale-label-small);
    font-weight: 600;
    color: var(--md-sys-color-primary);
    background: rgba(var(--md-sys-color-primary-rgb), 0.12);
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    margin-left: 8px;
}

.room-search-empty {
    padding: 12px 14px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-small);
    text-align: center;
}

/* =============================================
   Slug Preview
   ============================================= */

.slug-preview {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--md-sys-color-surface-container);
    border-radius: 8px;
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
}

.slug-preview-label {
    font-weight: 500;
    margin-right: 4px;
}

.slug-preview-url {
    color: var(--md-sys-color-primary);
    word-break: break-all;
}

/* =============================================
   Settings Modal Tabs
   ============================================= */

.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--md-sys-color-outline-variant);
    margin-bottom: 24px;
}

.settings-tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-medium);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.settings-tab-btn:hover {
    color: var(--md-sys-color-on-surface);
    background: rgba(var(--md-sys-color-primary-rgb), 0.08);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.settings-tab-btn.active {
    color: var(--md-sys-color-primary);
    border-bottom-color: var(--md-sys-color-primary);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

/* Settings Section Headers */
.settings-tab-content h3 {
    font-size: var(--md-sys-typescale-title-medium);
    color: var(--md-sys-color-on-surface);
    margin: 0 0 16px;
    font-weight: 600;
}

.settings-tab-content h3:not(:first-child) {
    margin-top: 32px;
}

/* =============================================
   Theme Selector
   ============================================= */

.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--md-sys-color-surface-container-high);
    border: 2px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option:hover {
    border-color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-container-highest);
}

.theme-option.active {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.3);
}

.theme-preview {
    display: flex;
    gap: 4px;
}

.theme-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(var(--md-sys-color-on-surface-rgb), 0.2);
}

.theme-name {
    font-size: var(--md-sys-typescale-body-small);
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

/* =============================================
   Toggle Label / Switch
   ============================================= */

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0;
    font-size: var(--md-sys-typescale-body-large);
    color: var(--md-sys-color-on-surface);
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--md-sys-color-outline);
    border-radius: 13px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--md-sys-color-surface);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch {
    background: var(--md-sys-color-primary);
}

.toggle-label input[type="checkbox"]:checked + .toggle-switch::after {
    transform: translateX(22px);
    background: var(--md-sys-color-on-primary);
}

/* =============================================
   Webhook Status / Domain Note
   ============================================= */

.webhook-domain-note {
    font-size: var(--md-sys-typescale-body-small);
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

.webhook-status {
    font-size: var(--md-sys-typescale-body-small);
    padding: 4px 0;
}

.webhook-status.valid {
    color: var(--md-sys-color-success);
}

.webhook-status.invalid {
    color: var(--md-sys-color-error);
}

/* =============================================
   Settings Modal Mobile
   ============================================= */

@media (max-width: 600px) {
    .theme-selector {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .settings-tab-btn {
        padding: 10px 16px;
        font-size: var(--md-sys-typescale-body-large);
    }

    .landing-actions {
        flex-direction: column;
    }
}

/* =============================================
   Responsive - Room Top Bar
   ============================================= */

@media (max-width: 968px) {
    .room-top-bar-center {
        max-width: none;
    }

    .stream-url-input {
        font-size: 16px;
    }

    .icon-btn {
        width: 48px;
        height: 48px;
        font-size: 24px;
    }

    .stream-header {
        padding: 20px 16px;
        opacity: 1;
        position: relative;
        background: var(--md-sys-color-surface-container-high);
    }

    button:not(.icon-btn):not(.top-bar-action-btn):not(.room-nav-home):not(.room-name-btn):not(.room-menu-item):not(.landing-footer-link) {
        min-height: 48px;
    }

    .landing-container {
        padding: 24px 16px;
    }

    .landing-title {
        font-size: var(--md-sys-typescale-headline-large);
    }

    .landing-subtitle {
        font-size: var(--md-sys-typescale-title-medium);
    }

    .quick-start {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .quick-start-divider {
        width: 100%;
        height: 1px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
        -webkit-user-select: none;
        user-select: none;
    }

    input, textarea {
        -webkit-user-select: text;
        user-select: text;
    }

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

    .stream-grid.has-focus {
        grid-template-columns: 1fr;
        grid-auto-rows: 160px;
        height: calc(100vh - 100px);
    }

    .stream-grid.has-focus .stream-card:not(.focused) .stream-header {
        padding: 6px 10px;
    }

    .room-content {
        padding: 16px;
        min-height: calc(100vh - 52px);
    }

    .room-top-bar {
        padding: 0 12px;
    }

    .top-bar-action-btn {
        width: 40px;
        height: 40px;
    }

    button:not(.icon-btn):not(.top-bar-action-btn):not(.room-nav-home):not(.room-name-btn):not(.room-menu-item):not(.landing-footer-link) {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 15px;
    }

    .modal-content {
        width: 90%;
        max-width: 400px;
        padding: 24px 20px;
    }

    input[type="text"],
    input[type="password"],
    input[type="url"] {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }

    .notification-container {
        bottom: 80px;
        right: 16px;
        left: 16px;
        max-width: calc(100% - 32px);
    }

    .notification {
        width: 100%;
        min-width: unset;
    }

    .stream-grid.single-stream .stream-card {
        height: calc(100vh - 200px);
        min-height: 400px;
    }

    .room-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .room-browser-toolbar {
        flex-direction: column;
    }

    .create-room-btn {
        width: 100%;
        justify-content: center;
    }
}
