/* Holodeck XR stylesheet — futuristic dark obsidian, amber gold, and cyan UI
   covering 1920x1080, 960x540, 1080x1920, 450x960 and .lean-paint flat mode. */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #080c14;
    color: #f8fafc;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}

#webgl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
}

#webgl-canvas:active {
    cursor: grabbing;
}

body.xr-presenting .top-bar,
body.xr-presenting .voice-dock,
body.xr-presenting .pointer-pill,
body.xr-presenting .launch-overlay {
    display: none;
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    pointer-events: none;
}

.brand-group,
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    pointer-events: auto;
}

.brand-group {
    background: rgba(9, 13, 22, 0.82);
    border: 1px solid rgba(250, 204, 21, 0.38);
    border-radius: 14px;
    padding: 6px 12px 6px 8px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: block;
    background: #ffffff;
}

.brand-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    color: #facc15;
}

.mode-pill,
.room-pill {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 999px;
}

.mode-pill {
    background: rgba(250, 204, 21, 0.16);
    border: 1px solid rgba(250, 204, 21, 0.45);
    color: #fef08a;
}

.room-pill {
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #bae6fd;
}

.tool-btn {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: rgba(9, 13, 22, 0.84);
    color: #e2e8f0;
    border-radius: 11px;
    padding: 8px 12px;
    min-height: 36px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tool-btn:hover:not(:disabled) {
    background: rgba(30, 41, 59, 0.92);
    border-color: rgba(250, 204, 21, 0.65);
    color: #ffffff;
}

.tool-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.tool-btn.is-active {
    background: rgba(250, 204, 21, 0.2);
    border-color: #facc15;
    color: #fef08a;
}

.tool-btn-xr:not(:disabled) {
    border-color: rgba(56, 189, 248, 0.6);
    color: #7dd3fc;
}

.tool-btn-icon {
    min-width: 36px;
    padding: 8px 10px;
}

/* Active 3D Pointer Pill */
.pointer-pill {
    position: fixed;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 19;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 24px);
    padding: 6px 10px 6px 12px;
    border-radius: 999px;
    background: rgba(9, 13, 22, 0.88);
    border: 1px solid rgba(56, 189, 248, 0.65);
    color: #e0f2fe;
    font-size: 13px;
    font-weight: 600;
}

.pointer-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #38bdf8;
    flex-shrink: 0;
}

.pointer-clear {
    appearance: none;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

/* Status Toast */
.status-toast {
    position: fixed;
    top: 108px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    max-width: min(560px, calc(100vw - 28px));
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(56, 189, 248, 0.55);
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.status-toast.is-error {
    background: rgba(69, 10, 10, 0.94);
    border-color: rgba(248, 113, 113, 0.72);
    color: #fecaca;
}

/* Initial Launch Overlay */
.launch-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 8, 15, 0.64);
}

.launch-card {
    width: 100%;
    max-width: 560px;
    background: rgba(10, 15, 26, 0.95);
    border: 1px solid rgba(250, 204, 21, 0.55);
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.58);
}

.launch-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.launch-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: #ffffff;
    flex-shrink: 0;
}

.launch-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #facc15;
    margin-bottom: 3px;
}

.launch-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
    color: #ffffff;
}

.launch-tagline {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.45;
    color: #cbd5e1;
}

.launch-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.mode-cta {
    flex: 1 1 150px;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.12s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.mode-cta:active:not(:disabled) {
    transform: scale(0.98);
}

.mode-cta:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mode-cta-vr {
    background: #eab308;
    color: #090d16;
}

.mode-cta-ar {
    background: #0284c7;
    color: #ffffff;
}

.mode-cta-web {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
    color: #f8fafc;
}

.mode-cta-web:hover {
    background: rgba(255, 255, 255, 0.18);
}

.launch-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.step-chip {
    flex: 1 1 140px;
    background: rgba(30, 41, 59, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12px;
    color: #e2e8f0;
    text-align: center;
}

.step-chip strong {
    color: #facc15;
}

.mic-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.mic-pill {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.mic-pill.is-ready {
    color: #4ade80;
}

.mic-pill.is-error {
    color: #fca5a5;
}

/* Bottom Voice Dock */
.voice-dock {
    position: fixed;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 22;
    width: min(640px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.voice-dock > * {
    pointer-events: auto;
}

.suggestion-chip {
    appearance: none;
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(10, 15, 26, 0.86);
    border: 1px solid rgba(250, 204, 21, 0.42);
    color: #fef08a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.suggestion-chip:hover {
    background: rgba(24, 34, 54, 0.94);
    border-color: #facc15;
}

.transcript-card {
    width: 100%;
    padding: 14px 18px;
    border-radius: 18px;
    background: rgba(9, 14, 24, 0.92);
    border: 2px solid rgba(250, 204, 21, 0.6);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.transcript-card.is-listening {
    border-color: #22c55e;
}

.transcript-card.is-thinking {
    border-color: #38bdf8;
}

.transcript-state {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #4ade80;
    margin-bottom: 6px;
}

.transcript-card.is-thinking .transcript-state {
    color: #38bdf8;
}

.transcript-body {
    margin: 0;
    font-size: 19px;
    line-height: 1.38;
    font-weight: 600;
    color: #ffffff;
    word-wrap: break-word;
}

.transcript-body .is-placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.transcript-interim {
    color: #86efac;
}

.audio-meter-wrap {
    margin-top: 10px;
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
}

.audio-meter-fill {
    width: 8%;
    height: 100%;
    border-radius: 999px;
    background: #22c55e;
    transition: width 0.08s linear;
}

.reply-banner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(9, 14, 24, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.28);
    font-size: 14px;
    line-height: 1.35;
    color: #e2e8f0;
}

.reply-text {
    flex: 1 1 auto;
}

.text-prompt-form {
    width: 100%;
    display: flex;
    gap: 8px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(9, 14, 24, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.text-prompt-input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    padding: 8px 10px;
    outline: none;
}

.voice-action-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.voice-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 148px;
    min-height: 54px;
    padding: 12px 26px;
    border-radius: 999px;
    border: 2px solid transparent;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
    transition: transform 0.12s ease, background-color 0.15s ease;
}

.voice-btn:active {
    transform: scale(0.97);
}

.voice-btn-talk {
    background: #eab308;
    color: #090d16;
    border-color: #fef08a;
}

.voice-btn-talk:hover {
    background: #facc15;
}

.voice-btn-go {
    background: #16a34a;
    color: #ffffff;
    border-color: #86efac;
    min-width: 156px;
}

.voice-btn-go:hover {
    background: #22c55e;
}

.voice-btn-cancel {
    background: rgba(185, 28, 28, 0.92);
    color: #ffffff;
    border-color: #fca5a5;
    min-width: 132px;
}

.voice-btn-cancel:hover {
    background: #dc2626;
}

.mic-svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.type-toggle-btn {
    appearance: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.36);
    background: rgba(9, 14, 24, 0.88);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.type-toggle-btn:hover {
    border-color: #facc15;
    color: #ffffff;
}

.type-toggle-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Shared Small Buttons */
.btn-small {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    padding: 8px 14px;
    min-height: 36px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(30, 41, 59, 0.85);
    color: #f8fafc;
}

.btn-accent {
    background: #eab308;
    border-color: #fde047;
    color: #090d16;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.btn-danger-ghost {
    background: rgba(185, 28, 28, 0.25);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

/* Modals (Saved Library & Help) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(5, 8, 15, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-dialog {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: #0b111e;
    border: 1px solid rgba(250, 204, 21, 0.48);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65);
}

.library-dialog {
    max-width: 620px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.modal-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #facc15;
}

.modal-header h2 {
    margin: 2px 0 0;
    font-size: 21px;
    color: #ffffff;
}

.modal-close {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.save-box {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 16px;
}

.save-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.save-row {
    display: flex;
    gap: 8px;
}

.save-input {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #080c14;
    color: #ffffff;
    font-size: 14px;
    padding: 8px 12px;
}

.save-status {
    margin-top: 8px;
    font-size: 12px;
    color: #86efac;
    min-height: 16px;
}

.library-share-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.library-qr-wrap {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.library-share-info {
    flex: 1 1 240px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.library-share-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #facc15;
}

.library-share-desc {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.42;
    color: #cbd5e1;
}

.library-share-url {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: #080c14;
    color: #e2e8f0;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 12px;
    padding: 8px 10px;
}

.library-share-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.copy-status {
    font-size: 12px;
    font-weight: 600;
    color: #86efac;
}

.copy-status.is-error {
    color: #fca5a5;
}

.player-name-row {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.player-name-label {
    margin-bottom: 0;
}

.library-section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 12px 0 8px;
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.library-empty {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(30, 41, 59, 0.45);
}

.library-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.library-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #f8fafc;
}

.library-card-sub {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.library-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.help-list {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
    line-height: 1.48;
    color: #e2e8f0;
}

.help-list strong {
    color: #facc15;
}

/* Strict ES5 Fallback & Canonical QR Recovery Styles */
.fallback-screen {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #080c14;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.fallback-card {
    max-width: 780px;
    width: 100%;
    background: #0f172a;
    border: 2px solid #eab308;
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
}

.fallback-main {
    flex: 1 1 320px;
}

.fallback-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.fallback-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #ffffff;
}

.fallback-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #facc15;
}

.fallback-title {
    margin: 2px 0 0;
    font-size: 24px;
    color: #ffffff;
}

.fallback-reason {
    font-size: 15px;
    color: #fca5a5;
    margin: 10px 0;
}

.fallback-help {
    font-size: 14px;
    color: #cbd5e1;
    line-height: 1.45;
}

.fallback-status {
    margin-top: 12px;
    font-size: 13px;
    color: #7dd3fc;
}

.fallback-qr-col {
    flex: 0 0 auto;
    text-align: center;
}

.fallback-qr-caption {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #cbd5e1;
    margin-bottom: 8px;
}

/* Canonical RCWeb QR Panel Rules */
.rcRoomQrCodeLink,
.rcRoomQrCodeLink * {
    box-sizing: content-box;
}

.rcRoomQrCodeLink {
    display: inline-block;
    text-decoration: none;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
}

.rcTechLabel {
    background-color: #000000;
    color: #ffffff;
    font-family: monospace;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.rcRoomQrCode {
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.rcRoomId {
    background-color: #000000;
    color: #ffffff;
    font-family: monospace;
    font-size: 15px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
    margin-top: 6px;
}

/* Hidden attribute enforcement */
[hidden] {
    display: none !important;
}

/* Lean-Paint Mode (flat colors, zero heavy shadows) */
body.lean-paint .launch-card,
body.lean-paint .transcript-card,
body.lean-paint .voice-btn,
body.lean-paint .modal-dialog {
    box-shadow: none;
}

body.lean-paint .brand-group,
body.lean-paint .tool-btn,
body.lean-paint .launch-card,
body.lean-paint .transcript-card,
body.lean-paint .reply-banner,
body.lean-paint .text-prompt-form,
body.lean-paint .save-box,
body.lean-paint .library-share-box {
    background: #0c1220;
}

/* Compact & Portrait Viewports (450x960, 1080x1920, 960x540) */
@media (max-width: 680px) {
    .top-bar {
        top: 8px;
        left: 8px;
        right: 8px;
        gap: 6px;
    }

    .brand-group {
        padding: 5px 10px 5px 6px;
    }

    .brand-name {
        font-size: 14px;
    }

    .tool-btn {
        padding: 6px 9px;
        font-size: 12px;
        min-height: 34px;
    }

    .launch-card {
        padding: 18px;
    }

    .launch-title {
        font-size: 24px;
    }

    .transcript-body {
        font-size: 16px;
    }

    .voice-btn {
        min-width: 122px;
        min-height: 50px;
        padding: 10px 20px;
        font-size: 16px;
    }
}
