@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Fraunces:wght@600;700&display=swap");

:root {
  --ink: #1b1f21;
  --cloud: #f6f3ec;
  --panel: rgba(255, 251, 245, 0.9);
  --panel-border: rgba(27, 31, 33, 0.12);
  --accent: #ff8f4a;
  --accent-2: #1fa6a2;
  --accent-3: #f1c96a;
  --shadow: rgba(18, 23, 26, 0.15);
  --glow: rgba(255, 143, 74, 0.35);
  --mobile-toolbar-clearance: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background: radial-gradient(
    circle at top,
    #fff7e8 0%,
    #f0efe8 45%,
    #e6efe8 100%
  );
}

#app {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100vh;
  height: 100vh;
  height: 100dvh;
}

#scene {
  width: 100%;
  height: 100%;
  display: block;
}

#mode-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 32;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 251, 245, 0.92);
  border: 1px solid var(--panel-border);
  box-shadow: 0 10px 28px var(--shadow);
  backdrop-filter: blur(10px);
  animation: floatIn 0.55s ease-out;
}

.mode-hud-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mode-hud-emoji {
  font-size: 18px;
  line-height: 1;
}

.mode-hud-label {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

#mode-hud-clear {
  appearance: none;
  border: 1px solid rgba(27, 31, 33, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

#mode-hud-clear:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(18, 23, 26, 0.1);
}

#mode-hud-clear:disabled {
  opacity: 0.55;
  cursor: default;
}

#hud {
  position: absolute;
  top: 84px;
  left: 24px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 12px 30px var(--shadow);
  backdrop-filter: blur(8px);
  display: grid;
  gap: 10px;
  max-width: 280px;
  animation: floatIn 0.8s ease-out;
}

.brand {
  display: grid;
  gap: 4px;
}

.logo {
  font-family: "Fraunces", serif;
  font-size: 20px;
  letter-spacing: 0.5px;
}

.tag {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.6px;
  color: rgba(27, 31, 33, 0.55);
}

.controls {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: rgba(27, 31, 33, 0.7);
}

.status {
  display: grid;
  gap: 6px;
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 143, 74, 0.12);
  color: #b85a20;
  transition: all 0.2s ease;
}

.status-pill.active {
  background: rgba(31, 166, 162, 0.15);
  color: #0f6f6c;
  box-shadow: 0 0 0 1px rgba(31, 166, 162, 0.2);
}

#paint-indicator {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 143, 74, 0.12);
  color: #b85a20;
  transition: all 0.2s ease;
}

#paint-indicator.active {
  background: rgba(31, 166, 162, 0.15);
  color: #0f6f6c;
  box-shadow: 0 0 0 1px rgba(31, 166, 162, 0.2);
}

#brush-indicator {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 143, 74, 0.12);
  color: #b85a20;
  transition: all 0.2s ease;
  display: none;
}

#brush-indicator.active {
  background: rgba(31, 166, 162, 0.15);
  color: #0f6f6c;
  box-shadow: 0 0 0 1px rgba(31, 166, 162, 0.2);
}

#brush-indicator.flash {
  animation: brush-indicator-flash 0.45s ease-out;
}

@keyframes brush-indicator-flash {
  0% {
    background: rgba(255, 200, 60, 0.5);
    transform: scale(1.08);
  }
  100% {
    background: rgba(31, 166, 162, 0.15);
    transform: scale(1);
  }
}

#mode-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#mode-controls button {
  appearance: none;
  border: 1px solid rgba(27, 31, 33, 0.15);
  background: rgba(255, 255, 255, 0.9);
  color: #1b1f21;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 6px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  text-align: center;
}

#mode-controls button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(18, 23, 26, 0.12);
}

#mode-controls button.active {
  background: rgba(31, 166, 162, 0.18);
  color: #0f6f6c;
  box-shadow: 0 0 0 1px rgba(31, 166, 162, 0.25);
}

.mode-icon {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
}

.mode-icon svg {
  width: 14px;
  height: 14px;
}

.mode-key {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(27, 31, 33, 0.15);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(27, 31, 33, 0.7);
}

.mode-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#mode-controls button.active .mode-key {
  border-color: rgba(31, 166, 162, 0.4);
  color: #0f6f6c;
  background: rgba(31, 166, 162, 0.15);
}

#scene {
  position: fixed;
  top: 0;
  left: 0;
  outline: none;
}

#radial-menu {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 12;
}

#radial-menu.active {
  pointer-events: auto;
}

.radial-center {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed rgba(27, 31, 33, 0.2);
  box-shadow: 0 6px 14px rgba(18, 23, 26, 0.18);
  font-size: 10px;
  font-weight: 600;
  color: rgba(27, 31, 33, 0.7);
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.radial-option {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%) translate(var(--x), var(--y));
  background: rgba(255, 251, 245, 0.96);
  border: 1px solid rgba(27, 31, 33, 0.12);
  color: #1b1f21;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(18, 23, 26, 0.2);
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.radial-option:hover {
  transform: translate(-50%, -50%) translate(var(--x), var(--y)) scale(1.05);
  box-shadow: 0 14px 32px rgba(18, 23, 26, 0.25);
}

#pickup-toast,
#status-toast {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 251, 245, 0.98);
  color: #1b1f21;
  border: 1px solid rgba(27, 31, 33, 0.15);
  box-shadow: 0 12px 30px rgba(18, 23, 26, 0.25);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 40;
  max-width: min(420px, 80vw);
  text-align: center;
  line-height: 1.3;
}

#pickup-toast {
  bottom: calc(120px + var(--mobile-toolbar-clearance));
}

#status-toast {
  bottom: calc(168px + var(--mobile-toolbar-clearance));
}

#pickup-toast.active,
#status-toast.active {
  opacity: 1;
  transform: translate(-50%, 0);
}

#hud[hidden],
#tweakpane[hidden] {
  display: none !important;
}

#user-toolbar-root {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

#user-toolbar-root .ut-shell,
#user-toolbar-root .ut-panel-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#user-toolbar-root .ut-dock,
#user-toolbar-root .ut-panel {
  pointer-events: auto;
}

.ut-shell.is-desktop .ut-dock {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(255, 251, 245, 0.92);
  border: 1px solid rgba(27, 31, 33, 0.12);
  box-shadow: 0 18px 38px rgba(18, 23, 26, 0.18);
  backdrop-filter: blur(14px);
}

.ut-shell.is-desktop .ut-panel {
  position: absolute;
  left: 50%;
  bottom: 106px;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 420px));
}

.ut-shell.is-desktop[data-sheet-state="collapsed"] .ut-panel {
  height: min(40vh, 360px);
}

.ut-shell.is-desktop[data-sheet-state="half"] .ut-panel {
  height: min(62vh, 560px);
}

.ut-shell.is-desktop[data-sheet-state="full"] .ut-panel {
  height: min(80vh, 760px);
}

.ut-shell.is-mobile .ut-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.96);
  border: 1px solid rgba(27, 31, 33, 0.12);
  box-shadow: 0 18px 36px rgba(18, 23, 26, 0.2);
  backdrop-filter: blur(16px);
}

.ut-shell.is-mobile .ut-panel {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-toolbar-clearance));
  height: min(56dvh, 440px);
}

.ut-shell.is-mobile[data-sheet-state="collapsed"] .ut-panel {
  height: min(34dvh, 280px);
}

.ut-shell.is-mobile[data-sheet-state="half"] .ut-panel {
  height: min(56dvh, 440px);
}

.ut-shell.is-mobile[data-sheet-state="full"] .ut-panel {
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--mobile-toolbar-clearance));
  height: auto;
}

.ut-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(31, 166, 162, 0.12), transparent 40%),
    rgba(255, 251, 245, 0.96);
  border: 1px solid rgba(27, 31, 33, 0.12);
  box-shadow: 0 20px 48px rgba(18, 23, 26, 0.2);
  overflow: hidden;
  backdrop-filter: blur(16px);
}

.ut-panel-scroll {
  overflow-y: auto;
  padding: 8px 16px 18px;
  overscroll-behavior: contain;
}

.ut-sheet-handle {
  width: 48px;
  height: 6px;
  margin: 12px auto 0;
  border: 0;
  border-radius: 999px;
  background: rgba(27, 31, 33, 0.18);
}

.ut-shell.is-desktop .ut-sheet-handle {
  opacity: 0;
  pointer-events: none;
  margin-top: 0;
  height: 0;
}

.ut-dock-button,
.ut-primary-button,
.ut-secondary-button,
.ut-chip,
.ut-subtab,
.ut-card,
.ut-pattern-card,
.ut-icon-button,
.ut-segmented-option,
.ut-asset-card,
.ut-toggle-row {
  appearance: none;
  border: 1px solid rgba(27, 31, 33, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.ut-dock-button:hover,
.ut-primary-button:hover,
.ut-secondary-button:hover,
.ut-chip:hover,
.ut-subtab:hover,
.ut-card:hover,
.ut-pattern-card:hover,
.ut-icon-button:hover,
.ut-segmented-option:hover,
.ut-asset-card:hover,
.ut-toggle-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(18, 23, 26, 0.1);
}

.ut-dock-button.is-active,
.ut-chip.is-active,
.ut-subtab.is-active,
.ut-card.is-active,
.ut-pattern-card.is-active,
.ut-segmented-option.is-active,
.ut-asset-card.is-active {
  background: rgba(31, 166, 162, 0.14);
  border-color: rgba(31, 166, 162, 0.35);
  color: #0f6f6c;
  box-shadow: 0 0 0 1px rgba(31, 166, 162, 0.18);
}

.ut-dock-button {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 60px;
  padding: 8px 6px;
  border-radius: 18px;
  text-align: center;
}

.ut-dock-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 143, 74, 0.12);
  font-weight: 700;
}

.ut-dock-label {
  font-size: 11px;
  font-weight: 700;
}

.ut-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 16px;
}

.ut-panel-heading {
  display: grid;
  gap: 4px;
}

.ut-panel-heading h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 24px;
}

.ut-panel-mode {
  font-size: 12px;
  color: rgba(27, 31, 33, 0.56);
}

.ut-panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ut-icon-button,
.ut-primary-button,
.ut-secondary-button,
.ut-subtab,
.ut-chip,
.ut-segmented-option {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 14px;
}

.ut-icon-button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.ut-primary-button {
  background: linear-gradient(135deg, rgba(255, 143, 74, 0.95), rgba(241, 201, 106, 0.92));
}

.ut-secondary-button {
  background: rgba(255, 255, 255, 0.86);
}

.ut-section,
.ut-slider,
.ut-toggle-row,
.ut-advanced {
  margin-top: 14px;
}

.ut-section-title {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(27, 31, 33, 0.5);
}

.ut-quick-row,
.ut-chip-row,
.ut-subtabs,
.ut-segmented,
.ut-panel-actions {
  display: flex;
  flex-wrap: wrap;
}

.ut-quick-row {
  gap: 10px;
}

.ut-quick-row--spread > * {
  flex: 1 1 120px;
}

.ut-chip-row,
.ut-subtabs,
.ut-segmented {
  gap: 8px;
}

.ut-chip--compact {
  padding-inline: 12px;
}

.ut-slider {
  display: grid;
  gap: 10px;
}

.ut-slider-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}

.ut-slider-value {
  color: rgba(27, 31, 33, 0.56);
}

.ut-slider input[type="range"] {
  width: 100%;
  accent-color: var(--accent-2);
}

.ut-toggle-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 18px;
  padding: 12px 14px;
}

.ut-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(27, 31, 33, 0.16);
}

.ut-toggle.is-active {
  background: rgba(31, 166, 162, 0.45);
}

.ut-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.18s ease;
}

.ut-toggle.is-active .ut-toggle-knob {
  transform: translateX(18px);
}

.ut-card-grid,
.ut-asset-grid,
.ut-pattern-grid {
  display: grid;
  gap: 10px;
}

.ut-card-grid,
.ut-pattern-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.ut-asset-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding-right: 2px;
}

.ut-card,
.ut-pattern-card,
.ut-asset-card {
  border-radius: 18px;
  padding: 14px;
  text-align: left;
}

.ut-card strong,
.ut-pattern-card strong,
.ut-asset-card strong {
  display: block;
  font-size: 13px;
}

.ut-card span,
.ut-asset-card span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(27, 31, 33, 0.58);
}

.ut-pattern-thumb {
  width: 100%;
  aspect-ratio: 1.8;
  margin-bottom: 10px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(31, 166, 162, 0.26), transparent 45%),
    linear-gradient(135deg, rgba(255, 143, 74, 0.16), rgba(31, 166, 162, 0.12));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(27, 31, 33, 0.64);
}

.ut-search-wrap {
  margin-bottom: 10px;
}

.ut-search {
  width: 100%;
  border: 1px solid rgba(27, 31, 33, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  font: inherit;
  background: rgba(255, 255, 255, 0.88);
}

.ut-advanced {
  border: 1px solid rgba(27, 31, 33, 0.1);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.64);
}

.ut-advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}

.ut-advanced-body {
  display: none;
  padding: 0 16px 16px;
}

.ut-advanced.is-open .ut-advanced-body {
  display: block;
}

.ut-caption,
.ut-footer-hint {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(27, 31, 33, 0.58);
}

#tweakpane {
  position: fixed;
  --tweakpane-margin: 24px;
  --tweakpane-bottom-gap: 24px;
  top: calc(var(--tweakpane-margin) + env(safe-area-inset-top, 0px));
  right: var(--tweakpane-margin);
  min-width: 280px;
  z-index: 10;
  height: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: none;
  max-height: calc(
    100vh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) -
      var(--tweakpane-bottom-gap)
  );
  max-height: calc(
    100dvh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) -
      var(--tweakpane-bottom-gap)
  );
  --tp-base-background-color: rgba(255, 251, 245, 0.88);
  --tp-base-shadow-color: rgba(15, 20, 24, 0.18);
  --tp-button-background-color: rgba(255, 143, 74, 0.85);
  --tp-button-background-color-hover: rgba(255, 143, 74, 1);
  --tp-button-background-color-active: rgba(219, 116, 55, 1);
  --tp-button-foreground-color: #1b1f21;
  --tp-container-background-color: rgba(255, 251, 245, 0.96);
  --tp-container-background-color-hover: rgba(255, 255, 255, 1);
  --tp-input-background-color: rgba(255, 255, 255, 0.9);
  --tp-input-border-color: rgba(27, 31, 33, 0.15);
  --tp-input-foreground-color: #1b1f21;
  --tp-label-foreground-color: rgba(27, 31, 33, 0.75);
  --tp-font-family: "Space Grotesk", sans-serif;
  --tp-base-radius: 12px;
  --tp-blade-spacing: 8px;
}

/* Tweakpane UI Contrast Fixes */
#tweakpane .tp-lblv_v input:disabled,
#tweakpane .tp-lblv_v input[readonly],
#tweakpane .tp-monv_v {
  color: #1b1f21 !important;
  opacity: 1 !important;
  font-weight: 600 !important;
}

#tweakpane .tp-lblv_v input:disabled {
  background-color: rgba(255, 255, 255, 0.95) !important;
}

#tweakpane .tp-rotv {
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

#tweakpane .tp-rotv_t,
#tweakpane .tp-rotv_c {
  pointer-events: auto;
}

#tweakpane .tp-rotv_c {
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 45px var(--shadow);
  flex: 0 1 auto;
  min-height: 0;
  max-height: calc(
    100vh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) -
      var(--tweakpane-bottom-gap) - 56px
  );
  max-height: calc(
    100dvh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) -
      var(--tweakpane-bottom-gap) - 56px
  );
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

#joystick {
  position: fixed;
  left: calc(var(--joystick-safe-left, 24px) + env(safe-area-inset-left, 0px));
  bottom: calc(
    var(--joystick-safe-bottom, 24px) + env(safe-area-inset-bottom, 0px)
  );
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 251, 245, 0.75);
  border: 1px solid rgba(27, 31, 33, 0.15);
  box-shadow: 0 12px 25px var(--shadow);
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  z-index: 25;
}

#joystick-stick {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  box-shadow: 0 6px 15px var(--glow);
  transform: translate3d(0, 0, 0);
  transition: transform 0.08s ease-out;
}

#action-jump {
  position: fixed;
  right: calc(var(--jump-safe-right, 24px) + env(safe-area-inset-right, 0px));
  bottom: calc(
    var(--jump-safe-bottom, 24px) + env(safe-area-inset-bottom, 0px)
  );
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(27, 31, 33, 0.15);
  background: rgba(255, 251, 245, 0.75);
  box-shadow: 0 12px 25px var(--shadow);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  z-index: 25;
  transition: transform 0.1s ease-out, background 0.15s ease;
}

#action-jump:active {
  transform: scale(0.9);
  background: rgba(255, 251, 245, 0.9);
}

#action-jump svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  transition: transform 0.25s ease;
}

#action-jump.action-jump--dive svg {
  transform: rotate(180deg);
}

body.joystick-dragging,
body.joystick-dragging * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
}

@media (max-width: 900px) {
  #mode-hud {
    top: 12px;
    left: 12px;
  }

  #hud {
    top: 72px;
    left: 16px;
    max-width: 220px;
  }

  #tweakpane {
    --tweakpane-margin: 12px;
    --tweakpane-bottom-gap: 12px;
    top: calc(var(--tweakpane-margin) + env(safe-area-inset-top, 0px));
    right: var(--tweakpane-margin);
    min-width: 240px;
  }

  #joystick {
    --joystick-safe-left: 16px;
    --joystick-safe-bottom: 16px;
  }
}

@media (max-width: 700px) {
  #hud {
    display: none;
  }

  #mode-hud {
    gap: 8px;
    padding: 9px 10px;
  }

  .mode-hud-label {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #mode-hud-clear {
    padding: 7px 9px;
    font-size: 11px;
  }

  #tweakpane {
    --tweakpane-margin: 8px;
    --tweakpane-bottom-gap: 8px;
    top: calc(var(--tweakpane-margin) + env(safe-area-inset-top, 0px));
    right: var(--tweakpane-margin);
    bottom: 0;
    height: auto;
    max-height: calc(
      100svh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) - 2px
    );
    max-height: calc(
      100dvh - var(--tweakpane-margin) - env(safe-area-inset-top, 0px) - 2px
    );
  }

  #pickup-toast,
  #status-toast {
    max-width: min(320px, calc(100vw - 24px));
    font-size: 12px;
  }
}

@media (max-width: 1023px) {
  #tweakpane {
    z-index: 24;
  }

  .ut-panel-heading h2 {
    font-size: 22px;
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
