html,
body {
  margin: 0;
  min-height: 100%;
  background: #07070d;
  color: #f6f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow: hidden;
}

.battle-mode {
  background:
    radial-gradient(circle at 18% 24%, rgba(70, 216, 255, 0.16), transparent 34%),
    radial-gradient(circle at 82% 70%, rgba(255, 79, 154, 0.14), transparent 36%),
    #040814;
}

.battle-mode .preview-pane {
  isolation: isolate;
}

.battle-mode .preview-pane::before {
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 22px;
  background: linear-gradient(145deg, #46d8ff, #ff4f9a 45%, #ffe12e 70%, #7cff4f);
  box-shadow:
    0 0 28px rgba(70, 216, 255, 0.26),
    0 0 52px rgba(255, 79, 154, 0.18);
  content: "";
}

.battle-mode canvas {
  border: 3px solid #071225;
  background: #071225;
  cursor: default;
}

.battle-mode .editor {
  border-color: rgba(70, 216, 255, 0.3);
  background:
    linear-gradient(180deg, rgba(10, 22, 43, 0.98), rgba(7, 10, 24, 0.99));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 22px 70px rgba(0, 0, 0, 0.42),
    0 0 36px rgba(70, 216, 255, 0.08);
}

.battle-mode .editor h1,
.battle-mode .editor h2 {
  color: #ffe12e;
}

.battle-mode .editor-card {
  border-color: rgba(124, 255, 79, 0.2);
  background: linear-gradient(145deg, rgba(70, 216, 255, 0.07), rgba(255, 79, 154, 0.06));
}

.battle-mode input[type="range"] {
  accent-color: #7cff4f;
}

.battle-mode .playback-readout,
.battle-mode .canvas-tool-readout {
  color: #7cff4f;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, calc(100vh * 9 / 16)) minmax(360px, 440px);
  gap: 18px;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  padding: 18px;
}

.preview-pane {
  position: relative;
  width: min(calc(100vw - 500px), calc(100vh * 9 / 16));
  max-width: calc(100vh * 9 / 16);
  height: min(calc(100vh - 36px), calc((100vw - 500px) * 16 / 9));
  max-height: calc(100vh - 36px);
  margin: auto;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.canvas-toolbar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: grid;
  gap: 8px;
  pointer-events: none;
  z-index: 3;
}

.canvas-tool-readout,
.canvas-tool-strip {
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(11, 15, 27, 0.82);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.30);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.canvas-tool-readout {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: #ffdf65;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
}

.canvas-tool-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 7px;
  scrollbar-width: none;
}

.canvas-tool-strip::-webkit-scrollbar {
  display: none;
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100vh - 36px);
  box-sizing: border-box;
  padding: 16px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(25, 28, 43, 0.96), rgba(13, 16, 27, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 22px 70px rgba(0, 0, 0, 0.34);
}

.editor[hidden],
.render-mode .editor {
  display: none;
}

.mobile-shell {
  display: none;
}

.render-mode .workspace {
  display: grid;
  place-items: center;
  padding: 0;
}

.render-mode .preview-pane {
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
}

.render-mode canvas {
  border-radius: 0;
  box-shadow: none;
}

.render-mode.battle-mode .preview-pane::before {
  display: none;
}

.render-mode.battle-mode canvas {
  border: 0;
}

.editor h1,
.editor h2 {
  margin: 0;
  line-height: 1.08;
}

.editor h1 {
  font-size: 22px;
}

.editor h2 {
  font-size: 14px;
  color: #cfd6ec;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.editor p {
  margin: 0;
  color: #aeb7d1;
  font-size: 13px;
  line-height: 1.48;
}

.editor-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.playback-card {
  border-color: rgba(255, 223, 101, 0.26);
  background: linear-gradient(180deg, rgba(255, 223, 101, 0.11), rgba(255, 255, 255, 0.055));
}

.timeline-control {
  display: grid;
  gap: 7px;
  color: #cfd6ec;
  font-size: 12px;
}

input[type="range"] {
  accent-color: #ffdf65;
  padding-inline: 0;
}

.playback-readout {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  width: fit-content;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: #ffdf65;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
}

.sticky-tools {
  position: sticky;
  top: -16px;
  z-index: 2;
  border-color: rgba(255, 223, 101, 0.28);
  background: rgba(30, 35, 55, 0.98);
}

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

.tool-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 58px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.10);
  color: #f6f7fb;
  padding: 8px 6px;
  line-height: 1;
}

.tool-button.active {
  border-color: rgba(255, 223, 101, 0.82);
  background: #ffdf65;
  color: #111827;
  box-shadow: 0 0 0 3px rgba(255, 223, 101, 0.14);
}

.tool-button.compact {
  flex: 0 0 auto;
  min-width: 56px;
  min-height: 50px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
}

.tool-icon {
  font-size: 21px;
  font-weight: 1000;
  line-height: 1;
}

.tool-label {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.fallback-tool-select {
  opacity: 0.72;
}

.tool-settings {
  display: grid;
  gap: 8px;
}

.tool-settings summary {
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: #cfd6ec;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.compact-row {
  margin-top: 8px;
}

.row,
.button-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.row label {
  display: grid;
  gap: 5px;
  flex: 1 1 120px;
  color: #cfd6ec;
  font-size: 12px;
}

.mobile-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mobile-sheet-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #cfd6ec;
  font-size: 12px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: #f6f7fb;
  padding: 8px 10px;
}

input[type="color"] {
  min-height: 37px;
  padding: 3px;
}

textarea {
  min-height: 190px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

button {
  border: 0;
  border-radius: 999px;
  background: #3949ab;
  color: #ffffff;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: rgba(255, 255, 255, 0.12);
}

button.danger {
  background: #e53935;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 5px;
}

.swatch {
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
}

.point-list,
.entity-list,
.object-editor {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
}

.object-editor {
  max-height: 360px;
}

.point-row,
.entity-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 42px;
  gap: 6px;
  align-items: center;
}

.battle-fighter-summary {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--fighter-color, #46d8ff);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.battle-fighter-summary span,
.battle-fighter-summary small {
  color: #aebbd7;
}

.battle-library-hero {
  overflow: hidden;
  border-color: rgba(70, 216, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(70, 216, 255, 0.12), transparent 48%),
    linear-gradient(225deg, rgba(255, 79, 154, 0.1), transparent 52%),
    rgba(255, 255, 255, 0.04);
}

.battle-picker-card {
  border-color: rgba(255, 225, 46, 0.28);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 225, 46, 0.1), transparent 42%),
    rgba(255, 255, 255, 0.045);
}

.battle-picker-title,
.roster-world > header,
.roster-card-head,
.battle-roster-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.battle-picker-title > div {
  display: grid;
  gap: 3px;
}

.live-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(124, 255, 79, 0.38);
  border-radius: 999px;
  background: rgba(124, 255, 79, 0.1);
  color: #8dff63;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.08em;
}

.fighter-slot-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}

.fighter-slot {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--fighter-color, #46d8ff) 48%, transparent);
  border-radius: 14px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--fighter-color, #46d8ff) 14%, transparent), rgba(2, 7, 18, 0.76));
}

.fighter-slot-avatar,
.roster-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--fighter-color, #46d8ff);
  border-radius: 50%;
  background: rgba(3, 8, 18, 0.9);
  box-shadow: 0 0 18px color-mix(in srgb, var(--fighter-color, #46d8ff) 44%, transparent);
  color: var(--fighter-color, #46d8ff);
  font-weight: 1000;
}

img.fighter-slot-avatar,
img.roster-avatar {
  display: block;
  object-fit: cover;
  object-position: center 24%;
}

.procedural-avatar {
  overflow: hidden;
  padding: 0;
}

.procedural-avatar svg {
  display: block;
  width: 100%;
  height: 100%;
}

.fighter-slot-avatar {
  width: 38px;
  height: 38px;
  font-size: 17px;
}

.fighter-slot > div:not(.fighter-slot-avatar) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.fighter-slot span,
.fighter-slot small {
  overflow: hidden;
  color: #aebbd7;
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-slot strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-slot p {
  grid-column: 1 / -1;
  overflow: hidden;
  color: color-mix(in srgb, var(--fighter-color, #46d8ff) 75%, white);
  font-size: 9px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fighter-slot-vs {
  color: #ffe12e;
  font-size: 13px;
  font-style: italic;
  font-weight: 1000;
  text-align: center;
}

.battle-select-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.battle-select-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #9eb0cc;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.battle-load-actions button:first-child {
  flex: 1 1 150px;
  background: linear-gradient(90deg, #168fe8, #704dff);
  box-shadow: 0 8px 24px rgba(48, 134, 255, 0.22);
}

.battle-roster-card {
  display: block;
}

.battle-roster-card summary {
  cursor: pointer;
  list-style: none;
}

.battle-roster-card summary::-webkit-details-marker {
  display: none;
}

.battle-roster-card summary span {
  color: #ffe12e;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.battle-roster-card summary small {
  color: #8e9bb4;
  font-size: 10px;
}

.battle-roster {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.roster-world {
  display: grid;
  gap: 8px;
}

.roster-world > header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
}

.roster-world > header strong {
  color: #dfe7f7;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.roster-world > header span {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #98a7c0;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 900;
}

.roster-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.roster-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.035);
  padding: 9px;
}

.roster-card.selected {
  border-color: color-mix(in srgb, var(--fighter-color, #46d8ff) 58%, transparent);
  background: color-mix(in srgb, var(--fighter-color, #46d8ff) 10%, transparent);
}

.roster-card-head {
  justify-content: flex-start;
}

.roster-avatar {
  width: 31px;
  height: 31px;
  font-size: 13px;
}

.roster-card-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.roster-card strong,
.roster-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-card strong {
  color: #f7f9ff;
  font-size: 11px;
}

.roster-card small,
.roster-card p {
  color: #8f9db6;
  font-size: 9px;
}

.roster-card p {
  min-height: 2.6em;
  line-height: 1.3;
}

.roster-pick-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.roster-pick-row button {
  min-width: 0;
  padding: 6px 5px;
  font-size: 9px;
}

.entity-row {
  grid-template-columns: 34px 52px 1fr 1fr;
}

.point-row button {
  min-width: 0;
  padding-inline: 0;
}

.selected-point {
  outline: 2px solid #ffdf65;
  outline-offset: 2px;
}

.selected-editor {
  border-color: rgba(255, 223, 101, 0.34);
  background: rgba(255, 223, 101, 0.075);
}

.selected-label {
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 223, 101, 0.14);
  color: #ffdf65;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}

.candidate-editor {
  border-color: rgba(255, 223, 101, 0.30);
  background: linear-gradient(180deg, rgba(255, 223, 101, 0.10), rgba(255, 255, 255, 0.055));
}

.candidate-controls {
  display: grid;
  gap: 9px;
}

.candidate-list {
  display: grid;
  gap: 9px;
  max-height: 360px;
  overflow: auto;
}

.director-summary {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(255, 223, 101, 0.18);
  border-radius: 14px;
  background: rgba(255, 223, 101, 0.08);
  padding: 9px 10px;
}

.director-summary strong {
  color: #ffdf65;
  font-size: 12px;
}

.director-summary span,
.director-summary p {
  color: #cfd6ec;
  font-size: 11px;
}

.candidate-card,
.approved-row {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  padding: 10px;
}

.candidate-card.active {
  border-color: rgba(255, 223, 101, 0.70);
  box-shadow: 0 0 0 2px rgba(255, 223, 101, 0.13);
}

.candidate-card.portfolio-pick {
  border-color: rgba(36, 223, 120, 0.52);
  background: linear-gradient(180deg, rgba(36, 223, 120, 0.10), rgba(0, 0, 0, 0.18));
}

.candidate-card > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.candidate-card strong {
  color: #f6f7fb;
  font-size: 13px;
}

.candidate-card span,
.approved-row small {
  color: #aeb7d1;
  font-size: 11px;
}

.candidate-card p {
  font-size: 11px;
}

.candidate-score {
  width: fit-content;
  border-radius: 999px;
  background: rgba(255, 223, 101, 0.16);
  color: #ffdf65;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 1000;
}

.grade-a {
  background: rgba(36, 223, 120, 0.18);
  color: #72ffad;
}

.grade-b {
  background: rgba(255, 223, 101, 0.18);
  color: #ffdf65;
}

.grade-c,
.grade-d {
  background: rgba(255, 109, 109, 0.16);
  color: #ff9a9a;
}

.approved-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  color: #f6f7fb;
  font-size: 12px;
}

.object-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.object-row.selected-object {
  border-color: rgba(255, 223, 101, 0.62);
  box-shadow: 0 0 0 2px rgba(255, 223, 101, 0.12);
}

.object-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #f6f7fb;
  font-size: 12px;
}

.object-title button {
  padding: 5px 8px;
  font-size: 11px;
}

.mini-actions {
  gap: 5px;
  justify-content: flex-end;
}

.object-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.object-grid label {
  display: grid;
  gap: 4px;
  color: #cfd6ec;
  font-size: 11px;
}

.status {
  min-height: 18px;
  color: #ffdf65;
  font-size: 12px;
}

@media (max-width: 980px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .workspace {
    grid-template-columns: 1fr;
    place-items: center;
    width: 100vw;
    height: 100dvh;
    min-height: 0;
    gap: 0;
    padding: 8px;
    overflow: hidden;
  }

  .preview-pane {
    width: min(calc(100vw - 16px), calc((100dvh - 16px) * 9 / 16));
    height: min(calc(100dvh - 16px), calc((100vw - 16px) * 16 / 9));
    aspect-ratio: 9 / 16;
  }

  canvas {
    border-radius: 14px;
  }

  .editor {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    height: auto;
    max-height: none;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  .editor > .editor-card:not(.sticky-tools) {
    display: none;
  }

  .mobile-shell {
    position: fixed;
    inset: 0;
    z-index: 21;
    display: block;
    pointer-events: none;
  }

  .mobile-topbar {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(11, 15, 27, 0.68);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
    backdrop-filter: blur(14px);
    padding: 8px 10px;
    pointer-events: none;
  }

  .mobile-topbar strong {
    display: block;
    color: #ffdf65;
    font-size: 13px;
    line-height: 1;
  }

  .mobile-topbar span {
    display: block;
    margin-top: 3px;
    max-width: 50vw;
    overflow: hidden;
    color: #dfe5f5;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-selected-pill {
    max-width: 42vw;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 223, 101, 0.14);
    color: #ffdf65;
    padding: 6px 9px;
    font-size: 11px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-panel-dock {
    position: fixed;
    right: 10px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 84px);
    left: 10px;
    z-index: 33;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    pointer-events: auto;
  }

  .mobile-panel-button {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 48px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(11, 15, 27, 0.82);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(14px);
    color: #f6f7fb;
    padding: 6px 4px;
    font-size: 10px;
  }

  .mobile-panel-button span:first-child {
    font-size: 18px;
    line-height: 1;
  }

  .mobile-panel-button.active {
    background: #ffdf65;
    color: #111827;
  }

  .mobile-sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 34;
    background: rgba(0, 0, 0, 0.38);
    pointer-events: auto;
  }

  .mobile-sheet {
    position: fixed;
    right: 8px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 84px);
    left: 8px;
    z-index: 35;
    display: grid;
    gap: 10px;
    max-height: min(48dvh, 390px);
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(28, 32, 49, 0.98), rgba(12, 15, 27, 0.99));
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
    padding: 12px;
    pointer-events: auto;
  }

  .mobile-sheet header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-sheet header strong {
    color: #ffdf65;
    font-size: 14px;
  }

  .mobile-sheet header button {
    padding: 6px 10px;
    font-size: 12px;
  }

  .mobile-sheet-body {
    display: grid;
    gap: 9px;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  .mobile-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-sheet-grid label,
  .mobile-sheet-body .row label {
    display: grid;
    gap: 5px;
    min-width: 0;
    color: #cfd6ec;
    font-size: 11px;
    font-weight: 800;
  }

  .mobile-sheet input,
  .mobile-sheet select {
    min-height: 36px;
    border-radius: 10px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .mobile-sheet .button-row {
    gap: 7px;
  }

  .mobile-sheet button {
    padding: 7px 10px;
    font-size: 12px;
  }

  .mobile-preset-row {
    max-height: 84px;
    overflow: auto;
  }

  .mobile-candidate-list {
    max-height: 238px;
  }

  .mobile-candidate-list .candidate-card {
    gap: 7px;
    padding: 9px;
  }

  .mobile-candidate-list .candidate-card .button-row {
    flex-wrap: nowrap;
  }

  .mobile-candidate-list .candidate-card button {
    flex: 1 1 0;
  }

  .mobile-swatches {
    grid-template-columns: repeat(11, minmax(0, 1fr));
  }

  .mobile-swatches .swatch {
    height: 22px;
    border-radius: 6px;
  }

  .mobile-entity-list {
    max-height: 118px;
    overflow: auto;
  }

  .mobile-tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sticky-tools {
    position: fixed;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    top: auto;
    z-index: 20;
    max-height: 78px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    padding: 8px;
    border-radius: 18px;
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
    pointer-events: auto;
  }

  .sticky-tools h2,
  .sticky-tools p,
  .sticky-tools .row,
  .sticky-tools .tool-settings {
    display: none;
  }

  .tool-grid {
    display: flex;
    flex: 1 1 auto;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .tool-grid::-webkit-scrollbar {
    display: none;
  }

  .tool-button {
    flex: 0 0 58px;
    min-height: 58px;
    border-radius: 16px;
  }

  .tool-button .tool-icon {
    font-size: 22px;
  }

  .tool-button .tool-label {
    font-size: 10px;
  }

  .canvas-toolbar {
    right: 8px;
    bottom: 8px;
    left: 8px;
  }

  .canvas-tool-strip {
    display: none;
  }

  .canvas-tool-readout {
    font-size: 11px;
    padding: 6px 9px;
  }
}
