/* ============================================================
   wacha.net — room page (chat.php and guest.php)
   Depends on css/theme.css for tokens.
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-main);
    height: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

/* --- NAV ---------------------------------------------------- */
.cinema-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border-bottom: 1px solid var(--line);
}
.cinema-nav .brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main);
    text-decoration: none;
}
.cinema-nav .brand .net, .cinema-nav .brand span { color: var(--wacha-orange); }
.cinema-nav .nav-right, .cinema-nav .nav-actions { display: flex; align-items: center; gap: 8px; }
.cinema-nav .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 999px;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.cinema-nav .back-link:hover { color: #fff; background: var(--glass); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--glass);
    color: var(--text-dim);
    font-size: 0.85rem;
    cursor: pointer;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); }
.icon-btn.is-active { color: var(--wacha-orange); border-color: rgba(241, 99, 41, 0.4); background: rgba(241, 99, 41, 0.12); }
.icon-btn.text-danger { color: var(--danger) !important; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }

.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.user-dropdown:hover, .user-dropdown.open { background: var(--glass); border-color: var(--line); }
.user-dropdown img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.user-dropdown .username { color: var(--text-main); font-size: 0.8rem; font-weight: 600; }
.user-dropdown .caret { font-size: 0.6rem; color: var(--text-faint); }
.user-dropdown .dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    min-width: 170px;
    padding: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    z-index: 200;
}
.user-dropdown:hover .dropdown-menu, .user-dropdown.open .dropdown-menu { display: block; }
.user-dropdown .dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.8rem;
    text-decoration: none;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.user-dropdown .dropdown-menu a:hover { background: var(--glass); color: #fff; }
.user-dropdown .dropdown-menu a.text-danger { color: var(--danger); }
.user-dropdown .dropdown-menu a.text-danger:hover { background: rgba(239, 68, 68, 0.1); }

/* --- LAYOUT ------------------------------------------------- */
.cinema-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* --- VIDEO WING --------------------------------------------- */
.video-wing {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
    min-width: 0;
}
.player-wrapper { flex: 1; position: relative; min-height: 0; background: #000; }
.player-wrapper #player, .player-wrapper iframe {
    position: absolute; inset: 0; width: 100%; height: 100%;
}

/* top overlay: room, live, title, viewers, sync */
.video-overlay-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 28px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 60%, transparent 100%);
    pointer-events: none;
    transition: opacity var(--dur) var(--ease);
}
.video-overlay-header > * { pointer-events: auto; }
.room-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(9, 9, 11, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.room-badge i { color: var(--wacha-orange); font-size: 0.7rem; }
.room-badge.live { color: #ffb08a; border-color: rgba(241, 99, 41, 0.4); background: rgba(241, 99, 41, 0.18); }
.room-badge.live i { font-size: 0.5rem; animation: chip-pulse 1.8s var(--ease) infinite; border-radius: 50%; }
.overlay-title {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.overlay-title:empty { display: none; }
.room-badge.sync i { color: var(--live); }
.room-badge.sync[data-state="syncing"] i { color: var(--warning); }
.room-badge.sync[data-state="host"] i { color: var(--wacha-orange); }

/* bottom overlay: fullscreen + options, shows on hover */
.video-overlay-tools {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(6px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.player-wrapper:hover .video-overlay-tools,
.player-wrapper:focus-within .video-overlay-tools,
.video-overlay-tools:hover { opacity: 1; transform: none; }
@media (hover: none) { .video-overlay-tools { opacity: 1; transform: none; } }
.video-overlay-tools .icon-btn { width: 32px; height: 32px; border-color: transparent; background: transparent; color: #fff; }
.video-overlay-tools .icon-btn:hover { background: rgba(255, 255, 255, 0.15); color: var(--wacha-orange); }
.video-overlay-tools .vo-gear { width: 32px; height: 32px; border-radius: 999px; }

/* --- HOST CONTROLS ------------------------------------------ */
.video-controls-bar {
    flex: none;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 10px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.video-controls-bar .controls-row { display: flex; align-items: center; gap: 10px; }

.transport-row { gap: 12px; }
.ctrl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--glass);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.ctrl-btn.btn-primary { background: var(--wacha-orange); border-color: var(--wacha-orange); color: #fff; }
.ctrl-btn.btn-primary:hover { background: var(--wacha-orange-hover); border-color: var(--wacha-orange-hover); }
.ctrl-btn.btn-icon { width: 36px; padding: 0; }
.ctrl-btn.btn-play-pause { width: 40px; height: 40px; background: var(--wacha-orange); border-color: var(--wacha-orange); color: #fff; font-size: 0.9rem; }
.ctrl-btn.btn-play-pause:hover { background: var(--wacha-orange-hover); }
.ctrl-btn.btn-play-pause .fa-pause { display: none; }
.ctrl-btn.btn-play-pause.is-playing .fa-pause { display: inline-block; }
.ctrl-btn.btn-play-pause.is-playing .fa-play { display: none; }

.seek-time {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
    min-width: 44px;
    text-align: center;
}
.seek-wrap { position: relative; flex: 1; display: flex; align-items: center; height: 24px; }
.seek-bar {
    --fill: 0%;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 5px;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(90deg, var(--wacha-orange) var(--fill), rgba(255, 255, 255, 0.14) var(--fill));
}
.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--wacha-orange);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform var(--dur) var(--ease);
}
.seek-bar:hover::-webkit-slider-thumb { transform: scale(1.15); }
.seek-bar::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--wacha-orange);
    cursor: pointer;
}
.seek-tip {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translate(-50%, -4px);
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--line-strong);
    color: #fff;
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.seek-wrap:hover .seek-tip { opacity: 1; }

.url-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 4px 4px 4px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.url-pill:focus-within { border-color: rgba(241, 99, 41, 0.6); box-shadow: 0 0 0 3px rgba(241, 99, 41, 0.15); }
.url-pill i.fab { color: var(--text-faint); }
.url-pill input[type="text"] {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text-main);
    font-size: 0.85rem;
    padding: 6px 0;
}
.url-pill input::placeholder { color: var(--text-faint); }
.url-pill .ctrl-btn { height: 32px; }

.video-wing.controls-hidden .video-controls-bar { display: none !important; }

/* --- SOCIAL WING -------------------------------------------- */
.social-wing {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--surface);
    border-left: 1px solid var(--line);
    overflow: hidden;
}

.chat-header {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.side-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-tab i { font-size: 0.8rem; }
.side-tab:hover { color: #fff; background: var(--glass); }
.side-tab.is-active { color: #fff; background: rgba(241, 99, 41, 0.14); }
.side-tab.is-active i { color: var(--wacha-orange); }
.side-tab .count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-main);
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.side-tab.has-unread::after {
    content: '';
    position: absolute;
    top: 7px;
    right: 8px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--wacha-orange);
    box-shadow: 0 0 0 2px var(--surface);
}
.chat-header .spacer { flex: 1; }
/* people toggle (room_users.js) lives in the tab bar */
.chat-header .user-list-toggle {
    position: static;
    width: auto;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    box-shadow: none;
}
.chat-header .user-list-toggle:hover { color: #fff; background: var(--glass); }
.chat-header .user-list-toggle .user-count-badge {
    position: static;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-main);
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.side-panel { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-panel[hidden] { display: none; }

/* --- CHAT --------------------------------------------------- */
.chat-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
#users-conversation { display: flex; flex-direction: column; gap: 12px; }

.chat-day {
    align-self: center;
    margin: 4px 0;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.msg { display: flex; gap: 10px; align-items: flex-end; }
.msg .avatar { flex: none; width: 32px; }
.msg .avatar img { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; display: block; }
.msg > div:not(.avatar), .msg .content { min-width: 0; max-width: 78%; display: flex; flex-direction: column; }
.msg .msg-meta {
    order: -1;
    margin: 0 0 3px;
    padding: 0 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-dim);
}
.msg .msg-meta .msg-time { font-weight: 400; color: var(--text-faint); }
.msg .bubble {
    position: relative;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.msg.other .bubble { background: var(--surface-3); color: var(--text-main); border-bottom-left-radius: 5px; }
.msg.me { flex-direction: row-reverse; }
.msg.me > div:not(.avatar), .msg.me .content { align-items: flex-end; }
.msg.me .msg-meta { text-align: right; }
.msg.me .bubble {
    background: rgba(241, 99, 41, 0.16);
    border: 1px solid rgba(241, 99, 41, 0.35);
    color: #fff;
    border-bottom-right-radius: 5px;
}
/* continuation of a run from the same sender: no avatar or name, tighter gap */
.msg.cont { margin-top: -7px; }
.msg.cont .avatar img { visibility: hidden; height: 0; }
.msg.cont .msg-meta { display: none; }
.msg.cont.other .bubble { border-bottom-left-radius: 16px; border-top-left-radius: 5px; }
.msg.cont.me .bubble { border-bottom-right-radius: 16px; border-top-right-radius: 5px; }
/* hover timestamp */
.msg .bubble-time {
    position: absolute;
    bottom: 2px;
    font-size: 0.62rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-faint);
    white-space: nowrap;
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.msg.other .bubble-time { left: calc(100% + 8px); }
.msg.me .bubble-time { right: calc(100% + 8px); }
.msg:hover .bubble-time { opacity: 1; }

.msg.system-message { justify-content: center; }
.msg.system-message .avatar { display: none; }
.msg.system-message > div, .msg.system-message .content { max-width: 90%; align-items: center; }
.msg.system-message .bubble {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--line);
    color: var(--text-faint);
    font-size: 0.72rem;
    font-style: normal;
    text-align: center;
}
.msg.system-message .msg-meta { display: none; }

.chat-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: var(--text-faint);
    font-size: 0.85rem;
    text-align: center;
}
.chat-empty i { font-size: 1.6rem; color: var(--wacha-orange); opacity: 0.7; }
.chat-scroll:not(:has(.msg)) .chat-empty { display: flex; }

.jump-latest {
    position: absolute;
    left: 50%;
    bottom: 76px;
    transform: translate(-50%, 12px);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid rgba(241, 99, 41, 0.4);
    background: var(--surface-3);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.jump-latest.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.jump-latest.has-new { border-color: var(--wacha-orange); background: var(--wacha-orange); }

.chat-input-section, .chat-input-area {
    flex: none;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.chat-input-section form, .chat-input-area form { display: flex; align-items: center; gap: 8px; }
.chat-input {
    flex: 1;
    min-width: 0;
    background: var(--surface-2) !important;
    border: 1px solid var(--line-strong) !important;
    border-radius: 999px !important;
    padding: 11px 16px !important;
    color: var(--text-main) !important;
    font-size: 0.85rem !important;
    font-family: inherit;
    outline: none;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chat-input:focus { border-color: var(--wacha-orange) !important; box-shadow: 0 0 0 3px rgba(241, 99, 41, 0.15); }
.chat-input::placeholder { color: var(--text-faint); }
.chat-send {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--wacha-orange);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(241, 99, 41, 0.3);
    transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.chat-send:hover { background: var(--wacha-orange-hover); transform: translateY(-1px); }
.chat-input-section input[type="hidden"] { display: none; }

/* --- QUEUE PANEL -------------------------------------------- */
.queue-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; scrollbar-width: thin; }
.queue-panel .queue-hint { font-size: 0.72rem; color: var(--text-faint); margin: 0 4px 10px; }
.queue-panel ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--line);
    cursor: grab;
    transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.queue-item:hover { border-color: var(--line-strong); background: var(--surface-3); }
.queue-item.ui-sortable-helper { box-shadow: var(--shadow-soft); cursor: grabbing; }
.queue-item .q-index {
    width: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-faint);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.queue-item .q-thumb {
    flex: none;
    width: 72px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    background: var(--surface-3) center / cover no-repeat;
}
.queue-item .q-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.queue-item .q-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.queue-item .q-sub { font-size: 0.68rem; color: var(--text-faint); }
.queue-item .q-handle { color: var(--text-faint); font-size: 0.75rem; }
.queue-item .remove-queue-item {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.queue-item .remove-queue-item:hover { color: var(--danger); background: rgba(239, 68, 68, 0.12); }
.queue-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 16px;
    color: var(--text-faint);
    font-size: 0.8rem;
    text-align: center;
}
.queue-empty i { font-size: 1.5rem; color: var(--wacha-orange); opacity: 0.7; }
.queue-panel ul:empty + .queue-empty { display: flex; }

/* --- TOASTS ------------------------------------------------- */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 340px;
    padding: 10px 12px 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    border-left: 3px solid var(--text-dim);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    color: var(--text-main);
    font-size: 0.8rem;
    animation: toast-in var(--dur) var(--ease);
}
.toast .toast-icon { font-size: 0.9rem; color: var(--text-dim); }
.toast .toast-body { flex: 1; padding: 0; }
.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.toast .toast-close:hover { color: #fff; }
.toast.toast-success { border-left-color: var(--live); } .toast.toast-success .toast-icon { color: var(--live); }
.toast.toast-error   { border-left-color: var(--danger); } .toast.toast-error .toast-icon { color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); } .toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info    { border-left-color: var(--wacha-orange); } .toast.toast-info .toast-icon { color: var(--wacha-orange); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- MOBILE ------------------------------------------------- */
.controls-fab { display: none; }

@media (max-width: 1100px) {
    .cinema-layout { display: flex; flex-direction: column; }
    .video-wing { flex: 0 0 auto; }
    .player-wrapper { aspect-ratio: 16 / 9; flex: none; }
    .social-wing {
        flex: 1;
        min-height: 200px;
        border-left: none;
        border-top: 1px solid var(--line);
    }
}

@media (max-width: 600px) {
    .cinema-nav { padding: 0 12px; height: 50px; }
    .cinema-nav .brand { font-size: 0.95rem; }
    .cinema-nav .back-link, .user-dropdown .username, .user-dropdown .caret { display: none; }
    .player-wrapper { max-height: 38vh; }
    .video-overlay-header { padding: 10px 12px 24px; }
    .overlay-title { display: none; }
    .chat-scroll { padding: 12px 10px; }
    .msg > div:not(.avatar), .msg .content { max-width: 84%; }
    .msg .bubble { font-size: 0.9rem; }
    .msg .bubble-time { display: none; }
    .chat-input-section, .chat-input-area { padding: 10px; }

    /* host controls become a bottom sheet opened from a floating button */
    .controls-fab {
        display: inline-flex;
        position: fixed;
        right: 14px;
        bottom: 74px;
        z-index: 90;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        border: none;
        background: var(--wacha-orange);
        color: #fff;
        font-size: 1rem;
        box-shadow: 0 8px 24px rgba(241, 99, 41, 0.4);
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
    .video-wing.controls-hidden ~ .controls-fab { display: none; }
    .video-controls-bar {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 95;
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line-strong);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
        transform: translateY(110%);
        transition: transform 240ms var(--ease);
    }
    .video-wing.sheet-open .video-controls-bar { transform: none; }
    .video-controls-bar::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        margin: -4px auto 6px;
        border-radius: 2px;
        background: var(--line-strong);
    }
    .jump-latest { bottom: 70px; }
}

/* guest room: nav chips */
.nav-user { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 0.8rem; font-weight: 500; }
.nav-user img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.nav-user .chip { padding: 3px 7px; }
.cinema-nav .btn-ghost, .cinema-nav .btn-accent { padding: 8px 14px; font-size: 0.8rem; }
@media (max-width: 600px) { .nav-user span:not(.chip) { display: none; } }
/* keep the player toolbar visible while the options panel is open */
.video-overlay-tools:has(.vo-gear.is-open) { opacity: 1; transform: none; }
