:root {
    --wp-bg: #060606;
    --wp-surface: #111214;
    --wp-surface-2: #191a1d;
    --wp-border: #323236;
    --wp-text: #f6f0e6;
    --wp-muted: #a9a095;
    --wp-accent: #b99045;
    --wp-accent-2: #d8bd7a;
    --wp-danger: #ef4444;
    --wp-ok: #47b881;
    --wp-info: #7aa7c7;
    --wp-caption-size: 18px;
    --wp-caption-color: #fff;
    --wp-caption-bg: rgba(0,0,0,.65);
    --wp-caption-bottom: 8%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(900px 420px at 72% -14%, rgba(216, 189, 122, .12), transparent 58%),
        linear-gradient(180deg, #14120f 0%, #090909 52%, var(--wp-bg) 100%);
    color: var(--wp-text);
    font-family: Vazirmatn, Vazir, sans-serif;
}

.wp-container {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
}

.wp-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.wp-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--wp-text);
    font-weight: 900;
}

.wp-logo img {
    height: 38px;
}

.wp-nav {
    display: flex;
    gap: 6px;
}

.nav-link.active {
    color: #111827;
    background: linear-gradient(90deg, var(--wp-accent), var(--wp-accent-2));
}

.wp-main {
    padding: 32px 0 max(32px, env(safe-area-inset-bottom));
}

.app-screen[hidden],
[hidden] {
    display: none !important;
}

.welcome-screen {
    min-height: calc(100vh - 160px);
    display: grid;
    align-content: center;
    gap: 26px;
}

.welcome-hero {
    text-align: center;
    max-width: 760px;
    margin-inline: auto;
}

.welcome-logo {
    height: 64px;
    margin-bottom: 14px;
}

.eyebrow,
.step-label {
    color: var(--wp-accent-2);
    font-weight: 900;
    margin: 0 0 8px;
}

.welcome-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(2.4rem, 7vw, 5rem);
    line-height: 1.15;
}

.welcome-hero p,
.privacy-note,
.help-text,
.mic-card p,
.center-panel p,
.step-panel p {
    color: #cbd5e1;
    line-height: 1.9;
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    max-width: 860px;
    margin-inline: auto;
}

.role-card,
.panel {
    background: rgba(15, 23, 42, .9);
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}

.role-card {
    display: grid;
    gap: 12px;
    align-content: start;
}

.role-card h2,
.panel h2,
.panel h3 {
    margin: 0;
}

.role-icon {
    width: 54px;
    height: 54px;
    display: inline-grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(245, 158, 11, .13);
    color: var(--wp-accent-2);
    font-size: 1.55rem;
}

.privacy-note,
.back-site-link {
    text-align: center;
    max-width: 760px;
    margin-inline: auto;
}

.back-site-link {
    color: var(--wp-muted);
}

.back-site-link:hover {
    color: var(--wp-accent-2);
}

.narrow-screen {
    min-height: calc(100vh - 150px);
    display: grid;
    place-items: center;
}

.center-panel,
.step-panel {
    width: min(560px, 100%);
}

.restore-panel,
.service-panel {
    display: grid;
    gap: 14px;
    justify-items: start;
}

.restore-panel .loader,
.service-panel .loader {
    justify-self: center;
}

.restore-status {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(56, 189, 248, .24);
    background: rgba(56, 189, 248, .08);
    color: #dbeafe;
}

.service-status-list {
    width: 100%;
    display: grid;
    gap: 10px;
    margin: 0;
}

.service-status-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 12px;
    background: rgba(15, 23, 42, .65);
}

.service-status-list dt {
    color: #cbd5e1;
    font-weight: 800;
}

.service-status-list dd {
    margin: 0;
    color: var(--wp-accent-2);
    font-weight: 900;
}

.command-hint {
    direction: ltr;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, .28);
    background: rgba(0, 0, 0, .26);
    color: #fde68a;
}

.loader {
    display: inline-block;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(245, 158, 11, .28);
    border-top-color: var(--wp-accent-2);
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

label,
fieldset legend {
    display: block;
    color: #e2e8f0;
    font-weight: 800;
    font-size: .92rem;
    margin: 14px 0 8px;
}

input,
button {
    font: inherit;
}

input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--wp-border);
    border-radius: 11px;
    background: #111827;
    color: var(--wp-text);
    padding: 10px 12px;
    outline: none;
}

input:focus,
button:focus-visible {
    border-color: var(--wp-accent-2);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, .25);
}

button:disabled {
    opacity: .65;
    cursor: wait;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-text-btn,
.danger-btn {
    min-height: 46px;
    border-radius: 11px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 900;
    padding: 0 18px;
    border: 1px solid transparent;
}

.primary-btn {
    background: linear-gradient(90deg, var(--wp-accent), var(--wp-accent-2));
    color: #111827;
}

.primary-btn.is-ready {
    background: linear-gradient(90deg, #16a34a, #86efac);
}

.secondary-btn,
.icon-text-btn {
    background: #1f2937;
    color: var(--wp-text);
    border-color: var(--wp-border);
}

.ghost-btn {
    background: transparent;
    color: var(--wp-muted);
    border-color: transparent;
}

.danger-btn {
    background: rgba(239, 68, 68, .14);
    color: #fecaca;
    border-color: rgba(239, 68, 68, .42);
}

.action-row,
.button-row,
.danger-row,
.invite-row,
.reaction-buttons,
.control-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.field-error {
    min-height: 22px;
    margin: 6px 0 0;
    color: #fca5a5;
    font-size: .88rem;
}

.diagnostic-code {
    color: var(--wp-muted);
    font-size: .9rem;
}

.diagnostic-code code {
    direction: ltr;
    display: inline-block;
    color: var(--wp-accent);
}

.auth-error-help {
    margin: 6px 0 0;
    color: #cbd5e1;
    line-height: 1.9;
}

.diagnostic-details {
    width: 100%;
    margin: 14px 0;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, .18);
    border-radius: 12px;
    background: rgba(15, 23, 42, .62);
    text-align: start;
}

.diagnostic-details summary {
    cursor: pointer;
    color: #f8d57e;
    font-weight: 800;
}

.safe-report {
    direction: ltr;
    max-height: 180px;
    overflow: auto;
    padding: 10px;
    border-radius: 10px;
    background: rgba(2, 6, 23, .78);
    color: #dbeafe;
    font-size: .78rem;
    text-align: left;
    white-space: pre-wrap;
}

.success-note {
    color: #bbf7d0;
    background: rgba(34, 197, 94, .12);
    border: 1px solid rgba(34, 197, 94, .32);
    border-radius: 10px;
    padding: 9px 11px;
}

.segmented-field {
    border: 1px solid var(--wp-border);
    border-radius: 12px;
    padding: 12px;
    margin: 18px 0 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.segmented-field label {
    margin: 0;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    border: 1px solid var(--wp-border);
    border-radius: 10px;
    background: #111827;
    cursor: pointer;
}

.segmented-field input {
    width: auto;
    min-height: auto;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.check-row input {
    width: 20px;
    min-height: 20px;
    margin-top: 3px;
}

.top-banner,
.status-banner {
    background: rgba(245, 158, 11, .14);
    border: 1px solid rgba(245, 158, 11, .42);
    color: #fde68a;
    border-radius: 12px;
    padding: 12px 14px;
    line-height: 1.8;
    margin-bottom: 16px;
}

.lobby-screen {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .72fr);
    gap: 18px;
    align-items: start;
}

.lobby-main {
    display: grid;
    gap: 16px;
    background:
        linear-gradient(135deg, rgba(216, 189, 122, .08), transparent 30%),
        linear-gradient(180deg, rgba(25, 26, 29, .98), rgba(8, 8, 9, .98));
    border-color: rgba(216, 189, 122, .28);
}

.room-code {
    direction: ltr;
    text-align: center;
    letter-spacing: .24em;
    font-size: clamp(1.5rem, 5vw, 2.4rem);
    font-weight: 900;
    color: var(--wp-accent-2);
    background: #11100e;
    text-shadow: 0 1px 28px rgba(216, 189, 122, .18);
    border-radius: 14px;
    padding: 14px;
}

.invite-qr-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
    width: min(100%, 380px);
    padding: 12px;
    border: 1px dashed rgba(216, 189, 122, .34);
    border-radius: 14px;
    background: rgba(255, 255, 255, .035);
}

.invite-qr-card canvas {
    width: 108px;
    height: 108px;
    border-radius: 10px;
    background: #f8fafc;
}

.invite-qr-card p,
.micro-note {
    margin: 0;
    color: var(--wp-muted);
    font-size: .88rem;
}

.compact-code {
    font-size: 1.25rem;
    letter-spacing: .18em;
}

.invite-row input {
    flex: 1 1 220px;
    direction: ltr;
}

.lobby-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.lobby-status-grid > div,
.room-preview {
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--wp-border);
    border-radius: 12px;
    padding: 12px;
}

.lobby-status-grid span {
    display: block;
    color: var(--wp-muted);
    font-size: .82rem;
}

.participant-cards {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.participant {
    display: grid;
    gap: 5px;
    padding: 12px;
    background: rgba(255, 255, 255, .035);
    border: 1px solid var(--wp-border);
    border-radius: 12px;
}

.participant span,
.chat-meta,
.empty-state {
    color: var(--wp-muted);
    font-size: .84rem;
    line-height: 1.7;
}

.ready-btn {
    width: min(280px, 100%);
    justify-self: start;
}

.room-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
    gap: 18px;
    align-items: start;
}

.cinema-column {
    display: grid;
    gap: 12px;
}

.video-shell {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    border: 1px solid rgba(216, 189, 122, .30);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .58), inset 0 0 0 1px rgba(255, 255, 255, .035);
    aspect-ratio: 16 / 9;
}

body.watch-party-cinema-lock {
    position: fixed;
    inset-inline: 0;
    width: 100%;
    overflow: hidden;
}

.video-shell.cinema-mode-active {
    position: fixed;
    z-index: 10000;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    padding:
        env(safe-area-inset-top)
        env(safe-area-inset-right)
        env(safe-area-inset-bottom)
        env(safe-area-inset-left);
    background: #000;
    display: grid;
    place-items: center;
    box-shadow: none;
}

.video-shell.cinema-mode-active video {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
    object-fit: contain;
}

.cinema-exit-button,
.cinema-orientation-hint {
    position: fixed;
    z-index: 10001;
    right: max(16px, env(safe-area-inset-right));
    color: #f8fafc;
    background: rgba(7, 10, 18, .82);
    border: 1px solid rgba(245, 158, 11, .45);
    backdrop-filter: blur(14px);
}

.cinema-exit-button {
    top: max(14px, env(safe-area-inset-top));
    min-height: 44px;
    border-radius: 999px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 900;
}

.cinema-orientation-hint {
    left: max(16px, env(safe-area-inset-left));
    bottom: max(18px, env(safe-area-inset-bottom));
    border-radius: 14px;
    padding: 10px 14px;
    text-align: center;
}

video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.video-shell [hidden] {
    display: none !important;
}

.mediabunny-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
    object-fit: contain;
}

.video-shell.cinema-mode-active .mediabunny-canvas {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100dvh;
}

video::cue {
    color: var(--wp-caption-color);
    background: var(--wp-caption-bg);
    font-size: var(--wp-caption-size);
    line-height: 1.75;
}

.reaction-layer,
.autoplay-overlay {
    position: absolute;
    inset: 0;
}

.reaction-layer {
    pointer-events: none;
    overflow: hidden;
}

.autoplay-overlay {
    display: grid;
    place-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, .68);
    text-align: center;
    padding: 20px;
}

.reaction-float {
    position: absolute;
    bottom: 16%;
    font-size: clamp(2rem, 5vw, 4rem);
    animation: float-reaction 1.8s ease-out forwards;
}

@keyframes float-reaction {
    from { transform: translateY(0) scale(.8); opacity: 0; }
    20% { opacity: 1; }
    to { transform: translateY(-220px) scale(1.3); opacity: 0; }
}

.movie-controls {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(216, 189, 122, .22);
    border-radius: 14px;
    background: rgba(12, 12, 13, .94);
    transition: opacity .22s ease, transform .22s ease;
}

.movie-controls.controls-auto-hidden {
    opacity: .18;
    transform: translateY(-4px);
}

.movie-controls.controls-auto-hidden:focus-within,
.movie-controls.controls-auto-hidden:hover {
    opacity: 1;
    transform: none;
}

.mic-level {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.mic-level span {
    display: block;
    height: 100%;
    transform-origin: right center;
    transform: scaleX(.08);
    transition: transform .25s ease;
    background: linear-gradient(90deg, var(--wp-ok), var(--wp-accent-2));
}

.voice-status,
.voice-partner-status {
    margin: 6px 0 0;
    color: #e5e7eb;
    font-size: .92rem;
}

.voice-partner-status {
    color: #94a3b8;
}

.voice-actions {
    margin-top: 8px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.primary-control-row {
    flex-wrap: nowrap;
}

.control-icon-btn {
    min-height: 44px;
    border: 1px solid var(--wp-border);
    border-radius: 10px;
    background: #1f2937;
    color: var(--wp-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 12px;
    cursor: pointer;
    font-weight: 900;
}

.control-icon-btn[aria-pressed="true"] {
    border-color: rgba(245, 158, 11, .62);
    color: var(--wp-accent-2);
}

.shared-control {
    box-shadow: inset 0 -2px 0 rgba(245, 158, 11, .28);
}

.local-control {
    box-shadow: inset 0 -2px 0 rgba(56, 189, 248, .18);
}

.time-readout,
.sync-status,
.audio-status {
    color: #cbd5e1;
    font-weight: 800;
    white-space: nowrap;
}

.sync-status {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(34, 197, 94, .3);
    color: #bbf7d0;
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(34, 197, 94, .1);
}

.audio-status {
    min-height: 20px;
    margin: 0;
    font-size: .88rem;
}

.progress-wrap {
    flex: 1 1 220px;
    min-width: 140px;
    margin: 0;
    position: relative;
}

.progress-wrap input {
    width: 100%;
    min-height: 44px;
    padding-inline: 0;
}

.seek-preview {
    position: absolute;
    bottom: calc(100% + 4px);
    inset-inline-start: 0;
    border-radius: 8px;
    padding: 3px 7px;
    background: #020617;
    border: 1px solid var(--wp-border);
    color: #fde68a;
    font-size: .78rem;
}

.compact-control {
    min-height: 44px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--wp-border);
    border-radius: 10px;
    background: #111827;
    color: #cbd5e1;
    font-size: .86rem;
}

.compact-control select,
.compact-control input[type="range"] {
    width: auto;
    min-height: 34px;
}

.compact-control input[type="range"] {
    inline-size: 108px;
    padding: 0;
}

.compact-control select {
    border-radius: 8px;
    border: 1px solid var(--wp-border);
    background: #020617;
    color: var(--wp-text);
    padding: 7px 9px;
}

.side-panel {
    display: grid;
    gap: 12px;
}

.side-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    background: rgba(15, 23, 42, .75);
    border: 1px solid var(--wp-border);
    border-radius: 14px;
    padding: 6px;
}

.side-tab {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--wp-muted);
    cursor: pointer;
    font-weight: 900;
}

.side-tab.active {
    background: #1f2937;
    color: var(--wp-text);
}

.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--wp-accent);
    color: #111827;
    font-size: .75rem;
}

.pill {
    color: #111827;
    background: var(--wp-accent-2);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: .78rem;
    font-weight: 900;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.chat-messages {
    height: 260px;
    overflow: auto;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 4px 2px;
}

.chat-message {
    background: #111827;
    border-radius: 10px;
    padding: 10px;
}

.chat-message p {
    margin: 4px 0 0;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.reaction-buttons button {
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid var(--wp-border);
    background: #1f2937;
    cursor: pointer;
}

.field-stack {
    display: grid;
    gap: 10px;
}

.countdown-number {
    font-size: clamp(5rem, 18vw, 12rem);
    font-weight: 900;
    color: var(--wp-accent-2);
    line-height: 1;
}

.toast-root {
    position: fixed;
    left: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    display: grid;
    gap: 10px;
    z-index: 100;
    max-width: min(360px, calc(100vw - 32px));
}

.toast {
    background: #111827;
    border: 1px solid var(--wp-border);
    color: var(--wp-text);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .36);
}

.toast-error {
    border-color: rgba(239, 68, 68, .5);
    color: #fecaca;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    background: rgba(2, 6, 23, .76);
    padding: 20px;
}

.dialog {
    width: min(420px, 100%);
    background: #0f172a;
    border: 1px solid var(--wp-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

body[data-wp-state="active-room"] {
    background: radial-gradient(circle at 50% 0, rgba(216, 189, 122, .10), transparent 34%), #050506;
}

body[data-wp-state="active-room"] .room-grid {
    width: min(1440px, calc(100% - 36px));
    grid-template-columns: minmax(0, 1fr) minmax(360px, 30%);
    gap: 22px;
    align-items: start;
}

body[data-wp-state="active-room"] .cinema-column {
    min-width: 0;
}

body[data-wp-state="active-room"] .video-shell {
    border-color: rgba(216, 189, 122, .30);
    background: #020202;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .58);
}

body[data-wp-state="active-room"] .movie-controls,
body[data-wp-state="active-room"] .side-panel > .panel,
body[data-wp-state="active-room"] .control-strip {
    background: rgba(12, 13, 15, .92);
    border-color: rgba(216, 189, 122, .18);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .26);
}

body[data-wp-state="active-room"] .side-panel {
    gap: 14px;
}

body[data-wp-state="active-room"] .side-tabs {
    gap: 8px;
    padding: 7px;
    border-color: rgba(216, 189, 122, .16);
    background: rgba(6, 8, 11, .9);
}

body[data-wp-state="active-room"] .side-tab.active {
    background: rgba(216, 189, 122, .18);
    color: #f8e7bd;
}

#tab-room {
    display: grid;
    gap: 18px;
}

#tab-room[hidden] {
    display: none;
}

#tab-room .compact-code {
    padding: 14px;
    border: 1px solid rgba(216, 189, 122, .24);
    border-radius: 14px;
    background: rgba(2, 6, 23, .52);
    text-align: center;
}

#active-participants {
    gap: 14px;
}

#active-participants .participant {
    padding: 15px;
    border-radius: 14px;
    background: rgba(15, 23, 42, .66);
}

.settings-section,
.shared-settings-note {
    display: grid;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 14px;
    background: rgba(2, 6, 23, .34);
}

.settings-section h3,
.shared-settings-note h3,
.chat-panel-head h2 {
    margin: 0;
}

.settings-section-head p,
.privacy-note p,
.shared-settings-note p,
.chat-panel-head p {
    margin: 4px 0 0;
    color: var(--wp-muted);
    line-height: 1.8;
}

.chat-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.chat-messages {
    min-height: 360px;
    height: min(52vh, 520px);
    gap: 4px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, .14);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(5, 7, 10, .64), rgba(15, 23, 42, .38));
}

.chat-empty {
    align-self: center;
    justify-self: center;
    display: grid;
    gap: 6px;
    max-width: 260px;
    color: var(--wp-muted);
    text-align: center;
}

.chat-empty strong {
    color: var(--wp-text);
}

.chat-message {
    display: grid;
    gap: 4px;
    max-width: 86%;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-top: 12px;
}

.chat-message.is-grouped {
    margin-top: 3px;
}

.chat-message.is-own {
    justify-self: end;
}

.chat-message.is-partner {
    justify-self: start;
}

.chat-sender {
    padding-inline: 6px;
    color: #f8d57e;
    font-size: .78rem;
    font-weight: 800;
}

.chat-bubble {
    padding: 10px 12px 8px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, .14);
}

.chat-message.is-own .chat-bubble {
    border-color: rgba(216, 189, 122, .28);
    background: rgba(96, 72, 31, .46);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 6px;
}

.chat-message.is-partner .chat-bubble {
    background: rgba(30, 41, 59, .70);
    border-bottom-left-radius: 6px;
}

.chat-bubble p {
    margin: 0;
    line-height: 1.85;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-meta {
    margin-top: 4px;
    color: rgba(226, 232, 240, .62);
    font-size: .72rem;
}

.new-message-pill {
    position: sticky;
    bottom: 86px;
    justify-self: center;
    z-index: 2;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(216, 189, 122, .35);
    border-radius: 999px;
    background: rgba(216, 189, 122, .18);
    color: #f8e7bd;
}

.chat-form {
    --chat-composer-bg: rgba(17, 24, 39, .94);
    --chat-composer-bg-active: rgba(20, 29, 45, .98);
    --chat-composer-border: rgba(148, 163, 184, .18);
    --chat-composer-border-active: rgba(216, 189, 122, .62);
    --chat-composer-glow: rgba(185, 144, 69, .16);
    position: sticky;
    bottom: 0;
    display: grid;
    gap: 8px;
    min-width: 0;
    padding-top: 12px;
    background: linear-gradient(180deg, transparent, rgba(12, 13, 15, .96) 24%);
}

.chat-form .reaction-buttons {
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .12);
    border-radius: 16px;
    background: rgba(15, 23, 42, .38);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

.chat-form .reaction-buttons button {
    border-color: rgba(148, 163, 184, .18);
    background: rgba(31, 41, 55, .74);
    color: var(--wp-text);
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.chat-form .reaction-buttons button:hover {
    border-color: rgba(216, 189, 122, .42);
    background: rgba(55, 65, 81, .72);
    transform: translateY(-1px);
}

.chat-composer {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--chat-composer-border);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 42%),
        var(--chat-composer-bg);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .045),
        0 14px 34px rgba(0, 0, 0, .18);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.chat-composer:focus-within {
    border-color: var(--chat-composer-border-active);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 46%),
        var(--chat-composer-bg-active);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .05),
        0 0 0 3px var(--chat-composer-glow),
        0 18px 38px rgba(0, 0, 0, .24);
}

.chat-composer textarea {
    display: block;
    width: 100%;
    min-height: 56px;
    max-height: 146px;
    padding: 3px 2px 0;
    overflow-y: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #fff7ed;
    font: inherit;
    font-size: .96rem;
    line-height: 1.7;
    outline: none;
    resize: none;
    text-align: right;
    caret-color: var(--wp-accent-2);
}

.chat-composer textarea::placeholder {
    color: rgba(226, 214, 196, .48);
}

.chat-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.chat-count {
    min-height: 20px;
    color: rgba(226, 214, 196, .38);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
    text-align: left;
    transition: color .18s ease;
}

.chat-count.is-warning {
    color: #d8bd7a;
}

.chat-count.is-limit {
    color: #f8d57e;
}

.chat-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    min-width: 96px;
    padding: 0 14px;
    border: 1px solid rgba(216, 189, 122, .32);
    border-radius: 12px;
    background: linear-gradient(180deg, #e0c583, #b99045);
    color: #101820;
    cursor: pointer;
    font: inherit;
    font-size: .88rem;
    font-weight: 950;
    line-height: 1;
    transition: transform .16s ease, border-color .16s ease, filter .16s ease, opacity .16s ease;
}

.chat-send-button svg {
    width: 18px;
    height: 18px;
    transform: scaleX(-1);
}

.chat-send-button:hover:not(:disabled) {
    border-color: rgba(248, 213, 126, .72);
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.chat-send-button:active:not(:disabled) {
    transform: translateY(0) scale(.98);
}

.chat-send-button:focus-visible {
    outline: 2px solid rgba(248, 213, 126, .72);
    outline-offset: 2px;
}

.chat-send-button:disabled {
    border-color: rgba(148, 163, 184, .16);
    background: rgba(55, 65, 81, .62);
    color: rgba(226, 214, 196, .42);
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}

.reaction-float {
    display: grid;
    justify-items: center;
    gap: 2px;
    max-width: 108px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(2, 6, 23, .62);
}

.reaction-float strong {
    font-size: 2rem;
    line-height: 1;
}

.reaction-float small {
    max-width: 92px;
    overflow: hidden;
    color: #fff7ed;
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 920px) {
    .role-grid,
    .lobby-screen,
    .room-grid {
        grid-template-columns: 1fr;
    }

    .side-panel {
        order: 2;
    }

    body[data-wp-state="active-room"] .room-grid {
        width: min(100% - 20px, 760px);
        grid-template-columns: 1fr;
    }

    body[data-wp-state="active-room"] .side-panel {
        width: 100%;
    }
}

@media (max-width: 620px) {
    .wp-container {
        width: min(100% - 20px, 1180px);
    }

    .wp-logo span {
        display: none;
    }

    .wp-main {
        padding-top: 18px;
    }

    .welcome-screen,
    .narrow-screen {
        min-height: calc(100vh - 120px);
    }

    .role-card,
    .panel {
        padding: 15px;
        border-radius: 14px;
    }

    .action-row > button,
    .control-strip > button,
    .invite-row > button,
    .button-row > button {
        flex: 1 1 150px;
    }

    .lobby-status-grid,
    .participant-cards {
        grid-template-columns: 1fr;
    }

    .invite-qr-card {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .side-tabs {
        position: sticky;
        top: 72px;
        z-index: 10;
    }

    .side-tab {
        font-size: .84rem;
        padding-inline: 4px;
    }

    .room-code {
        font-size: 1.45rem;
    }

    .chat-form {
        grid-template-columns: 1fr;
        padding-bottom: calc(env(safe-area-inset-bottom) + 4px);
    }

    .chat-form .reaction-buttons {
        gap: 7px;
        padding: 7px;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .chat-form .reaction-buttons button {
        flex: 0 0 44px;
    }

    .chat-composer {
        padding: 12px;
        border-radius: 16px;
    }

    .chat-composer textarea {
        min-height: 54px;
        max-height: 136px;
        font-size: 16px;
    }

    .chat-composer-footer {
        gap: 8px;
    }

    .chat-send-button {
        min-height: 44px;
        min-width: 88px;
        padding-inline: 12px;
    }

    .chat-messages {
        min-height: 280px;
        height: min(48vh, 440px);
    }

    .chat-message {
        max-width: 94%;
    }

    .primary-control-row {
        flex-wrap: wrap;
    }

    .progress-wrap {
        flex-basis: 100%;
        order: 10;
    }

    .control-icon-btn,
    .compact-control {
        flex: 1 1 132px;
    }

    .time-readout,
    .sync-status,
    .audio-status {
        flex: 1 1 100%;
        text-align: center;
        white-space: normal;
    }

    .compact-control input[type="range"] {
        inline-size: min(120px, 42vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
