  @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@500;600;700;800&display=swap');

  @font-face {
    font-family: 'Mumbotfont';
    src: url('/assets/Mumbotfont-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
  }

  :root {
    --game-cursor: url('../assets/cursor.png?v=4') 0 0, auto;
    --game-cursor-pointer: url('../assets/cursor.png?v=4') 0 0, pointer;
    --game-cursor-text: url('../assets/cursor.png?v=4') 0 0, text;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
  canvas {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  body.gameplay-cursor,
  body.gameplay-cursor canvas,
  body.gameplay-cursor #multiplayer-chat {
    cursor: var(--game-cursor);
  }

  body.gameplay-cursor button,
  body.gameplay-cursor .multiplayer-voice-toggle {
    cursor: var(--game-cursor-pointer);
  }

  #blocker {
    position: fixed; inset: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; cursor: pointer;
    background: transparent;
    isolation: isolate;
  }
  #blocker::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    backdrop-filter: blur(16px) saturate(1.15) brightness(0.85);
    -webkit-backdrop-filter: blur(16px) saturate(1.15) brightness(0.85);
    background: rgba(0, 0, 0, 0.42);
  }
  #blocker > * {
    position: relative;
    z-index: 1;
  }
  #blocker .menu-title {
    max-width: min(520px, 88vw);
    height: auto;
    margin-bottom: 12px;
    display: block;
    user-select: none;
    pointer-events: none;
  }
  #blocker .controls-hint {
    font-family: 'Segoe UI', sans-serif;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    line-height: 1.9;
    text-align: center;
    margin-top: 8px;
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.65);
  }
  #blocker .start-hint {
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
  }
  #blocker h1 {
    font-family: 'Segoe UI', system-ui, sans-serif; color: #fff;
    font-size: 72px; margin-bottom: 8px; letter-spacing: 6px;
  }
  #blocker .sub {
    font-family: 'Courier New', monospace; color: #0a0;
    font-size: 14px; letter-spacing: 4px; margin-bottom: 32px;
  }
  #blocker p {
    font-family: 'Segoe UI', sans-serif; color: #888;
    font-size: 15px; line-height: 2; text-align: center;
  }
  #blocker .key {
    display: inline-block; background: rgba(0,255,0,0.1);
    border: 1px solid rgba(0,255,0,0.4); border-radius: 4px;
    padding: 2px 10px; font-family: 'Courier New', monospace;
    color: #0f0; font-size: 13px;
  }
  #blocker .start-hint {
    margin-top: 28px; color: #555; font-size: 13px;
    font-family: 'Segoe UI', sans-serif; animation: pulse 2s infinite;
  }
  @keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

  /* Pause menu icon buttons — match multiplayer chat glass controls */
  #blocker .menu-icon-row {
    position: absolute;
    bottom: 30px;
    right: 30px;
    display: flex;
    gap: 10px;
  }
  #blocker .menu-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #blocker .menu-icon-btn:hover {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.32);
  }

  /* Controls / options panel — match multiplayer chat glass cards */
  #blocker .controls-panel {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    animation: fadeIn 0.3s ease;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  }
  #blocker .controls-panel.show {
    display: flex;
  }
  #blocker .controls-panel .controls-title {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 20px;
  }
  #blocker .controls-panel .controls-close {
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    cursor: pointer;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }
  #blocker .controls-panel .controls-close:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  #blocker .options-panel {
    max-width: min(520px, calc(100vw - 40px));
    margin: 0 auto;
  }
  #blocker .option-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(440px, calc(100vw - 56px));
  }
  #blocker .option-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    text-align: left;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px) saturate(1.1);
    -webkit-backdrop-filter: blur(8px) saturate(1.1);
    transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }
  #blocker .option-toggle:hover {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  #blocker .option-label,
  #blocker .option-description,
  #blocker .option-value {
    display: block;
  }
  #blocker .option-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #fff;
  }
  #blocker .option-description {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.35;
  }
  #blocker .option-value {
    flex: 0 0 auto;
    min-width: 44px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
  }
  #blocker .option-toggle:hover .option-value {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
  }
  #blocker .option-toggle.is-off .option-value {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.55);
    box-shadow: none;
  }
  #blocker .option-expander {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px) saturate(1.1);
    -webkit-backdrop-filter: blur(8px) saturate(1.1);
    overflow: hidden;
  }
  #blocker .option-expander summary {
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.82);
    cursor: pointer;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    list-style-position: inside;
    transition: color 0.18s ease, background 0.18s ease;
  }
  #blocker .option-expander summary:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
  }
  #blocker .option-expander .option-toggle {
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: none;
  }
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  #loading {
    position: fixed; inset: 0; z-index: 20;
    background: #000500;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
  }
  #loading h2 {
    font-family: 'Mumbotfont', 'Segoe UI', system-ui, sans-serif;
    color: #88aaff;
    font-size: 18px;
    margin-bottom: 18px;
    letter-spacing: 0.18em;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 18px rgba(136, 170, 255, 0.32);
  }
  .progress-bar {
    width: 300px; height: 2px; background: rgba(0,255,0,0.1);
    border-radius: 1px; overflow: hidden;
  }
  .progress-fill {
    width: 0%; height: 100%;
    background: linear-gradient(90deg, #00ff00, #44ff44);
    border-radius: 1px; transition: width 0.3s;
  }

  #hud {
    position: fixed; top: 20px; left: 20px; z-index: 5;
    font-family: 'Courier New', monospace; color: #0f0;
    font-size: 12px; pointer-events: none;
    text-shadow: 0 0 8px rgba(0,255,0,0.3);
    line-height: 1.8;
  }
  body.vision-scan #hud {
    color: #ff2a1f;
    text-shadow: 0 0 10px rgba(255,42,31,0.55);
  }
  #camera-mode-fade {
    position: fixed;
    inset: 0;
    z-index: 9;
    background: #000;
    opacity: 0;
    pointer-events: none;
  }
  #camera-photo-flash {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: #fff;
    opacity: 0;
    pointer-events: none;
  }
  #camera-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
  }
  #camera-photo-modal[hidden] {
    display: none !important;
  }
  #camera-photo-modal .camera-photo-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    cursor: pointer;
    opacity: 0;
  }
  #camera-photo-modal .camera-photo-dialog {
    position: relative;
    z-index: 1;
    max-width: min(920px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    border-radius: 10px;
    background: rgba(12, 16, 28, 0.96);
    border: 1px solid rgba(136, 170, 255, 0.35);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    opacity: 0;
    transform: scale(0.9) translateY(14px);
  }
  #camera-photo-modal.is-visible .camera-photo-backdrop {
    animation: camera-photo-backdrop-in 0.32s ease-out forwards;
  }
  #camera-photo-modal .camera-photo-dialog.is-popping-in {
    animation: camera-photo-pop-in 0.42s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
  }
  @keyframes camera-photo-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  @keyframes camera-photo-pop-in {
    from {
      opacity: 0;
      transform: scale(0.88) translateY(18px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }
  #camera-photo-modal .camera-photo-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: #eef3ff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
  }
  #camera-photo-modal .camera-photo-close:hover {
    background: rgba(255, 255, 255, 0.16);
  }
  #camera-photo-modal .camera-photo-preview {
    display: block;
    width: 100%;
    max-height: calc(72vh - 140px);
    object-fit: contain;
    border-radius: 4px;
    background: #000;
  }
  #camera-photo-modal .camera-photo-metadata {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(136, 170, 255, 0.22);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.55;
    color: #b8c8e8;
  }
  #camera-photo-modal .camera-photo-meta-row {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 8px 12px;
    align-items: start;
  }
  #camera-photo-modal .camera-photo-meta-row + .camera-photo-meta-row {
    margin-top: 6px;
  }
  #camera-photo-modal .camera-photo-meta-label {
    color: rgba(136, 170, 255, 0.85);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  #camera-photo-modal .camera-photo-meta-value {
    color: #eef3ff;
    word-break: break-word;
  }
  #camera-photo-modal .camera-photo-meta-row-entities .camera-photo-meta-value {
    color: #d4e4ff;
  }
  #camera-photo-modal .camera-photo-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  #camera-photo-modal .camera-photo-btn {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 10px 18px;
    border-radius: 6px;
    border: 1px solid rgba(136, 170, 255, 0.45);
    background: rgba(68, 136, 255, 0.12);
    color: #cce0ff;
    cursor: pointer;
  }
  #camera-photo-modal .camera-photo-btn:hover {
    background: rgba(68, 136, 255, 0.22);
  }
  #camera-photo-modal .camera-photo-btn-primary {
    background: rgba(68, 136, 255, 0.85);
    color: #fff;
    border-color: #6af;
  }
  #camera-photo-modal .camera-photo-btn-primary:hover {
    background: rgba(100, 160, 255, 0.95);
  }
  #camera-photo-modal .camera-photo-save-status {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.32);
    text-align: right;
    min-height: 16px;
    transition: color 0.3s ease;
  }
  #camera-photo-modal .camera-photo-save-pending {
    color: rgba(255, 255, 255, 0.42);
  }
  #camera-photo-modal .camera-photo-save-ok {
    color: rgba(100, 220, 130, 0.85);
  }
  #camera-hud {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #camera-hud[hidden] {
    display: none !important;
  }
  #camera-hud img {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
  }
  body.vision-camera #hud {
    opacity: 0;
    visibility: hidden;
  }
  body.vision-camera-film::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background:
      radial-gradient(ellipse at center, transparent 28%, rgba(0, 0, 0, 0.82) 100%),
      repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.12) 0,
        rgba(0, 0, 0, 0.12) 1px,
        transparent 1px,
        transparent 3px
      );
    mix-blend-mode: multiply;
    opacity: 0.85;
  }
  body.vision-fallback-scanlines::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background:
      radial-gradient(circle at 50% 50%, rgba(0,255,80,0.04), rgba(0,40,10,0.16)),
      repeating-linear-gradient(
        to bottom,
        rgba(0,255,80,0.045) 0,
        rgba(0,255,80,0.045) 1px,
        transparent 1px,
        transparent 4px
      );
    mix-blend-mode: screen;
  }
  body.scan-fallback-tint::after {
    background:
      radial-gradient(circle at 50% 50%, rgba(255,35,25,0.08), rgba(90,0,0,0.22)),
      repeating-linear-gradient(
        to bottom,
        rgba(255,35,25,0.06) 0,
        rgba(255,35,25,0.06) 1px,
        transparent 1px,
        transparent 4px
      );
  }
  #energy-bar-outer {
    width: 180px; height: 6px; margin-top: 6px;
    background: rgba(0,255,0,0.08);
    border: 1px solid rgba(0,255,0,0.25);
    border-radius: 3px; overflow: hidden;
  }
  body.vision-scan #energy-bar-outer {
    background: rgba(255,30,20,0.08);
    border-color: rgba(255,42,31,0.28);
  }
  #energy-bar-inner {
    width: 100%; height: 100%;
    background: linear-gradient(90deg, #00ff00, #44ff44);
    border-radius: 3px;
    transition: width 0.2s;
    box-shadow: 0 0 8px rgba(0,255,0,0.4);
  }
  body.vision-scan #energy-bar-inner {
    background: linear-gradient(90deg, #ff2218, #ff7058);
    box-shadow: 0 0 10px rgba(255,42,31,0.5);
  }
  #energy-bar-inner.low {
    background: linear-gradient(90deg, #ff4444, #ff8800);
    box-shadow: 0 0 8px rgba(255,68,68,0.4);
  }
  #energy-label {
    display: flex; justify-content: space-between; width: 180px;
    font-size: 10px; margin-top: 2px; opacity: 0.7;
  }
  #scan-cooldown {
    position: fixed; top: 20px; right: 20px; z-index: 5;
    width: 180px; opacity: 0; pointer-events: none;
    font-family: 'Courier New', monospace; color: #ff2a1f;
    font-size: 12px; line-height: 1.8;
    text-align: left;
    text-shadow: 0 0 10px rgba(255,42,31,0.55);
    transition: opacity 0.18s;
  }
  #scan-cooldown.show { opacity: 1; }
  #scan-cooldown-bar-outer {
    width: 180px; height: 6px; margin-top: 6px;
    background: rgba(255,30,20,0.08);
    border: 1px solid rgba(255,42,31,0.28);
    border-radius: 3px; overflow: hidden;
  }
  #scan-cooldown-bar-inner {
    width: 100%; height: 100%;
    background: linear-gradient(90deg, #ff2218, #ff7058);
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(255,42,31,0.5);
  }
  #scan-cooldown-label {
    display: flex; justify-content: space-between; width: 180px;
    font-size: 10px; margin-top: 2px; opacity: 0.75;
  }
  #scan-readout {
    position: fixed; top: 72px; right: 20px; z-index: 5;
    width: 220px; opacity: 0; pointer-events: none;
    font-family: 'Courier New', monospace; color: #ff2a1f;
    font-size: 11px; line-height: 1.6;
    text-align: right;
    text-shadow: 0 0 10px rgba(255,42,31,0.55);
  }
  #scan-entity-ids {
    overflow-wrap: anywhere;
    white-space: pre-line;
  }
  #scan-entity-modal {
    position: fixed; right: 20px; bottom: 24px; z-index: 5;
    width: 280px; opacity: 0; pointer-events: none;
    padding: 12px 14px;
    border: 1px solid rgba(255,42,31,0.35);
    background: transparent;
    font-family: 'Courier New', monospace; color: #ff2a1f;
    font-size: 11px; line-height: 1.65;
    text-align: left;
    text-shadow: none;
    transition: opacity 0.5s;
  }
  #scan-entity-modal span {
    color: inherit;
  }
  #pickup-flash {
    position: fixed; top: 80px; left: 20px; z-index: 120;
    font-family: 'Courier New', monospace; color: #0f0;
    font-size: 13px; opacity: 0; pointer-events: none;
    text-shadow: 0 0 12px rgba(0,255,0,0.6);
    transition: opacity 0.2s;
  }
  body.vision-scan #pickup-flash {
    color: #ff2a1f;
    text-shadow: 0 0 12px rgba(255,42,31,0.7);
  }
  #pickup-flash.show { opacity: 1; }

  /* Cassette / interact prompt — frosted glass (matches .multiplayer-chat-field / .multiplayer-voice-toggle) */
  #interact-prompt {
    position: fixed;
    left: 50%;
    bottom: calc(28% + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 11;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  }
  #interact-prompt.show {
    opacity: 1;
  }
  #interact-prompt[aria-hidden="true"] {
    visibility: hidden;
  }
  #interact-prompt.show[aria-hidden="false"] {
    visibility: visible;
  }
  .interact-prompt-pill {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    min-height: 28px;
    padding: 0 12px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    white-space: nowrap;
    max-width: min(320px, calc(100vw - 32px));
    overflow: hidden;
  }
  .interact-prompt-key {
    flex: 0 0 28px;
    width: 28px;
    min-height: 28px;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.12);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    color: #fff;
    letter-spacing: 0;
    box-sizing: border-box;
  }
  .interact-prompt-text {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    min-width: 0;
    padding: 0 2px 0 10px;
    align-self: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .interact-prompt-action {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.72);
  }
  .interact-prompt-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
  }
  body.vision-scan .interact-prompt-pill {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
  }
  body.vision-scan .interact-prompt-key {
    border-right-color: rgba(255, 255, 255, 0.22);
    color: #fff;
  }

  /* Cassette playback HUD — waveform + playhead (glass, matches chat controls) */
  #cassette-player {
    position: fixed;
    left: 50%;
    bottom: calc(22% + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 12;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s ease, visibility 0.22s ease;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  }
  #cassette-player .cassette-player-pill {
    pointer-events: none;
  }
  #cassette-player .cassette-player-hints {
    pointer-events: auto;
  }
  #cassette-player.show {
    opacity: 1;
    visibility: visible;
  }
  .cassette-player-pill {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    padding: 12px 14px 10px;
    color: rgba(255, 255, 255, 0.92);
  }
  .cassette-player-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    padding-bottom: 2px;
  }
  .cassette-player-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .cassette-player-time {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.72);
    font-variant-numeric: tabular-nums;
  }
  .cassette-player-wave-wrap {
    position: relative;
    width: 100%;
    height: 44px;
    min-height: 44px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
    isolation: isolate;
    pointer-events: auto;
    touch-action: none;
    cursor: pointer;
  }
  .cassette-player-wave-wrap.scrubbing {
    cursor: grabbing;
    border-color: rgba(255, 255, 255, 0.38);
  }
  .cassette-player-wave-wrap.scrubbing .cassette-player-playhead {
    transition: none;
  }
  .cassette-player-wave-wrap.is-loading {
    pointer-events: none;
    cursor: default;
  }
  .cassette-player-loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
  }
  #cassette-player.is-loading .cassette-player-loading,
  .cassette-player-wave-wrap.is-loading .cassette-player-loading {
    display: flex;
  }
  #cassette-player.is-loading .cassette-player-wave,
  .cassette-player-wave-wrap.is-loading .cassette-player-wave {
    opacity: 0;
  }
  #cassette-player.is-loading .cassette-player-hint-pause {
    opacity: 0.35;
    pointer-events: none;
  }
  .cassette-player-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.22);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cassette-player-spin 0.75s linear infinite;
  }
  @keyframes cassette-player-spin {
    to { transform: rotate(360deg); }
  }
  .cassette-player-wave {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    z-index: 1;
  }
  .cassette-player-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    margin-left: -1px;
    z-index: 2;
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.85);
    pointer-events: none;
    transition: left 0.05s linear;
  }
  .cassette-player-hints {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-shrink: 0;
    padding-top: 2px;
  }
  .cassette-player-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
  }
  .cassette-player-key {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.12);
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
  }
  body.vision-scan .cassette-player-pill {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
  }
  @media (hover: none) and (pointer: coarse) {
    #cassette-player {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 212px);
      width: min(320px, calc(100vw - 24px));
      pointer-events: auto;
    }
    .cassette-player-key { display: none; }
    .cassette-player-hint {
      gap: 0;
      padding: 6px 10px;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.22);
      background: rgba(255, 255, 255, 0.1);
      touch-action: manipulation;
    }
  }

  #termination-screen {
    position: fixed; inset: 0; z-index: 40;
    display: none; align-items: center; justify-content: center;
    flex-direction: column;
    background: #000;
    color: #fff;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    text-align: center;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
  }
  #termination-screen.show {
    display: flex;
  }
  #termination-screen::before {
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.05) 0,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 5px
    );
    opacity: 0.22;
    pointer-events: none;
  }
  #termination-screen .termination-title {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: clamp(48px, 11vw, 128px);
    letter-spacing: 10px;
    color: #fff;
  }
  #termination-screen .termination-sub {
    margin-top: 18px;
    font-size: 15px;
    letter-spacing: 5px;
    color: #fff;
  }
  #termination-screen .termination-hint {
    margin-top: 42px;
    font-size: 13px;
    letter-spacing: 3px;
    color: #fff;
    animation: pulse 1.2s infinite;
  }

  /* ── Terminal GUI ── */
  #terminal-gui {
    position: fixed; inset: 0; z-index: 30;
    background: rgba(0, 8, 0, 0);
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(0px);
    cursor: var(--game-cursor);
    transition: background 0.35s ease, backdrop-filter 0.35s ease;
  }
  #terminal-gui.open {
    display: flex;
  }
  #terminal-gui.visible {
    background: rgba(0, 8, 0, 0.6);
    backdrop-filter: blur(4px);
  }

  @keyframes termOpen {
    0%   { transform: scaleX(0) scaleY(0.004); }
    40%  { transform: scaleX(1) scaleY(0.004); }
    60%  { transform: scaleX(1) scaleY(0.004); }
    100% { transform: scaleX(1) scaleY(1); }
  }
  @keyframes termClose {
    0%   { transform: scaleX(1) scaleY(1); }
    40%  { transform: scaleX(1) scaleY(0.004); }
    60%  { transform: scaleX(1) scaleY(0.004); }
    100% { transform: scaleX(0) scaleY(0.004); }
  }

  #terminal-gui .term-window {
    position: relative;
    width: 720px; max-width: 90vw; height: 520px; max-height: 85vh;
    background: #0a1a0a;
    border: 1px solid rgba(0,255,0,0.2);
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    display: flex; flex-direction: column;
    transform: scaleX(0) scaleY(0.004);
  }
  #terminal-gui.open .term-window {
    animation: termOpen 0.6s ease-out forwards;
  }
  #terminal-gui.closing .term-window {
    animation: termClose 0.45s ease-in forwards;
  }
  #terminal-gui .term-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0,255,0,0.1);
    font-family: 'Courier New', monospace;
  }
  #terminal-gui .term-ascii {
    color: #0f0; font-size: 5px; line-height: 1.1;
    white-space: pre; margin-bottom: 12px;
  }
  #terminal-gui .term-tabs {
    display: flex; gap: 0;
  }
  #terminal-gui .term-tab {
    padding: 8px 20px;
    font-family: 'Courier New', monospace; font-size: 12px;
    color: #0a0; letter-spacing: 2px;
    background: transparent;
    border: 1px solid rgba(0,255,0,0.15);
    border-bottom: none;
    cursor: var(--game-cursor-pointer);
    transition: all 0.15s;
    display: flex; align-items: center; gap: 6px;
  }
  #terminal-gui .term-tab:hover { color: #0f0; background: rgba(0,255,0,0.05); }
  #terminal-gui .term-tab.active {
    color: #0f0; background: rgba(0,255,0,0.1);
    border-color: rgba(0,255,0,0.3);
    text-shadow: 0 0 6px rgba(0,255,0,0.4);
  }
  #terminal-gui .term-tab .tab-icon { font-size: 11px; }
  #terminal-gui .term-body {
    padding: 16px 20px;
    overflow-y: auto; flex: 1;
    font-family: 'Courier New', monospace;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,255,0,0.2) transparent;
  }
  #terminal-gui .term-body::-webkit-scrollbar { width: 4px; }
  #terminal-gui .term-body::-webkit-scrollbar-thumb { background: rgba(0,255,0,0.2); border-radius: 2px; }

  /* Projects grid */
  .term-projects { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .term-project {
    border: 1px solid rgba(0,255,0,0.15);
    border-radius: 0; padding: 14px 16px;
    cursor: var(--game-cursor-pointer); transition: all 0.15s;
  }
  .term-project:hover { border-color: rgba(0,255,0,0.4); background: rgba(0,255,0,0.03); }
  .term-project .proj-name {
    color: #0f0; font-size: 13px; font-weight: bold;
    letter-spacing: 2px; margin-bottom: 4px;
    text-shadow: 0 0 6px rgba(0,255,0,0.3);
  }
  .term-project .proj-desc { color: #0a0; font-size: 11px; opacity: 0.7; }
  .term-project .proj-icon { color: #0a0; font-size: 10px; margin-bottom: 6px; }

  /* Console */
  .term-console { color: #0f0; font-size: 12px; line-height: 1.8; }
  .term-console .line-boot { color: #0f0; }
  .term-console .line-info { color: #0a0; }
  .term-console .line-dim { color: #070; }
  .term-console .console-input {
    display: flex; align-items: center; margin-top: 16px; gap: 8px;
  }
  .term-console .console-prompt { color: #0f0; flex-shrink: 0; }
  .term-console .console-field {
    background: transparent; border: none;
    color: #0f0; font-family: 'Courier New', monospace; font-size: 12px;
    outline: none; flex: 1; min-width: 0;
    cursor: var(--game-cursor-text);
  }
  .term-console .console-cursor {
    display: inline-block; width: 8px; height: 14px;
    background: #0f0; animation: blink 1s step-end infinite;
  }
  @keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

  /* Locations */
  .term-locations { display: flex; flex-direction: column; gap: 10px; }
  .locations-header { color: #070; font-size: 11px; margin-bottom: 8px; letter-spacing: 1px; }
  .term-location {
    border: 1px solid rgba(0,255,0,0.15);
    border-radius: 0; padding: 14px 16px;
    cursor: var(--game-cursor-pointer); transition: all 0.15s;
  }
  .term-location:hover { border-color: rgba(0,255,0,0.4); background: rgba(0,255,0,0.03); }
  .term-location .loc-name {
    color: #0f0; font-size: 13px; font-weight: bold;
    letter-spacing: 2px; margin-bottom: 4px;
    text-shadow: 0 0 6px rgba(0,255,0,0.3);
  }
  .term-location .loc-coords { color: #0a0; font-size: 10px; margin-bottom: 6px; }
  .term-location .loc-desc { color: #070; font-size: 11px; }

  /* Links */
  .term-links { display: flex; flex-direction: column; gap: 8px; }
  .term-link {
    border: 1px solid rgba(0,255,0,0.15);
    border-radius: 0; padding: 12px 16px;
    color: #0f0; font-size: 12px;
    cursor: var(--game-cursor-pointer); transition: all 0.15s;
    display: flex; justify-content: space-between; align-items: center;
  }
  .term-link:hover { border-color: rgba(0,255,0,0.4); background: rgba(0,255,0,0.03); }
  .term-link .link-label { letter-spacing: 1px; }
  .term-link .link-url { color: #070; font-size: 10px; }

  #terminal-gui .term-close {
    position: absolute; top: 12px; right: 14px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Courier New', monospace; font-size: 16px;
    color: #0a0; cursor: var(--game-cursor-pointer);
    border: 1px solid rgba(0,255,0,0.15); border-radius: 0;
    background: transparent; transition: all 0.15s;
    z-index: 1;
  }
  #terminal-gui .term-close:hover {
    color: #0f0; border-color: rgba(0,255,0,0.5);
    background: rgba(0,255,0,0.1);
    text-shadow: 0 0 8px rgba(0,255,0,0.5);
  }
  .term-close-hint {
    text-align: center; padding: 10px;
    color: #050; font-family: 'Courier New', monospace;
    font-size: 10px; letter-spacing: 2px;
    border-top: 1px solid rgba(0,255,0,0.1);
  }

  /* ── Map Transition Loading Screen ── */
  #map-transition {
    position: fixed; inset: 0; z-index: 25;
    background: #000;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  #map-transition.active {
    opacity: 1; pointer-events: auto;
  }
  #map-transition .transition-text {
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 48px; letter-spacing: 6px;
    margin-bottom: 24px;
    text-transform: uppercase;
  }
  #map-transition .transition-sub {
    font-family: 'Courier New', monospace;
    font-size: 14px; letter-spacing: 3px;
    opacity: 0.7;
  }
  #map-transition .transition-bar {
    width: 200px; height: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 1px; overflow: hidden;
    margin-top: 32px;
  }
  #map-transition .transition-fill {
    width: 0%; height: 100%;
    border-radius: 1px;
    animation: transitionProgress 1s ease-in-out infinite;
  }
  @keyframes transitionProgress {
    0% { width: 0%; margin-left: 0%; }
    50% { width: 100%; margin-left: 0%; }
    100% { width: 0%; margin-left: 100%; }
  }
  #map-transition.cyber { background: #000500; }
  #map-transition.cyber .transition-text { color: #0f0; text-shadow: 0 0 30px rgba(0,255,0,0.6), 0 0 60px rgba(0,255,0,0.3); }
  #map-transition.cyber .transition-sub { color: #0a0; }
  #map-transition.cyber .transition-fill { background: linear-gradient(90deg, #00ff00, #44ff44); }
  #map-transition.crimson { background: #100505; }
  #map-transition.crimson .transition-text { color: #ff4422; text-shadow: 0 0 30px rgba(255,68,34,0.6), 0 0 60px rgba(255,68,34,0.3); }
  #map-transition.crimson .transition-sub { color: #a44; }
  #map-transition.crimson .transition-fill { background: linear-gradient(90deg, #ff4422, #ff8800); }
  #sequence-fade-overlay {
    position: fixed;
    inset: 0;
    z-index: 85;
    pointer-events: none;
    opacity: 0;
    background: #000;
  }

  /* ── Debug Panel ── */
  #debug-panel {
    position: fixed; top: 10px; right: 10px; z-index: 100;
    width: 320px; max-height: calc(100vh - 20px);
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.94);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    padding: 16px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #cbd5e1;
    font-size: 12px;
    display: none;
    backdrop-filter: blur(14px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
  }
  #debug-panel.visible { display: block; }
  #debug-panel h3 {
    color: #f8fafc; font-size: 12px; margin: 14px 0 8px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    padding-bottom: 6px; letter-spacing: 1px;
    font-weight: 700;
  }
  #debug-panel h3:first-child { margin-top: 0; }
  #debug-panel .row {
    display: flex; align-items: center; justify-content: space-between;
    margin: 5px 0;
  }
  #debug-panel .row label { flex: 0 0 110px; color: #94a3b8; font-size: 11px; }
  #debug-panel .row input[type=range] {
    flex: 1; margin: 0 8px;
    accent-color: #38bdf8; height: 3px;
  }
  #debug-panel .row .val {
    flex: 0 0 42px; text-align: right; color: #e2e8f0; font-size: 11px;
  }
  #debug-panel .row input[type=color] {
    width: 28px; height: 20px; border: 1px solid rgba(148, 163, 184, 0.28);
    background: #0f172a; cursor: pointer; padding: 0;
  }
  #debug-panel .debug-select,
  #debug-panel.editor-layout .editor-view-select select {
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 7px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 11px;
    outline: none;
  }
  #debug-panel .debug-select {
    flex: 1;
    margin: 0 8px;
    padding: 4px 7px;
  }
  #debug-panel .debug-text {
    flex: 1;
    min-width: 0;
    margin: 0 8px;
    padding: 4px 7px;
    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 7px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 11px;
    outline: none;
  }
  #debug-panel .debug-select:focus,
  #debug-panel .debug-text:focus,
  #debug-panel.editor-layout .editor-view-select select:focus {
    border-color: rgba(56, 189, 248, 0.65);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.12);
  }
  #debug-panel .btn-row {
    display: flex; gap: 8px; margin-top: 12px;
  }
  #debug-panel button {
    flex: 1; padding: 6px 0;
    background: rgba(30, 41, 59, 0.92); border: 1px solid rgba(148, 163, 184, 0.22);
    color: #dbeafe; font-family: inherit; font-size: 11px;
    border-radius: 7px; cursor: pointer; letter-spacing: 0.4px;
    font-weight: 650;
  }
  #debug-panel button:hover { background: rgba(51, 65, 85, 0.96); border-color: rgba(56, 189, 248, 0.45); color: #f8fafc; }
  #debug-panel button:disabled {
    opacity: 0.35;
    cursor: default;
  }
  #debug-panel button:disabled:hover {
    background: rgba(30, 41, 59, 0.92);
  }
  #debug-panel .hint {
    color: #64748b; font-size: 10px; text-align: center; margin-top: 8px;
  }
  #debug-panel::-webkit-scrollbar { width: 4px; }
  #debug-panel::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 2px; }

  #debug-panel.gameplay-debug {
    width: min(420px, calc(100vw - 20px));
  }
  #debug-panel.gameplay-debug .gameplay-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  }
  #debug-panel.gameplay-debug .gameplay-debug-header strong {
    color: #f8fafc;
    font-size: 12px;
    letter-spacing: 1px;
  }
  #debug-panel.gameplay-debug .gameplay-debug-header span {
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
  }
  #debug-panel.gameplay-debug .gameplay-debug-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  #debug-panel.gameplay-debug .debug-stats-export-btn,
  #debug-panel.editor-layout .debug-stats-export-btn {
    flex: 0 0 auto;
    min-width: 24px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.42);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  #debug-panel.gameplay-debug .debug-stats-export-btn:hover,
  #debug-panel.editor-layout .debug-stats-export-btn:hover {
    color: #f8fafc;
    border-color: rgba(125, 211, 252, 0.5);
    background: rgba(14, 116, 144, 0.28);
  }

  #debug-panel .debug-tabs {
    display: flex; gap: 0; margin-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }
  #debug-panel .debug-tab {
    flex: 1; padding: 8px; text-align: center;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-bottom: none;
    color: #94a3b8; cursor: pointer;
    font-family: inherit;
    font-size: 11px; letter-spacing: 1px;
    transition: all 0.15s;
  }
  #debug-panel .debug-tab:hover { color: #e2e8f0; background: rgba(148, 163, 184, 0.08); }
  #debug-panel .debug-tab.active {
    color: #f8fafc; background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.45);
  }
  .outliner {
    max-height: 50vh; overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px; margin-bottom: 8px;
    background: rgba(2, 6, 23, 0.24);
  }
  .outliner::-webkit-scrollbar { width: 4px; }
  .outliner::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.35); border-radius: 2px; }
  .outliner-group {
    padding: 5px 8px;
    color: #93c5fd; font-size: 10px; letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(30, 41, 59, 0.45);
    cursor: pointer; user-select: none;
  }
  .outliner-group:hover { background: rgba(51, 65, 85, 0.65); }
  .outliner-group.custom-group {
    color: #c4b5fd;
    background: rgba(49, 46, 129, 0.34);
  }
  .outliner-group.custom-group:hover {
    background: rgba(67, 56, 202, 0.36);
  }
  .outliner-group-name-input {
    width: 150px;
    padding: 1px 4px;
    background: rgba(2, 6, 23, 0.68);
    border: 1px solid rgba(196, 181, 253, 0.48);
    border-radius: 5px;
    color: #f8fafc;
    font: inherit;
    font-size: 10px;
    letter-spacing: 0.8px;
    outline: none;
  }
  .outliner-group-name-input:focus {
    border-color: rgba(196, 181, 253, 0.78);
    background: rgba(15, 23, 42, 0.9);
  }
  .outliner-empty {
    padding: 5px 8px 5px 22px;
    color: #64748b;
    font-size: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
    font-style: italic;
  }
  .outliner-item {
    padding: 3px 8px 3px calc(12px + (var(--depth, 0) * 14px));
    cursor: pointer;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
    font-size: 11px; color: #cbd5e1;
    display: flex; justify-content: space-between;
    gap: 8px;
    align-items: center; transition: background 0.1s;
  }
  .outliner-item:hover { background: rgba(51, 65, 85, 0.5); }
  .outliner-item.selected {
    background: rgba(56, 189, 248, 0.18); color: #f8fafc;
  }
  .outliner-item[draggable="true"] {
    cursor: grab;
  }
  .outliner-item.dragging {
    opacity: 0.45;
    cursor: grabbing;
  }
  .outliner-item.drop-inside {
    background: rgba(56, 189, 248, 0.28);
    box-shadow: inset 3px 0 0 rgba(125, 211, 252, 0.9);
  }
  .outliner-group.drop-group {
    background: rgba(124, 58, 237, 0.38);
    box-shadow: inset 3px 0 0 rgba(196, 181, 253, 0.82);
  }
  .outliner-item .obj-main {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }
  .outliner-item .object-disclosure {
    flex: 0 0 10px;
    color: #94a3b8;
    text-align: center;
  }
  .outliner-item .empty-disclosure {
    opacity: 0;
  }
  .outliner-item .obj-icon {
    flex: 0 0 14px;
    color: #7dd3fc;
    font-size: 11px;
    line-height: 1;
    text-align: center;
  }
  .outliner-item .obj-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .obj-tag {
    flex: 0 0 auto;
    padding: 1px 4px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.7);
    font-size: 8px;
    line-height: 1.2;
    letter-spacing: 0.45px;
  }
  .outliner-item[data-category="actor"] .obj-icon,
  .selected-info[data-category="actor"] .obj-tag {
    color: #c4b5fd;
    border-color: rgba(196, 181, 253, 0.28);
  }
  .outliner-item[data-category="camera"] .obj-icon,
  .selected-info[data-category="camera"] .obj-tag {
    color: #f0abfc;
    border-color: rgba(240, 171, 252, 0.3);
  }
  .outliner-item[data-category="sound"] .obj-icon,
  .selected-info[data-category="sound"] .obj-tag {
    color: #5eead4;
    border-color: rgba(94, 234, 212, 0.3);
  }
  .outliner-item[data-category="light"] .obj-icon,
  .selected-info[data-category="light"] .obj-tag {
    color: #fde68a;
    border-color: rgba(253, 230, 138, 0.28);
  }
  .outliner-item[data-category="geometry"] .obj-icon,
  .selected-info[data-category="geometry"] .obj-tag {
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.28);
  }
  .outliner-item[data-category="helper"] .obj-icon,
  .selected-info[data-category="helper"] .obj-tag {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.28);
  }
  .selected-info .instance-tag {
    color: #67e8f9;
    border-color: rgba(103, 232, 249, 0.36);
    background: rgba(8, 47, 73, 0.56);
  }
  .outliner-item .obj-pos {
    color: #64748b; font-size: 9px;
    font-family: "SFMono-Regular", Consolas, monospace;
    flex: 0 0 auto;
  }
  .outliner-item .obj-sequence-badge {
    flex: 0 0 auto;
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.28);
    background: rgba(20, 83, 45, 0.32);
    border-radius: 999px;
    padding: 1px 5px;
    font-size: 8px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .selected-info {
    padding: 8px;
    background: rgba(15, 23, 42, 0.68);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px; margin-top: 8px;
    font-size: 11px;
  }
  .selected-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .selected-title h3 {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .selected-info .prop-row {
    display: flex; align-items: center;
    margin: 4px 0; color: #cbd5e1;
  }
  .selected-info .prop-label { flex: 0 0 52px; font-size: 10px; color: #94a3b8; }
  .selected-info .scale-label {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  #debug-panel .selected-info .scale-lock-btn {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 5px;
    font-size: 10px;
    line-height: 1;
    color: #94a3b8;
  }
  #debug-panel .selected-info .scale-lock-btn.locked {
    color: #f8fafc;
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.58);
  }
  .selected-info .prop-inputs { display: flex; gap: 3px; flex: 1; }
  .selected-info .decal-texture-drop,
  .selected-info .primitive-texture-drop,
  .selected-info .sound-file-drop {
    border: 1px dashed transparent;
    border-radius: 4px;
    padding: 2px;
  }
  .selected-info .decal-texture-drop.drag-over,
  .selected-info .primitive-texture-drop.drag-over,
  .selected-info .sound-file-drop.drag-over {
    border-color: rgba(56, 189, 248, 0.75);
    background: rgba(56, 189, 248, 0.12);
  }
  .selected-info .prop-toggle-inputs {
    align-items: center;
  }
  .selected-info .prop-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    min-height: 22px;
    color: #cbd5e1;
    font-size: 11px;
    cursor: pointer;
    user-select: none;
  }
  .selected-info .prop-toggle input {
    accent-color: #38bdf8;
    cursor: pointer;
  }
  .selected-info .material-search-row {
    margin-bottom: 6px;
  }
  .selected-info .material-search-input {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid rgba(125, 211, 252, 0.22);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.52);
    color: #e2e8f0;
    font: 10px "SFMono-Regular", Consolas, monospace;
    outline: none;
  }
  .selected-info .material-search-input:focus {
    border-color: rgba(125, 211, 252, 0.52);
    background: rgba(15, 23, 42, 0.76);
  }
  .selected-info .material-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 56vh;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.45) rgba(15, 23, 42, 0.18);
  }
  .selected-info .material-list::-webkit-scrollbar {
    width: 6px;
  }
  .selected-info .material-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  .selected-info .material-list::-webkit-scrollbar-thumb {
    background: rgba(125, 211, 252, 0.45);
    border-radius: 999px;
  }
  .selected-info .material-card {
    padding: 7px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.54);
  }
  .selected-info .material-card-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    margin-bottom: 5px;
  }
  .selected-info .material-card-head span {
    overflow: hidden;
    color: #e2e8f0;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .selected-info .material-card-head em {
    overflow: hidden;
    color: #64748b;
    font-size: 9px;
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .selected-info .material-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 5px;
  }
  .selected-info .material-chips span {
    padding: 2px 5px;
    border: 1px solid rgba(125, 211, 252, 0.18);
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.42);
    color: #bae6fd;
    font-size: 9px;
    line-height: 1.2;
  }
  .selected-info .material-multipliers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
  }
  .selected-info .material-multipliers label {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    color: #c4b5fd;
    font-size: 9px;
  }
  .selected-info .material-multipliers label span {
    flex: 0 0 42px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .selected-info .material-multiplier-input {
    width: 100%;
    min-width: 0;
    padding: 2px 4px;
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(196, 181, 253, 0.24);
    border-radius: 5px;
    color: #f8fafc;
    font: 10px "SFMono-Regular", Consolas, monospace;
    text-align: right;
    outline: none;
  }
  .selected-info .material-multiplier-input:focus {
    border-color: rgba(196, 181, 253, 0.65);
    background: rgba(15, 23, 42, 0.82);
  }
  .selected-info .material-textures {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .selected-info .material-textures div {
    display: flex;
    gap: 6px;
    min-width: 0;
    color: #94a3b8;
    font-size: 9px;
  }
  .selected-info .material-textures b {
    flex: 0 0 72px;
    color: #7dd3fc;
    font-weight: 700;
  }
  .selected-info .material-textures span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .selected-info .material-empty {
    color: #64748b;
    font-size: 9px;
    font-style: italic;
  }
  .selected-info .prop-input,
  .selected-info .name-input,
  .selected-info .group-input {
    width: 100%; padding: 3px 4px;
    background: rgba(2, 6, 23, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    color: #f8fafc; font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px; outline: none;
    text-align: right;
  }
  .selected-info .name-input {
    text-align: left;
  }
  .selected-info .group-input {
    padding: 3px 24px 3px 8px;
    background:
      linear-gradient(45deg, transparent 50%, #93c5fd 50%) right 12px center / 5px 5px no-repeat,
      linear-gradient(135deg, #93c5fd 50%, transparent 50%) right 7px center / 5px 5px no-repeat,
      linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.72));
    color: #dbeafe;
    font-weight: 650;
    letter-spacing: 0.2px;
    text-align: left;
    appearance: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
  .selected-info .group-input:hover {
    border-color: rgba(96, 165, 250, 0.42);
    background:
      linear-gradient(45deg, transparent 50%, #bfdbfe 50%) right 12px center / 5px 5px no-repeat,
      linear-gradient(135deg, #bfdbfe 50%, transparent 50%) right 7px center / 5px 5px no-repeat,
      linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.82));
  }
  .selected-info .group-input option {
    background: #0f172a;
    color: #e2e8f0;
  }
  .selected-info .prop-input[type="number"] {
    cursor: ew-resize;
    user-select: none;
  }
  .selected-info .prop-input[type="number"].value-dragging,
  body.inspector-value-dragging,
  body.inspector-value-dragging * {
    cursor: ew-resize !important;
  }
  .selected-info .prop-input:focus,
  .selected-info .name-input:focus,
  .selected-info .group-input:focus {
    border-color: rgba(56, 189, 248, 0.65);
    background: rgba(15, 23, 42, 0.82);
  }
  .selected-info .group-input:focus {
    background:
      linear-gradient(45deg, transparent 50%, #bfdbfe 50%) right 12px center / 5px 5px no-repeat,
      linear-gradient(135deg, #bfdbfe 50%, transparent 50%) right 7px center / 5px 5px no-repeat,
      rgba(15, 23, 42, 0.82);
  }
  .outliner-context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 128px;
    padding: 4px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(12px);
  }
  .outliner-move-group-menu {
    min-width: 156px;
    max-width: 240px;
    max-height: min(320px, calc(100vh - 16px));
    overflow-y: auto;
  }
  .outliner-context-label {
    padding: 5px 8px 4px;
    color: #64748b;
    font: 700 9px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0.7px;
    text-transform: uppercase;
  }
  .outliner-context-menu button {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #cbd5e1;
    font: 650 11px Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-align: left;
    cursor: pointer;
  }
  .outliner-context-menu button:hover {
    background: rgba(56, 189, 248, 0.16);
    color: #f8fafc;
  }
  .outliner-context-menu button.danger {
    color: #fecaca;
  }
  .outliner-context-menu button.danger:hover {
    background: rgba(239, 68, 68, 0.18);
  }
  .outliner-context-menu button:disabled {
    color: #475569;
    cursor: default;
  }
  .outliner-context-menu button:disabled:hover {
    background: transparent;
  }
  .btn-danger {
    background: rgba(239,68,68,0.14) !important;
    border-color: rgba(248,113,113,0.38) !important;
    color: #fecaca !important;
  }
  .btn-danger:hover {
    background: rgba(239,68,68,0.24) !important;
  }

  /* ── Content Browser ── */
  .content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 4px;
  }
  .content-explorer {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .content-explorer-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  #debug-panel .content-up {
    flex: 0 0 auto;
    width: 28px;
    padding: 4px 0;
    border-radius: 2px;
    font-size: 11px;
  }
  .content-breadcrumb {
    flex: 1;
    min-width: 0;
    padding: 5px 7px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 7px;
    background: rgba(2, 6, 23, 0.32);
    color: #cbd5e1;
    font-size: 10px;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 5px;
    overflow: hidden;
    white-space: nowrap;
  }
  #debug-panel .content-crumb {
    flex: 0 1 auto;
    min-width: 0;
    width: auto;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #cbd5e1;
    font: inherit;
    letter-spacing: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }
  #debug-panel .content-crumb:hover {
    color: #f8fafc;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  #debug-panel .content-crumb.current {
    color: #94a3b8;
    cursor: default;
    pointer-events: none;
    text-decoration: none;
  }
  .content-crumb-separator {
    flex: 0 0 auto;
    color: #475569;
  }
  .content-view-toggle {
    display: flex;
    flex: 0 0 auto;
    gap: 3px;
  }
  .content-import-dropdown {
    position: relative;
    display: flex;
    margin-left: 4px;
  }
  #debug-panel .content-view-toggle button {
    flex: 0 0 auto;
    width: 28px;
    padding: 4px 0;
    border-radius: 2px;
    font-size: 11px;
  }
  #debug-panel .content-view-toggle button.active-view {
    background: rgba(56, 189, 248, 0.2);
    border-color: rgba(56, 189, 248, 0.55);
    color: #f8fafc;
  }
  #debug-panel .content-view-toggle .content-import-action {
    width: 34px;
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(56, 189, 248, 0.42);
    color: #f8fafc;
    font-size: 10px;
    line-height: 1;
  }
  #debug-panel .content-view-toggle .content-import-action:hover {
    background: rgba(56, 189, 248, 0.28);
    border-color: rgba(56, 189, 248, 0.65);
  }
  .content-import-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 70px;
    padding: 4px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 6px;
    background: rgba(2, 6, 23, 0.96);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  }
  .content-import-dropdown.open .content-import-menu {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  #debug-panel .content-view-toggle .content-import-menu button {
    width: 100%;
    padding: 5px 8px;
    text-align: left;
    font-size: 10px;
  }
  .content-item {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.62);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
  }
  .content-item:hover {
    border-color: rgba(56, 189, 248, 0.48);
    background: rgba(30, 41, 59, 0.84);
  }
  .content-item:active {
    background: rgba(56, 189, 248, 0.18);
    transform: scale(0.96);
  }
  .content-icon {
    font-size: 18px; color: #7dd3fc;
    text-shadow: none;
    line-height: 1;
  }
  .content-label {
    font-size: 9px; color: #cbd5e1;
    letter-spacing: 0.5px; text-align: center;
  }
  .content-title {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
  }
  .content-explorer.grid-view .content-label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .content-tag {
    flex: 0 0 auto;
    padding: 1px 4px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.7);
    font-size: 7px;
    line-height: 1.2;
    letter-spacing: 0.35px;
  }
  .content-item[data-category="actor"] .content-icon,
  .content-item[data-category="actor"] .content-tag {
    color: #c4b5fd;
    border-color: rgba(196, 181, 253, 0.28);
  }
  .content-item[data-category="camera"] .content-icon,
  .content-item[data-category="camera"] .content-tag {
    color: #f0abfc;
    border-color: rgba(240, 171, 252, 0.3);
  }
  .content-item[data-category="sound"] .content-icon,
  .content-item[data-category="sound"] .content-tag {
    color: #5eead4;
    border-color: rgba(94, 234, 212, 0.3);
  }
  .content-item[data-category="light"] .content-icon,
  .content-item[data-category="light"] .content-tag {
    color: #fde68a;
    border-color: rgba(253, 230, 138, 0.28);
  }
  .content-item[data-category="geometry"] .content-icon,
  .content-item[data-category="geometry"] .content-tag {
    color: #7dd3fc;
    border-color: rgba(125, 211, 252, 0.28);
  }
  .content-item[data-category="helper"] .content-icon,
  .content-item[data-category="helper"] .content-tag {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.28);
  }
  .content-empty {
    min-width: 140px;
    padding: 18px 10px;
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 9px;
    color: #94a3b8;
    font-size: 10px;
    letter-spacing: 0.5px;
    text-align: center;
  }
  .content-item:hover .content-label { color: #f8fafc; }
  .content-folder {
    background: rgba(30, 41, 59, 0.72);
  }
  .content-count {
    color: #94a3b8;
    font-size: 8px;
    line-height: 1;
  }
  .content-import {
    border-style: dashed;
  }
  .content-import:hover {
    border-style: solid;
  }
  .content-explorer.list-view .content-explorer-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .content-explorer.list-view .content-item {
    width: auto;
    min-height: 28px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 4px 8px;
  }
  .content-explorer.list-view .content-icon {
    flex: 0 0 18px;
    font-size: 14px;
  }
  .content-explorer.list-view .content-title {
    flex: 1;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }
  .content-explorer.list-view .content-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .content-explorer.list-view .content-count {
    margin-left: auto;
    font-size: 9px;
  }

  /* ── Fullscreen Editor Layout ── */
  #debug-panel.editor-layout {
    --editor-left-panel-width: 270px;
    --editor-right-panel-width: 330px;
    --editor-bottom-panel-height: 220px;
    --editor-debug-panel-width: 460px;
    inset: 0;
    width: auto;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
  }
  #debug-panel.editor-layout .editor-topbar,
  #debug-panel.editor-layout .editor-panel,
  #debug-panel.editor-layout .editor-bottom-panel,
  #debug-panel.editor-layout .editor-controls-overlay {
    pointer-events: auto;
  }
  #debug-panel.editor-layout.editor-hud-hidden > * {
    display: none !important;
  }
  #debug-panel.editor-layout .editor-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 12px;
    background: rgba(15, 23, 42, 0.96);
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  #debug-panel.editor-layout .editor-brand {
    color: #f8fafc;
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 800;
    white-space: nowrap;
  }
  #debug-panel.editor-layout .debug-tabs {
    margin: 0;
    border: none;
    flex: 0 0 auto;
  }
  #debug-panel.editor-layout .debug-tab {
    min-width: 78px;
    padding: 7px 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 7px;
    margin-right: 4px;
    background: rgba(30, 41, 59, 0.72);
  }
  #debug-panel.editor-layout .debug-tab.active {
    background: rgba(56, 189, 248, 0.2);
  }
  #debug-panel.editor-layout .editor-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
  }
  #debug-panel.editor-layout .editor-actions button {
    flex: 0 0 auto;
    min-width: 58px;
    padding: 6px 9px;
    border-radius: 7px;
    font-size: 10px;
  }
  #debug-panel.editor-layout .editor-actions .editor-icon-btn,
  #debug-panel.editor-layout .editor-overflow .editor-icon-btn {
    min-width: 28px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    line-height: 1;
  }
  #debug-panel.editor-layout .editor-actions .editor-sim-toggle {
    min-width: 28px;
    letter-spacing: 0;
  }
  #debug-panel.editor-layout .editor-actions .editor-sim-toggle.paused {
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.48);
    background: rgba(127, 29, 29, 0.45);
  }
  #debug-panel.editor-layout .editor-actions .editor-sim-toggle.running {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.38);
    background: rgba(20, 83, 45, 0.36);
  }
  #debug-panel.editor-layout .editor-overflow {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
  }
  #debug-panel.editor-layout .editor-menu-trigger {
    font-size: 15px;
    position: relative;
    z-index: 12;
  }
  #debug-panel.editor-layout .editor-overflow-menu {
    position: absolute;
    top: calc(100% - 1px);
    right: 0;
    z-index: 11;
    min-width: 158px;
    padding: 4px;
    display: none;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(12, 19, 34, 0.98));
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 11px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.45);
  }
  #debug-panel.editor-layout .editor-overflow.open .editor-overflow-menu,
  #debug-panel.editor-layout .editor-overflow:focus-within .editor-overflow-menu {
    display: block;
  }
  #debug-panel.editor-layout .editor-overflow.open .editor-menu-trigger {
    border-color: rgba(125, 211, 252, 0.52);
    background: rgba(30, 41, 59, 0.98);
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.28);
  }
  #debug-panel.editor-layout .editor-overflow-menu button {
    width: 100%;
    min-width: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    text-align: left;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 0;
    background: rgba(15, 23, 42, 0.78);
    box-shadow: none;
  }
  #debug-panel.editor-layout .editor-overflow-menu button:first-child {
    border-top: 0;
  }
  #debug-panel.editor-layout .editor-overflow-menu button:hover {
    background: rgba(30, 41, 59, 0.98);
  }
  #debug-panel.editor-layout .editor-overflow-menu .editor-menu-icon {
    width: 14px;
    color: #7dd3fc;
    text-align: center;
    flex: 0 0 14px;
  }
  #debug-panel.editor-layout .editor-controls-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 58px 18px 18px;
    background: rgba(2, 6, 23, 0.58);
    backdrop-filter: blur(10px);
  }
  #debug-panel.editor-layout .editor-controls-overlay.show {
    display: flex;
  }
  #debug-panel.editor-layout .editor-controls-card {
    width: min(780px, 100%);
    max-height: min(720px, calc(100vh - 76px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.52);
  }
  #debug-panel.editor-layout .editor-settings-card {
    width: min(440px, 100%);
    max-height: min(560px, calc(100vh - 76px));
  }
  #debug-panel.editor-layout .editor-controls-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  }
  #debug-panel.editor-layout .editor-controls-eyebrow {
    margin-bottom: 4px;
    color: #7dd3fc;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
  }
  #debug-panel.editor-layout .editor-controls-header h2 {
    margin: 0;
    color: #f8fafc;
    font-size: 16px;
    letter-spacing: 0.5px;
  }
  #debug-panel.editor-layout button.editor-controls-close {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    min-width: 0;
    padding: 0;
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
  }
  #debug-panel.editor-layout .editor-controls-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.42) transparent;
  }
  #debug-panel.editor-layout .editor-controls-grid::-webkit-scrollbar {
    width: 6px;
  }
  #debug-panel.editor-layout .editor-controls-grid::-webkit-scrollbar-track {
    background: transparent;
  }
  #debug-panel.editor-layout .editor-controls-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.52), rgba(59, 130, 246, 0.32));
    border: 2px solid rgba(15, 23, 42, 0.98);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .editor-controls-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.72), rgba(59, 130, 246, 0.5));
  }
  #debug-panel.editor-layout .editor-controls-grid section {
    padding: 12px;
    background: rgba(2, 6, 23, 0.38);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
  }
  #debug-panel.editor-layout .editor-controls-grid h3 {
    margin: 0 0 10px;
    padding: 0 0 7px;
    color: #f8fafc;
    font-size: 10px;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }
  #debug-panel.editor-layout .control-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 25px;
    color: #cbd5e1;
  }
  #debug-panel.editor-layout .control-row span {
    margin-left: auto;
    color: #94a3b8;
    font-size: 11px;
    text-align: right;
  }
  #debug-panel.editor-layout .control-row kbd {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 3px 6px;
    border: 1px solid rgba(125, 211, 252, 0.28);
    border-bottom-color: rgba(125, 211, 252, 0.45);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.9);
    color: #dbeafe;
    font: 800 10px "SFMono-Regular", Consolas, monospace;
    text-align: center;
    box-shadow: inset 0 -1px 0 rgba(125, 211, 252, 0.18);
  }
  #debug-panel.editor-layout .editor-settings-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }
  #debug-panel.editor-layout .editor-settings-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(2, 6, 23, 0.38);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 10px;
  }
  #debug-panel.editor-layout .editor-settings-section-title {
    color: #f8fafc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  #debug-panel.editor-layout .editor-settings-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #cbd5e1;
    font-size: 11px;
  }
  #debug-panel.editor-layout .editor-settings-field strong {
    color: #f8fafc;
    font-size: 11px;
    letter-spacing: 0.4px;
  }
  #debug-panel.editor-layout .editor-settings-section input[type=range] {
    width: 100%;
    margin: 0;
    accent-color: #38bdf8;
  }
  #debug-panel.editor-layout .editor-settings-select {
    width: 100%;
    margin: 0;
    padding: 7px 9px;
  }
  #debug-panel.editor-layout .editor-settings-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  #debug-panel.editor-layout .editor-settings-actions button {
    flex: 0 0 auto;
    width: 100%;
  }
  #debug-panel.editor-layout .editor-settings-actions button.is-active {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.38);
    background: rgba(20, 83, 45, 0.36);
  }
  #debug-panel.editor-layout .editor-settings-actions .hint {
    margin-top: 0;
    text-align: left;
    line-height: 1.5;
  }
  @media (max-width: 720px) {
    #debug-panel.editor-layout .editor-controls-grid {
      grid-template-columns: 1fr;
    }
  }
  #debug-panel.editor-layout {
    --editor-toolbar-shift: 0px;
  }
  #debug-panel.editor-layout[data-editor-tab="vcam"] {
    --editor-toolbar-shift: 34px;
  }
  #debug-panel.editor-layout[data-editor-tab="debug"] {
    --editor-toolbar-shift: -308px;
  }
  #debug-panel.editor-layout .editor-transform-modes {
    position: fixed;
    top: 48px;
    right: calc(var(--editor-right-panel-width) + 28px + var(--editor-toolbar-shift));
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 0;
    border-left: none;
    flex: 0 0 auto;
  }
  #debug-panel.editor-layout .editor-transform-btn {
    flex: 0 0 auto;
    min-width: 30px;
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 7px;
    color: #94a3b8;
    font-size: 10px;
  }
  #debug-panel.editor-layout .editor-transform-btn.active-mode {
    color: #f8fafc;
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.58);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.14);
  }
  #debug-panel.editor-layout .transform-icon {
    color: #7dd3fc;
    font-size: 13px;
    line-height: 1;
  }
  #debug-panel.editor-layout .editor-camera-speed {
    position: fixed;
    top: 48px;
    right: calc(var(--editor-right-panel-width) + 301px + var(--editor-toolbar-shift));
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.9);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.28);
    pointer-events: auto;
    overflow: hidden;
    transition: width 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  }
  #debug-panel.editor-layout .editor-camera-icon {
    color: #7dd3fc;
    font-size: 13px;
    line-height: 1;
  }
  #debug-panel.editor-layout .editor-camera-speed input[type=range] {
    width: 0;
    margin: 0;
    opacity: 0;
    accent-color: #38bdf8;
    transition: width 0.16s ease, opacity 0.12s ease;
  }
  #debug-panel.editor-layout .editor-camera-speed:hover,
  #debug-panel.editor-layout .editor-camera-speed:focus-within {
    border-color: rgba(56, 189, 248, 0.45);
    background: rgba(15, 23, 42, 0.96);
  }
  #debug-panel.editor-layout .editor-camera-speed:hover input[type=range],
  #debug-panel.editor-layout .editor-camera-speed:focus-within input[type=range] {
    width: 96px;
    opacity: 1;
  }
  #debug-panel.editor-layout .editor-view-select {
    position: fixed;
    top: 48px;
    right: calc(var(--editor-right-panel-width) + 136px + var(--editor-toolbar-shift));
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 7px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.9);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.7px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.28);
    pointer-events: auto;
  }
  #debug-panel.editor-layout .editor-view-select select {
    min-width: 108px;
    padding: 3px 7px;
  }
  #debug-panel.editor-layout #debug-tab-content,
  #debug-panel.editor-layout .editor-shell {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  #debug-panel.editor-layout .editor-panel,
  #debug-panel.editor-layout .editor-bottom-panel {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.38);
    backdrop-filter: blur(14px);
  }
  #debug-panel.editor-layout .editor-hierarchy {
    position: absolute;
    top: 48px;
    left: 10px;
    bottom: 10px;
    width: var(--editor-left-panel-width);
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }
  #debug-panel.editor-layout .editor-inspector {
    position: absolute;
    top: 48px;
    right: 10px;
    bottom: calc(var(--editor-bottom-panel-height) + 18px);
    width: var(--editor-right-panel-width);
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.42) transparent;
  }
  #debug-panel.editor-layout .editor-inspector::-webkit-scrollbar {
    width: 6px;
  }
  #debug-panel.editor-layout .editor-inspector::-webkit-scrollbar-track {
    background: transparent;
  }
  #debug-panel.editor-layout .editor-inspector::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.58), rgba(56, 189, 248, 0.28));
    border-radius: 999px;
  }
  #debug-panel.editor-layout .editor-inspector::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.82), rgba(56, 189, 248, 0.42));
  }
  #debug-panel.editor-layout .render-inspector {
    bottom: 10px;
    width: min(var(--editor-right-panel-width), calc(100vw - 20px));
  }
  #debug-panel.editor-layout .debug-inspector {
    left: 10px;
    right: auto;
    bottom: 10px;
    width: min(var(--editor-debug-panel-width), calc(100vw - 20px));
  }
  #debug-panel.editor-layout .editor-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }
  #debug-panel.editor-layout .editor-panel-title-row .editor-panel-title {
    flex: 1;
    min-width: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
  }
  #debug-panel.editor-layout .debug-stat-list,
  #debug-panel.gameplay-debug .debug-stat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  #debug-panel.editor-layout .debug-stat-row,
  #debug-panel.gameplay-debug .debug-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.32);
  }
  #debug-panel.editor-layout .debug-stat-label,
  #debug-panel.gameplay-debug .debug-stat-label {
    min-width: 0;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
  }
  #debug-panel.editor-layout .debug-stat-row strong,
  #debug-panel.gameplay-debug .debug-stat-row strong {
    display: block;
    color: #f8fafc;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0.2px;
    text-align: right;
  }
  #debug-panel.editor-layout .debug-breakdown,
  #debug-panel.gameplay-debug .debug-breakdown {
    margin-top: 10px;
  }
  #debug-panel.editor-layout .debug-breakdown-category,
  #debug-panel.gameplay-debug .debug-breakdown-category {
    margin-top: 6px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.24);
    overflow: hidden;
  }
  #debug-panel.editor-layout .debug-breakdown-category summary,
  #debug-panel.gameplay-debug .debug-breakdown-category summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    color: #f8fafc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    cursor: pointer;
    list-style-position: inside;
  }
  #debug-panel.editor-layout .debug-breakdown-category summary span:last-child,
  #debug-panel.gameplay-debug .debug-breakdown-category summary span:last-child {
    color: #94a3b8;
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
  }
  #debug-panel.editor-layout .debug-breakdown-table,
  #debug-panel.gameplay-debug .debug-breakdown-table {
    border-top: 1px solid rgba(148, 163, 184, 0.12);
  }
  #debug-panel.editor-layout .debug-breakdown-head,
  #debug-panel.editor-layout .debug-breakdown-row,
  #debug-panel.gameplay-debug .debug-breakdown-head,
  #debug-panel.gameplay-debug .debug-breakdown-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px 42px 42px 42px;
    gap: 6px;
    align-items: center;
    padding: 6px 10px;
  }
  #debug-panel.editor-layout .debug-breakdown-head,
  #debug-panel.gameplay-debug .debug-breakdown-head {
    color: #7dd3fc;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: rgba(30, 41, 59, 0.38);
  }
  #debug-panel.editor-layout .debug-breakdown-row,
  #debug-panel.gameplay-debug .debug-breakdown-row {
    color: #cbd5e1;
    font-size: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
  }
  #debug-panel.editor-layout .debug-breakdown-head span:not(:first-child),
  #debug-panel.editor-layout .debug-breakdown-row span:not(:first-child),
  #debug-panel.gameplay-debug .debug-breakdown-head span:not(:first-child),
  #debug-panel.gameplay-debug .debug-breakdown-row span:not(:first-child) {
    text-align: right;
  }
  #debug-panel.editor-layout .debug-object-name,
  #debug-panel.gameplay-debug .debug-object-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e2e8f0;
  }
  #debug-panel.editor-layout .render-inspector .row {
    width: 100%;
  }
  #debug-panel.editor-layout .render-inspector .row label {
    flex-basis: 96px;
  }
  #debug-panel.editor-layout .render-inspector .row input[type=range],
  #debug-panel.editor-layout .render-inspector .debug-select {
    min-width: 0;
  }
  #debug-panel.editor-layout .render-section {
    margin-top: 10px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 9px;
    background: rgba(2, 6, 23, 0.22);
    overflow: hidden;
  }
  #debug-panel.editor-layout .render-section:first-of-type {
    margin-top: 0;
  }
  #debug-panel.editor-layout .render-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 9px;
    border: 0;
    border-radius: 0;
    background: rgba(30, 41, 59, 0.48);
    color: #f8fafc;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-align: left;
  }
  #debug-panel.editor-layout .render-section-toggle:hover {
    background: rgba(51, 65, 85, 0.72);
  }
  #debug-panel.editor-layout .render-section-caret {
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid #7dd3fc;
    transform: rotate(90deg);
    transition: transform 0.12s ease;
  }
  #debug-panel.editor-layout .render-section.collapsed .render-section-caret {
    transform: rotate(0deg);
  }
  #debug-panel.editor-layout .render-section-body {
    padding: 6px 8px 8px;
  }
  #debug-panel.editor-layout .editor-bottom-panel {
    position: absolute;
    left: calc(var(--editor-left-panel-width) + 20px);
    right: 10px;
    bottom: 10px;
    z-index: 30;
    height: var(--editor-bottom-panel-height);
    padding: 10px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  #debug-panel.editor-layout .animate-timeline-body {
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.5) rgba(15, 23, 42, 0.18);
    user-select: none;
  }
  #debug-panel.editor-layout .animate-track-row,
  #debug-panel.editor-layout .animate-channel-row,
  #debug-panel.editor-layout .animate-frame-ruler {
    user-select: none;
  }
  #debug-panel.editor-layout .animate-timeline-body::-webkit-scrollbar {
    width: 7px;
  }
  #debug-panel.editor-layout .animate-timeline-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .animate-timeline-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.62), rgba(56, 189, 248, 0.28));
    border: 2px solid rgba(15, 23, 42, 0.9);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .animate-timeline-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.84), rgba(56, 189, 248, 0.42));
  }
  #debug-panel.editor-layout .animate-timeline-body.middle-scroll-active {
    cursor: grabbing;
  }
  #debug-panel.editor-layout .animate-waveform-clip {
    position: absolute;
    top: 3px;
    bottom: 3px;
    min-width: 12px;
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 0 3px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 3px;
    background: rgba(245, 158, 11, 0.1);
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
  }
  #debug-panel.editor-layout .animate-waveform-clip span:not(.animate-waveform-loading) {
    flex: 1 1 1px;
    min-width: 1px;
    border-radius: 1px;
    background: rgba(251, 191, 36, 0.72);
    box-shadow: 0 0 3px rgba(245, 158, 11, 0.25);
  }
  #debug-panel.editor-layout .animate-waveform-loading {
    width: 100%;
    color: rgba(251, 191, 36, 0.78);
    font-size: 9px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0;
  }
  #debug-panel.editor-layout .animate-header-actions {
    position: relative;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
  }
  #debug-panel.editor-layout .animate-fx-menu-wrap {
    position: relative;
    z-index: 50;
    display: flex;
  }
  #debug-panel.editor-layout .animate-fx-menu {
    position: absolute;
    right: 0;
    bottom: 28px;
    min-width: 120px;
    padding: 4px;
    border: 1px solid rgba(251, 191, 36, 0.34);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36);
    display: none;
    z-index: 200;
  }
  #debug-panel.editor-layout .animate-fx-menu.open {
    display: block;
  }
  #debug-panel.editor-layout .animate-fx-menu button {
    width: 100%;
    padding: 5px 7px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #fde68a;
    font-size: 10px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
  }
  #debug-panel.editor-layout .animate-fx-menu button:hover {
    background: rgba(251, 191, 36, 0.14);
  }
  #debug-panel.editor-layout .animate-fx-clip {
    position: absolute;
    top: 4px;
    bottom: 4px;
    min-width: 18px;
    padding: 2px 5px;
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 4px;
    background: rgba(251, 191, 36, 0.18);
    color: #fde68a;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    z-index: 2;
  }
  #debug-panel.editor-layout .animate-fx-clip.selected,
  #debug-panel.editor-layout .sequence-fx-card.selected {
    border-color: rgba(255, 255, 255, 0.78);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.36);
  }
  #debug-panel.editor-layout .sequence-fx-card {
    padding: 6px;
    margin: 0 0 6px;
    border: 1px solid rgba(251, 191, 36, 0.18);
    border-radius: 6px;
    background: rgba(251, 191, 36, 0.06);
  }
  #debug-panel.editor-layout .sequence-fx-card-head {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
  }
  #debug-panel.editor-layout .sequence-fx-select,
  #debug-panel.editor-layout .sequence-fx-delete {
    border: 0;
    background: transparent;
    color: #fde68a;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
  }
  #debug-panel.editor-layout .sequence-fx-select {
    flex: 1;
    text-align: left;
  }
  #debug-panel.editor-layout .sequence-fx-delete {
    color: #f87171;
  }
  #debug-panel.editor-layout .editor-resize-handle {
    position: absolute;
    z-index: 8;
    opacity: 0;
    transition: opacity 0.12s ease, background 0.12s ease;
    touch-action: none;
  }
  #debug-panel.editor-layout .editor-resize-handle:hover,
  #debug-panel.editor-layout .editor-resize-handle.is-resizing {
    opacity: 1;
  }
  #debug-panel.editor-layout .editor-resize-handle--right,
  #debug-panel.editor-layout .editor-resize-handle--left {
    top: 8px;
    bottom: 8px;
    width: 8px;
    cursor: ew-resize;
  }
  #debug-panel.editor-layout .editor-resize-handle--right {
    right: -4px;
    background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.34), transparent);
  }
  #debug-panel.editor-layout .editor-resize-handle--left {
    left: -4px;
    background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.34), transparent);
  }
  #debug-panel.editor-layout .editor-resize-handle--top {
    top: -4px;
    left: 8px;
    right: 8px;
    height: 8px;
    cursor: ns-resize;
    background: linear-gradient(180deg, transparent, rgba(125, 211, 252, 0.34), transparent);
  }
  body.editor-panel-resizing {
    user-select: none;
  }
  #debug-panel.editor-layout .animate-tl-scrollbar {
    width: 100%;
    height: 12px;
    margin: 2px 0 0;
    cursor: grab;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    flex: 0 0 12px;
  }
  #debug-panel.editor-layout .animate-tl-scrollbar:active {
    cursor: grabbing;
  }
  #debug-panel.editor-layout .animate-tl-scrollbar::-webkit-slider-runnable-track {
    height: 7px;
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .animate-tl-scrollbar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 44px;
    height: 7px;
    border: 2px solid rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.62), rgba(56, 189, 248, 0.28));
  }
  #debug-panel.editor-layout .animate-tl-scrollbar:hover::-webkit-slider-thumb {
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.84), rgba(56, 189, 248, 0.42));
  }
  #debug-panel.editor-layout .animate-tl-scrollbar::-moz-range-track {
    height: 7px;
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .animate-tl-scrollbar::-moz-range-thumb {
    width: 44px;
    height: 7px;
    border: 2px solid rgba(15, 23, 42, 0.9);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(125, 211, 252, 0.62), rgba(56, 189, 248, 0.28));
  }
  #debug-panel.editor-layout .editor-panel-title,
  #debug-panel.editor-layout .editor-section-title,
  #debug-panel.editor-layout .editor-bottom-header {
    color: #f8fafc;
    font-size: 11px;
    letter-spacing: 1px;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    font-weight: 800;
  }
  #debug-panel.editor-layout .editor-section-title {
    margin-top: 12px;
    color: #94a3b8;
    font-size: 10px;
  }
  #debug-panel.editor-layout .editor-panel-tabs {
    display: flex;
    gap: 2px;
    padding-bottom: 7px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }
  #debug-panel.editor-layout .editor-panel-tab {
    flex: 1;
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.42);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    padding: 5px 4px;
    cursor: pointer;
  }
  #debug-panel.editor-layout .editor-panel-tab.active {
    background: rgba(56, 189, 248, 0.16);
    border-color: rgba(125, 211, 252, 0.42);
    color: #f8fafc;
  }
  #debug-panel.editor-layout .animate-content-browser {
    flex: 1;
    min-height: 0;
    display: flex;
    min-width: 0;
    overflow: hidden;
  }
  #debug-panel.editor-layout .editor-bottom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  #debug-panel.editor-layout .outliner {
    flex: 1;
    max-height: none;
    margin: 0;
    min-height: 0;
    background: rgba(2, 6, 23, 0.28);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.42) rgba(15, 23, 42, 0.18);
  }
  #debug-panel.editor-layout .outliner::-webkit-scrollbar {
    width: 8px;
  }
  #debug-panel.editor-layout .outliner::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .outliner::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.55), rgba(56, 189, 248, 0.28));
    border: 2px solid rgba(15, 23, 42, 0.85);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .outliner::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.8), rgba(56, 189, 248, 0.45));
  }
  #debug-panel.editor-layout .selected-info {
    margin-top: 0;
    background: rgba(2, 6, 23, 0.28);
  }
  #debug-panel.editor-layout .editor-empty-state {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  #debug-panel.editor-layout .content-grid {
    grid-template-columns: repeat(3, 50px);
    gap: 6px;
    margin-bottom: 0;
  }
  #debug-panel.editor-layout .content-explorer {
    flex: 1;
    min-height: 0;
  }
  #debug-panel.editor-layout .content-explorer-grid {
    grid-template-columns: repeat(auto-fill, 72px);
    align-content: start;
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(125, 211, 252, 0.42) rgba(15, 23, 42, 0.18);
  }
  #debug-panel.editor-layout .content-explorer-grid::-webkit-scrollbar {
    width: 8px;
  }
  #debug-panel.editor-layout .content-explorer-grid::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .content-explorer-grid::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.55), rgba(56, 189, 248, 0.28));
    border: 2px solid rgba(15, 23, 42, 0.85);
    border-radius: 999px;
  }
  #debug-panel.editor-layout .content-explorer-grid::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(125, 211, 252, 0.8), rgba(56, 189, 248, 0.45));
  }
  #debug-panel.editor-layout .content-explorer-grid.middle-scroll-active {
    cursor: grabbing;
    user-select: none;
  }
  #debug-panel.editor-layout .content-item {
    box-sizing: border-box;
    width: 50px;
    min-width: 0;
    height: 56px;
    padding: 6px 3px;
  }
  #debug-panel.editor-layout .content-explorer-grid .content-item {
    width: 72px;
  }
  #debug-panel.editor-layout .animate-content-browser .content-explorer {
    min-width: 0;
    width: 100%;
  }
  #debug-panel.editor-layout .animate-content-browser .content-explorer-bar {
    gap: 6px;
    min-width: 0;
  }
  #debug-panel.editor-layout .animate-content-browser .content-breadcrumb {
    min-width: 0;
  }
  #debug-panel.editor-layout .animate-content-browser .content-view-toggle {
    flex-shrink: 0;
  }
  #debug-panel.editor-layout .animate-content-browser .content-explorer-grid {
    grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
    min-width: 0;
    overflow-x: hidden;
  }
  #debug-panel.editor-layout .animate-content-browser .content-item,
  #debug-panel.editor-layout .animate-content-browser .content-explorer-grid .content-item {
    width: 100%;
  }
  #debug-panel.editor-layout .content-explorer.list-view .content-explorer-grid {
    display: flex;
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
  }
  #debug-panel.editor-layout .content-explorer.list-view .content-item {
    width: auto;
    height: auto;
  }
  #debug-panel.editor-layout .content-icon {
    font-size: 16px;
  }
  #debug-panel.editor-layout .content-label {
    font-size: 8px;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  @media (max-width: 980px) {
    #debug-panel.editor-layout {
      --editor-left-panel-width: 220px;
      --editor-right-panel-width: 280px;
    }
    #debug-panel.editor-layout .editor-transform-modes {
      right: calc(var(--editor-right-panel-width) + 28px + var(--editor-toolbar-shift));
    }
    #debug-panel.editor-layout .editor-view-select {
      right: calc(var(--editor-right-panel-width) + 136px + var(--editor-toolbar-shift));
    }
  }

  /* ── Touch Controls (frosted glass — matches .multiplayer-voice-toggle / chat field) ── */
  #touch-controls {
    position: fixed; inset: 0; z-index: 8;
    pointer-events: none;
    touch-action: none;
    -webkit-user-select: none; user-select: none;
  }
  #touch-joystick-zone {
    position: absolute;
    left: 0; bottom: 0;
    width: 45%; height: 50%;
    z-index: 1;
    pointer-events: auto;
    touch-action: none;
  }
  #touch-joystick-base {
    position: absolute;
    left: 60px; bottom: 80px;
    width: 100px; height: 100px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.18s ease, box-shadow 0.18s ease;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
  }
  #touch-joystick-thumb {
    position: absolute;
    left: 50%; top: 50%;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.55);
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18), 0 0 12px rgba(255, 255, 255, 0.14);
  }
  #touch-look-zone {
    position: absolute;
    right: 0; top: 0;
    width: 55%; height: 100%;
    z-index: 1;
    pointer-events: auto;
    touch-action: none;
  }
  .touch-btn {
    position: absolute;
    z-index: 2;
    pointer-events: auto;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    line-height: 1;
    outline: none;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  }
  .touch-btn:active,
  .touch-btn.active {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.24);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.32);
  }
  .touch-btn-top {
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    bottom: auto;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
  }
  #touch-btn-camera {
    right: 66px;
  }
  #touch-btn-menu {
    right: 14px;
    font-size: 13px;
    letter-spacing: 0;
  }
  #touch-btn-jump {
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  }
  #touch-btn-sprint {
    right: 78px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 48px);
  }
  #touch-btn-interact {
    right: 78px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 168px);
  }
  #touch-btn-lay {
    font-size: 20px;
    letter-spacing: 0;
    /* Emoji rendering — keep the glyph centered and crisp */
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  }
  #touch-btn-scan,
  #touch-btn-lay {
    right: 14px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 152px);
    min-width: 44px;
    font-size: 9px;
  }

  /* Hide touch controls on non-touch/desktop */
  @media (hover: hover) and (pointer: fine) {
    #touch-controls { display: none !important; }
  }

  /* ── Multiplayer Chat ── */
  #multiplayer-chat {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 12;
    width: min(360px, calc(100vw - 36px));
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    color: rgba(255, 255, 255, 0.96);
    pointer-events: none;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  }
  #multiplayer-chat.hidden {
    display: none;
  }
  body.vision-scan #multiplayer-chat {
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
  }
  .multiplayer-chat-log {
    max-height: 150px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 8px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.45s ease, transform 0.45s ease, max-height 0.18s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
  }
  body.vision-scan .multiplayer-chat-log {
    scrollbar-color: rgba(255, 255, 255, 0.38) transparent;
  }
  #multiplayer-chat:hover .multiplayer-chat-log,
  #multiplayer-chat:focus-within .multiplayer-chat-log {
    max-height: min(320px, 42vh);
  }
  #multiplayer-chat.inactive:not(:hover):not(:focus-within) .multiplayer-chat-log {
    opacity: 0;
    transform: translateY(6px);
  }
  .multiplayer-chat-line {
    width: fit-content;
    max-width: 100%;
    padding: 5px 9px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    backdrop-filter: blur(8px) saturate(1.1);
    -webkit-backdrop-filter: blur(8px) saturate(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }
  body.vision-scan .multiplayer-chat-line {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
  }
  .multiplayer-chat-line--system {
    color: rgba(255, 255, 255, 0.72);
    font-weight: 600;
  }
  body.vision-scan .multiplayer-chat-line--system {
    color: rgba(255, 255, 255, 0.72);
  }
  .multiplayer-chat-name {
    margin-right: 7px;
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
  }
  body.vision-scan .multiplayer-chat-name {
    color: #fff;
  }
  .multiplayer-chat-form {
    pointer-events: auto;
    touch-action: manipulation;
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .multiplayer-chat-field {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
    cursor: var(--game-cursor-text);
    touch-action: manipulation;
    transition: flex-basis 0.18s ease, width 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  }
  .multiplayer-chat-field:hover,
  .multiplayer-chat-field:focus-within {
    flex-basis: min(260px, calc(100vw - 78px));
    width: min(260px, calc(100vw - 78px));
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  .multiplayer-chat-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
  }
  body.vision-scan .multiplayer-chat-field {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
  }
  body.vision-scan .multiplayer-chat-field:hover,
  body.vision-scan .multiplayer-chat-field:focus-within {
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  .multiplayer-voice-toggle {
    flex: 0 0 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px) saturate(1.15);
    -webkit-backdrop-filter: blur(10px) saturate(1.15);
  }
  .multiplayer-voice-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
  }
  .multiplayer-control-svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
  }
  .multiplayer-chat-icon .multiplayer-control-svg {
    width: 19px;
    height: 19px;
  }
  .multiplayer-voice-toggle:hover,
  .multiplayer-voice-toggle:focus {
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  .multiplayer-voice-toggle.active {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.24);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.32);
  }
  .multiplayer-voice-toggle.active .multiplayer-control-svg {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.45));
  }
  .multiplayer-voice-toggle:disabled {
    opacity: 0.35;
    cursor: default;
    box-shadow: none;
  }
  body.vision-scan .multiplayer-voice-toggle {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.82);
  }
  body.vision-scan .multiplayer-voice-toggle:hover,
  body.vision-scan .multiplayer-voice-toggle:focus {
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26), 0 0 16px rgba(255, 255, 255, 0.18);
  }
  body.vision-scan .multiplayer-voice-toggle.active {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.32);
  }
  body.vision-scan .multiplayer-voice-toggle.active .multiplayer-control-svg {
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.45));
  }
  .multiplayer-chat-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 1px;
    height: 28px;
    box-sizing: border-box;
    padding: 6px 8px 6px 0;
    border: 0;
    background: transparent;
    color: #fff;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 700;
    outline: none;
    opacity: 0;
    transition: opacity 0.12s ease;
  }
  .multiplayer-chat-field:hover .multiplayer-chat-input,
  .multiplayer-chat-field:focus-within .multiplayer-chat-input {
    opacity: 1;
  }
  .multiplayer-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.66);
  }
  .multiplayer-chat-input:focus {
    box-shadow: none;
  }
  body.vision-scan .multiplayer-chat-input {
    color: #fff;
  }
  body.vision-scan .multiplayer-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.66);
  }
  body.vision-scan .multiplayer-chat-input:focus {
    box-shadow: none;
  }

  /* On touch: hide keyboard-only hints, adjust HUD */
  @media (hover: none) and (pointer: coarse) {
    #blocker .start-hint { content: '[ tap to start ]'; }
    .key-hint { display: none !important; }
    #interact-prompt .interact-prompt-key { display: none; }
    #interact-prompt .interact-prompt-pill { padding: 0 12px; }
    #interact-prompt .interact-prompt-text { padding-left: 0; }
    #hud { font-size: 10px; top: env(safe-area-inset-top, 10px); left: env(safe-area-inset-left, 10px); }
    .term-close-hint { display: none; }
    #multiplayer-chat {
      left: 12px;
      bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
      width: min(360px, calc(100vw - 24px));
    }
    .multiplayer-chat-log {
      max-height: min(180px, 24vh);
    }
    .multiplayer-chat-field {
      border-color: rgba(255, 255, 255, 0.38);
    }
    .multiplayer-chat-field:focus-within {
      flex-basis: min(200px, calc(100vw - 110px));
      width: min(200px, calc(100vw - 110px));
    }
    #touch-look-zone {
      top: calc(env(safe-area-inset-top, 0px) + 84px);
      height: calc(100% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 168px);
    }
    #touch-joystick-zone {
      height: calc(50% - 72px);
    }
    .touch-btn,
    #touch-joystick-base {
      border-color: rgba(255, 255, 255, 0.38);
    }
    #touch-btn-jump {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 108px);
    }
    #touch-btn-sprint {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 56px);
    }
    #touch-btn-lay {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 164px);
    }
  }

  /* ── Scene drag-and-drop ── */

  /* Full-screen drop zone — sits below editor panels (z-index 100) but above
     the WebGL canvas, so panel drag targets still work normally. */
  #scene-drop-zone {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
  }
  #scene-drop-zone.active {
    pointer-events: auto;
  }

  .content-item.dragging {
    opacity: 0.45;
  }

  #scene-drop-hint {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(14px, -50%);
    display: none;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.55);
    border-radius: 6px;
    color: #38bdf8;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  }

  #scene-drop-hint.visible {
    display: flex;
  }

  #scene-drop-hint::before {
    content: '⊕';
    font-size: 12px;
  }
