/* ================================================================
   LiveDeck — Application Styles
   ================================================================ */

:root {
    --brand-primary:   #6c63ff;
    --brand-secondary: #4ecdc4;
    --dark-bg:         #1a1a2e;
    --panel-bg:        #16213e;
    --card-bg:         #0f3460;
    --text-light:      #e0e0e0;
    --success-green:   #2ecc71;
    --warning-amber:   #f39c12;
    --danger-red:      #e74c3c;
}

/* ── Reset / Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f5f7fa; color: #333; }

/* ── Landing page ──────────────────────────────────────────────── */
.landing-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark-bg), var(--card-bg));
}
.landing-card {
    text-align: center;
    padding: 3rem 4rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
}
.brand { font-size: 3.5rem; font-weight: 800; letter-spacing: -1px; color: var(--brand-primary); }
.tagline { font-size: 1.2rem; opacity: 0.7; margin: 0.5rem 0 2rem; }
.action-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ── Auth card ─────────────────────────────────────────────────── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
}
.auth-card {
    background: var(--panel-bg);
    color: var(--text-light);
    border-radius: 0.75rem;
    padding: 2rem;
    width: min(400px, 95vw);
    box-shadow: 0 4px 32px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.auth-hero-wrapper {
    overflow: hidden;
    margin: -2rem -2rem 0 -2rem;
    border-radius: 0.75rem 0.75rem 0 0;
    flex-shrink: 0;
}
.auth-hero-img {
    display: block;
    width: 100%;
    height: auto;
}
.auth-form-area {
    padding: 1.5rem 0 0;
}
.auth-form-area label { color: var(--text-light); opacity: 0.75; font-size: 0.85rem; }
.auth-form-area .form-control {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-light);
}
.auth-form-area .form-control:focus {
    background: rgba(255,255,255,0.1);
    border-color: var(--brand-primary);
    color: var(--text-light);
    box-shadow: 0 0 0 0.2rem rgba(108,99,255,0.25);
}
.auth-form-area .form-control::placeholder { color: rgba(224,224,224,0.4); }
@media (max-width: 500px) {
    .auth-container {
        align-items: stretch;
        background: var(--dark-bg);
        padding: 0;
    }
    .auth-card {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
    .auth-hero-wrapper {
        flex: 0 1 auto;
        min-height: 0;
        max-height: none;
        border-radius: 0;
        margin: 0;
    }
    .auth-form-area {
        flex: 0 0 auto;
        padding: 1.5rem 0 2rem;
    }
}
.auth-card h2 { margin-bottom: 1.5rem; }
.auth-welcome-msg { font-size: 1.15rem; font-weight: 600; text-align: center; margin-bottom: 1.25rem; color: var(--text-light); }

/* ── Presenter layout ──────────────────────────────────────────── */
.presenter-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
.presenter-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.slide-list-panel {
    background: var(--panel-bg);
    color: var(--text-light);
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid #333;
}
.slide-list-panel h3 { color: white; margin-bottom: 1rem; }
.slide-thumb {
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.4rem;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.15s;
}
.slide-thumb:hover { background: rgba(255,255,255,0.1); }
.slide-thumb.active { background: var(--brand-primary); }
.slide-num { font-size: 0.8rem; opacity: 0.6; }
.slide-title-sm { font-size: 0.85rem; flex: 1; }
.current-badge {
    font-size: 0.65rem;
    background: var(--success-green);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
}
.poll-thumb {
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.4rem;
    background: rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.poll-thumb:hover { background: rgba(255,255,255,0.1); }
.poll-thumb.active { background: var(--brand-primary); }
.poll-type-badge { font-size: 0.65rem; opacity: 0.6; }
.poll-q-preview { font-size: 0.85rem; }
.editor-main {
    background: #f5f7fa;
    overflow-y: auto;
    padding: 1.5rem;
}
.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 0.75rem;
}
.slide-title-input { max-width: 200px; }
.canvas-position-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.empty-editor {
    text-align: center;
    margin-top: 5rem;
    color: #aaa;
    font-size: 1.2rem;
}
.poll-assignment { background: white; padding: 1rem; border-radius: 0.5rem; }

/* ── Canvas ──────────────────────────────────────────────────────
   --ld-aspect-w / --ld-aspect-h are the per-presentation stage ratio.
   Defaults to 16:9 here; the editor / present / replay containers
   override the values via inline style read from Sessions.AspectRatio. */
:root {
    --ld-aspect-w: 16;
    --ld-aspect-h: 9;
}
.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    overflow: hidden;
    background: #e8eaf0;
    border-radius: 0.5rem;
    cursor: grab;
}
.canvas-wrapper:active { cursor: grabbing; }
.canvas-plane {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    /* will-change is toggled on only during animated pans (see canvas.js
       navigateTo). Keeping it on permanently forces the browser to rasterize
       the plane into a compositor bitmap that gets scaled on zoom — which
       makes text fuzzy at high magnification. */
}
.slide-node {
    position: absolute;
    width: 1100px;
    min-height: 620px;
    background: white;
    overflow: hidden;
}
/* In edit mode, show a subtle dashed outline so slide boundaries are visible */
.slide-node.edit-mode {
    outline: 2px dashed rgba(108, 99, 255, 0.45);
    outline-offset: -1px;
}
.canvas-element {
    position: absolute;
    user-select: none;
    touch-action: none;
}
.canvas-element.dragging { opacity: 0.8; cursor: grabbing; }
.canvas-element.element-multi-selected {
    outline: calc(2px * var(--canvas-inv-scale, 1)) dashed #ff7043;
    outline-offset: calc(2px * var(--canvas-inv-scale, 1));
}
.canvas-element.element-selected {
    outline: calc(2px * var(--canvas-inv-scale, 1)) solid var(--brand-primary);
    outline-offset: calc(2px * var(--canvas-inv-scale, 1));
}
.canvas-element--hidden-preview {
    outline: calc(1px * var(--canvas-inv-scale, 1)) dashed rgba(108, 99, 255, 0.55);
    outline-offset: calc(1px * var(--canvas-inv-scale, 1));
}
.audio-element-card {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box;
    color: #333;
    font-size: 12px;
}
.audio-element-card .audio-element-label {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}
.audio-element-card .audio-element-icon { font-size: 14px; }
.audio-element-card .audio-element-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.audio-element-card audio { height: 28px; }
.text-content {
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    outline: none;
    user-select: text;
    cursor: text;
}
.code-block {
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
    font-size: 0.9rem;
    overflow: auto;
    border-radius: 0.25rem;
}
.drag-handle {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #c4ccd8;
    color: #556277;
    cursor: grab;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    opacity: 0;
    transition: opacity 0.15s ease;
    transform: scale(var(--canvas-inv-scale, 1));
    transform-origin: 10px 10px;
}
.canvas-element:hover .drag-handle,
.canvas-element.element-selected .drag-handle {
    opacity: 1;
}
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: var(--brand-primary);
    cursor: se-resize;
    border-radius: 2px;
    transform: scale(var(--canvas-inv-scale, 1));
    transform-origin: 100% 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.canvas-element.element-selected .resize-handle {
    opacity: 1;
    pointer-events: auto;
}
.element-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-red);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transform: scale(var(--canvas-inv-scale, 1));
    transform-origin: 12px 8px;
}
.canvas-element:hover .element-delete,
.canvas-element.element-selected .element-delete { display: flex; }
.slide-overlay {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    pointer-events: none;
    z-index: 100;
}
.slide-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.7rem;
    color: #aaa;
    padding: 0.25rem;
    background: rgba(0,0,0,0.03);
}

/* ── Element properties bar (editor) ───────────────────────────── */
.element-props-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: #eef1f7;
    border: 1px solid #d0d7e6;
    border-radius: 0.4rem;
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.element-props-bar .props-label {
    font-weight: 600;
    color: var(--brand-primary);
    white-space: nowrap;
}
.props-element-picker {
    width: 240px !important;
}
.props-empty {
    color: #657187;
}
.props-content-input {
    width: min(360px, 50vw) !important;
}
.props-help {
    color: #657187;
    font-size: 0.78rem;
}
.element-props-bar input[type="text"],
.element-props-bar input[type="number"] {
    padding: 0.2rem 0.45rem;
    border: 1px solid #c4ccd8;
    border-radius: 0.3rem;
    font-size: 0.85rem;
    background: white;
}
.element-props-bar input[type="text"]  { width: 160px; }
.element-props-bar input[type="number"] { width: 72px; }

/* ── Rich-text formatting toolbar ──────────────────────────────── */
.fmt-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
}
.fmt-btn {
    padding: 0.15rem 0.5rem;
    background: white;
    border: 1px solid #c4ccd8;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    line-height: 1.4;
    cursor: pointer;
    color: #333;
    min-width: 26px;
}
.fmt-btn:hover { background: #eef1f7; border-color: #a0abbe; }
.fmt-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #c4ccd8;
    margin: 0 3px;
}
.fmt-size {
    width: 56px;
    padding: 0.15rem 0.35rem;
    border: 1px solid #c4ccd8;
    border-radius: 0.25rem;
    font-size: 0.8rem;
}
.fmt-color {
    width: 30px;
    height: 26px;
    padding: 1px 2px;
    border: 1px solid #c4ccd8;
    border-radius: 0.25rem;
    cursor: pointer;
}
.html-editor-panel {
    background: white;
    border: 1px solid #d0d7e6;
    border-radius: 0.5rem;
    padding: 0.85rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.html-source-input {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
    font-size: 0.85rem;
}
.html-editor-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.65rem;
    flex-wrap: wrap;
}
.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.steps-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.step-card {
    background: white;
    border: 1px solid #dbe1ec;
    border-radius: 0.55rem;
    overflow: hidden;
}
.step-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    user-select: none;
}
.step-card-header:hover {
    background: #f6f8fc;
}
.step-num {
    font-weight: 700;
    color: #556277;
    min-width: 1.25rem;
}
.step-title {
    flex: 1;
    min-width: 0;
}
.step-actions-count {
    flex-shrink: 0;
}
.step-card-body {
    padding: 0.9rem 0.85rem 1rem;
    border-top: 1px solid #eef2f7;
}

/* Element groups bar — sits below the props bar, lets the presenter author
   persistent groups out of the current shift+click multi-selection. */
.element-groups-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: #f4f6fa;
    border-bottom: 1px solid #e1e6ee;
    font-size: 0.82rem;
    flex-wrap: wrap;
}
.element-groups-bar .groups-picker { width: 200px; }
.element-groups-bar .group-name-input { width: 160px; }
.element-groups-bar .props-help { color: #6b7280; font-size: 0.78rem; }

/* Editor banner shown while a step's full state is being previewed. */
.step-preview-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: linear-gradient(180deg, #fff8e1, #fff3c4);
    border-bottom: 1px solid #f1c40f;
    font-size: 0.82rem;
    color: #5d4400;
}
.step-preview-banner .btn-xs {
    padding: 2px 8px;
    font-size: 0.74rem;
    line-height: 1.6;
}

/* Transform action target inputs — appear directly under a transform action row. */
.transform-targets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 2px 0 6px 12px;
    padding: 4px 6px;
    background: #f6f8fb;
    border-radius: 4px;
}
.transform-targets input[type="number"] {
    width: 56px;
    padding: 2px 4px;
    font-size: 0.78rem;
    border: 1px solid #cfd6df;
    border-radius: 3px;
}
.transform-targets .btn-xs {
    padding: 0 6px;
    font-size: 0.72rem;
    line-height: 1.6;
}

/* ── Presentation view ─────────────────────────────────────────── */
.presentation-root {
    position: fixed;
    inset: 0;
    background: #111;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.presentation-root .canvas-wrapper {
    /* Letterboxed stage: pick whichever dimension limit binds first
       (full width, or full height * aspect). The other axis follows
       from aspect-ratio. */
    width: min(100vw, 100vh * var(--ld-aspect-w) / var(--ld-aspect-h));
    height: min(100vh, 100vw * var(--ld-aspect-h) / var(--ld-aspect-w));
    aspect-ratio: var(--ld-aspect-w) / var(--ld-aspect-h);
    border-radius: 0;
    background: #1a1a2e;
    flex: 0 0 auto;
}

/* Poll overlay — base (positioning only; .poll-overlay supplies the box styling) */
.presentation-overlay {
    position: fixed;
    z-index: 200;
}
/* Poll overlay — position variants */
.presentation-overlay.overlay-bottom-right  { bottom: 6rem;   right:  2rem; }
.presentation-overlay.overlay-bottom-left   { bottom: 6rem;   left:   2rem; }
.presentation-overlay.overlay-top-right     { top:    3.5rem; right:  2rem; }
.presentation-overlay.overlay-top-left      { top:    3.5rem; left:   2rem; }
.presentation-overlay.overlay-bottom-center { bottom: 6rem;   left: 50%; transform: translateX(-50%); }
.presentation-overlay.overlay-top-center    { top:    3.5rem; left: 50%; transform: translateX(-50%); }
.presentation-overlay.overlay-center        { top:    50%;    left: 50%; transform: translate(-50%, -50%); }

/* Sentiment bar — base */
.presentation-sentiment-bar {
    position: fixed;
    z-index: 200;
    left: 0;
    right: 0;
    bottom: 0;
    padding-left: 3.75rem;
    background: rgba(0,0,0,0.6);
}
.presentation-sentiment-bar .sentiment-overlay { background: transparent; }
/* Sentiment bar — position variants */
.presentation-sentiment-bar.sentiment-bottom-right,
.presentation-sentiment-bar.sentiment-bottom-left,
.presentation-sentiment-bar.sentiment-bottom-center { bottom: 0; }
.presentation-sentiment-bar.sentiment-top-right,
.presentation-sentiment-bar.sentiment-top-left,
.presentation-sentiment-bar.sentiment-top-center    { top: 0; }
.presentation-status-bar {
    position: fixed;
    top: 1rem;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    z-index: 300;
}
.connection-status {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.connection-status:hover { filter: brightness(1.15); }
.connection-status:focus-visible { outline: 2px solid var(--accent-blue, #3b82f6); outline-offset: 2px; }
.connection-status.connected { background: var(--success-green); color: white; }
.connection-status.disconnected { background: var(--danger-red); color: white; }
.connection-status .connection-count { margin-left: 0.4rem; opacity: 0.9; font-weight: 600; }

.join-qr-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    animation: join-qr-fade 120ms ease-out;
}
@keyframes join-qr-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.join-qr-panel {
    position: relative;
    background: white;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
}
.join-qr-image {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.join-qr-image svg {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    display: block;
}
.join-qr-url {
    flex: 0 0 auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: clamp(2rem, 8vh, 6rem);
    font-weight: 700;
    color: #111827;
    word-break: break-all;
    text-align: center;
    line-height: 1.1;
}
.join-qr-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    z-index: 1;
}
.join-qr-close:hover { color: #111827; }
.sentiment-toggle-btn {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: 300;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.2s, background 0.2s;
}
.sentiment-toggle-btn:hover { opacity: 0.85; background: rgba(255,255,255,0.25); }
.sentiment-toggle-btn.active { opacity: 0.85; background: transparent; }
.playback-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 300;
    display: flex;
    gap: 0.4rem;
}
.playback-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    /* Neutral translucent fill + contrasting border so the buttons stay
       visible against both light and dark canvas backgrounds. */
    background: rgba(255,255,255,0.85);
    color: #0f172a;
    border: 1px solid rgba(0,0,0,0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.75;
    transition: opacity 0.2s, background 0.2s;
}
.playback-btn:hover:not(:disabled) { opacity: 1; background: rgba(255,255,255,1); }
.playback-btn:disabled { opacity: 0.3; cursor: default; }

/* Chrome-visibility toggle — small, subtle button fixed in the top-right corner.
   Styled to match the bottom-left sentiment toggle (faint translucent circle,
   low opacity). Sits in the corner; the playback controls are shifted left. */
.chrome-toggle-btn {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 310;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
    transition: opacity 0.2s, background 0.2s;
}
.chrome-toggle-btn:hover { opacity: 0.85; background: rgba(255,255,255,0.25); }
/* Even fainter when the chrome is hidden, but still findable on hover. */
.chrome-toggle-btn.is-off { opacity: 0.3; }
.chrome-toggle-btn.is-off:hover { opacity: 0.85; background: rgba(255,255,255,0.25); }
/* Make room in the corner for the chrome toggle (present view only; replay keeps right:1rem) */
.presentation-root .playback-controls { right: 3.6rem; }
/* Hidden presenter chrome when toggled off */
.chrome-hidden { display: none !important; }
.presentation-waiting {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: white;
    font-size: 1.5rem;
}

/* ── Replay view ───────────────────────────────────────────────
   Fixed 16:9 letterboxed stage. The canvas-wrapper inside the stage
   is sized relative to the stage, not the viewport, so the replay
   frame never overflows even on very wide or very tall screens. */
.replay-root {
    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.replay-stage {
    position: relative;
    aspect-ratio: var(--ld-aspect-w) / var(--ld-aspect-h);
    width: min(100vw, 100vh * var(--ld-aspect-w) / var(--ld-aspect-h));
    height: min(100vh, 100vw * var(--ld-aspect-h) / var(--ld-aspect-w));
    overflow: hidden;
    background: #1a1a2e;
    box-shadow: 0 0 24px rgba(0,0,0,0.6);
}
.replay-stage .canvas-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 0;
    cursor: default;
}
.replay-stage .presentation-overlay { position: absolute; }
.replay-stage .move-indicator       { position: absolute; }
.replay-stage .playback-controls    { position: absolute; }

/* Loading overlay — shown until all canvas media has finished loading. */
.replay-loading {
    position: absolute;
    inset: 0;
    z-index: 500;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}
.replay-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: replay-spin 0.9s linear infinite;
}
@keyframes replay-spin {
    to { transform: rotate(360deg); }
}

/* ── Poll results ──────────────────────────────────────────────── */
.poll-results { padding: 0.5rem 0; }
.result-row {
    display: grid;
    grid-template-columns: 180px 1fr 80px;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.result-label { font-size: 0.9rem; }
.result-bar-track { background: #e9ecef; border-radius: 1rem; height: 18px; overflow: hidden; }
.result-bar { background: var(--brand-primary); height: 100%; border-radius: 1rem; transition: width 0.4s ease; }
.result-count { font-size: 0.85rem; text-align: right; }
.result-participants { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: -0.25rem 0 0.75rem 0; }
.rating-stats { display: flex; gap: 1.5rem; }
.stat { text-align: center; }
.stat-val { display: block; font-size: 2rem; font-weight: 700; color: var(--brand-primary); }
.stat-lbl { font-size: 0.75rem; color: #888; text-transform: uppercase; }
.text-responses { display: flex; flex-direction: column; gap: 0.5rem; }
.text-response-item {
    background: #f8f9fa;
    border-left: 3px solid var(--brand-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0 0.25rem 0.25rem 0;
    font-style: italic;
    font-size: 0.9rem;
}

/* ── Poll overlay (on canvas) ──────────────────────────────────── */
.poll-overlay {
    background: rgba(0,0,0,0.82);
    color: white;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    min-width: 260px;
}
.poll-canvas-overlay {
    display: flex;
    align-items: stretch;
    z-index: 160;
    pointer-events: none;
}
.poll-canvas-overlay .poll-overlay {
    width: 100%;
    min-width: 0;
}
.poll-overlay-question { font-weight: 700; margin-bottom: 0.5rem; }
.poll-overlay-responses { font-size: 0.75rem; opacity: 0.7; margin-bottom: 0.75rem; }
.overlay-choices { display: flex; flex-direction: column; gap: 0.5rem; }
.overlay-choice-item {
    padding: 0.55rem 0.75rem;
    border-radius: 0.65rem;
    background: rgba(255,255,255,0.08);
    font-size: 0.85rem;
    line-height: 1.3;
}
.overlay-bar-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.3rem; }
.overlay-label { font-size: 0.8rem; width: 120px; }
.overlay-bar-track { flex: 1; background: rgba(255,255,255,0.2); border-radius: 1rem; height: 12px; overflow: hidden; }
.overlay-bar { background: var(--brand-secondary); height: 100%; border-radius: 1rem; transition: width 0.4s ease; }
.overlay-pct { font-size: 0.75rem; width: 36px; text-align: right; }
.overlay-rating { font-size: 1rem; }

/* ── Poll results: pie chart ──────────────────────────────────── */
.poll-pie-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.25rem 0;
}
.poll-pie { width: 180px; height: 180px; flex: 0 0 auto; }
.poll-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.poll-pie-legend li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.poll-pie-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex: 0 0 12px;
}
.poll-pie-legend-label { flex: 1; }
.poll-pie-legend-count { font-size: 0.85rem; color: #555; }

/* Pie variant inside the overlay (darker theme) */
.overlay-pie {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.overlay-pie-svg { width: 130px; height: 130px; flex: 0 0 auto; }
.overlay-pie-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.overlay-pie-legend li { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; }
.overlay-pie-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex: 0 0 10px;
}
.overlay-pie-label { flex: 1; line-height: 1.2; }
.overlay-pie-pct { font-size: 0.75rem; opacity: 0.85; }

/* ── Poll overlay preview pane (Poll Manager) ─────────────────── */
.poll-preview-pane {
    flex: 1;
    min-width: 260px;
    background: #1a1a2e;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.poll-preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 0.25rem;
}

/* ── Sentiment overlay ─────────────────────────────────────────── */
.sentiment-overlay { padding: 0.5rem; background: rgba(0,0,0,0.6); }
.sentiment-overlay-label { font-size: 0.7rem; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.25rem; }
.sentiment-bar-container { display: flex; height: 12px; border-radius: 1rem; overflow: hidden; background: rgba(255,255,255,0.12); }
.segment { height: 100%; transition: width 0.6s ease; }
.seg-very-negative { background: #c0392b; }
.seg-negative      { background: #e67e22; }
.seg-positive      { background: #7cb342; }
.seg-very-positive { background: #16a085; }
.sentiment-avg { font-size: 0.7rem; color: rgba(255,255,255,0.6); margin-top: 0.25rem; }
.sentiment-participants {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 0.4rem;
    max-height: 120px;
    overflow-y: auto;
}
.sentiment-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.sentiment-dot--vn { background: #c0392b; }
.sentiment-dot--n  { background: #e67e22; }
.sentiment-dot--p  { background: #7cb342; }
.sentiment-dot--vp { background: #16a085; }

.sentiment-participant {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px 1px 1px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    font-size: 0.72rem;
    color: rgba(255,255,255,0.9);
    max-width: 160px;
}
.sentiment-participant .sentiment-dot { width: 18px; height: 18px; }
.sentiment-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* ── Connected-audience badges on presenter dashboard ─────────────── */
.connected-audience { margin-top: 0.75rem; margin-bottom: 1rem; }
.connected-audience-label { font-size: 0.85rem; color: #555; margin-bottom: 0.4rem; }
.connected-audience-list { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.connected-audience-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    font-size: 0.72rem;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Audience participation ─────────────────────────────────────── */
.participate-container {
    min-height: 100vh;
    background: var(--dark-bg);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
}
.participate-header {
    background: var(--panel-bg);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #333;
}
.session-title { font-weight: 700; font-size: 1.1rem; }
.nickname-badge {
    background: var(--brand-primary);
    color: inherit;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: filter 0.15s;
}
.nickname-badge:hover { filter: brightness(1.15); }
.nickname-input {
    background: var(--panel-bg);
    color: var(--text-light);
    border: 1px solid var(--brand-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    outline: none;
    max-width: 12rem;
}
.participate-body { padding: 1.5rem; flex: 1; max-width: 600px; margin: 0 auto; width: 100%; }

.sentiment-section { margin-bottom: 2rem; }
.sentiment-faces {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.sentiment-face {
    background: none;
    border: 3px solid transparent;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.3;
    transition: transform 0.15s, opacity 0.15s, background 0.15s, border-color 0.15s;
}
.sentiment-face:hover { opacity: 0.65; transform: scale(1.1); }
.sentiment-face--vn:hover { border-color: #c0392b; }
.sentiment-face--n:hover  { border-color: #e67e22; }
.sentiment-face--z:hover  { border-color: #e0b800; }
.sentiment-face--p:hover  { border-color: #7cb342; }
.sentiment-face--vp:hover { border-color: #16a085; }
.sentiment-face--vn.active { opacity: 1; transform: scale(1.18); border-color: #c0392b; background: rgba(192,57,43,0.15); }
.sentiment-face--n.active  { opacity: 1; transform: scale(1.18); border-color: #e67e22; background: rgba(230,126,34,0.15); }
.sentiment-face--z.active  { opacity: 1; transform: scale(1.18); border-color: #e0b800; background: rgba(224,184,0,0.15); }
.sentiment-face--p.active  { opacity: 1; transform: scale(1.18); border-color: #7cb342; background: rgba(124,179,66,0.15); }
.sentiment-face--vp.active { opacity: 1; transform: scale(1.18); border-color: #16a085; background: rgba(22,160,133,0.15); }

.poll-section {
    background: var(--panel-bg);
    border-radius: 0.75rem;
    padding: 1.5rem;
}
.poll-question { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; }
.poll-options { display: flex; flex-direction: column; gap: 0.5rem; }
.poll-option {
    background: rgba(255,255,255,0.07);
    border: 2px solid transparent;
    color: var(--text-light);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}
.poll-option:hover { background: rgba(255,255,255,0.12); }
.poll-option.selected { border-color: var(--brand-primary); background: rgba(108,99,255,0.2); }
.poll-option.disabled, .poll-option[disabled] { opacity: 0.4; cursor: not-allowed; }
.poll-option.disabled:hover, .poll-option[disabled]:hover { background: rgba(255,255,255,0.07); }
.poll-hint { font-size: 0.85rem; opacity: 0.75; margin-bottom: 0.5rem; }
.rating-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.rating-btn {
    background: rgba(255,255,255,0.07);
    border: 2px solid transparent;
    color: var(--text-light);
    width: 44px;
    height: 44px;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
}
.rating-btn:hover { background: rgba(255,255,255,0.15); }
.rating-btn.selected { border-color: var(--brand-primary); background: rgba(108,99,255,0.3); }

.voted-message {
    text-align: center;
    font-size: 1.5rem;
    padding: 2rem;
    color: var(--success-green);
}
.checkmark { font-size: 2rem; }
.waiting-message {
    text-align: center;
    padding: 3rem;
    color: rgba(255,255,255,0.4);
}
.status-message { display: flex; align-items: center; gap: 1rem; justify-content: center; padding: 3rem; color: var(--text-light); }

/* ── Dashboard ──────────────────────────────────────────────────── */
.dashboard-layout { min-height: 100vh; background: #f5f7fa; display: flex; flex-direction: column; }
.dashboard-header {
    background: var(--dark-bg);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}
.dashboard-header h1 { font-size: 1.4rem; color: var(--brand-primary); }
.dashboard-nav { display: flex; gap: 1.25rem; }
.dashboard-brand { color: var(--brand-primary); text-decoration: none; }
.dashboard-nav a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; transition: color 0.15s; }
.dashboard-nav a:hover, .dashboard-nav a.active { color: white; }
.dashboard-nav a.active { font-weight: 600; }
.dashboard-nav-link { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.9rem; transition: color 0.15s; }
.dashboard-nav-link:hover { color: white; }
.dashboard-body { padding: 1.5rem 2rem; flex: 1; }
.session-panel { background: white; border-radius: 0.75rem; padding: 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.session-meta { font-size: 0.85rem; color: #666; margin: 0.25rem 0 0.75rem; }
.slides-panel { background: white; border-radius: 0.75rem; padding: 1.25rem; margin-bottom: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.slide-nav-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.slide-nav-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 0.4rem;
    border: 1px solid #dee2e6;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.slide-nav-btn:hover { background: #f8f9fa; }
.slide-nav-btn.current { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.dashboard-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.poll-panel, .sentiment-panel {
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.poll-question-live { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.75rem; }
.no-session-panel { text-align: center; padding: 4rem 2rem; }
.create-session-form { max-width: 400px; margin: 1.5rem auto 0; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .presenter-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .slide-list-panel { border-right: none; border-bottom: 1px solid #333; max-height: 200px; }
    .dashboard-columns { grid-template-columns: 1fr; }
    .result-row { grid-template-columns: 120px 1fr 60px; }
    .landing-card { padding: 2rem 1.5rem; }
    .brand { font-size: 2.5rem; }
}

/* ── Presentation editor split layout ─────────────────────────── */
.presentation-editor {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #f5f7fa;
}
.editor-steps-panel {
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    flex: 0 0 var(--steps-panel-width, 360px);
    min-width: 0;
    order: 1;
}
.editor-splitter {
    flex: 0 0 6px;
    background: #c4c9d4;
    cursor: col-resize;
    transition: background 0.12s;
    user-select: none;
    position: relative;
    order: 2;
}
/* Wider transparent hit area so the 6px splitter is easy to grab. */
.editor-splitter::before {
    content: '';
    position: absolute;
    inset: 0 -4px;
}
.editor-splitter:hover,
.editor-splitter.editor-splitter--dragging { background: var(--brand-primary); }
.editor-canvas-panel {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    overflow: hidden;
    flex: 1 1 0;
    min-width: 0;
    order: 3;
}
/* Stage fills the remaining vertical space in the editor panel and
   acts as a size container so .canvas-wrapper inside it can size off
   the real available area (toolbar + props bar already consumed). */
.editor-canvas-stage {
    flex: 1 1 0;
    min-height: 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    container-type: size;
}
.editor-canvas-stage .canvas-wrapper {
    /* Force the editor preview to the presentation's target aspect
       regardless of panel size, so wrap/layout matches /present and
       /replay. Pick whichever dimension constraint binds first: full
       width, or full height * aspect. aspect-ratio derives the other. */
    width: min(100cqw, 100cqh * var(--ld-aspect-w) / var(--ld-aspect-h));
    height: auto;
    aspect-ratio: var(--ld-aspect-w) / var(--ld-aspect-h);
    flex: 0 0 auto;
}
.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e0e4ea;
    flex-shrink: 0;
}
.steps-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: 0.5rem;
    min-width: 0;
}
.step-card {
    background: #f8f9fa;
    border: 1px solid #e0e4ea;
    border-radius: 0.4rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    flex-shrink: 0;
}
.step-card-body > * { min-width: 0; }
.step-card-body .form-control,
.step-card-body .form-select { min-width: 0; }
.step-actions-count { display: flex; gap: 4px; flex-shrink: 0; }
.step-actions-count .badge { font-size: 0.65rem; }
.step-card--open { border-color: var(--brand-primary); }
.step-card--dragging { opacity: 0.45; }
.step-card-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    user-select: none;
}
.step-card-header:hover { background: rgba(99,102,241,0.07); }
.step-card-header:hover .step-title { color: #6366f1; }
.step-num {
    font-size: 0.72rem;
    font-weight: 700;
    color: #999;
    min-width: 18px;
}
.step-title {
    font-size: 0.84rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: grab;
}
.step-title:active { cursor: grabbing; }
.step-card-body {
    padding: 0.75rem;
    border-top: 1px solid #e0e4ea;
    background: white;
}

/* ── Step drag-and-drop drop zones ─────────────────────────────── */
.step-drop-zone {
    height: 4px;
    border-radius: 3px;
    margin: 1px 4px;
    background: transparent;
    transition: background 0.12s;
    position: relative;
    flex-shrink: 0;
}
.step-drop-zone::after {
    content: '';
    display: block;
    height: 3px;
    border-radius: 2px;
    background: transparent;
    margin: 4px 0;
    transition: background 0.12s;
}
.step-drop-zone--active { background: rgba(99,102,241,0.18); }
.step-drop-zone--active::after { background: var(--brand-primary); }

/* When any step is being dragged, make all drop zones visible & larger hit targets */
.steps-list--dragging .step-drop-zone {
    height: 22px;
    background: rgba(99,102,241,0.05);
    border: 1px dashed rgba(99,102,241,0.35);
}
.steps-list--dragging .step-drop-zone::after {
    background: rgba(99,102,241,0.35);
    height: 2px;
}
.steps-list--dragging .step-drop-zone--active {
    background: rgba(99,102,241,0.22);
    border-color: var(--brand-primary);
}

/* ── Bootstrap btn-xs (not in Bootstrap 5) ─────────────────────── */
.btn-xs {
    padding: 0.1rem 0.3rem;
    font-size: 0.75rem;
    line-height: 1.4;
}

/* ── Move indicator (in /present) ──────────────────────────────── */
.move-indicator {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.5);
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    padding: 0.2rem 0.75rem;
    border-radius: 1rem;
    z-index: 300;
    pointer-events: none;
}
.move-label { font-style: italic; }

/* ── Participate header right cluster ──────────────────────────── */
.participate-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Audience question icon button ─────────────────────────────── */
.question-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.75);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1;
}
.question-icon-btn:hover {
    background: rgba(108,99,255,0.25);
    border-color: var(--brand-primary);
    color: white;
}

/* ── Audience-canvas toggle button (header) ────────────────────── */
.presenter-view-btn {
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.presenter-view-btn:hover {
    background: rgba(108,99,255,0.25);
    border-color: var(--brand-primary);
    color: white;
}

/* ── Audience canvas (presenter-screen mirror) ─────────────────── */
.audience-canvas-root {
    position: fixed;
    inset: 0;
    background: #111;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none; /* let our pinch/pan handlers consume gestures */
    z-index: 50;
}
.audience-canvas-stage {
    position: relative;
    width: min(100vw, 100vh * var(--ld-aspect-w) / var(--ld-aspect-h));
    height: min(100vh, 100vw * var(--ld-aspect-h) / var(--ld-aspect-w));
    aspect-ratio: var(--ld-aspect-w) / var(--ld-aspect-h);
    flex: 0 0 auto;
    overflow: hidden;
}
.audience-canvas-stage .canvas-wrapper {
    width: 100%;
    height: 100%;
    aspect-ratio: var(--ld-aspect-w) / var(--ld-aspect-h);
    background: #1a1a2e;
}
.audience-canvas-back,
.audience-canvas-reset {
    position: absolute;
    top: 0.6rem;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    z-index: 60;
    backdrop-filter: blur(6px);
}
.audience-canvas-back  { right: 0.75rem; }
.audience-canvas-reset { right: 8.5rem; }
.audience-canvas-back:hover,
.audience-canvas-reset:hover {
    background: rgba(108,99,255,0.55);
    border-color: var(--brand-primary);
}

/* ── Question / Comment modal overlay ──────────────────────────── */
.question-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.question-modal-card {
    background: var(--panel-bg);
    color: var(--text-light);
    border-radius: 0.75rem;
    padding: 1.5rem;
    width: min(480px, 100%);
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.question-modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}
.question-modal-textarea {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.5rem;
    color: var(--text-light);
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    font-family: inherit;
}
.question-modal-textarea:focus {
    border-color: var(--brand-primary);
    background: rgba(255,255,255,0.1);
}
.question-modal-textarea::placeholder { color: rgba(224,224,224,0.35); }
.question-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.question-submitted-msg {
    text-align: center;
    font-size: 1.3rem;
    color: var(--success-green);
    padding: 0.5rem 0;
}

/* ── Dashboard: audience questions panel ───────────────────────── */
.questions-panel {
    background: white;
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.question-entries {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 400px;
    overflow-y: auto;
}
.question-entry {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.6rem 0.85rem;
    border-left: 3px solid var(--brand-primary);
}
.question-entry-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.2rem;
}
.question-entry-nickname {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--brand-primary);
}
.question-entry-time {
    font-size: 0.75rem;
    color: #999;
}
.question-entry-text {
    font-size: 0.95rem;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Questions toggle button on /present (next to ☺) ───────────── */
.questions-toggle-btn {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 0.2rem 0.5rem;
    border-radius: 1rem;
    border: none;
    background: var(--success-green);
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.questions-toggle-btn:hover { opacity: 1; }
.questions-toggle-btn.active { opacity: 1; }

/* ── Questions HUD overlay on /present ─────────────────────────── */
.presentation-questions-hud {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 200;
    width: 300px;
    max-height: 60vh;
    pointer-events: none;
}

/* ── QuestionsOverlay component (dark canvas theme) ────────────── */
.questions-overlay {
    background: rgba(15, 52, 96, 0.88);
    border-radius: 0.6rem;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-light);
}
.questions-overlay-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.55;
    margin-bottom: 0.5rem;
}
.questions-overlay-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: calc(60vh - 3rem);
    overflow-y: auto;
}
.questions-overlay-entry {
    border-left: 3px solid var(--brand-primary);
    padding-left: 0.5rem;
}
.questions-overlay-nickname {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--brand-primary);
    display: block;
    margin-bottom: 0.1rem;
}
.questions-overlay-text {
    font-size: 0.85rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    opacity: 0.9;
}

/* ── Canvas element animations ─────────────────────────────────── */
@keyframes cog-spin {
    to { transform: rotate(360deg); }
}
@keyframes ai-pulse {
    0%, 100% { opacity: 0.92; }
    50%      { opacity: 1;    }
}
@keyframes cog-spin-reverse {
    to { transform: rotate(-360deg); }
}

/* ── Quiz feedback (audience after vote) ───────────────────────── */
.quiz-feedback {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.95rem;
}
.quiz-feedback.correct {
    background: rgba(16, 185, 129, 0.18);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.quiz-feedback.incorrect {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.quiz-feedback-icon { font-size: 1.4rem; font-weight: 700; }

/* ── Quiz leaderboard overlay (HUD) ────────────────────────────── */
.quiz-leaderboard {
    background: rgba(15, 16, 32, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.6rem;
    padding: 1rem 1.25rem;
    color: var(--text-light, #fff);
    min-width: 16rem;
    max-width: 22rem;
}
.quiz-leaderboard-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
    opacity: 0.85;
}
.quiz-leaderboard-list {
    list-style: none;
    counter-reset: rank;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.quiz-leaderboard-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    font-variant-numeric: tabular-nums;
}
.quiz-leaderboard-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 700;
    font-size: 0.78rem;
}
.quiz-leaderboard-row.rank-1 .quiz-leaderboard-rank { background: #f59e0b; color: #000; }
.quiz-leaderboard-row.rank-2 .quiz-leaderboard-rank { background: #94a3b8; color: #000; }
.quiz-leaderboard-row.rank-3 .quiz-leaderboard-rank { background: #b45309; color: #fff; }
.quiz-leaderboard-name  { flex: 1 1 auto; font-weight: 600; }
.quiz-leaderboard-score { font-weight: 700; }
.quiz-leaderboard-of    { opacity: 0.5; font-weight: 400; font-size: 0.8em; }

.leaderboard-btn.active { background: rgba(245, 158, 11, 0.25); }

/* ── /present record button ────────────────────────────────────── */
.record-btn .record-dot {
    color: #ef4444;
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
.record-btn.recording {
    background: rgba(239, 68, 68, 0.25);
    color: #ef4444;
    animation: livedeck-record-pulse 1.5s ease-in-out infinite;
}
@keyframes livedeck-record-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ── Ranking poll (audience + overlay) ─────────────────────────── */
.poll-ranking-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.poll-ranking-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.4rem;
    cursor: grab;
}
.poll-ranking-row:active { cursor: grabbing; }
.poll-ranking-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    background: var(--brand-primary, #8b5cf6);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.8rem;
}
.poll-ranking-label  { flex: 1 1 auto; }
.poll-ranking-actions { display: flex; gap: 0.2rem; }
.poll-ranking-actions .btn { padding: 0.05rem 0.45rem; font-size: 0.75rem; }

.overlay-ranking-list {
    list-style: none;
    counter-reset: rank;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.overlay-ranking-row {
    counter-increment: rank;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.3rem;
}
.overlay-ranking-row::before {
    content: "#" counter(rank);
    font-weight: 700;
    color: var(--brand-primary, #8b5cf6);
    min-width: 1.8rem;
}
.overlay-ranking-label { flex: 1 1 auto; }
.overlay-ranking-avg {
    font-size: 0.75rem;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

/* ── Word-cloud results overlay ────────────────────────────────── */
.overlay-wordcloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    align-items: baseline;
    justify-content: center;
    padding: 0.5rem;
    line-height: 1.1;
}
.overlay-wordcloud-word {
    font-weight: 700;
    transition: transform 0.2s ease;
}
.overlay-wordcloud-word:hover { transform: scale(1.05); }
.overlay-wordcloud-empty {
    text-align: center;
    opacity: 0.6;
    font-style: italic;
    padding: 0.75rem;
}
.overlay-choice-hint {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 0.4rem;
    text-align: center;
}

/* ── Audience question list + upvotes (modal) ──────────────────── */
.question-list-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.question-list-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}
.question-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 40vh;
    overflow-y: auto;
}
.question-list-entry {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.5rem;
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.04);
}
.question-upvote-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: transparent;
    color: inherit;
    border-radius: 0.4rem;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-size: 0.75rem;
    line-height: 1;
    min-width: 2.4rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.question-upvote-btn:hover  { background: rgba(255, 255, 255, 0.08); }
.question-upvote-btn.voted {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.6);
}
.question-upvote-arrow { font-size: 0.85rem; }
.question-upvote-count { font-weight: 700; }
.question-list-text { flex: 1 1 auto; min-width: 0; }
.question-list-nickname {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.8;
    display: block;
    margin-bottom: 0.15rem;
}
.question-list-body {
    font-size: 0.9rem;
    margin: 0;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ── Presenter dashboard / overlay upvote badges ───────────────── */
.question-entry-upvotes,
.questions-overlay-upvotes {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.05rem 0.4rem;
    border-radius: 0.4rem;
    background: rgba(99, 102, 241, 0.25);
    color: var(--brand-primary, #8b5cf6);
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── Audience emoji-reaction buttons ───────────────────────────── */
.emoji-reactions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0.75rem 0.5rem 1rem;
    margin-top: auto;
}
.emoji-reaction-btn {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.emoji-reaction-btn:hover    { background: rgba(255, 255, 255, 0.12); }
.emoji-reaction-btn:active   { transform: scale(0.92); }

/* ── /present floating emoji burst ─────────────────────────────── */
#livedeck-emoji-stream {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 200px;
    height: 70vh;
    pointer-events: none;
    z-index: 9000;
    overflow: hidden;
}
.livedeck-emoji-burst {
    position: absolute;
    bottom: 0;
    left: calc(50% + var(--ld-emoji-jitter, 0px));
    transform: translateX(-50%);
    font-size: 2.5rem;
    line-height: 1;
    user-select: none;
    animation: livedeck-emoji-rise 3s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
    will-change: transform, opacity;
}
@keyframes livedeck-emoji-rise {
    0%   { transform: translate(-50%, 0)     scale(0.6); opacity: 0;   }
    10%  { transform: translate(-50%, -20px) scale(1.1); opacity: 1;   }
    100% { transform: translate(-50%, -65vh) scale(1.0); opacity: 0;   }
}

/* Editor mode: force animation elements to their visible end-state so authors
   can see what they're positioning. Without this, CSS animations marked with
   [data-livedeck-css-animation] sit paused at their 0% keyframe (often opacity 0),
   making the elements invisible in /presenter/editor. /present is unaffected
   because the `start` step action flips animation-play-state to running. */
.canvas-element.edit-mode .animation-content [data-livedeck-css-animation] {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    stroke-dashoffset: 0 !important;
}
