/*-----------------------------------*
  #GAME PAGE - GLOBAL RESET
  Canvas fills the whole viewport.
  No scrolling, no body padding.
*-----------------------------------*/

.game-body {
    padding-top: 0 !important;
    overflow: hidden;
    height: 100dvh;
    width: 100dvw;
    background: #080a12;
}

#game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: default;
    touch-action: none;
}

/* Pointer lock - hide cursor inside canvas */
#game-canvas {
  cursor: default;
}

/*-----------------------------------*
  #LOADING SCREEN
*-----------------------------------*/

#loading-screen {
    position: fixed;
    inset: 0;
    background: #080a12;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.6s ease;
}

#loading-screen:not(.loading-active) {
    opacity: 0;
    pointer-events: none;
}

.loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-logo {
    font-family: var(--ff-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--bright-snow);
    text-transform: uppercase;
    letter-spacing: -1px;
}

.loading-label {
    font-size: var(--fs-body-sm);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.loading-bar-track {
    width: 240px;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.loading-tip {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    max-width: 260px;
    line-height: 1.5;
    margin-top: 8px;
}

/*-----------------------------------*
  #HUD - TOP BAR
*-----------------------------------*/

.game-hud-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    z-index: 100;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    gap: var(--space-md);

    background: rgba(10, 10, 15, 0.75);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.game-logo {
    order: 0;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    color: var(--bright-snow);
    flex-shrink: 0;
}

.game-logo:hover {
    color: var(--primary);
    opacity: 1;
}

.hud-center {
    order: 1;
    flex: 1;
    display: flex;
    justify-content: center;
}

.hud-world-name {
    font-size: var(--fs-body-sm);
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-right {
    order: 2;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.hud-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: var(--fs-body-sm);
    color: var(--bright-snow);
}

.hud-pill-icon { font-size: 12px; }
.hud-pill-label { color: var(--text-light); }

.hud-icon-btn {
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    color: var(--bright-snow);
    text-decoration: none;
    transition: background var(--motion-sm), border-color var(--motion-sm);
}

.hud-icon-btn:hover {
    background: rgba(79, 124, 255, 0.15);
    border-color: rgba(79, 124, 255, 0.3);
    opacity: 1;
}

/*-----------------------------------*
  #HUD - CONTROLS HINT
*-----------------------------------*/

.hud-controls-hint {
    position: fixed;
    bottom: var(--space-xl);
    left: var(--space-lg);
    z-index: 100;

    display: flex;
    flex-direction: column;
    gap: 6px;

    opacity: 1;
    transition: opacity 1s ease;
}

.hud-controls-hint.hidden {
    opacity: 0;
    pointer-events: none;
}

.hud-touch-hint {
    position: fixed;
    top: 62px;
    right: max(16px, env(safe-area-inset-right));
    z-index: 115;
    display: none;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    max-width: min(440px, calc(100dvw - 32px));
    pointer-events: none;
    opacity: 1;
    transition: opacity 1s ease;
}

.hud-touch-hint.hidden {
    opacity: 0;
}

.touch-hint-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    background: rgba(10, 10, 15, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    backdrop-filter: blur(8px);
}

.hint-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}


/*-----------------------------------*
  #VOICE BUTTON
*-----------------------------------*/

.voice-c {
  width: 100%;
  background: rgba(10,10,15,0.85);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  text-align: left;
  padding: 0;
}

.voice-c-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.voice-c-mic-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ripple ring - animated with transform+opacity (composited, no paint) */
.voice-c-mic-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(74,222,128,0.22);
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
}

.voice-c-mic-bg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, box-shadow 0.25s;
}

.voice-c-mic-bg svg {
  width: 16px;
  height: 16px;
  stroke: rgba(255,255,255,0.5);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s;
}

.voice-c-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.voice-c-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
  line-height: 1.2;
}

.voice-c-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.42);
  transition: color 0.25s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.voice-c-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255,255,255,0.13);
  transition: background 0.25s, box-shadow 0.25s;
}

/* strip slides open when live */
.voice-c-strip {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1), border-top-width 0.3s;
  border-top: 0px solid rgba(255,255,255,0.06);
}


.voice-c-strip-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 7px;
}

.voice-c-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f7cff, #7c4fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  flex-shrink: 0;
}

.voice-c-speaker {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
  min-width: 0;
}

.voice-c-bars {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 14px;
  flex-shrink: 0;
  margin-left: auto;
}

.voice-c-bar {
  width: 2.5px;
  border-radius: 1px;
  background: rgba(255,255,255,0.08);
  height: 2px;
  transition: height 0.07s ease, background 0.12s;
}

.voice-c-db {
  font-size: 9px;
  font-weight: 700;
  color: rgba(74,222,128,0.5);
  flex-shrink: 0;
  width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s;
}

/* live state */
.voice-c.live {
  border-color: rgba(74,222,128,0.35);
  background: rgba(6,18,11,0.88);
}

.voice-c.live .voice-c-mic-wrap::before {
  animation: vcMicRipple 2s ease-out infinite;
}

.voice-c.live .voice-c-mic-bg {
  background: rgba(74,222,128,0.15);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.1);
}
.voice-c.live .voice-c-mic-bg svg { stroke: #4ade80; }
.voice-c.live .voice-c-label { color: #4ade80; }
.voice-c.live .voice-c-sub { color: rgba(74,222,128,0.55); }

.voice-c.live .voice-c-dot {
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74,222,128,0.12), 0 0 8px rgba(74,222,128,0.4);
  animation: vcDotPulse 1.8s ease-in-out infinite;
}

.voice-c.live .voice-c-strip {
  max-height: 220px;
  border-top-width: 1px;
}

.voice-c-strip-head {
  padding: 5px 10px 2px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.voice-c-participants {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 8px 8px;
  max-height: 150px;
  overflow-y: auto;
  scrollbar-width: none;
}
.voice-c-participants::-webkit-scrollbar { display: none; }

.voice-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border-radius: 5px;
  font-size: 11px;
  min-width: 0;
}

.voice-row + .voice-row {
  border-top: 1px solid rgba(255,255,255,0.05);
}

.voice-row-avatar {
  font-size: 12px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.voice-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  font-size: 11px;
}

/* scope bars/db inside rows to override the old strip-inner sizing */
.voice-row .voice-c-bars {
  margin-left: 0;
  height: 12px;
}

.voice-row .voice-c-bar {
  width: 2px;
  height: 2px;
}

.voice-row .voice-c-db {
  font-size: 9px;
  width: 28px;
}

/* error state */
.voice-c.error {
  border-color: rgba(255,79,79,0.3);
  background: rgba(18,6,6,0.88);
}

.voice-c.error .voice-c-mic-bg { background: rgba(255,79,79,0.1); }
.voice-c.error .voice-c-mic-bg svg { stroke: #ff7b7b; }
.voice-c.error .voice-c-label { color: #ff7b7b; }
.voice-c.error .voice-c-sub { color: rgba(255,79,79,0.45); }
.voice-c.error .voice-c-dot { background: #ff7b7b; }

/* connecting */
.voice-c[data-voice-state="connecting"] .voice-c-dot {
  background: var(--primary);
  animation: vcDotPulse 0.9s ease-in-out infinite;
}

@keyframes vcDotPulse {
  0%,100% { box-shadow: 0 0 0 2px rgba(74,222,128,0.12), 0 0 6px rgba(74,222,128,0.3); }
  50%      { box-shadow: 0 0 0 4px rgba(74,222,128,0.06), 0 0 14px rgba(74,222,128,0.5); }
}

@keyframes vcMicRipple {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0;   }
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    font-family: var(--ff-body);
    font-size: 10px;
    font-weight: 700;
    color: var(--bright-snow);
    letter-spacing: 0.5px;
    min-width: 52px;
    text-align: center;
}



/*-----------------------------------*
  #CHAT PANEL
*-----------------------------------*/

.chat-area {
    position: fixed;
    top: 62px;
    left: 24px;
    z-index: 100;
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 260px;
    justify-content: flex-end;
}


.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: scroll;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    padding-top: 8px;
}

.chat-messages::-webkit-scrollbar { display: none; }

.chat-msg {
    display: flex;
    gap: 6px;
    font-size: 12px;
    background: rgba(10, 10, 15, 0.7);
    padding: 4px 8px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.chat-msg-name {
    color: var(--primary);
    font-weight: 700;
    flex-shrink: 0;
    white-space: nowrap;
}

.chat-msg-text { color: var(--bright-snow); word-break: break-word; }
.chat-msg.system .chat-msg-text { color: var(--text-light); font-style: italic; }
.chat-msg.self .chat-msg-name { color: #ffd700; }

.chat-input-row {
    display: flex;
    gap: 6px;
}

.chat-panel.chat-hidden {
    height: 0;
}

.chat-panel.chat-hidden .chat-messages,
.chat-panel.chat-hidden .chat-input-row {
    display: none;
}

.hide-control-hints .hud-controls-hint,
.hide-control-hints .hud-touch-hint {
    display: none !important;
}

.chat-input {
    flex: 1;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(79, 124, 255, 0.35);
    border-radius: 8px;
    padding: 6px 10px;
    font-family: var(--ff-body);
    font-size: 12px;
    color: var(--bright-snow);
    outline: none;
}

.chat-input:focus { border-color: var(--primary); }

.chat-send-btn {
    width: 30px;
    height: 30px;
    background: var(--primary);
    color: var(--text-dark);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover { filter: brightness(1.1); }

@media (max-width: 1180px), (max-height: 760px) {
    .is-embedded-world .game-hud-top {
        height: 52px;
        padding: 0 20px;
    }

    .is-embedded-world .game-logo {
        margin-right: auto;
    }

    .is-embedded-world .hud-center {
        flex: 0 1 auto;
        margin: 0 auto;
    }

    .is-embedded-world .hud-right {
        margin-left: auto;
    }

    .is-embedded-world .chat-area {
        top: 70px;
        left: 16px;
        width: min(286px, calc(100dvw - 32px));
    }

    .is-embedded-world .chat-panel {
        height: 112px;
    }

    .is-embedded-world .chat-messages {
        flex: 0 1 64px;
        min-height: 0;
        padding-top: 0;
    }

    .is-embedded-world .chat-msg {
        font-size: 11px;
        padding: 4px 7px;
    }

    .is-embedded-world .chat-input {
        min-height: 30px;
    }

    .is-embedded-world .chat-send-btn {
        width: 34px;
        height: 30px;
        flex: 0 0 34px;
    }
}

/*-----------------------------------*
  #MOBILE FULLSCREEN PROMPT
*-----------------------------------*/

.world-fullscreen-prompt {
    position: fixed;
    inset: 0;
    z-index: 420;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    background: rgba(5, 6, 12, 0.72);
    backdrop-filter: blur(10px);
}

.world-fullscreen-prompt[hidden] {
    display: none;
}

.world-fullscreen-card {
    width: min(360px, 100%);
    padding: 18px;
    background: rgba(14, 15, 22, 0.94);
    border: 1px solid rgba(79, 124, 255, 0.32);
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.54);
}

.world-fullscreen-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.world-fullscreen-card h2 {
    display: block;
    margin: 0 0 8px;
    color: var(--bright-snow);
    font-size: 24px;
    line-height: 1.1;
}

.hud-icon-btn svg,
.hud-pill-icon svg {
    width: 16px !important;
    height: 16px !important;
    stroke: currentColor;
    fill: none;
    display: block;
    pointer-events: none;
}
#btn-settings svg {
    width: 16px !important;
    min-width: 16px !important;
}

button.hud-icon-btn {
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}


.world-fullscreen-card h2::after {
    display: none;
}

.world-fullscreen-card p {
    margin: 0;
    color: var(--text-light);
    font-size: 13px;
    line-height: 1.5;
}

.world-fullscreen-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.world-fullscreen-actions button {
    flex: 1;
    min-height: 42px;
    border-radius: 8px;
    font-size: 13px;
}

.world-fullscreen-enter {
    background: var(--primary);
    color: var(--text-dark);
    border: 1px solid var(--primary);
}

.world-fullscreen-dismiss {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bright-snow);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.world-fullscreen-prompt.is-denied .world-fullscreen-card {
    border-color: rgba(255, 79, 79, 0.34);
}

/*-----------------------------------*
  #STAND PROMPTS AND PANELS
*-----------------------------------*/

.stand-prompt {
    position: fixed;
    left: 50%;
    bottom: 86px;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(10, 10, 15, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--bright-snow);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-sm), transform var(--motion-sm);
}

.stand-prompt.visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
    cursor: pointer;
}

.stand-prompt-key {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    background: var(--primary);
    color: var(--text-dark);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.stand-prompt-action {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.stand-panel {
    position: fixed;
    top: 64px;
    right: 24px;
    bottom: 24px;
    z-index: 150;
    width: min(360px, calc(100dvw - 32px));
    max-height: calc(100dvh - 88px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(14px);
    overflow: hidden;
    touch-action: manipulation;
    transform: translateX(calc(100% + 32px));
    opacity: 0;
    pointer-events: none;
    transition: transform var(--motion-md) var(--ease-smooth), opacity var(--motion-sm);
}

.stand-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.stand-panel-header,
.stand-editor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.stand-panel-kicker {
    margin: 0 0 4px;
    font-size: 10px;
    line-height: 1.2;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.stand-panel-title,
.stand-editor-title {
    display: block;
    margin: 0;
    max-width: 260px;
    font-size: 20px;
    line-height: 1.15;
    color: var(--bright-snow);
    overflow-wrap: anywhere;
}

.stand-panel-title::after,
.stand-editor-title::after {
    display: none;
}

.stand-panel-meta {
    margin: 5px 0 0;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-light);
}

.stand-panel-close {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--bright-snow);
    font-size: 15px;
    line-height: 1;
}

.stand-panel-close:hover {
    background: rgba(255, 79, 79, 0.16);
    color: #ff7b7b;
}

.stand-panel-text {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--bright-snow);
    overflow-wrap: anywhere;
}

.stand-products {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-auto-rows: min-content;
    gap: 8px;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.stand-product {
    min-height: 58px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    color: var(--bright-snow);
    text-align: left;
    touch-action: manipulation;
    transform: translateY(0) scale(1);
    transform-origin: center;
    transition: transform 160ms var(--ease-standard),
                background var(--motion-sm),
                border-color var(--motion-sm),
                box-shadow var(--motion-sm);
}

.stand-product:hover {
    background: rgba(79, 124, 255, 0.18);
    border-color: rgba(79, 124, 255, 0.35);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px) scale(1.015);
}

.stand-product:active {
    transform: translateY(0) scale(0.99);
}

.stand-product.disabled {
    opacity: 0.68;
}

.stand-product.bought,
.stand-product:disabled {
    opacity: 0.58;
    cursor: default;
}

.stand-product.bought:hover,
.stand-product:disabled:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.09);
    box-shadow: none;
    transform: none;
}

.stand-product-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.08);
    transition: transform 180ms var(--ease-standard);
}

.stand-product:hover .stand-product-thumb {
    transform: scale(1.08);
}

.stand-product-info {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stand-product-name {
    min-width: 0;
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stand-product-price {
    flex-shrink: 0;
    padding: 4px 7px;
    background: #4ade80;
    color: #08210f;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.stand-product.bought .stand-product-price,
.stand-product:disabled .stand-product-price {
    background: var(--primary);
    color: var(--text-dark);
}

.stand-products-empty {
    margin: 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.45;
}

.stand-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 320;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-sm);
}

.stand-editor-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.stand-editor {
    width: min(780px, 100%);
    max-height: min(88dvh, 760px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: var(--carbon-mid);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.stand-editor-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.stand-editor-tab {
    min-height: 34px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 700;
    transition: background var(--motion-sm), border-color var(--motion-sm), color var(--motion-sm);
}

.stand-editor-tab.active {
    background: rgba(79, 124, 255, 0.18);
    border-color: rgba(79, 124, 255, 0.38);
    color: var(--bright-snow);
}

.stand-editor-body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}

.stand-editor-section {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.stand-editor-section.active {
    display: flex;
}

.stand-editor-section-head h3 {
    margin: 0 0 4px;
    color: var(--bright-snow);
    font-size: 15px;
    line-height: 1.2;
}

.stand-editor-section-head p {
    margin: 0;
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.45;
}

.stand-editor-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 700;
}

.stand-editor-input {
    width: 100%;
    resize: none;
    padding: 10px 12px;
    background: var(--carbon-black);
    border: 1px solid rgba(79, 124, 255, 0.35);
    border-radius: 8px;
    color: var(--bright-snow);
    font-family: var(--ff-body);
    font-size: 13px;
    line-height: 1.45;
    outline: none;
}

.stand-editor-input:focus {
    border-color: var(--primary);
}

.stand-editor-count {
    align-self: flex-end;
    font-size: 11px;
    color: var(--text-light);
}

.stand-theme-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.stand-theme-option {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--bright-snow);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    transition: background var(--motion-sm), border-color var(--motion-sm), transform var(--motion-sm);
}

.stand-theme-option:hover,
.stand-theme-option.active {
    background: rgba(79, 124, 255, 0.16);
    border-color: rgba(79, 124, 255, 0.4);
}

.stand-theme-option:active {
    transform: scale(0.98);
}

.stand-theme-swatch {
    width: 34px;
    height: 28px;
    flex: 0 0 34px;
    border-radius: 6px;
    background:
        linear-gradient(135deg, var(--stand-theme-accent), transparent 45%),
        linear-gradient(180deg, var(--stand-theme-top), var(--stand-theme-bottom));
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.stand-appearance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 200px));
    justify-content: start;
    gap: 10px;
}

.stand-appearance-option {
    position: relative;
    min-width: 0;
    width: 100%;
    min-height: 154px;
    display: grid;
    grid-template-rows: 86px 18px 30px;
    gap: 5px;
    align-content: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--bright-snow);
    text-align: center;
    overflow: hidden;
    transition:
        transform var(--motion-sm) var(--ease-smooth),
        border-color var(--motion-sm) var(--ease-standard),
        background var(--motion-sm) var(--ease-standard),
        box-shadow var(--motion-sm) var(--ease-standard);
}

.stand-appearance-option:hover {
    transform: translateY(-1px);
    border-color: rgba(101, 216, 255, 0.25);
    background: rgba(101, 216, 255, 0.065);
}

.stand-appearance-option.active {
    border-color: rgba(101, 216, 255, 0.34);
    background: rgba(79, 124, 255, 0.075);
    box-shadow: 0 0 0 1px rgba(101, 216, 255, 0.08);
}

.stand-appearance-preview {
    position: relative;
    width: 100%;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background:
        radial-gradient(circle at 50% 42%, rgba(101, 216, 255, 0.12), transparent 60%),
        rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.stand-appearance-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.stand-appearance-title {
    min-width: 0;
    align-self: center;
    color: var(--bright-snow);
    font-size: 13px;
    font-weight: 800;
    line-height: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stand-appearance-option small {
    min-width: 0;
    color: var(--text-light);
    font-size: 11px;
    font-weight: 600;
    line-height: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stand-gamepass-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stand-gamepass-status {
    margin-right: auto;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 700;
}

.stand-gamepass-tool,
.stand-gamepass-move,
.stand-gamepass-toggle {
    min-height: 30px;
    padding: 7px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 800;
}

.stand-gamepass-tool,
.stand-gamepass-move {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--bright-snow);
}

.stand-gamepass-tool:hover,
.stand-gamepass-move:hover:not(:disabled) {
    background: rgba(79, 124, 255, 0.18);
    border-color: rgba(79, 124, 255, 0.34);
}

.stand-gamepass-move:disabled {
    opacity: 0.36;
    cursor: default;
}

.stand-gamepass-list {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 2px;
}

.stand-gamepass-row {
    min-height: 44px;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 8px;
    padding: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
}

.stand-gamepass-row.muted {
    opacity: 0.68;
}

.stand-gamepass-toggle {
    background: rgba(255, 79, 79, 0.14);
    border: 1px solid rgba(255, 79, 79, 0.28);
    color: #ffb4b4;
}

.stand-gamepass-toggle.active {
    background: rgba(74, 222, 128, 0.16);
    border-color: rgba(74, 222, 128, 0.34);
    color: #8ff2b1;
}

.stand-gamepass-name {
    min-width: 0;
    color: var(--bright-snow);
    font-size: 12px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stand-gamepass-price {
    padding: 4px 7px;
    background: rgba(74, 222, 128, 0.16);
    color: #8ff2b1;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.stand-editor-actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.stand-release-btn,
.stand-save-btn {
    min-width: 92px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.stand-release-btn {
    background: rgba(255, 79, 79, 0.14);
    color: #ff9b9b;
    border: 1px solid rgba(255, 79, 79, 0.28);
}

.stand-save-btn {
    background: var(--primary);
    color: var(--text-dark);
}

/*-----------------------------------*
  #STAND NO-PRODUCTS MODAL
*-----------------------------------*/

.stand-no-products-overlay {
    position: fixed;
    inset: 0;
    z-index: 320;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.52);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}

.stand-no-products-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.stand-no-products-modal {
    width: min(340px, calc(100dvw - 32px));
    background: #fff;
    border-radius: 22px;
    padding: 28px 22px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.stand-no-products-overlay.open .stand-no-products-modal {
    transform: scale(1);
}

.stand-no-products-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: #3bbec8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.stand-no-products-text {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    line-height: 1.55;
}

.stand-no-products-ok {
    width: 100%;
    padding: 14px;
    background: #3b7cf5;
    color: #fff;
    border: none;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.07em;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.stand-no-products-ok:hover {
    background: #2d6ae0;
}

.stand-no-products-ok:active {
    transform: scale(0.98);
}

.stand-no-products-tutorial {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    color: #3b7cf5;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.stand-no-products-tutorial:hover {
    color: #2d6ae0;
}

/*-----------------------------------*
  #STAND TUTORIAL PANEL
*-----------------------------------*/

.stand-tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 320;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.52);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
}

.stand-tutorial-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.stand-tutorial-panel {
    width: min(400px, calc(100dvw - 32px));
    background: #0c0f1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transform: scale(0.9);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
}

.stand-tutorial-overlay.open .stand-tutorial-panel {
    transform: scale(1);
}

.stand-tutorial-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stand-tutorial-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.stand-tutorial-title::after {
    display: none;
}

.stand-tutorial-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    counter-reset: tutorial-step;
}

.stand-tutorial-steps li {
    counter-increment: tutorial-step;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.stand-tutorial-steps li::before {
    content: counter(tutorial-step);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.stand-tutorial-steps li span {
    font-size: 13px;
    color: rgba(226, 232, 240, 0.85);
    line-height: 1.6;
}

.stand-tutorial-steps li strong {
    color: #fff;
    font-weight: 700;
}

.stand-tutorial-done {
    align-self: flex-end;
    padding: 10px 22px;
    background: var(--primary);
    color: var(--text-dark);
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.stand-tutorial-done:hover {
    opacity: 0.88;
}

/*-----------------------------------*
  #STAND EDITOR HELP BUTTON
*-----------------------------------*/

.stand-editor-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.stand-help-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(79, 124, 255, 0.14);
    border: 1px solid rgba(79, 124, 255, 0.28);
    color: rgba(148, 163, 184, 0.9);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.stand-help-btn:hover {
    background: rgba(79, 124, 255, 0.28);
    border-color: rgba(79, 124, 255, 0.5);
    color: #fff;
}

/*-----------------------------------*
  #MOBILE GAME CONTROLS
*-----------------------------------*/

.mobile-game-controls {
    position: fixed;
    inset: auto 0 0;
    z-index: 140;
    display: none;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 0 40px max(34px, calc(env(safe-area-inset-bottom) + 20px));
    pointer-events: none;
}

.mobile-joystick {
    position: relative;
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 50%, rgba(79, 124, 255, 0.12), rgba(10, 10, 15, 0.52) 62%, rgba(10, 10, 15, 0.75)),
        rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.22);
    pointer-events: auto;
    touch-action: none;
    backdrop-filter: blur(10px);
}

.mobile-joystick::before {
    content: "";
    position: absolute;
    inset: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.mobile-joystick-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(242, 242, 247, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.34);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    transform: translate(-50%, -50%);
    transition: transform 80ms linear;
}

.mobile-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: rgba(10, 10, 15, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: var(--bright-snow);
    font-size: 15px;
    font-weight: var(--fw-bold);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    backdrop-filter: blur(10px);
}

.mobile-control-btn:active {
    background: var(--primary);
    color: var(--text-dark);
}

.mobile-jump {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    margin-bottom: 18px;
    border-radius: 50%;
    pointer-events: auto;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

@media (pointer: coarse), (max-width: 768px) {
    .mobile-game-controls {
        display: flex;
    }
}

@media (pointer: coarse), (hover: none) {
    .hud-controls-hint {
        display: none;
    }

    .hud-touch-hint {
        display: flex;
    }
}

@media (max-width: 420px) {
    .mobile-game-controls {
        gap: 12px;
        padding-inline: 28px;
    }

    .mobile-joystick {
        width: 120px;
        height: 120px;
        flex-basis: 120px;
    }

    .mobile-joystick-knob {
        width: 50px;
        height: 50px;
    }

    .mobile-control-btn {
        font-size: 14px;
    }

    .mobile-jump {
        width: 56px;
        height: 56px;
        flex-basis: 56px;
        font-size: 10px;
    }
}

/*-----------------------------------*
  #SETTINGS MODAL
*-----------------------------------*/

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding:
        max(clamp(10px, 2.4dvw, 28px), env(safe-area-inset-top))
        max(clamp(10px, 2.4dvw, 28px), env(safe-area-inset-right))
        max(clamp(10px, 2.4dvw, 28px), env(safe-area-inset-bottom))
        max(clamp(10px, 2.4dvw, 28px), env(safe-area-inset-left));

    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-sm);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--carbon-mid);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    width: min(100%, 600px);
    max-height: min(760px, 100%);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px clamp(16px, 3dvw, 28px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex: 0 0 auto;
}

.modal-title {
    font-size: var(--fs-body-lg);
    font-weight: 700;
    color: var(--bright-snow);
    margin: 0;
    /* override global h2 underline */
    display: block;
}

.modal-title::after { display: none; }

.modal-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background var(--motion-sm);
}

.modal-close:hover {
    background: rgba(255, 79, 79, 0.15);
    color: #ff4f4f;
}

.modal-body {
    padding: clamp(14px, 2.4dvw, 24px) clamp(16px, 3dvw, 28px);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 12px;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.setting-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 46%) minmax(0, 1fr);
    flex: 0 0 auto;
    align-items: center;
    gap: 12px 14px;
    min-height: 52px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    cursor: pointer;
    min-width: 0;
}

.setting-label {
    flex: 1;
    font-size: var(--fs-body-sm);
    color: var(--bright-snow);
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
}

.setting-value {
    font-size: var(--fs-body-sm);
    color: var(--primary);
    font-weight: 700;
    min-width: 42px;
    text-align: right;
    justify-self: end;
}

input[type="range"] {
    width: 100%;
    min-width: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.setting-row input[type="range"] {
    touch-action: none;
}

.setting-select {
    width: min(100%, 280px);
    min-width: 0;
    justify-self: center;
    align-self: center;
    background: var(--carbon-black);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--bright-snow);
    font-family: var(--ff-body);
    font-size: var(--fs-body-sm);
    min-height: 34px;
    padding: 6px 10px;
    cursor: pointer;
}

.setting-toggle {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    justify-self: start;
}

.setting-audio-row {
    align-items: center;
}

.setting-audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.setting-audio-btn {
    min-height: 32px;
    min-width: 86px;
    padding: 0 14px;
    border: 1px solid rgba(77, 124, 255, 0.55);
    border-radius: 8px;
    background: rgba(77, 124, 255, 0.14);
    color: var(--bright-snow);
    font: 700 var(--fs-body-sm) var(--ff-body);
    cursor: pointer;
}

.setting-audio-btn:hover {
    background: rgba(77, 124, 255, 0.24);
}

.setting-audio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted-text);
    font-size: var(--fs-body-sm);
    font-weight: 700;
    cursor: pointer;
}

.setting-audio-toggle input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

.setting-track-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    justify-self: end;
}

.modal-footer {
    padding: 14px clamp(16px, 3dvw, 28px) 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.modal-footer .btn-primary {
    min-width: 112px;
    min-height: 44px;
    border-radius: 8px;
}

@media (max-width: 620px) {
    .stand-editor-overlay {
        align-items: stretch;
        padding: 10px;
    }

    .stand-editor {
        width: 100%;
        max-height: calc(100dvh - 20px);
        padding: 14px;
    }

    .stand-editor-header {
        gap: 8px;
    }

    .stand-editor-tabs {
        grid-template-columns: 1fr;
    }

    .stand-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stand-gamepass-row {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 7px;
    }

    .stand-gamepass-price {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }

    .stand-gamepass-move {
        min-width: 54px;
    }

    .stand-gamepass-up {
        grid-column: 3;
        grid-row: 1;
    }

    .stand-gamepass-down {
        grid-column: 3;
        grid-row: 2;
    }

    .stand-editor-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .modal-overlay {
        align-items: stretch;
        padding:
            max(10px, env(safe-area-inset-top))
            max(10px, env(safe-area-inset-right))
            max(10px, env(safe-area-inset-bottom))
            max(10px, env(safe-area-inset-left));
    }

    .modal {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 10px;
    }

    .modal-header {
        padding: 14px 14px 12px;
    }

    .modal-body {
        padding: 12px 14px;
        gap: 10px;
    }

    .setting-row {
        grid-template-columns: minmax(0, 1fr) minmax(46px, auto);
        gap: 10px 12px;
        min-height: 0;
        padding: 12px;
    }

    .setting-row input[type="range"],
    .setting-row .setting-select,
    .setting-row .setting-toggle {
        grid-column: 1 / -1;
    }

    .setting-row .setting-select {
        width: 100%;
        justify-self: stretch;
    }

    .setting-row .setting-value {
        grid-column: 2;
        grid-row: 1;
    }

    .setting-label {
        font-size: 0.88rem;
    }

    .setting-audio-controls {
        grid-column: 1 / -1;
        grid-row: auto;
        width: 100%;
    }

    .setting-audio-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .setting-audio-row .setting-label {
        flex: 0 0 auto;
    }

    .setting-audio-row .setting-audio-controls {
        flex: 0 0 auto;
    }

    .setting-row .setting-track-label {
        flex: 0 0 auto;
        justify-self: center;
        align-self: center;
        text-align: center;
        max-width: 100%;
    }

    .modal-footer {
        padding: 12px 14px 14px;
    }

    .modal-footer .btn-primary {
        width: 100%;
    }
}

@media (max-height: 560px) and (orientation: landscape) {
    .modal-overlay {
        align-items: stretch;
        padding:
            max(8px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
    }

    .modal {
        height: 100%;
        max-height: 100%;
    }

    .modal-header {
        padding-block: 10px;
    }

    .modal-body {
        padding-block: 10px;
        gap: 8px;
    }

    .setting-row {
        min-height: 44px;
        padding-block: 9px;
    }

    .modal-footer {
        padding-block: 10px;
    }
}

/*-----------------------------------*
  #RESPONSIVE
*-----------------------------------*/

@media (max-width: 768px) {
    .hud-controls-hint {
        display: none;
    }

    .game-hud-top {
        height: 48px;
        padding: 0 var(--space-md);
        gap: var(--space-sm);
    }

    .game-logo {
        order: 0;
        margin-right: 0;
        font-size: 18px;
        letter-spacing: 0;
    }

    .hud-world-name {
        display: none;
    }

    .hud-center {
        display: none;
    }

    .hud-right {
        order: 1;
        margin-left: auto;
        gap: 6px;
    }

    .hud-pill {
        padding: 4px 8px;
        font-size: 11px;
    }

    .hud-pill-label {
        display: none;
    }



    .chat-area,
    .is-embedded-world .chat-area {
        top: 56px;
        left: 10px;
        width: min(250px, calc(100dvw - 20px));
    }

    .chat-panel,
    .is-embedded-world .chat-panel {
        height: clamp(136px, 24dvh, 180px);
    }

    .chat-messages,
    .is-embedded-world .chat-messages {
        flex: 1 1 52px;
        gap: 3px;
    }

    .chat-msg {
        font-size: 10px;
        padding: 3px 7px;
    }

    .chat-input {
        min-height: 28px;
        padding: 5px 9px;
        font-size: 11px;
    }

    .chat-send-btn,
    .is-embedded-world .chat-send-btn {
        width: 30px;
        height: 28px;
        flex-basis: 30px;
    }

    .stand-prompt {
        bottom: 22px;
        max-width: calc(100dvw - 28px);
    }

    .stand-prompt-action {
        white-space: normal;
    }

    .stand-panel {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
        max-height: min(72dvh, 520px);
        transform: translateY(calc(100% + 24px));
    }

    .stand-panel.open {
        transform: translateY(0);
    }

    .stand-product-info {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .stand-product-name {
        white-space: normal;
    }

    .stand-products {
        padding: 6px;
    }

    .stand-product {
        min-height: 64px;
    }

    .voice-c.live .voice-c-strip {
        max-height: 160px;
    }
}





.chat-voice-btn {
    width: min(100%, 238px);
    min-height: 42px;
    position: relative;
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) 54px;
    align-items: center;
    gap: 9px;
    overflow: hidden;
    background: rgba(10, 10, 15, 0.74);
    color: var(--bright-snow);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 9px;
    text-align: left;
}

.voice-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

.voice-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-label,
.voice-substatus {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-label {
    color: var(--bright-snow);
    font-size: 12px;
    line-height: 1.1;
}

.voice-substatus {
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
    line-height: 1.1;
}

.voice-level-track {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
}

.voice-meter {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: #4ade80;
    opacity: 0.88;
    transition: width 80ms linear;
}

.chat-voice-btn.active,
.chat-voice-btn[data-voice-state="live"] {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(12, 28, 18, 0.76);
}

.chat-voice-btn.active .voice-status-dot,
.chat-voice-btn[data-voice-state="live"] .voice-status-dot {
    background: #4ade80;
    box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.12), 0 0 14px rgba(74, 222, 128, 0.5);
}

.chat-voice-btn[data-voice-state="connecting"] {
    border-color: rgba(79, 124, 255, 0.46);
}

.chat-voice-btn[data-voice-state="connecting"] .voice-status-dot {
    background: var(--primary);
    animation: voicePulse 1s ease-in-out infinite;
}

.chat-voice-btn.error,
.chat-voice-btn[data-voice-state="error"],
.chat-voice-btn[data-voice-state="unsupported"] {
    background: rgba(255, 79, 79, 0.16);
    border-color: rgba(255, 79, 79, 0.34);
    color: #ffb0b0;
}

.chat-voice-btn.error .voice-status-dot,
.chat-voice-btn[data-voice-state="error"] .voice-status-dot,
.chat-voice-btn[data-voice-state="unsupported"] .voice-status-dot {
    background: #ff7b7b;
    box-shadow: 0 0 0 4px rgba(255, 79, 79, 0.12);
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); opacity: 0.65; }
    50% { transform: scale(1.28); opacity: 1; }
}

@media (pointer: coarse) and (orientation: landscape), (max-width: 1024px) and (max-height: 520px) {
    .game-hud-top,
    .is-embedded-world .game-hud-top {
        height: 38px;
        padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
        gap: 8px;
    }

    .game-logo,
    .is-embedded-world .game-logo {
        font-size: clamp(14px, 2.4dvw, 18px);
        letter-spacing: 0;
    }

    .hud-center,
    .is-embedded-world .hud-center {
        display: flex;
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        margin: 0;
    }

    .hud-world-name,
    .is-embedded-world .hud-world-name {
        display: block;
        max-width: 28dvw;
        overflow: hidden;
        color: rgba(255, 255, 255, 0.7);
        font-size: 10px;
        letter-spacing: 2px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .hud-right,
    .is-embedded-world .hud-right {
        gap: 6px;
        margin-left: 0;
    }

    .hud-pill,
    .is-embedded-world .hud-pill {
        min-height: 28px;
        padding: 3px 8px;
        font-size: 11px;
    }

    .hud-pill-icon,
    .is-embedded-world .hud-pill-icon {
        font-size: 11px;
    }

    
    .is-embedded-world {
        width: 30px;
        height: 30px;
        border-radius: 7px;
        font-size: 13px;
    }

    .chat-area,
    .is-embedded-world .chat-area {
        top: 46px;
        left: max(8px, env(safe-area-inset-left));
        width: min(310px, 38dvw);
        gap: 5px;
    }

    .chat-panel,
    .is-embedded-world .chat-panel {
        height: clamp(140px, 24dvh, 178px);
        gap: 5px;
    }

    .chat-messages,
    .is-embedded-world .chat-messages {
        flex: 1 1 66px;
        gap: 2px;
        padding-top: 0;
    }

    .chat-msg,
    .is-embedded-world .chat-msg {
        gap: 4px;
        padding: 3px 7px;
        font-size: 10px;
        line-height: 1.25;
    }

    .chat-input-row,
    .is-embedded-world .chat-input-row {
        gap: 5px;
    }

    .chat-input,
    .is-embedded-world .chat-input {
        min-height: 26px;
        padding: 4px 9px;
        font-size: 11px;
    }

    .chat-send-btn,
    .is-embedded-world .chat-send-btn {
        width: 32px;
        height: 26px;
        flex: 0 0 32px;
        border-radius: 7px;
        font-size: 12px;
    }

    .chat-voice-btn,
    .is-embedded-world .chat-voice-btn {
        width: min(220px, 100%);
        min-height: 34px;
        grid-template-columns: 8px minmax(0, 1fr) 44px;
        gap: 7px;
        padding: 5px 7px;
        border-radius: 8px;
    }

    .voice-label,
    .is-embedded-world .voice-label {
        font-size: 10px;
    }

    .voice-substatus,
    .is-embedded-world .voice-substatus {
        font-size: 9px;
    }

    .voice-status-dot,
    .is-embedded-world .voice-status-dot {
        width: 8px;
        height: 8px;
    }

    .voice-level-track,
    .is-embedded-world .voice-level-track {
        height: 5px;
    }

    .hud-touch-hint {
        top: 46px;
        right: max(14px, env(safe-area-inset-right));
        max-width: min(390px, 48dvw);
        gap: 5px;
    }

    .touch-hint-pill {
        min-height: 24px;
        padding: 4px 8px;
        font-size: 10px;
    }

    .mobile-game-controls {
        gap: 12px;
        padding: 0 max(76px, calc(env(safe-area-inset-right) + 54px)) max(46px, calc(env(safe-area-inset-bottom) + 36px)) max(76px, calc(env(safe-area-inset-left) + 54px));
    }

    .mobile-joystick {
        width: 96px;
        height: 96px;
        flex-basis: 96px;
    }

    .mobile-joystick::before {
        inset: 22px;
    }

    .mobile-joystick-knob {
        width: 42px;
        height: 42px;
    }

    .mobile-jump {
        width: 54px;
        height: 54px;
        flex-basis: 54px;
        margin-bottom: 20px;
        font-size: 10px;
    }

    .stand-prompt {
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .stand-panel {
        top: 44px;
        right: max(8px, env(safe-area-inset-right));
        bottom: max(8px, env(safe-area-inset-bottom));
        left: auto;
        width: min(320px, calc(100dvw - 24px));
        max-height: calc(100dvh - 56px);
        transform: translateX(calc(100% + 24px));
    }

    .stand-panel.open {
        transform: translateX(0);
    }

    .voice-c.live .voice-c-strip {
        max-height: 80px;
    }
}

@media (pointer: coarse) and (orientation: landscape) and (max-height: 430px) {
    .game-hud-top,
    .is-embedded-world .game-hud-top {
        height: 34px;
    }

    .hud-world-name,
    .is-embedded-world .hud-world-name {
        display: none;
    }

    .chat-area,
    .is-embedded-world .chat-area {
        top: 42px;
        width: min(290px, 38dvw);
    }

    .chat-panel,
    .is-embedded-world .chat-panel {
        height: clamp(124px, 30dvh, 146px);
    }

    .chat-messages,
    .is-embedded-world .chat-messages {
        flex-basis: 52px;
    }

    .mobile-game-controls {
        padding: 0 max(62px, calc(env(safe-area-inset-right) + 46px)) max(34px, calc(env(safe-area-inset-bottom) + 28px)) max(62px, calc(env(safe-area-inset-left) + 46px));
    }

    .mobile-joystick {
        width: 84px;
        height: 84px;
        flex-basis: 84px;
    }

    .mobile-joystick::before {
        inset: 19px;
    }

    .mobile-joystick-knob {
        width: 36px;
        height: 36px;
    }

    .mobile-jump {
        width: 48px;
        height: 48px;
        flex-basis: 48px;
        margin-bottom: 16px;
    }

    .voice-c.live .voice-c-strip {
        max-height: 0;
        border-top-width: 0;
    }
}

