  :root {
    --bg0: #e8dfd3;
    --bg1: #f5efe6;
    --panel: rgba(255, 252, 247, 0.94);
    --panel-strong: rgba(255, 250, 243, 0.97);
    --border: rgba(139, 109, 76, 0.18);
    --border-strong: rgba(180, 95, 40, 0.6);
    --text: #2a1f14;
    --muted: #7a6b5a;
    --accent: #b45f26;
    --accent-2: #2e7d4f;
    --danger: #c0392b;
    --shadow: rgba(60, 40, 20, 0.12);
    --glow: rgba(180, 95, 38, 0.08);
    --bubble: rgba(255, 250, 243, 0.96);
    --hud-bg0: #1b140f;
    --hud-bg1: #261c16;
    --hud-panel: rgba(34, 26, 20, 0.96);
    --hud-panel-strong: rgba(27, 21, 16, 0.98);
    --hud-border: rgba(118, 89, 64, 0.45);
    --hud-border-strong: rgba(160, 118, 79, 0.68);
    --hud-text: #f1e5d5;
    --hud-muted: #b39d86;
    --hud-accent: #c28b54;
    --hud-accent-2: #7f9b73;
    --hud-danger: #cf6a57;
    --hud-shadow: rgba(0, 0, 0, 0.35);
    --hud-glow: rgba(194, 139, 84, 0.14);
    --hud-bubble: rgba(33, 25, 19, 0.98);
  }

  *, *::before, *::after { box-sizing: border-box; }
  html, body {
    width: 100%; height: 100%; margin: 0; overflow: hidden;
    background:
      radial-gradient(ellipse at 15% 85%, rgba(127, 155, 115, 0.08), transparent 50%),
      radial-gradient(ellipse at 85% 15%, rgba(194, 139, 84, 0.08), transparent 50%),
      linear-gradient(160deg, var(--hud-bg1), var(--hud-bg0));
    color: var(--hud-text);
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  }

  #app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }
  #world { position: absolute; inset: 0; }
  #world canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

  body.account-page {
    overflow: auto;
    min-height: 100%;
  }

  .account-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    isolation: isolate;
  }

  .account-art {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: linear-gradient(160deg, var(--hud-bg1), var(--hud-bg0));
  }

  .account-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(180deg, rgba(27, 21, 16, 0.18), rgba(27, 21, 16, 0.9)),
      radial-gradient(ellipse at 18% 85%, rgba(127, 155, 115, 0.14), transparent 52%),
      radial-gradient(ellipse at 86% 18%, rgba(194, 139, 84, 0.14), transparent 52%);
  }

  .account-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    opacity: 0.42;
  }

  .account-panel {
    width: min(520px, calc(100vw - 32px));
    border-left: 4px solid var(--hud-accent);
    padding: 0;
    background: var(--hud-panel-strong);
    border-top: 1px solid var(--hud-border);
    border-right: 1px solid var(--hud-border);
    border-bottom: 1px solid var(--hud-border);
    box-shadow: 0 8px 40px var(--hud-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
  }

  .account-panel.account-page-success { border-left-color: var(--hud-accent-2); }
  .account-panel.account-page-error { border-left-color: var(--hud-danger); }
  .account-panel-art {
    position: relative;
    max-height: 300px;
    overflow: hidden;
    background: rgba(27, 21, 16, 0.82);
  }
  .account-panel-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 68%, rgba(27, 21, 16, 0.62) 84%, var(--hud-panel-strong) 100%);
    pointer-events: none;
  }
  .account-panel-art img {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
  }
  .account-panel-body {
    padding: 0 18px 18px;
    margin-top: -10px;
    position: relative;
    z-index: 1;
  }
  .account-eyebrow {
    margin-bottom: 8px;
    color: var(--hud-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  .account-panel h1 {
    margin: 0 0 10px;
    color: var(--hud-accent);
    font-size: 18px;
    letter-spacing: 0;
    line-height: 1.15;
  }
  .account-panel.account-page-success h1 { color: var(--hud-accent-2); }
  .account-panel.account-page-error h1 { color: var(--hud-danger); }
  .account-panel p {
    margin: 0 0 14px;
    color: var(--hud-text);
    font-size: 13px;
    line-height: 1.5;
  }
  .account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }
  .account-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
  }
  .account-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
  }
  .account-form label {
    color: var(--hud-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
  }
  .account-form input {
    min-height: 36px;
    border: 1px solid var(--hud-border);
    border-radius: 4px;
    background: rgba(24, 18, 14, 0.92);
    color: var(--hud-text);
    padding: 6px 10px;
    font-size: 13px;
    outline: none;
  }
  .account-form input:focus { border-color: var(--hud-accent); }
  .account-form button { justify-self: start; }

  #speech-layer { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
  #hud { position: absolute; inset: 0; z-index: 8; pointer-events: none; }

  #hud-status-bar {
    position: absolute; bottom: 66px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 10px;
    background: var(--hud-panel); border: 1px solid var(--hud-border);
    border-radius: 8px; padding: 4px 12px;
    box-shadow: 0 2px 14px var(--hud-shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    pointer-events: none; user-select: none; z-index: 9;
    font-size: 10px; color: var(--hud-muted);
    font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  }
  #hud-status-bar .hud-item { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
  #hud-status-bar .hud-label { font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: var(--hud-muted); font-size: 9px; }
  #hud-status-bar .hud-value { color: var(--hud-accent-2); font-weight: 700; }
  #hud-status-bar .hud-sep { width: 1px; height: 14px; background: var(--hud-border); flex-shrink: 0; }
  #hud-status-bar:empty { display: none !important; }

  #hud-alert {
    position: absolute; left: 50%; bottom: 104px; transform: translateX(-50%);
    max-width: min(560px, calc(100vw - 20px));
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(207, 106, 87, 0.58);
    border-left: 3px solid var(--hud-danger);
    background: rgba(48, 18, 14, 0.95);
    box-shadow: 0 2px 14px var(--hud-shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    color: #ffb1a6;
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    user-select: none;
    z-index: 9;
  }
  #hud-alert[hidden] { display: none; }

  #corner-chip {
    position: absolute; right: 10px; bottom: 10px;
    padding: 4px 10px; border-radius: 4px;
    background: var(--hud-panel); border: 1px solid var(--hud-border);
    border-left: 3px solid var(--hud-accent-2);
    color: var(--hud-muted); font-size: 11px;
    box-shadow: 0 2px 10px var(--hud-shadow);
    user-select: none; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    z-index: 8; pointer-events: auto;
    display: none;
  }
  #coords { color: var(--hud-accent-2); font-weight: 700; }

  /* ---- HUD BAR ---- */
  #hud-bar {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: stretch; gap: 3px;
    background: var(--hud-panel); border: 1px solid var(--hud-border);
    border-radius: 10px; padding: 5px 8px;
    box-shadow: 0 2px 20px var(--hud-shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    pointer-events: auto; user-select: none; z-index: 9;
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }
  .hud-main-row { display: flex; align-items: flex-end; gap: 4px; }
  .bar-sep { width: 1px; align-self: stretch; min-height: 28px; background: var(--hud-border); margin: 0 2px; flex-shrink: 0; }

  .bar-btn {
    width: 42px; height: 42px;
    border: 1px solid var(--hud-border); border-radius: 6px;
    background: rgba(44, 34, 26, 0.9); color: var(--hud-text);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.12s ease; padding: 0; flex-shrink: 0;
    position: relative;
  }
  .bar-btn:hover { background: rgba(71, 53, 39, 0.92); border-color: var(--hud-border-strong); }
  .bar-btn.active { border-color: var(--hud-accent); background: rgba(89, 61, 37, 0.9); color: var(--hud-accent); }
  .bar-btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
  .bar-btn svg { width: 20px; height: 20px; }

  /* ---- HOTBAR SLOTS ---- */
  #hotbar { display: flex; align-items: stretch; min-width: 315px; }
  .hotbar-info-row {
    display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr 1.25fr; gap: 0;
    color: var(--hud-accent-2); font-size: 9px; font-weight: 800; text-transform: uppercase;
    border-bottom: 1px solid var(--hud-border);
    background: rgba(30, 23, 18, 0.55);
  }
  .hotbar-info {
    display: flex; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; height: 16px; overflow: hidden;
  }
  .hotbar-info + .hotbar-info { border-left: 1px solid var(--hud-border); }
  .hotbar-info .hud-label { color: var(--hud-muted); font-size: 8px; font-weight: 800; }
  .hotbar-info .hud-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hotbar-slots { display: flex; gap: 3px; }
  .hotbar-slot {
    width: 50px; height: 50px;
    border: 1px solid var(--hud-border); border-radius: 5px;
    background: rgba(30, 23, 18, 0.9);
    cursor: pointer; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2px; transition: all 0.12s ease; position: relative; overflow: hidden;
  }
  .hotbar-slot:hover { border-color: rgba(194, 139, 84, 0.45); }
  .hotbar-slot.active { border-color: var(--hud-accent); background: rgba(85, 58, 34, 0.9); box-shadow: 0 0 0 1px var(--hud-accent); }
  .hotbar-slot.empty { opacity: 0.4; cursor: default; }
  .hotbar-slot canvas { width: 34px; height: 30px; image-rendering: pixelated; display: block; object-fit: contain; }
  .hotbar-slot .clear-slot {
    position: absolute; top: 0; right: 0; width: 14px; height: 14px;
    background: rgba(207, 106, 87, 0.9); color: #fff; font-size: 9px; font-weight: 700;
    border-radius: 0 4px 0 4px; display: none; align-items: center; justify-content: center;
    cursor: pointer; line-height: 1; border: none; padding: 0;
  }
  .hotbar-slot:hover .clear-slot { display: flex; }
  .hotbar-slot.empty .clear-slot { display: none !important; }

  /* ---- CHAT POPUP ---- */
  #chat-popup {
    position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
    width: min(420px, calc(100vw - 40px));
    background: var(--hud-panel); border: 1px solid var(--hud-border);
    border-radius: 8px; padding: 8px;
    box-shadow: 0 4px 20px var(--hud-shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    pointer-events: auto; display: none; z-index: 10;
  }
  #chat-popup.open { display: block; }
  #chat-log {
    max-height: 110px; overflow-y: auto; display: grid; gap: 4px; margin-bottom: 6px;
    padding-right: 2px; font-size: 11px; color: var(--hud-text);
  }
  .chat-log-row { padding: 4px 6px; border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(24,18,14,.72); word-break: break-word; }
  .chat-log-name { color: var(--hud-accent); font-weight: 800; }
  #chat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px; }

  /* ---- BLOCK DRAWER ---- */
  #block-drawer {
    position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
    width: min(500px, calc(100vw - 40px));
    max-height: min(420px, 55vh);
    background: var(--hud-panel); border: 1px solid var(--hud-border);
    border-radius: 0; padding: 10px;
    box-shadow: 0 4px 24px var(--hud-shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    pointer-events: auto; display: none; z-index: 10;
    overflow-y: auto;
  }
  #block-drawer.open { display: block; }
  #block-drawer::-webkit-scrollbar, .scroll-list::-webkit-scrollbar, #palette-grid::-webkit-scrollbar { height: 5px; width: 5px; }
  #block-drawer::-webkit-scrollbar-thumb, .scroll-list::-webkit-scrollbar-thumb, #palette-grid::-webkit-scrollbar-thumb { background: rgba(154, 121, 89, 0.35); border-radius: 3px; }

  .drawer-top-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
  #drawer-search {
    flex: 1; min-height: 28px; border-radius: 4px;
    border: 1px solid var(--hud-border);
    background: rgba(24, 18, 14, 0.92); color: var(--hud-text);
    padding: 5px 10px; outline: none; font-size: 12px;
  }
  #drawer-search:focus { border-color: var(--hud-accent); }
  #drawer-search::placeholder { color: #9d8770; }

  .drawer-section { margin-top: 4px; }
  .drawer-section-header {
    font-size: 10px; font-weight: 800; color: var(--hud-muted);
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; padding: 5px 0 3px; display: flex;
    align-items: center; gap: 6px; user-select: none;
  }
  .drawer-section-header::before { content: "\25BE"; font-size: 10px; transition: transform 0.15s; }
  .drawer-section-header.collapsed::before { transform: rotate(-90deg); }
  .drawer-section-body {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 6px; padding-top: 4px;
  }
  .drawer-section-body.collapsed { display: none; }
  .drawer-block {
    border: 0; border-radius: 0;
    background: transparent; padding: 3px 0;
    cursor: pointer; text-align: center; transition: all 0.12s;
    position: relative; display: grid; gap: 3px; align-content: start; min-height: 95px;
  }
  .drawer-block:hover { color: var(--hud-accent); background: transparent; }
  .drawer-block canvas { width: 54px; height: 52px; image-rendering: pixelated; margin: 0 auto; display: block; }
  .drawer-block .db-name { font-size: 9px; font-weight: 700; color: var(--hud-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .drawer-block .db-count { font-size: 8px; font-weight: 800; color: var(--hud-muted); }
  .drawer-block .db-actions { display: flex; gap: 3px; justify-content: center; align-items: center; flex-wrap: nowrap; min-width: 0; }
  .drawer-block .db-edit {
    font-size: 8px; cursor: pointer; transition: opacity 0.1s;
    color: var(--hud-bg0); background: var(--hud-accent); border: 0; border-radius: 0; padding: 3px 4px; line-height: 1.1;
    text-transform: uppercase; font-weight: 800;
    min-width: 0; flex: 1 1 0;
  }
  .drawer-block .db-edit.icon { width: 20px; height: 20px; min-height: 20px; padding: 0; display: inline-grid; place-items: center; font-size: 13px; flex: 0 0 20px; }
  .drawer-block .db-edit:hover { opacity: 1; }
  .drawer-block .db-star {
    position: absolute; top: 2px; right: 3px; font-size: 11px;
    cursor: pointer; opacity: 0.3; transition: opacity 0.1s;
    color: var(--hud-muted); background: none; border: none; padding: 0; line-height: 1;
  }
  .drawer-block .db-star:hover { opacity: 0.8; }
  .drawer-block .db-star.starred { opacity: 1; color: #e8c44a; }
  .dialog-btn.star-action { min-width: 42px; font-size: 18px; line-height: 1; }
  .dialog-btn.star-action.starred { color: #e8c44a; }
  .drawer-block.placeholder {
    border-style: none;
    color: var(--hud-accent);
    background: transparent;
  }
  .drawer-block.placeholder:hover { background: transparent; }
  .drawer-block.placeholder .db-placeholder {
    width: 54px; height: 52px; margin: 0 auto; display: grid; place-items: center;
    border: 0; border-radius: 0; color: var(--hud-accent);
    font-size: 18px; font-weight: 800; line-height: 1;
  }

  /* ---- MODALS ---- */
  .modal { z-index: 20; display: none; background: rgba(10, 7, 5, 0.54); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); pointer-events: auto; position: absolute; inset: 0; }
  .modal.open { display: block; }

  .dialog {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: min(980px, calc(100vw - 20px)); max-height: min(94vh, 920px);
    overflow: auto; background: var(--hud-panel-strong);
    border: 1px solid var(--hud-border); border-left: 4px solid var(--hud-accent);
    border-radius: 6px; box-shadow: 0 8px 40px var(--hud-shadow); padding: 16px;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  }
  .dialog h2 { margin: 0 0 10px; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; color: var(--hud-accent); font-weight: 800; }
  .dialog p { margin: 4px 0 10px; color: var(--hud-muted); line-height: 1.45; font-size: 12px; }
  .dialog-grid { display: grid; gap: 10px; }
  .dialog-grid.two { grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); }
  .dialog-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dialog-card { border: 0; border-radius: 0; background: transparent; padding: 0; }
  .dialog-card h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--hud-muted); font-weight: 700; }
  .auth-welcome { display: grid; gap: 10px; }
  .auth-welcome h2 { margin-bottom: 0; }
  .auth-welcome-body {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, auto);
    gap: 0;
  }
  .auth-welcome-art {
    grid-area: auto;
    position: relative;
    min-width: 0;
    height: min(380px, 48vh);
    max-height: 440px;
    min-height: 240px;
    overflow: hidden;
  }
  .auth-welcome-art::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 42%, rgba(27, 21, 16, 0.28) 60%, rgba(27, 21, 16, 0.76) 82%, var(--hud-panel-strong) 100%);
    pointer-events: none;
  }
  .auth-welcome-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
  }
  .auth-welcome-copy-stack {
    grid-area: auto;
    align-self: auto;
    z-index: 1;
    min-height: 0;
    max-height: none;
    overflow: visible;
    margin-top: max(-95px, -12vh);
    padding: 8px 0 2px;
    display: grid;
    gap: 10px;
    background: linear-gradient(180deg, transparent 0, rgba(27, 21, 16, 0.58) 34px, var(--hud-panel-strong) 100%);
  }
  .auth-welcome-copy {
    margin: 0;
    white-space: pre-line;
    color: var(--hud-text);
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.78), 0 0 14px rgba(0, 0, 0, 0.55);
  }
  .auth-support-copy {
    padding-bottom: 0;
    font-size: 12px;
    font-weight: 700;
    color: #fff5dc;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.65);
  }
  .auth-support-copy a {
    color: #ffd477;
    font-weight: 900;
    text-decoration: underline;
    text-decoration-color: rgba(255, 212, 119, 0.72);
    text-underline-offset: 3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 16px rgba(0, 0, 0, 0.75);
  }
  .auth-support-copy a:hover,
  .auth-support-copy a:focus-visible {
    color: #fff0b8;
    text-decoration-color: currentColor;
  }
  .auth-divider {
    width: 100%;
    height: 1px;
    margin: 1px 0 2px;
    background: linear-gradient(90deg, transparent, var(--hud-border-strong), transparent);
  }
  .texture-inspect-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-items: start; }
  .texture-collection-hint { margin: 10px 0 0; color: var(--hud-muted); font-size: 12px; }
  .dialog-card.texture-inspect-card { border: 0; border-radius: 0; background: transparent; padding: 0; }
  #texture-preview-host { min-width: 0; }
  .texture-full-thumbnail {
    display: block;
    width: min(260px, 100%);
    height: auto;
    margin: 0 auto;
    image-rendering: pixelated;
    border: 0;
    border-radius: 0;
    background: rgba(18, 13, 10, 0.58);
  }
  .sign-inspect-preview { display: grid; gap: 8px; }
  .jukebox-inspect-preview { display: grid; gap: 8px; }
  .prop-snapshot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
  .prop-snapshot { margin: 0; min-width: 0; }
  .prop-snapshot img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; image-rendering: pixelated; background: rgba(0,0,0,.22); }
  .robot-inspect { display: grid; gap: 10px; min-width: 0; }
  .robot-inspect-image { display: block; width: min(320px, 100%); margin: 0 auto; image-rendering: pixelated; }
  .robot-inspect-copy {
    max-height: min(48vh, 460px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--hud-text);
    font-size: 13px;
    line-height: 1.5;
    padding-right: 3px;
  }
  .jukebox-mini-roll {
    width: 100%;
    height: 72px;
    border-radius: 0;
    border: 0;
    background: #0a0806;
    image-rendering: pixelated;
  }
  .jukebox-instrument-legend { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 10px; color: var(--hud-text); }
  .jukebox-instrument-chip { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
  .jukebox-instrument-chip span { width: 8px; height: 8px; border-radius: 0; flex: 0 0 auto; }
  .sign-reader-scroll {
    max-width: 100%;
    max-height: 220px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 0;
    border-radius: 0;
    background: rgba(24,18,14,.92);
  }
  .sign-markdown-body {
    box-sizing: border-box;
    width: calc(var(--sign-reader-line-chars) * 1ch + 16px);
    padding: 8px;
    color: var(--hud-text);
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: normal;
    word-break: normal;
  }
  .sign-inspect-card .sign-reader-scroll { max-height: min(48vh, 420px); overflow-x: hidden; }
  .sign-inspect-card .sign-markdown-body {
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .sign-markdown-body h1,
  .sign-markdown-body h2,
  .sign-markdown-body h3,
  .sign-markdown-body p,
  .sign-markdown-body ul,
  .sign-markdown-body ol { margin: 0 0 8px; }
  .sign-markdown-body h1 { font-size: 18px; line-height: 1.2; color: var(--hud-accent); }
  .sign-markdown-body h2 { font-size: 16px; line-height: 1.25; color: var(--hud-accent); }
  .sign-markdown-body h3 { font-size: 14px; line-height: 1.3; color: var(--hud-accent); }
  .sign-markdown-body ul,
  .sign-markdown-body ol { padding-left: 22px; }
  .sign-markdown-body a { color: var(--hud-accent-2); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
  .sign-markdown-body > :last-child { margin-bottom: 0; }
  .sign-embedded-image {
    display: block; position: relative; margin: 8px 0; border: 0; border-radius: 0;
    overflow: hidden; background: transparent; max-width: 100%;
  }
  .sign-embedded-image img { display: block; width: 100%; max-height: 320px; object-fit: contain; background: rgba(0,0,0,.22); }
  .sign-embedded-image.blurred img { filter: blur(16px); transform: scale(1.03); }
  .sign-image-warning {
    position: absolute; inset: 0; display: grid; place-items: center; padding: 12px;
    background: rgba(10,7,5,.58); text-align: center;
  }
  .sign-image-warning button { pointer-events: auto; }
  .sign-image-placeholder { display: block; margin: 8px 0; padding: 0; border: 0; border-radius: 0; color: var(--hud-muted); font-size: 11px; }
  .sign-syntax-help { margin-top: 8px; color: var(--hud-muted); font-size: 11px; line-height: 1.35; }
  .sign-syntax-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 3px 10px; margin-top: 6px; align-items: baseline; }
  .sign-syntax-cell { min-width: 0; padding: 0; border: 0; background: transparent; color: var(--hud-text); overflow-wrap: anywhere; }
  .sign-syntax-cell code { font-size: 11px; color: var(--hud-accent); }
  .sign-syntax-cell .sign-markdown-body { width: 100%; padding: 0; font-size: 11px; background: transparent; }
  .guide-dialog {
    --tutorial-desktop-slide-height: min(620px, calc(80vh - 130px));
    width: min(1120px, calc(100vw - 20px));
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .guide-scroll {
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0;
  }
  .guide-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--hud-accent);
    letter-spacing: 0;
    text-transform: none;
  }
  .guide-icon {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--hud-accent);
  }
  .guide-icon svg { width: 100%; height: 100%; }
  .modes-intro-arrow {
    width: 44px;
    height: 44px;
    border: 1px solid var(--hud-border);
    border-radius: 6px;
    background: rgba(44, 34, 26, 0.9);
    color: var(--hud-text);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
  }
  .modes-intro-arrow:disabled { opacity: 0.28; cursor: default; }
  .guide-loop-video {
    display: block;
    width: 420px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    max-height: min(52vh, 420px);
    object-fit: contain;
    border-radius: 6px;
    background: rgba(16, 12, 9, 0.36);
    cursor: zoom-in;
  }
  .tutorial-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    gap: 10px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.78);
  }
  .tutorial-video-overlay-media {
    display: block;
    width: min(720px, calc(100vw - 32px));
    height: min(720px, calc(100vh - 96px));
    object-fit: contain;
    background: #000;
  }
  .tutorial-video-close {
    justify-self: center;
  }
  .tutorial-guide {
    min-height: var(--tutorial-desktop-slide-height);
  }
  .tutorial-layout {
    display: grid;
    grid-template-columns: minmax(170px, 220px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding: 18px;
  }
  .tutorial-mobile-header { display: none; }
  .tutorial-toc {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 12px;
    max-height: calc(min(92vh, 900px) - 96px);
    overflow: auto;
    padding-right: 4px;
  }
  .tutorial-toc h3 {
    margin: 0;
    color: var(--hud-accent);
    font-size: 12px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0;
  }
  .tutorial-toc-chapter {
    display: grid;
    gap: 4px;
  }
  .tutorial-toc-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--hud-accent);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    list-style: none;
    padding: 7px 4px;
  }
  .tutorial-toc-heading::-webkit-details-marker { display: none; }
  .tutorial-toc-heading::after {
    content: "\203a";
    margin-left: auto;
    transition: transform 120ms ease;
  }
  .tutorial-toc-chapter[open] .tutorial-toc-heading::after {
    transform: rotate(90deg);
  }
  .tutorial-toc-heading .guide-icon {
    width: 16px;
    height: 16px;
  }
  .tutorial-toc-pages {
    display: grid;
    gap: 2px;
    padding-bottom: 4px;
  }
  .tutorial-toc button {
    appearance: none;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--hud-text);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    text-align: left;
    padding: 5px 4px 5px 18px;
  }
  .tutorial-toc button.active,
  .tutorial-toc button:hover {
    color: var(--hud-accent);
  }
  .tutorial-toc button .guide-icon {
    width: 14px;
    height: 14px;
  }
  .tutorial-main {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 10px;
    align-content: center;
    min-height: var(--tutorial-desktop-slide-height);
  }
  .tutorial-carousel {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 10px;
    align-items: center;
    width: 100%;
    min-height: var(--tutorial-desktop-slide-height);
  }
  .tutorial-page-host {
    min-width: 0;
    display: grid;
    justify-items: center;
    align-items: center;
    height: var(--tutorial-desktop-slide-height);
    overflow: hidden;
  }
  .tutorial-page {
    display: grid;
    justify-items: center;
    align-content: start;
    gap: 10px;
    width: 100%;
    max-height: var(--tutorial-desktop-slide-height);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 6px;
    text-align: center;
  }
  .tutorial-page h1.guide-heading {
    justify-content: center;
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    text-transform: uppercase;
  }
  .tutorial-page p {
    margin: 0;
    max-width: 520px;
    color: var(--hud-text);
    font-size: 13px;
    line-height: 1.62;
    text-align: left;
  }
  .guide-key-term {
    color: var(--hud-accent);
    font-weight: 900;
  }
  .tutorial-copy-section {
    display: grid;
    justify-items: center;
    gap: 5px;
    width: min(100%, 540px);
  }
  .tutorial-syntax-table {
    display: grid;
    grid-template-columns: max-content minmax(180px, 1fr);
    gap: 6px 12px;
    width: min(100%, 430px);
    margin-top: 2px;
    overflow-x: auto;
    text-align: left;
  }
  .tutorial-syntax-label {
    color: var(--hud-accent);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .tutorial-syntax-table code {
    color: var(--hud-text);
    font-size: 12px;
    white-space: nowrap;
  }
  .tutorial-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px 14px;
    width: min(100%, 680px);
    margin-top: 4px;
  }
  .tutorial-icon-item {
    display: grid;
    grid-template-columns: 34px 1fr;
    justify-items: start;
    align-content: center;
    gap: 2px 8px;
    min-height: 56px;
    color: var(--hud-text);
    font-size: 11px;
    font-weight: 800;
    text-align: left;
  }
  .tutorial-icon-item .guide-icon {
    grid-row: span 2;
    width: 28px;
    height: 28px;
  }
  .tutorial-icon-item small {
    color: var(--hud-muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
  }
  .tutorial-dots {
    max-width: min(100%, 430px);
    flex-wrap: wrap;
  }
  .modes-intro-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
  }
  .modes-intro-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 1px solid var(--hud-border-strong);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
  }
  .modes-intro-dots button.active {
    background: var(--hud-accent);
    border-color: var(--hud-accent);
  }
  .guide-inline-icon {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    vertical-align: -0.12em;
    color: var(--hud-accent);
    font-weight: 800;
    white-space: nowrap;
  }
  .guide-inline-icon .guide-icon {
    width: 1em;
    height: 1em;
  }
  .guide-inline-label {
    color: var(--hud-accent);
  }
  .guide-actions {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--hud-border);
    background: rgba(24,18,14,.82);
    margin: 0;
  }
  #texture-modal-meta { display: grid; gap: 6px; font-size: 12px; color: var(--hud-text); min-width: 0; }
  #texture-modal-meta.texture-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: baseline;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  #texture-modal-meta.texture-meta-bar .texture-meta-row { display: flex; gap: 5px; align-items: baseline; }
  #texture-modal .dialog { border-radius: 0; }
  .texture-meta-row { display: grid; grid-template-columns: minmax(82px, auto) minmax(0, 1fr); gap: 8px; align-items: baseline; }
  .texture-meta-label { color: var(--hud-accent); text-transform: uppercase; font-size: 10px; letter-spacing: 0.8px; font-weight: 800; }
  .texture-meta-value { min-width: 0; overflow-wrap: anywhere; }
  .texture-author-link { appearance: none; border: 0; background: transparent; color: var(--hud-accent-2); cursor: pointer; font: inherit; font-weight: 800; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
  .texture-author-link:hover, .texture-author-link:focus-visible { color: var(--hud-accent); outline: none; }
  .auth-error { color: var(--hud-danger); font-size: 11px; margin-top: 6px; min-height: 16px; }
  .auth-credentials { display: grid; gap: 4px; }
  .auth-inline-actions { display: flex; justify-content: flex-end; align-items: center; min-height: 20px; }
  .auth-link-btn {
    border: 0; background: transparent; color: var(--hud-muted); cursor: pointer;
    font: inherit; font-size: 11px; font-weight: 700; padding: 2px 0;
    text-decoration: underline; text-underline-offset: 2px;
  }
  .auth-link-btn:hover, .auth-link-btn:focus-visible { color: var(--hud-accent); outline: none; }
  .auth-reset-fields { display: grid; gap: 6px; margin-top: 2px; }
  .auth-reset-fields[hidden] { display: none; }
  .auth-reset-status { color: var(--hud-muted); font-size: 12px; min-height: 16px; }
  .auth-reset-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 0; }
  .dialog-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

  .dialog-btn {
    border: 1px solid var(--hud-border); border-radius: 4px;
    min-height: 30px; background: rgba(44, 34, 26, 0.9);
    color: var(--hud-text); cursor: pointer; font-size: 11px;
    font-weight: 700; letter-spacing: 0.4px; pointer-events: auto;
    transition: all 0.12s ease; padding: 0 8px;
  }
  .dialog-btn:hover { background: rgba(71, 53, 39, 0.92); border-color: var(--hud-border-strong); }
  .dialog-btn.primary { border-color: rgba(194, 139, 84, 0.42); background: rgba(87, 60, 37, 0.95); color: var(--hud-accent); font-weight: 800; }
  .dialog-btn.primary:hover { background: rgba(104, 72, 44, 0.98); }
  .dialog-btn.danger { border-color: rgba(207, 106, 87, 0.42); background: rgba(72, 34, 28, 0.92); color: var(--hud-danger); }
  .icon-help-btn { width: 30px; min-width: 30px; padding: 0; font-weight: 900; }
  .dialog-btn.compact { min-height: 22px; padding: 3px 5px; font-size: 8px; line-height: 1.1; text-transform: uppercase; font-weight: 800; }

  .tool-btn {
    border: 1px solid var(--hud-border); border-radius: 4px;
    min-height: 28px; background: rgba(44, 34, 26, 0.9);
    color: var(--hud-text); cursor: pointer; font-size: 11px;
    font-weight: 700; letter-spacing: 0.4px; pointer-events: auto;
    transition: all 0.12s ease; padding: 0 8px;
  }
  .tool-btn:hover { background: rgba(71, 53, 39, 0.92); border-color: var(--hud-border-strong); }
  .tool-btn.active { border-color: var(--hud-accent); background: rgba(89, 61, 37, 0.9); color: var(--hud-accent); font-weight: 800; }
  .tool-btn svg { width: 18px; height: 18px; pointer-events: none; }
  .editor-tool-icon-btn {
    width: 34px;
    min-width: 34px;
    min-height: 30px;
    padding: 0;
    display: inline-grid;
    place-items: center;
  }
  .editor-tool-row {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 4px;
  }

  .scroll-list { max-height: 300px; overflow: auto; display: grid; gap: 4px; padding-right: 2px; }
  #search-results.scroll-list { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); align-items: start; gap: 10px; }
  .search-block-tile { min-height: 124px; padding-top: 4px; gap: 4px; }
  .search-block-tile .db-name { width: 100%; font-size: 12px; line-height: 1.15; }
  .search-block-tile .search-block-author { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.15; font-weight: 700; color: var(--hud-muted); }
  .search-block-tile .search-block-stats { width: 100%; min-height: 14px; font-size: 10px; line-height: 1.2; font-weight: 800; color: #e8c44a; }
  .search-block-tile .search-block-actions { min-height: 0; margin: 0; }
  .search-block-tile .search-star-btn { top: 2px; right: 5px; width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0; font-size: 14px; }
  .search-empty { grid-column: 1 / -1; padding: 8px 0; }
  .list-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; border: 0; border-radius: 0; padding: 4px 0; background: transparent; }
  .list-title { font-size: 12px; font-weight: 700; color: var(--hud-text); }
  .list-subtitle { font-size: 10px; color: var(--hud-muted); margin-top: 1px; }

  .search-filter-row { display:grid; grid-template-columns:minmax(0, 1fr) minmax(96px, 140px) 160px; gap:6px; }
  #chat-input, #auth-username, #auth-password, #password-reset-username, #settings-new-email, #settings-email-password, #settings-delete-password, #character-email-input, #block-name-input, #search-input, #search-tags-input, #search-creator-input, #texture-tags-input, #character-bio-input, #message-compose-to, #message-compose-text, #message-compose-atoms, #message-compose-code, #message-compose-waves, .character-row select {
    width: 100%; min-height: 30px; border-radius: 4px;
    border: 1px solid var(--hud-border);
    background: rgba(24, 18, 14, 0.92); color: var(--hud-text);
    padding: 6px 10px; outline: none; font-size: 12px;
    transition: border-color 0.12s;
  }
  .editor-footer-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }
  .editor-footer-row .dialog-actions {
    margin-top: 0;
    justify-content: flex-end;
    align-items: center;
  }
  .editor-inline-error {
    display: none;
    min-height: 14px;
    margin-left: 10px;
    color: var(--hud-danger);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }
  .editor-publish-action {
    display: grid;
    gap: 3px;
    align-items: end;
  }
  .publish-action-stack {
    display: grid;
    gap: 3px;
    align-items: end;
  }
  .publish-action-stack .editor-inline-error {
    margin-left: 0;
    text-align: center;
  }
  .editor-action-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .editor-publish-fields {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) auto;
    gap: 4px;
    align-items: center;
  }
  .editor-discoverable-toggle { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--hud-muted); white-space: nowrap; }
  /* â”€â”€ DAW JUKEBOX EDITOR â”€â”€ */
  .daw-dialog { max-width: calc(100vw - 24px); width: min(1280px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
  .daw-transport { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--hud-bg0); border-top: 1px solid var(--hud-border); flex-shrink: 0; flex-wrap: wrap; }
  .daw-transport-left { display: flex; align-items: center; gap: 4px; }
  .daw-transport-center { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; }
  .daw-transport-right { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
  .daw-tbtn { width: 30px; height: 26px; border: 1px solid var(--hud-border); border-radius: 3px; background: var(--hud-bg1); color: var(--hud-text); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: all .1s; }
  .daw-tbtn:hover { border-color: var(--hud-accent); color: var(--hud-accent); }
  .daw-tbtn.active { border-color: var(--hud-accent); color: var(--hud-accent); background: rgba(194,139,84,.15); }
  .daw-mobile-label { display: none; }
  #jukebox-instruments-btn, #jukebox-mixer-btn { display: none; }
  .daw-time { font-family: monospace; font-size: 12px; color: var(--hud-accent); min-width: 38px; }
  .daw-tlabel { display: flex; align-items: center; gap: 3px; font-size: 9px; font-weight: 800; color: var(--hud-muted); text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
  .daw-tlabel input[type=number] { width: 46px; min-height: 22px; border-radius: 3px; border: 1px solid var(--hud-border); background: rgba(24,18,14,.92); color: var(--hud-text); padding: 1px 4px; font-size: 11px; text-align: center; outline: none; }
  .daw-tlabel input[type=range] { width: 70px; accent-color: var(--hud-accent); height: 4px; }
  .daw-transport input[type=text], .daw-transport select, .daw-editor-actions input[type=text] { min-height: 22px; border-radius: 3px; border: 1px solid var(--hud-border); background: rgba(24,18,14,.92); color: var(--hud-text); padding: 1px 6px; font-size: 11px; outline: none; }
  .daw-transport input[type=text] { width: 120px; }
  .daw-transport select { width: auto; }
  .daw-editor-actions { display: contents; }
  .daw-editor-actions input[type=text] { width: 150px; }

  .daw-main { display: flex; flex: 1; min-height: 0; overflow: hidden; }

  /* MIXER PANEL */
  .daw-mixer { width: 130px; min-width: 130px; background: var(--hud-bg0); border-right: 1px solid var(--hud-border); display: flex; flex-direction: column; overflow-y: auto; padding: 4px; gap: 3px; }
  .daw-strip { background: var(--hud-bg1); border: 1px solid var(--hud-border); border-radius: 4px; padding: 4px 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; transition: border-color .1s; }
  .daw-strip:hover { border-color: rgba(194,139,84,.5); }
  .daw-strip.active { border-color: var(--hud-accent); box-shadow: inset 0 0 8px rgba(194,139,84,.12); }
  .daw-strip-header { display: flex; align-items: center; gap: 3px; width: 100%; }
  .daw-strip-num { width: 18px; height: 16px; border-radius: 2px; background: var(--hud-bg0); border: 1px solid var(--hud-border); color: var(--hud-muted); font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .daw-strip.active .daw-strip-num { background: var(--hud-accent); color: var(--hud-bg0); border-color: var(--hud-accent); }
  .daw-strip-icon { width: 16px; height: 16px; image-rendering: auto; opacity: .55; flex-shrink: 0; }
  .daw-strip.active .daw-strip-icon { opacity: 1; }
  .daw-strip-name { font-size: 8px; color: var(--hud-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; line-height: 1.2; }
  .daw-strip.active .daw-strip-name { color: var(--hud-accent); }
  .daw-strip-del { width: 12px; height: 12px; border: none; background: none; color: rgba(139,109,76,.3); cursor: pointer; font-size: 10px; padding: 0; line-height: 1; flex-shrink: 0; }
  .daw-strip-del:hover { color: var(--hud-danger); }

  .daw-fader-wrap { display: flex; flex-direction: column; align-items: center; gap: 1px; }
  .daw-fader { position: relative; width: 14px; height: 64px; background: #0a0806; border-radius: 7px; border: 1px solid rgba(118,89,64,.25); cursor: pointer; touch-action: none; }
  .daw-fader-fill { position: absolute; bottom: 0; left: 0; right: 0; border-radius: 0 0 6px 6px; background: linear-gradient(to top, var(--hud-accent), rgba(194,139,84,.35)); pointer-events: none; }
  .daw-fader-thumb { position: absolute; left: -3px; right: -3px; height: 5px; border-radius: 2px; background: linear-gradient(to bottom, #e8d5bf, #b39d86); border: 1px solid rgba(200,170,130,.5); pointer-events: none; }
  .daw-fader-val { font-size: 7px; color: var(--hud-muted); font-family: monospace; }

  .daw-knob-sm-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
  .daw-knob-sm { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a2e25, #1a1410); border: 1.5px solid #4a3828; position: relative; cursor: grab; touch-action: none; user-select: none; }
  .daw-knob-sm:hover { border-color: var(--hud-accent); }
  .daw-knob-sm-notch { position: absolute; top: 3px; left: 50%; width: 1.5px; height: 6px; background: var(--hud-accent); border-radius: 1px; margin-left: -0.75px; transform-origin: center 9px; }
  .daw-knob-sm-val { font-size: 7px; color: var(--hud-muted); font-family: monospace; }
  .daw-knob-sm-lbl { font-size: 7px; font-weight: 700; color: rgba(179,157,134,.6); text-transform: uppercase; letter-spacing: .3px; }

  .daw-ms-row { display: flex; gap: 2px; }
  .daw-ms-btn { width: 20px; height: 14px; border: 1px solid var(--hud-border); border-radius: 2px; background: var(--hud-bg0); color: var(--hud-muted); font-size: 7px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .1s; }
  .daw-ms-btn.on-m { background: var(--hud-danger); color: #fff; border-color: var(--hud-danger); }
  .daw-ms-btn.on-s { background: var(--hud-accent); color: var(--hud-bg0); border-color: var(--hud-accent); }

  .daw-add-btn { width: 100%; min-height: 22px; border: 1px dashed var(--hud-border); border-radius: 3px; background: transparent; color: var(--hud-muted); font-size: 10px; cursor: pointer; transition: all .1s; }
  .daw-add-btn:hover { border-color: var(--hud-accent); color: var(--hud-accent); }

  /* PIANO ROLL */
  .daw-pianoroll { flex: 1; overflow: hidden; background: var(--hud-bg0); position: relative; min-width: 0; display: flex; flex-direction: column; }
  .daw-pianoroll canvas { display: block; touch-action: none; flex: 1 1 auto; width: 100%; height: 100%; min-height: 0; }
  .daw-hscroll-wrap { padding: 0 4px 2px; background: var(--hud-bg0); flex-shrink: 0; }
  .daw-hscroll { width: 100%; height: 10px; accent-color: var(--hud-accent); cursor: pointer; }

  .daw-meta { font-size: 9px; color: var(--hud-muted); padding: 2px 10px; background: var(--hud-bg0); border-top: 1px solid rgba(118,89,64,.15); flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* BOTTOM PANEL */
  .daw-bottom { display: flex; border-top: 1px solid var(--hud-border); background: var(--hud-bg0); flex-shrink: 0; height: 180px; min-height: 140px; }
  .daw-browser { width: 100%; display: flex; flex-direction: column; overflow: hidden; }
  .daw-browser-header { padding: 4px 5px; flex-shrink: 0; }
  .daw-browser-header input { width: 100%; min-height: 22px; border-radius: 3px; border: 1px solid var(--hud-border); background: rgba(24,18,14,.92); color: var(--hud-text); padding: 2px 6px; font-size: 10px; outline: none; }
  #jukebox-browser-close-btn { display: none; }
  .daw-cat-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 5px 4px; flex-shrink: 0; }
  .daw-cat-tabs::-webkit-scrollbar { height: 0; }
  .daw-cat-btn { width: 26px; height: 26px; border: 1px solid var(--hud-border); border-radius: 3px; background: var(--hud-bg1); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 2px; transition: all .1s; }
  .daw-cat-btn:hover { border-color: var(--hud-accent); }
  .daw-cat-btn.active { border-color: var(--hud-accent); background: rgba(194,139,84,.15); }
  .daw-cat-btn img { width: 18px; height: 18px; image-rendering: auto; filter: brightness(.55) sepia(.3); }
  .daw-cat-btn.active img, .daw-cat-btn:hover img { filter: brightness(.9) sepia(.15); }
  .daw-inst-list { flex: 1; overflow: hidden; padding: 0 5px 4px; display: flex; flex-direction: column; flex-wrap: wrap; gap: 2px; align-content: flex-start; }
  .daw-inst-item { display: flex; align-items: center; gap: 5px; padding: 2px 5px; border-radius: 3px; cursor: pointer; font-size: 10px; color: var(--hud-muted); transition: background .08s; height: 22px; }
  .daw-inst-item:hover { background: rgba(194,139,84,.08); }
  .daw-inst-item.active { background: rgba(194,139,84,.18); color: var(--hud-accent); }
  .daw-inst-item img { width: 16px; height: 16px; image-rendering: auto; opacity: .5; }
  .daw-inst-item.active img { opacity: 1; }
  .daw-inst-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .daw-sep { width: 1px; height: 80%; background: var(--hud-border); flex-shrink: 0; }

  .daw-cat-back { display: none; }
  .daw-cat-grid { display: none; }

  @media (max-width: 720px) {
    .daw-dialog { max-width: calc(100vw - 10px); }
    .daw-transport { gap: 4px; padding: 4px 6px; }
    .daw-mixer { width: 100px; min-width: 100px; }
    .daw-bottom { height: 220px; flex-direction: column; }
    .daw-editor-actions input[type=text] { width: auto; min-width: 86px; flex: 1 1 110px; }
    .daw-browser { width: 100%; height: 100%; }
    .daw-inst-list { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .daw-cat-tabs { display: none; }
    .daw-cat-back { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--hud-border); border-radius: 3px; background: var(--hud-bg1); color: var(--hud-text); font-size: 10px; cursor: pointer; }
    .daw-cat-back:hover { border-color: var(--hud-accent); color: var(--hud-accent); }
    .daw-cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 0 5px 4px; flex-shrink: 0; }
    .daw-cat-grid .daw-cat-btn { width: auto; height: auto; aspect-ratio: 1; }
  }
  #chat-input:focus, #auth-username:focus, #auth-password:focus, #password-reset-username:focus, #settings-new-email:focus, #settings-email-password:focus, #settings-delete-password:focus, #character-email-input:focus,
  #block-name-input:focus, #search-input:focus, #search-tags-input:focus, #search-creator-input:focus, #texture-tags-input:focus, .character-row select:focus {
    border-color: var(--hud-accent); box-shadow: 0 0 0 2px var(--hud-glow);
  }
  #chat-input::placeholder, #auth-username::placeholder, #auth-password::placeholder, #password-reset-username::placeholder, #settings-new-email::placeholder, #settings-email-password::placeholder, #settings-delete-password::placeholder, #character-email-input::placeholder,
  #block-name-input::placeholder, #search-input::placeholder, #search-tags-input::placeholder, #search-creator-input::placeholder, #texture-tags-input::placeholder { color: #9d8770; }

  .drawer-icon-btn {
    position: relative;
    width: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    display: inline-grid;
    place-items: center;
  }
  .drawer-icon-btn svg { width: 16px; height: 16px; }
  .hud-badge { min-width: 12px; height: 12px; padding: 0 2px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 8px; line-height: 12px; text-align: center; }
  .hotbar-badge { position:absolute; top:-5px; right:-5px; min-width:16px; height:16px; padding:0 4px; border-radius:999px; background:var(--danger); color:#fff; font-size:9px; font-weight:900; line-height:16px; text-align:center; box-shadow:0 1px 6px rgba(0,0,0,.35); }
  .notification-list { display:grid; gap:8px; max-height:min(52vh, 420px); overflow:auto; padding-right:2px; }
  .notification-item { display:grid; gap:3px; border-bottom:1px solid var(--hud-border); padding:6px 0; font-size:12px; }
  .notification-item.unread .notification-title { color:var(--hud-accent); }
  .notification-title { font-weight:900; color:var(--hud-text); }
  .notification-body { color:var(--hud-muted); line-height:1.35; overflow-wrap:anywhere; }
  .notification-time { color:var(--hud-muted); font-size:10px; font-weight:800; }
  .social-tabs { display:flex; gap:4px; margin:8px 0; }
  .social-tab { border:1px solid var(--hud-border); border-radius:4px; background:rgba(44,34,26,.9); color:var(--hud-text); padding:5px 10px; font-size:11px; font-weight:800; cursor:pointer; }
  .social-tab.active { border-color:var(--hud-accent); color:var(--hud-accent); background:rgba(89,61,37,.9); }
  .social-panel[hidden] { display:none !important; }
  .friend-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(128px,1fr)); gap:8px; }
  .friend-card { border:0; border-radius:0; background:transparent; padding:0; display:grid; gap:6px; justify-items:center; text-align:center; }
  .friend-card canvas { width:72px; height:72px; image-rendering:pixelated; border:0; border-radius:0; background:transparent; }
  .friend-actions { display:flex; gap:5px; flex-wrap:wrap; justify-content:center; }
  .inspect-action-status { min-height:16px; margin-top:8px; font-size:11px; line-height:1.35; color:var(--hud-accent-2); }
  .inspect-action-status.error { color:#ff8f7a; }
  .message-layout { display:grid; grid-template-columns:minmax(150px, 220px) minmax(0, 1fr); gap:10px; align-items:stretch; margin-top:10px; }
  .message-mobile-nav { display:none; }
  .message-conversation-list { max-height:430px; overflow-y:auto; display:grid; gap:4px; align-content:start; padding-right:2px; }
  .message-conversation-btn { width:100%; border:0; border-radius:0; background:transparent; color:var(--hud-text); cursor:pointer; padding:5px 0; text-align:left; display:grid; gap:3px; }
  .message-conversation-btn:hover { border-color:var(--hud-border-strong); background:rgba(44,34,26,.94); }
  .message-conversation-btn.active { border-color:var(--hud-accent); background:rgba(89,61,37,.9); }
  .message-conversation-name { display:flex; justify-content:space-between; gap:8px; align-items:center; font-size:12px; font-weight:800; color:var(--hud-accent); }
  .message-conversation-time { color:var(--hud-muted); font-size:9px; font-weight:700; white-space:nowrap; }
  .message-conversation-preview { color:var(--hud-muted); font-size:10px; line-height:1.3; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .message-thread-panel { min-height:0; display:grid; grid-template-rows:minmax(180px, 1fr) auto; gap:8px; }
  .message-thread { max-height:300px; overflow-y:auto; display:grid; gap:8px; align-content:start; padding-right:2px; font-size:12px; }
  .message-bubble { max-width:min(86%, 460px); border:0; border-radius:0; background:transparent; padding:0; display:grid; gap:4px; justify-self:start; }
  .message-bubble.outgoing { justify-self:end; background:transparent; border-color:transparent; }
  .message-bubble-meta { display:flex; justify-content:space-between; gap:10px; color:var(--hud-muted); font-size:10px; font-weight:800; }
  .message-bubble-body { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.35; }
  .message-bubble-resources { color:var(--hud-accent-2); font-size:10px; font-weight:800; }
  .message-composer { border:0; border-radius:0; background:transparent; padding:0; display:grid; gap:6px; }
  .admin-grid { display:grid; grid-template-columns:minmax(180px,260px) minmax(0,1fr); gap:12px; align-items:start; }
  .admin-list { display:grid; gap:6px; max-height:360px; overflow:auto; font-size:11px; }
  .admin-row { border:0; border-bottom:1px solid var(--hud-border); padding:6px 0; display:grid; gap:3px; }
  .admin-row strong { color:var(--hud-accent); }
  .admin-form { display:grid; gap:6px; }
  .settings-mail-list { display:grid; gap:8px; margin-top:4px; }
  .settings-mail-option { display:flex; align-items:center; gap:8px; color:var(--hud-text); font-size:12px; font-weight:800; }
  .settings-mail-option input { width:16px; height:16px; accent-color:var(--hud-accent); }
  .settings-account-section { display:grid; gap:7px; margin-bottom:12px; }
  .settings-section-title { color:var(--hud-accent); font-size:13px; font-weight:900; }
  .settings-current-email, .settings-email-status { color:var(--hud-muted); font-size:12px; min-height:16px; }
  .settings-email-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .admin-form input, .admin-form textarea, .admin-form select, #bug-title-input, #bug-body-input, #player-report-reason-input {
    border:1px solid var(--hud-border); border-radius:2px; background:rgba(24,18,14,.92); color:var(--hud-text); padding:6px 8px; font-size:12px;
  }
  .admin-section { display:grid; gap:6px; }
  .admin-inline { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .admin-wide { grid-column:1 / -1; }
  .admin-mail-grid { grid-template-columns:minmax(260px, 0.75fr) minmax(320px, 1fr); }
  .admin-mail-preview { display:grid; gap:6px; min-width:0; }
  .admin-mail-preview-frame { width:100%; min-height:320px; border:1px solid var(--hud-border); background:#fff; }
  .admin-mail-preview-source { min-height:320px; margin:0; white-space:pre-wrap; overflow:auto; border:1px solid var(--hud-border); background:rgba(24,18,14,.92); color:var(--hud-text); padding:8px; font-size:11px; line-height:1.4; }
  .admin-mail-preview-tabs { display:flex; flex-wrap:wrap; gap:4px; }
  .admin-mail-preview-tab.active { border-color:var(--hud-accent); color:var(--hud-accent); }
  .admin-mail-preview-panel[hidden] { display:none; }
  .admin-mail-meta { display:grid; gap:2px; font-size:10px; color:var(--hud-muted); overflow-wrap:anywhere; }
  .admin-check { display:flex; align-items:center; gap:6px; min-height:28px; color:var(--hud-text); font-size:12px; }
  .admin-check input { accent-color:var(--hud-accent); }
  .admin-row .admin-row-actions { display:flex; gap:4px; flex-wrap:wrap; }
  .message-resources { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
  .message-resources label { display:grid; gap:3px; font-size:10px; font-weight:800; color:var(--hud-muted); text-transform:uppercase; }

  .palette-grid { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; max-height: 260px; overflow: auto; padding-right: 2px; }
  .palette-swatch { aspect-ratio: 1; border: 1px solid rgba(139,109,76,0.12); border-radius: 3px; cursor: pointer; position: relative; overflow: hidden; background: rgba(255,255,255,0.5); transition: border-color 0.1s; }
  .palette-swatch:hover { border-color: var(--accent); }
  .palette-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(180, 95, 38, 0.2); }
  .palette-swatch.transparent {
    background: linear-gradient(45deg, rgba(0,0,0,0.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.06) 75%),
      linear-gradient(45deg, rgba(0,0,0,0.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.06) 75%), rgba(255,255,255,0.4);
    background-size: 8px 8px; background-position: 0 0, 4px 4px;
  }
  #editor-modal .dialog-grid.two > .dialog-card:first-child { display: grid; grid-template-rows: auto auto; align-content: start; min-height: 0; }
  .editor-palette-row {
    border-top: 1px solid var(--hud-border);
    padding-top: 8px;
    margin-top: 4px;
  }
  .editor-palette-row .palette-grid {
    grid-template-columns: repeat(16, minmax(0, 1fr));
    align-content: start;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .editor-action-note { grid-column: 1 / -1; border-top: 1px solid var(--hud-border); padding-top: 8px; margin: 0; color: var(--hud-muted); line-height: 1.35; font-size: 12px; }

  .character-creator-grid { display: grid; grid-template-columns: minmax(100px, 126px) minmax(220px, 300px) minmax(360px, 1fr); gap: 10px; align-items: stretch; min-height: 0; }
  #character-credit-copy { margin-top: -4px; color: var(--hud-muted); font-size: 12px; }
  #character-credit-copy a { color: var(--hud-accent); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
  #character-credit-copy a:visited { color: var(--hud-accent); }
  .character-edit-note { margin: -2px 0 8px; color: var(--hud-muted); font-size: 11px; line-height: 1.35; }
  .character-field-list { min-height: 0; }
  .character-category-rail { display: grid; align-content: start; gap: 6px; max-height: min(70vh, 620px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-right: 2px; }
  .character-category-btn { min-height: 52px; border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(24,18,14,.92); color: var(--hud-text); cursor: pointer; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 5px 4px; text-align: center; }
  .character-category-btn[data-active="true"] { border-color: var(--hud-accent); color: var(--hud-accent); box-shadow: inset 0 0 0 1px var(--hud-glow); }
  .character-category-icon { display: none; }
  .character-category-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--hud-muted); }
  .character-category-selected { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; font-weight: 700; line-height: 1.1; color: var(--hud-accent-2); }
  .character-category-selected[hidden] { display: none; }
  .character-picker-panel { border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(38,29,22,.88); padding: 8px; min-height: 0; max-height: min(70vh, 620px); overflow: hidden; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: 8px; }
  .character-picker-panel[hidden] { display: none; }
  .character-picker-title { margin: 0; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--hud-accent); }
  .character-subcategory-tabs { display: flex; flex-wrap: wrap; gap: 4px; overflow: visible; -webkit-overflow-scrolling: touch; min-height: 0; flex-shrink: 0; }
  .character-subcategory-tab { flex: 1 1 110px; min-width: 92px; min-height: 30px; border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(24,18,14,.92); color: var(--hud-muted); cursor: pointer; font-size: 10px; font-weight: 800; padding: 4px 8px; white-space: normal; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; text-align: center; }
  .character-subcategory-tab[data-active="true"] { border-color: var(--hud-accent); color: var(--hud-accent); }
  .character-option-grid { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; padding-right: 2px; }
  .character-option-card { border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(24,18,14,.92); color: var(--hud-text); cursor: pointer; display: grid; justify-items: center; gap: 4px; padding: 6px 4px; min-height: 92px; }
  .character-option-card[data-active="true"] { border-color: var(--hud-accent); box-shadow: inset 0 0 0 1px var(--hud-glow); }
  .character-option-preview { width: 52px; height: 52px; image-rendering: pixelated; }
  .character-option-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; color: var(--hud-muted); text-align: center; }
  .character-color-menu { display: flex; flex-wrap: wrap; gap: 5px; max-height: 76px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .character-color-menu[hidden] { display: none; }
  .character-color-swatch { width: 24px; height: 24px; border: 1px solid rgba(255,255,255,0.24); border-radius: 3px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.16); }
  .character-color-swatch[data-active="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }
  .character-preview-card { display: grid; grid-template-rows: auto auto auto auto; align-content: start; gap: 8px; justify-items: center; min-height: 0; position: relative; }
  #character-preview { width: min(100%, 34vh); max-width: 240px; aspect-ratio: 1; image-rendering: pixelated; border: 1px solid var(--hud-border); border-radius: 4px; background: rgba(24,18,14,0.92); align-self: start; }
  .character-preview-controls { display: flex; gap: 6px; align-items: center; justify-content: center; }
  .character-facing-btn { min-width: 34px; min-height: 28px; border-radius: 4px; border: 1px solid var(--hud-border); background: rgba(24,18,14,0.92); color: var(--hud-text); cursor: pointer; font-size: 16px; line-height: 1; }
  .character-facing-btn[data-active="true"] { border-color: var(--hud-accent); box-shadow: 0 0 0 2px var(--hud-glow); }
  .character-body-color-menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-height: 58px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px; }
  .character-body-color-menu[hidden] { display: none; }
  .character-bio-card { grid-column: 2 / 4; }
  .character-email-field { display: grid; gap: 4px; margin-top: 8px; }
  .character-email-field[hidden] { display: none; }
  .character-email-field label { font-size: 10px; font-weight: 800; color: var(--hud-muted); text-transform: uppercase; letter-spacing: 1px; }
  .character-email-error { min-height: 14px; font-size: 10px; color: var(--danger); }
  .character-email-error:empty { display: none; }
  .character-form-actions { grid-column: 2 / 4; margin-top: 0; }
  .sound-icon-muted { display: none; }
  #sound-btn[data-muted="true"] .sound-icon-on { display: none; }
  #sound-btn[data-muted="true"] .sound-icon-muted { display: block; }

  /* ---- EDITOR VIEWS 2x2 GRID ---- */
  #editor-views {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px;
  }
  .mobile-editor-view-tabs, .mobile-palette-launch { display: none; }
  .editor-palette-overlay { display: none; }
  .flat-face-wrap {
    border: 1px solid var(--hud-border); border-top: 3px solid var(--hud-accent);
    border-radius: 4px; background: rgba(38, 29, 22, 0.88);
    padding: 6px; display: flex; flex-direction: column; align-items: center;
  }
  .flat-face-wrap label {
    font-size: 9px; font-weight: 800; color: var(--hud-accent);
    margin-bottom: 3px; text-transform: uppercase; letter-spacing: 1.5px;
  }
  .flat-face-wrap canvas {
    width: 100%; image-rendering: pixelated; border-radius: 2px; border: 1px solid var(--hud-border);
    background: linear-gradient(45deg, rgba(0,0,0,0.03) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.03) 75%),
      linear-gradient(45deg, rgba(0,0,0,0.03) 25%, transparent 25%, transparent 75%, rgba(0,0,0,0.03) 75%), rgba(255,255,255,0.6);
    background-size: 10px 10px; background-position: 0 0, 5px 5px;
  }
  .flat-face-wrap canvas, #editor-canvas, #flat-face-top, #flat-face-left, #flat-face-right { touch-action: none; }

  #speech-layer .speech-bubble {
    position: absolute; transform: translate(-50%, -100%);
    min-width: 70px; max-width: 200px; padding: 6px 10px;
    border-radius: 6px; background: var(--hud-bubble);
    border: 1px solid var(--hud-border);
    box-shadow: 0 2px 12px var(--hud-shadow);
    color: var(--hud-text); font-size: 12px; line-height: 1.35;
    pointer-events: none; white-space: pre-wrap;
  }
  #speech-layer .speech-name { display: block; font-size: 10px; color: var(--hud-accent); font-weight: 700; letter-spacing: 0.5px; margin-bottom: 2px; }
  #speech-layer .speech-bubble::after {
    content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%);
    border-width: 5px 5px 0 5px; border-style: solid; border-color: var(--hud-bubble) transparent transparent transparent;
  }

  @media (max-width: 720px) {
    #hud-bar { max-width: calc(100vw - 10px); bottom: max(4px, env(safe-area-inset-bottom)); padding: 3px 4px; gap: 2px; overflow: visible; }
    .hud-main-row { gap: 2px; justify-content: center; }
    .bar-btn { width: 34px; height: 34px; }
    .bar-btn svg { width: 16px; height: 16px; }
    #hotbar { display: flex; min-width: 0; }
    .hotbar-info-row {
      grid-template-columns: repeat(6, minmax(0, 1fr));
      grid-template-areas:
        "atoms atoms waves waves code code"
        "you you you cell cell cell";
    }
    .hotbar-info:nth-child(1) { grid-area: you; }
    .hotbar-info:nth-child(2) { grid-area: atoms; }
    .hotbar-info:nth-child(3) { grid-area: waves; }
    .hotbar-info:nth-child(4) { grid-area: code; }
    .hotbar-info:nth-child(5) { grid-area: cell; }
    .hotbar-info { gap: 2px; height: 15px; padding: 0 3px; }
    .hotbar-info + .hotbar-info { border-left: 0; }
    .hotbar-info:nth-child(3),
    .hotbar-info:nth-child(4),
    .hotbar-info:nth-child(5) { border-left: 1px solid var(--hud-border); }
    .hotbar-info:nth-child(1),
    .hotbar-info:nth-child(5) { border-top: 1px solid var(--hud-border); }
    .hotbar-info .hud-label { font-size: 7px; }
    .hotbar-slots { display: flex; gap: 2px; }
    .hotbar-slot:nth-child(n + 4) { display: none; }
    #inbox-btn { display: none; }
    .hotbar-slot { width: 40px; height: 40px; justify-content: center; }
    .hotbar-slot canvas { width: 30px; height: 28px; }
    .hotbar-slot .clear-slot { display: none !important; }
    .bar-sep { display: none; min-height: 34px; }
    .modal.open {
      display: block; position: fixed; inset: 0;
      overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain; padding: max(6px, env(safe-area-inset-top)) 5px max(84px, env(safe-area-inset-bottom));
      touch-action: pan-y;
    }
    .modal.open .dialog {
      position: relative; top: auto; left: auto; transform: none;
      width: 100%; max-width: none; max-height: none; min-height: 0;
      margin: 0 auto; border-radius: 4px; padding: 10px;
      overflow: visible; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    }
    .dialog { width: calc(100vw - 10px); border-radius: 4px; padding: 10px; max-height: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
    .auth-welcome-body {
      display: grid;
      grid-template-rows: minmax(0, auto);
      height: auto;
      min-height: 0;
      overflow: visible;
      gap: 0;
    }
    .auth-welcome-art {
      grid-area: auto;
      position: relative;
      height: min(300px, 36dvh);
      max-height: 340px;
      min-height: 190px;
      overflow: hidden;
    }
    .auth-welcome-art::after { background: linear-gradient(180deg, transparent 36%, rgba(27, 21, 16, 0.2) 52%, rgba(27, 21, 16, 0.58) 76%, var(--hud-panel-strong) 100%); }
    .auth-welcome-image { width: 100%; height: 100%; margin: 0 auto; object-fit: cover; }
    .auth-welcome-copy-stack {
      grid-area: auto;
      align-self: auto;
      min-height: 0;
      max-height: none;
      overflow: visible;
      margin-top: max(-75px, -9dvh);
      padding: 8px 10px 10px;
      gap: 8px;
      z-index: 1;
      background: linear-gradient(180deg, transparent 0, rgba(27, 21, 16, 0.62) 42px, var(--hud-panel-strong) 100%);
    }
    .auth-welcome-copy { font-size: 11px; line-height: 1.35; }
    .auth-divider { margin-top: 1px; }
    #character-modal.open { overflow: hidden; }
    #character-modal.open .dialog { height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); overflow: hidden; margin: 6px auto; display: flex; flex-direction: column; }
    .dialog-grid.two, .dialog-grid.three, .admin-grid, .admin-inline { grid-template-columns: 1fr; }
    .scroll-list { max-height: none; overflow: visible; }
    .message-layout { grid-template-columns:1fr; min-height:min(68dvh, 560px); }
    .message-mobile-nav { display:grid; grid-template-columns:auto minmax(0, 1fr) auto; gap:8px; align-items:center; margin-top:8px; }
    .message-mobile-title { color:var(--hud-accent); font-size:12px; font-weight:900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:center; }
    .message-conversation-list { max-height:none; overflow-y:auto; }
    .message-thread-panel { min-height:min(62dvh, 520px); grid-template-rows:minmax(0, 1fr) auto; }
    .message-thread { max-height:none; overflow-y:auto; }
    #friend-panel-inbox[data-mobile-view="list"] .message-thread-panel,
    #friend-panel-inbox[data-mobile-view="thread"] .message-conversation-list,
    #friend-panel-inbox[data-mobile-view="thread"] .message-composer,
    #friend-panel-inbox[data-mobile-view="compose"] .message-conversation-list,
    #friend-panel-inbox[data-mobile-view="compose"] .message-thread { display:none; }
    #friend-panel-inbox[data-mobile-view="list"] #message-mobile-back-btn { visibility:hidden; }
    #friend-panel-inbox[data-mobile-view="list"] #message-mobile-compose-btn { visibility:hidden; }
    #friend-panel-inbox[data-mobile-view="compose"] #message-mobile-compose-btn { visibility:hidden; }
    .message-bubble { max-width:94%; }
    .texture-inspect-card { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px; align-items: start; }
    #texture-modal.unique-prop-inspect.open {
      overflow: hidden;
      padding: max(6px, env(safe-area-inset-top)) 5px max(6px, env(safe-area-inset-bottom));
    }
    #texture-modal.unique-prop-inspect.open .dialog {
      display: flex;
      flex-direction: column;
      max-height: calc(100dvh - 12px);
      overflow: hidden;
    }
    #texture-modal.unique-prop-inspect .unique-prop-inspect-card {
      flex: 1 1 auto;
      min-height: 0;
      overflow: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-y;
    }
    #texture-modal.unique-prop-inspect #texture-preview-host {
      min-height: 0;
      overflow: visible;
    }
    #texture-modal.unique-prop-inspect .dialog-actions {
      flex: 0 0 auto;
    }
    #texture-modal-summary { margin-bottom: 6px; }
    #texture-modal-meta { display: flex; flex-wrap: wrap; gap: 4px; align-content: start; font-size: 11px; }
    .texture-meta-row { display: inline-flex; align-items: baseline; gap: 4px; max-width: 100%; border: 1px solid rgba(118,89,64,.35); border-radius: 0; background: rgba(24,18,14,.58); padding: 3px 5px; }
    .texture-meta-label { font-size: 8px; letter-spacing: 0.5px; }
    .texture-meta-value { overflow-wrap: anywhere; }
    #texture-preview-host canvas { max-height: 120px; object-fit: contain; }
    #texture-modal.unique-prop-inspect .prop-snapshot-grid { grid-template-columns: minmax(0, 1fr); }
    #texture-modal.unique-prop-inspect .robot-inspect {
      min-height: 0;
      max-height: none;
      grid-template-rows: auto minmax(0, 1fr);
      overflow: visible;
    }
    #texture-modal.unique-prop-inspect .robot-inspect-image {
      max-height: min(22dvh, 160px);
      width: auto;
      max-width: 100%;
    }
    #texture-modal.unique-prop-inspect .robot-inspect-copy {
      min-height: 0;
      max-height: none;
      overflow: visible;
    }
    .character-creator-grid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "preview" "bio" "actions"; gap: 6px; flex: 1; min-height: 0; position: relative; }
    .character-edit-note { margin-bottom: 6px; font-size: 10px; }
    #character-fields { grid-area: preview; align-self: stretch; justify-self: start; z-index: 6; width: 62px; min-height: 0; max-height: 100%; pointer-events: none; padding: 8px 0 8px 8px; overflow: hidden; }
    .character-category-rail { height: 100%; max-height: 100%; display: grid; grid-auto-rows: minmax(0, 1fr); align-content: stretch; gap: 4px; overflow: hidden; pointer-events: auto; padding-right: 0; }
    .character-category-btn { min-height: 0; width: 54px; height: 100%; padding: 3px; background: rgba(24,18,14,.78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: hidden; }
    .character-category-label { font-size: 8px; white-space: nowrap; line-height: 1.05; text-transform: none; }
    .character-category-selected { font-size: 7px; white-space: nowrap; line-height: 1.02; }
    .character-preview-card { grid-area: preview; min-height: 0; padding: 4px 4px 4px 70px; overflow: hidden; grid-template-rows: minmax(0, 1fr) auto; align-content: stretch; }
    .character-preview-card h3, .character-preview-controls { display: none; }
    #character-preview { width: 100%; height: 100%; max-width: none; min-height: 0; object-fit: contain; }
    .character-body-color-menu { max-height: 58px; overflow-y: auto; justify-content: center; align-self: end; }
    .character-picker-panel { grid-area: preview; z-index: 8; height: 100%; max-height: none; min-height: 0; overflow: hidden; background: var(--hud-panel-strong); }
    .character-picker-panel[hidden] { display: none; }
    .character-option-grid { min-height: 0; overflow-y: auto; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
    .character-bio-card { grid-area: bio; padding: 6px; }
    .character-bio-card h3 { display: none; }
    #character-bio-input { min-height: 34px; height: 34px; rows: 1; }
    .character-form-actions { grid-area: actions; margin-top: 0; }
    #editor-modal.open { overflow-y: auto; -webkit-overflow-scrolling: touch; }
    #editor-modal.open .dialog { max-height: none; overflow: visible; }
    #editor-modal .dialog-grid.two { gap: 6px; }
    #editor-modal .dialog-card { border: 0; background: transparent; padding: 0; }
    #editor-modal .dialog-card h3, #editor-modal .dialog-card p { display: none; }
    #editor-modal .dialog-actions { margin-top: 6px; }
    #editor-modal .tool-btn, #editor-modal .dialog-btn { min-height: 34px; }
    .editor-footer-row { grid-template-columns: 1fr; gap: 6px; }
    .editor-publish-fields { grid-template-columns: 1fr; }
    .editor-discoverable-toggle { min-height: 30px; }
    .palette-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); max-height: 200px; }
    .mobile-editor-view-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
    .mobile-editor-view-tabs .tool-btn { padding: 0 4px; }
    #editor-views { grid-template-columns: 1fr; }
    #editor-views .flat-face-wrap { display: none; }
    #editor-modal[data-mobile-view="iso"] #editor-views .flat-face-wrap[data-editor-view="iso"],
    #editor-modal[data-mobile-view="top"] #editor-views .flat-face-wrap[data-editor-view="top"],
    #editor-modal[data-mobile-view="left"] #editor-views .flat-face-wrap[data-editor-view="left"],
    #editor-modal[data-mobile-view="right"] #editor-views .flat-face-wrap[data-editor-view="right"] { display: flex; }
    .mobile-palette-launch { display: block; margin-bottom: 8px; }
    .mobile-palette-launch .dialog-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
    .editor-palette-row { display: none; }
    .editor-palette-overlay.open { display: grid; position: fixed; inset: 0; z-index: 40; background: var(--hud-panel-strong); padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
    .editor-palette-overlay .palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 8px; max-height: none; overflow-y: auto; padding: 4px; }
    .editor-palette-overlay .palette-swatch { min-height: 34px; }
    #block-drawer { width: calc(100vw - 16px); max-height: 45vh; }
    #chat-popup { width: calc(100vw - 20px); bottom: 52px; }
    .drawer-section-body { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
    .drawer-top-row { flex-wrap: wrap; }
    #drawer-search { flex-basis: 100%; }
    .search-filter-row { grid-template-columns:minmax(0, 1fr); }
    #guide-modal.open { overflow: hidden; padding: max(6px, env(safe-area-inset-top)) 5px max(10px, env(safe-area-inset-bottom)); }
    #guide-modal.open .guide-dialog {
      height: calc(100dvh - 16px);
      max-height: calc(100dvh - 16px);
      overflow: hidden;
      width: 100%;
      border-radius: 0;
      border-left-width: 0;
      display: grid;
      grid-template-rows: minmax(0, 1fr) auto;
    }
    .guide-scroll { min-height: 0; overflow: auto; touch-action: pan-y; }
    .guide-actions { padding: 8px 12px max(10px, env(safe-area-inset-bottom)); }
    .guide-loop-video { width: min(100%, 320px); max-height: min(34dvh, 320px); }
    .guide-loop-video.mobile-inline { cursor: default; }
    .tutorial-layout { grid-template-columns: 1fr; gap: 6px; padding: 6px 10px 8px; }
    .tutorial-guide { touch-action: pan-y; }
    .tutorial-mobile-header {
      display: grid;
      grid-template-columns: 34px minmax(0, auto) 34px;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 10px 10px 2px;
    }
    .tutorial-mobile-menu-btn {
      width: 34px;
      height: 34px;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--hud-accent);
      cursor: pointer;
      display: grid;
      place-content: center;
      gap: 4px;
      padding: 0;
      flex: 0 0 auto;
    }
    .tutorial-mobile-menu-btn span {
      display: block;
      width: 18px;
      height: 2px;
      background: currentColor;
    }
    .tutorial-mobile-current-title {
      color: var(--hud-accent);
      font-size: 12px;
      font-weight: 900;
      text-transform: uppercase;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: center;
    }
    .tutorial-mobile-toc-overlay {
      position: fixed;
      inset: 0;
      z-index: 60;
      display: grid;
      align-items: start;
      padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
      background: rgba(10, 7, 5, 0.68);
    }
    .tutorial-mobile-toc-overlay[hidden] { display: none; }
    .tutorial-mobile-toc-panel {
      width: min(360px, calc(100vw - 24px));
      max-height: calc(100dvh - 24px);
      overflow: auto;
      margin: 0;
      padding: 14px 12px 12px;
      background: var(--hud-panel-strong);
      border-left: 4px solid var(--hud-accent);
      border-top: 1px solid var(--hud-border);
      border-right: 1px solid var(--hud-border);
      border-bottom: 1px solid var(--hud-border);
      box-shadow: 0 8px 40px var(--hud-shadow);
    }
    .tutorial-mobile-toc-close {
      float: right;
      width: 28px;
      height: 28px;
      border: 0;
      border-radius: 0;
      background: transparent;
      color: var(--hud-muted);
      cursor: pointer;
      font-size: 22px;
      line-height: 1;
    }
    .tutorial-mobile-toc-overlay .tutorial-toc {
      position: static;
      display: grid;
      max-height: none;
      overflow: visible;
      padding-right: 0;
    }
    .tutorial-toc { display: none; }
    .tutorial-main { min-height: 0; align-content: start; gap: 8px; }
    .tutorial-carousel { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; align-items: start; }
    .tutorial-carousel .modes-intro-arrow { display: none; }
    .tutorial-page-host {
      height: min(430px, calc(100dvh - 158px));
      align-items: start;
      overflow: hidden;
    }
    .tutorial-page {
      max-height: min(430px, calc(100dvh - 158px));
      gap: 8px;
      padding: 0 4px;
      touch-action: pan-y;
    }
    .tutorial-page h1.guide-heading { font-size: 20px; }
    .tutorial-icon-grid { justify-content: center; }
    #hud-status-bar { bottom: calc(max(42px, env(safe-area-inset-bottom)) + 38px); font-size: 8px; gap: 4px; padding: 2px 6px; max-width: calc(100vw - 10px); flex-wrap: wrap; justify-content: center; }
    #hud-alert { bottom: calc(max(42px, env(safe-area-inset-bottom)) + 84px); max-width: calc(100vw - 12px); font-size: 10px; }
    #jukebox-modal.open { overflow: hidden; padding: 0; }
    #jukebox-modal.open .daw-dialog { position: relative; width: 100vw; max-width: 100vw; min-height: 100dvh; height: 100dvh; max-height: none; margin: 0 !important; border-radius: 0; overflow: hidden; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
    .daw-transport {
      position: static; z-index: 4; grid-column: 1; grid-row: 1;
      width: 100%; max-height: 45dvh;
      flex-direction: row; align-items: center; flex-wrap: wrap; gap: 5px; padding: max(6px, env(safe-area-inset-top)) 6px 6px;
      overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
      background: rgba(18,13,10,.96); border: 0; border-bottom: 1px solid var(--hud-border); border-radius: 0;
    }
    .daw-transport-left, .daw-transport-center, .daw-transport-right { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 5px; width: auto; min-width: 0; }
    .daw-transport-left { flex: 0 1 auto; }
    .daw-transport-center, .daw-transport-right { flex: 1 1 220px; }
    .daw-tbtn { width: auto; min-width: 48px; height: 32px; justify-content: center; gap: 4px; padding: 0 6px; font-size: 10px; font-weight: 800; }
    .daw-mobile-label { display: inline; }
    .daw-time { min-width: 38px; text-align: center; padding: 3px 0; }
    .daw-tlabel { width: auto; min-width: 74px; justify-content: space-between; gap: 4px; flex: 1 1 74px; }
    .daw-tlabel input[type=number] { width: 42px; }
    .daw-tlabel input[type=range] { width: min(28vw, 110px); }
    .jukebox-zoom-control, .jukebox-bar-control { display: none; }
    .daw-transport input[type=text] { width: auto; min-width: 72px; flex: 1 1 84px; }
    .daw-transport select { width: auto; }
    #jukebox-instruments-btn, #jukebox-mixer-btn { display: flex; }
    .daw-main { grid-column: 1; grid-row: 2; min-height: 0; height: 100%; overflow: hidden; }
    .daw-editor-actions input[type=text] {
      width: auto; min-width: 86px; min-height: 34px; flex: 1 1 110px;
      font-size: 12px; padding: 6px 8px;
    }
    .daw-editor-actions .dialog-btn {
      width: auto; min-width: 0; min-height: 34px;
      padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .daw-mixer { display: none; }
    .daw-dialog.mobile-mixer-open .daw-mixer { display: flex; position: absolute; z-index: 5; inset: max(8px, env(safe-area-inset-top)) 8px auto auto; width: min(220px, 70vw); max-height: calc(100dvh - 16px); border-left: 1px solid var(--hud-border); border-right: 0; overflow-y: auto; }
    .daw-pianoroll { min-height: 0; height: 100%; }
    .daw-pianoroll canvas { width: 100%; height: calc(100% - 16px); max-height: none; }
    .daw-hscroll-wrap { height: 16px; padding: 0 4px 2px; }
    .daw-meta { display: none; }
    .daw-bottom { display: none; position: fixed; inset: 0; z-index: 42; height: auto; min-height: 0; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); background: var(--hud-panel-strong); border: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .daw-dialog.mobile-instruments-open .daw-bottom { display: flex; }
    .daw-dialog.mobile-instruments-open:not(.mobile-instrument-category-open) #jukebox-inst-search { display: none; }
    .daw-dialog.mobile-instruments-open .daw-cat-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 4px 5px 8px; }
    .daw-dialog.mobile-instruments-open .daw-cat-btn { width: auto; height: 54px; display: grid; gap: 2px; justify-items: center; align-content: center; }
    .daw-cat-label { display: none; }
    .daw-dialog.mobile-instruments-open .daw-cat-label { display: none; }
    #jukebox-browser-close-btn { display: block; }
    .daw-inst-list { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); align-content: start; flex-wrap: nowrap; }
    .daw-browser { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  }
