:root {
  color-scheme: dark;
  --bg: #080b0a;
  --panel: rgba(18, 23, 21, 0.78);
  --panel-solid: #121715;
  --panel-strong: rgba(24, 31, 28, 0.94);
  --line: rgba(226, 239, 232, 0.11);
  --line-strong: rgba(226, 239, 232, 0.19);
  --text: #f2f5f0;
  --muted: #98a39d;
  --muted-2: #68736d;
  --accent: #95f0b2;
  --accent-strong: #b7ffc9;
  --accent-dark: #183e27;
  --danger: #ff8e86;
  --warning: #f0c979;
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --topbar-height: 64px;
  font-family: Inter, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: var(--app-height, 100%);
  min-height: -webkit-fill-available;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.app {
  position: relative;
  width: 100%;
  height: var(--app-height, 100%);
  min-height: -webkit-fill-available;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 42%, rgba(38, 56, 47, 0.18), transparent 44%),
    linear-gradient(145deg, #0c100e 0%, #070908 62%, #0b0f0d 100%);
}

#viewport {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 600ms ease;
  touch-action: none;
}

#viewport.inspect-mode {
  cursor: crosshair;
}

.app.has-structure #viewport {
  opacity: 1;
}

.ambient {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

.ambient-a {
  width: 38vw;
  height: 38vw;
  left: -13vw;
  top: -15vw;
  background: rgba(57, 143, 91, 0.11);
}

.ambient-b {
  width: 30vw;
  height: 30vw;
  right: -12vw;
  bottom: -15vw;
  background: rgba(82, 122, 107, 0.08);
}

.noise {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.glass-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(22px) saturate(125%);
  -webkit-backdrop-filter: blur(22px) saturate(125%);
}

.topbar {
  position: fixed;
  z-index: 30;
  top: 14px;
  left: 16px;
  right: 16px;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 10px 0 16px;
  border-radius: 16px;
}

.brand {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  transform: rotate(30deg) skewY(-7deg);
}

.brand-mark span {
  position: absolute;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--accent);
  background: rgba(149, 240, 178, 0.07);
}

.brand-mark span:nth-child(1) {
  transform: translate(-5px, 4px);
}

.brand-mark span:nth-child(2) {
  transform: translate(5px, -4px);
}

.brand-mark span:nth-child(3) {
  width: 8px;
  height: 8px;
  border-color: var(--accent-strong);
  background: var(--accent);
  box-shadow: 0 0 18px rgba(149, 240, 178, 0.52);
}

.brand-copy {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.brand-copy strong {
  font-size: 18px;
  font-weight: 640;
  letter-spacing: 0.08em;
}

.brand-copy small,
.section-kicker {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.live-state {
  min-width: 150px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(240, 201, 121, 0.08);
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(149, 240, 178, 0.08), 0 0 12px rgba(149, 240, 178, 0.36);
}

.status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 142, 134, 0.08);
}

.format-badge {
  margin-left: 3px;
  padding: 4px 7px;
  border: 1px solid rgba(149, 240, 178, 0.18);
  border-radius: 6px;
  color: var(--accent);
  background: rgba(149, 240, 178, 0.065);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-button,
.primary-button,
.icon-button,
.tool-button,
.mini-button {
  border: 0;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.text-button {
  height: 38px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.text-button:hover {
  color: var(--text);
}

.primary-button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
  border-radius: 11px;
  color: #0b160f;
  background: var(--accent);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 7px 24px rgba(104, 226, 143, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

.primary-button svg,
.text-button svg,
.icon-button svg,
.tool-button svg,
.trust-row svg,
.drop-zone svg,
.drop-overlay svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.empty-state {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: clamp(44px, 8.4vw, 142px);
  width: min(590px, calc(100vw - 88px));
  transform: translateY(-44%);
  transition: opacity 360ms ease, transform 480ms cubic-bezier(0.2, 0.75, 0.25, 1), visibility 360ms;
}

.app.has-structure .empty-state {
  opacity: 0;
  visibility: hidden;
  transform: translate(-24px, -44%);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
}

.eyebrow > span {
  width: 25px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(149, 240, 178, 0.55);
}

.empty-state h1 {
  margin: 0;
  font-size: clamp(44px, 5.5vw, 78px);
  font-weight: 460;
  line-height: 1.09;
  letter-spacing: -0.055em;
}

.empty-state h1 em {
  color: var(--accent);
  font-style: normal;
  text-shadow: 0 0 32px rgba(149, 240, 178, 0.13);
}

.hero-copy {
  width: min(540px, 100%);
  margin: 23px 0 27px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
}

.drop-zone {
  position: relative;
  width: min(550px, 100%);
  min-height: 122px;
  display: grid;
  grid-template-columns: 78px 1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 0 18px;
  padding: 18px 21px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(110deg, rgba(149, 240, 178, 0.055), transparent 38%),
    rgba(18, 24, 21, 0.66);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 16px 54px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.drop-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.04) 50%, transparent 65%);
  transform: translateX(-100%);
  transition: transform 600ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  transform: translateY(-2px);
  border-color: rgba(149, 240, 178, 0.45);
  background:
    linear-gradient(110deg, rgba(149, 240, 178, 0.1), transparent 44%),
    rgba(20, 28, 24, 0.78);
}

.drop-zone:hover::after {
  transform: translateX(100%);
}

.drop-visual {
  position: relative;
  grid-row: 1 / 3;
  width: 70px;
  height: 70px;
  display: block;
}

.cube {
  position: absolute;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(149, 240, 178, 0.4);
  transform: rotate(30deg) skewY(-10deg);
}

.cube-back {
  left: 11px;
  top: 8px;
  opacity: 0.36;
}

.cube-front {
  left: 25px;
  top: 24px;
  background: rgba(149, 240, 178, 0.08);
  box-shadow: 0 0 24px rgba(149, 240, 178, 0.08);
}

.drop-arrow {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #0c1510;
  background: var(--accent);
  box-shadow: 0 7px 15px rgba(61, 175, 97, 0.25);
}

.drop-arrow svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.drop-copy {
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drop-copy strong {
  font-size: 15px;
  font-weight: 600;
}

.drop-copy span {
  color: var(--muted);
  font-size: 11px;
}

.extension-list {
  align-self: start;
  margin-top: 10px;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.trust-row {
  width: min(550px, 100%);
  display: flex;
  align-items: center;
  gap: 25px;
  margin-top: 17px;
  color: var(--muted-2);
  font-size: 10px;
}

.trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trust-row svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

.viewport-frame {
  position: absolute;
  z-index: 2;
  inset: 92px 338px 52px 22px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 280ms ease;
}

.corner {
  position: absolute;
  width: 18px;
  height: 18px;
  opacity: 0.33;
}

.corner.tl {
  top: 0;
  left: 0;
  border-top: 1px solid var(--muted);
  border-left: 1px solid var(--muted);
}

.corner.tr {
  top: 0;
  right: 0;
  border-top: 1px solid var(--muted);
  border-right: 1px solid var(--muted);
}

.corner.bl {
  bottom: 0;
  left: 0;
  border-bottom: 1px solid var(--muted);
  border-left: 1px solid var(--muted);
}

.corner.br {
  right: 0;
  bottom: 0;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
}

.axis-label {
  position: absolute;
  bottom: -4px;
  font: 700 8px/1 ui-monospace, monospace;
  opacity: 0.35;
}

.axis-x {
  left: 31px;
  color: #ff8d86;
}

.axis-y {
  left: 47px;
  color: #8bf0a7;
}

.axis-z {
  left: 63px;
  color: #8cbaff;
}

.inspector {
  position: fixed;
  z-index: 20;
  top: 92px;
  right: 16px;
  bottom: 16px;
  width: 304px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  border-radius: var(--radius);
  opacity: 1;
  transform: translateX(0);
  transition: width 280ms ease, opacity 280ms ease, transform 360ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

@media (min-width: 901px) {
  .inspector.has-selection {
    width: 384px;
    padding-right: 24px;
    padding-left: 24px;
    background: rgba(15, 20, 18, 0.94);
    border-color: rgba(226, 239, 232, 0.18);
  }
}

.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 54px;
}

.inspector h2 {
  max-width: 250px;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 570;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-card {
  min-height: 108px;
  display: grid;
  grid-template-columns: 86px 1fr;
  align-items: center;
  margin: 16px 0 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.dimension-graphic {
  position: relative;
  width: 64px;
  height: 64px;
}

.dim-cube {
  position: absolute;
  left: 16px;
  top: 14px;
  width: 31px;
  height: 31px;
  border: 1px solid rgba(149, 240, 178, 0.44);
  background: rgba(149, 240, 178, 0.04);
  transform: rotate(30deg) skewY(-8deg);
  box-shadow: 8px -8px 0 -1px rgba(149, 240, 178, 0.025), 8px -8px 0 0 rgba(149, 240, 178, 0.16);
}

.dim-line {
  position: absolute;
  display: block;
  height: 1px;
  transform-origin: left center;
}

.dim-x {
  width: 23px;
  left: 15px;
  bottom: 6px;
  background: #ff8d86;
}

.dim-y {
  width: 23px;
  left: 15px;
  bottom: 6px;
  background: #8bf0a7;
  transform: rotate(-90deg);
}

.dim-z {
  width: 21px;
  left: 15px;
  bottom: 6px;
  background: #8cbaff;
  transform: rotate(-35deg);
}

.dimension-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.dimension-values span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 9px;
  border-left: 1px solid var(--line);
}

.dimension-values small,
.stat-grid small,
.inspector-foot small {
  color: var(--muted-2);
  font-size: 9px;
}

.dimension-values strong {
  overflow: hidden;
  font-size: 16px;
  font-weight: 550;
  text-overflow: ellipsis;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.stat-grid article {
  min-width: 0;
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.012);
}

.stat-grid article > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-grid strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 560;
  text-overflow: ellipsis;
}

.selection-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 18px;
  padding-top: 16px;
  padding-right: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  border-top: 1px solid var(--line);
  scrollbar-color: rgba(149, 240, 178, 0.28) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.selection-section.is-hidden {
  display: none;
}

.inspector.has-selection .material-section {
  display: none;
}

.selection-head,
.nbt-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selection-head h3 {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 570;
}

.icon-button.compact {
  width: 28px;
  height: 28px;
}

.selected-block-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.018);
}

.selected-swatch {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 20px rgba(0, 0, 0, 0.18);
}

.selected-block-main > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.selected-block-main strong,
.selected-block-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-block-main strong {
  font-size: 14px;
  font-weight: 590;
}

.selected-block-main small {
  color: #89958e;
  font: 500 10px/1.3 ui-monospace, monospace;
}

.fluid-badge {
  padding: 4px 6px;
  border: 1px solid rgba(98, 178, 240, 0.22);
  border-radius: 6px;
  color: #8dcbfa;
  background: rgba(65, 151, 218, 0.08);
  font-size: 8px;
  white-space: nowrap;
}

.fluid-badge.lava {
  color: #ffb068;
  border-color: rgba(255, 135, 67, 0.25);
  background: rgba(255, 100, 35, 0.09);
}

.coordinate-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.coordinate-strip span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 8px;
  border-right: 1px solid var(--line);
}

.coordinate-strip span:last-child {
  border-right: 0;
}

.coordinate-strip small {
  color: #87928c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.coordinate-strip strong {
  overflow: hidden;
  font: 570 11px/1.25 ui-monospace, monospace;
  text-overflow: ellipsis;
}

.state-list {
  max-height: 82px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  margin-top: 9px;
  overflow: auto;
  scrollbar-width: thin;
}

.state-chip {
  max-width: 100%;
  padding: 4px 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #c0cac4;
  background: rgba(255, 255, 255, 0.018);
  font: 500 9px/1.3 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-chip b {
  color: var(--accent);
  font-weight: 550;
}

.state-empty {
  color: var(--muted-2);
  font-size: 9px;
}

.is-light-block-swatch {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 216, 96, 0.44) !important;
  box-shadow: inset 0 0 12px rgba(255, 205, 73, 0.22), 0 0 14px rgba(255, 190, 47, 0.12) !important;
}

.is-light-block-swatch::before {
  position: absolute;
  inset: 19%;
  content: "";
  opacity: var(--light-icon-opacity, 0.8);
  background:
    linear-gradient(90deg, transparent 42%, #fff4a5 42% 58%, transparent 58%),
    linear-gradient(transparent 42%, #fff4a5 42% 58%, transparent 58%);
  filter: drop-shadow(0 0 3px #ffc63b);
  transform: rotate(45deg);
  pointer-events: none;
}

.is-light-block-swatch::after {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 12px;
  padding: 1px 2px;
  content: attr(data-light-level);
  border: 1px solid rgba(255, 241, 181, 0.55);
  border-radius: 4px;
  color: #fff7d0;
  background: rgba(44, 31, 8, 0.84);
  font: 800 7px/1.25 ui-monospace, monospace;
  text-align: center;
  pointer-events: none;
}

.light-block-section {
  --light-level-ratio: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 207, 76, 0.28);
  border-radius: 11px;
  background:
    radial-gradient(circle at 28px 28px, rgba(255, 216, 88, 0.16), transparent 52px),
    linear-gradient(135deg, rgba(255, 203, 64, 0.075), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 247, 207, 0.05);
}

.light-block-icon-shell {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 218, 105, 0.32);
  border-radius: 12px;
  background: rgba(21, 17, 8, 0.66);
  box-shadow: 0 0 22px rgba(255, 193, 45, var(--light-glow-alpha, 0.06));
}

.light-block-icon {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 0 7px rgba(255, 205, 69, 0.54));
}

.light-block-icon-level {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 20px;
  padding: 3px 4px;
  border: 1px solid rgba(255, 239, 177, 0.55);
  border-radius: 7px;
  color: #fff7cf;
  background: #5b410c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
  font: 800 9px/1 ui-monospace, monospace;
  text-align: center;
}

.light-block-details,
.light-block-heading > div {
  min-width: 0;
}

.light-block-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.light-block-heading > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.light-block-heading strong {
  color: #f5e7bb;
  font-size: 11px;
}

.light-block-heading .section-kicker {
  color: #cda94a;
}

.light-block-level {
  flex: 0 0 auto;
  color: #ffe68f !important;
  font: 760 10px/1.2 ui-monospace, monospace !important;
}

.light-block-meter {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.light-block-meter i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #b48722, #ffd04d 62%, #fff5bd);
  box-shadow: 0 0 9px rgba(255, 208, 77, 0.48);
  transition: width 180ms ease-out;
}

.light-block-details > small {
  display: block;
  margin-top: 7px;
  color: #a89e7c;
  font-size: 9px;
  line-height: 1.5;
}

.command-block-section {
  flex: 0 0 auto;
  max-height: min(390px, 45vh);
  margin-top: 10px;
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(236, 176, 111, 0.34);
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgba(224, 134, 70, 0.12), transparent 58%),
    rgba(4, 7, 6, 0.82);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.045), 0 14px 34px rgba(0, 0, 0, 0.16);
  scrollbar-color: rgba(224, 164, 100, 0.25) transparent;
  scrollbar-width: thin;
}

/* The selection panel is the single vertical scroll owner. Keeping these
   children as separate scrollports traps the wheel while their lower halves
   are still clipped by the fixed-height inspector. */
.selection-section > .command-block-section,
.selection-section > .container-section {
  max-height: none;
  overflow: visible;
}

.command-block-section.is-hidden,
.command-detail-row.is-hidden {
  display: none;
}

.command-block-head,
.command-block-head > div,
.command-text-head {
  display: flex;
  align-items: center;
}

.command-block-head,
.command-text-head {
  justify-content: space-between;
  gap: 10px;
}

.command-block-head > div {
  min-width: 0;
  gap: 8px;
}

.command-mode-badge {
  --mode-color: #aeb8b2;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--mode-color) 38%, transparent);
  border-radius: 6px;
  color: var(--mode-color);
  background: color-mix(in srgb, var(--mode-color) 9%, transparent);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.command-mode-badge.impulse {
  --mode-color: #ffb56e;
}

.command-mode-badge.repeat {
  --mode-color: #d9a3ff;
}

.command-mode-badge.chain {
  --mode-color: #83e0a4;
}

.command-fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.command-fact-grid > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
}

.command-fact-grid small,
.command-detail-row small,
.command-text-head small {
  color: #929e97;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.command-fact-grid strong {
  overflow: hidden;
  color: #f1f5f2;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-runtime {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.command-runtime:empty {
  display: none;
}

.command-runtime span {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #c6d1ca;
  background: rgba(255, 255, 255, 0.03);
  font: 500 9px/1.3 ui-monospace, monospace;
}

.command-detail-row {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.command-detail-row span {
  overflow-wrap: anywhere;
  color: #d5ddd8;
  font: 500 10px/1.55 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.command-text-head {
  margin-top: 11px;
}

.command-text-head span {
  color: #8e9993;
  font-size: 9px;
}

.command-text {
  max-height: 132px;
  margin: 7px 0 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid rgba(236, 176, 111, 0.26);
  border-radius: 9px;
  color: #ffe0b9;
  background: rgba(1, 3, 2, 0.72);
  font: 520 11px/1.6 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.nbt-title-row {
  margin: 12px 0 7px;
  color: #87928c;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.nbt-title-row > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.nbt-type {
  color: #aeb9b2;
  font: 500 9px/1 ui-monospace, monospace;
  letter-spacing: 0;
}

.copy-button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.copy-button:hover:not(:disabled) {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.27);
}

.copy-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.nbt-view {
  min-height: 86px;
  flex: 1;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #bddbc5;
  background: rgba(2, 5, 4, 0.62);
  font: 500 10px/1.65 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-color: rgba(149, 240, 178, 0.22) transparent;
  scrollbar-width: thin;
}

.nbt-view.loading {
  color: var(--muted-2);
}

.stat-icon {
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(149, 240, 178, 0.15);
  border-radius: 8px;
  color: var(--accent);
  background: rgba(149, 240, 178, 0.055);
  font: 600 8px/1 ui-monospace, monospace;
}

.blocks-icon::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid currentColor;
  box-shadow: 4px -4px 0 -1px var(--panel-solid), 4px -4px 0 0 currentColor;
}

.palette-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: conic-gradient(#89e5a6, #e8cf88, #8cbaff, #d08cf2, #89e5a6);
  opacity: 0.9;
}

.density-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  background-image: radial-gradient(currentColor 1px, transparent 1.3px);
  background-size: 4px 4px;
}

.fluid-stat {
  grid-column: 1 / 3;
}

.fluid-icon::before {
  content: "≈";
  color: #83c8fa;
  font: 700 15px/1 ui-monospace, monospace;
  text-shadow: 0 0 9px rgba(83, 175, 242, 0.3);
}

.material-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 23px;
}

.section-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-row h3 {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 560;
}

.muted-number {
  color: var(--muted-2);
  font-size: 10px;
}

.block-list-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-bottom: 7px;
}

.block-search {
  min-width: 0;
  height: 31px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(3, 6, 5, 0.26);
  transition: border-color 150ms ease, background 150ms ease;
}

.block-search:focus-within {
  border-color: rgba(149, 240, 178, 0.28);
  background: rgba(149, 240, 178, 0.035);
}

.block-search svg {
  flex: 0 0 13px;
  width: 13px;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.7;
}

.block-search input {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: #cbd2ce;
  background: transparent;
  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
}

.block-search input::placeholder {
  color: #68716c;
}

.nbt-filter {
  min-width: 55px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.018);
  font: 650 8px/1 ui-monospace, monospace;
  cursor: pointer;
}

.nbt-filter:hover,
.nbt-filter.is-active {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.27);
  background: rgba(149, 240, 178, 0.07);
}

.block-list-summary {
  margin: 0 2px 7px;
  color: var(--muted-2);
  font-size: 8px;
}

.nbt-type-summary {
  max-height: 47px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 8px;
  overflow: auto;
  scrollbar-width: thin;
}

.nbt-type-summary.is-hidden {
  display: none;
}

.nbt-type-summary span {
  padding: 3px 5px;
  border: 1px solid rgba(149, 240, 178, 0.13);
  border-radius: 5px;
  color: #93cfa6;
  background: rgba(149, 240, 178, 0.045);
  font: 600 7px/1 ui-monospace, monospace;
}

.material-list {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  scrollbar-color: rgba(149, 240, 178, 0.2) transparent;
  scrollbar-width: thin;
}

.material-row {
  flex: 0 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  grid-template-areas:
    "swatch copy count"
    "swatch meta meta"
    ". bar bar";
  align-items: center;
  gap: 4px 9px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.material-row:hover,
.material-row:focus-visible {
  outline: 0;
  border-color: rgba(149, 240, 178, 0.09);
  background: rgba(255, 255, 255, 0.025);
}

.material-row.has-nbt {
  background: linear-gradient(90deg, rgba(149, 240, 178, 0.025), transparent 42%);
}

.material-swatch {
  grid-area: swatch;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

.material-swatch.is-textured,
.selected-swatch.is-textured {
  image-rendering: pixelated;
  background-repeat: no-repeat;
}

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

.material-name {
  overflow: hidden;
  color: #cbd2ce;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-id {
  overflow: hidden;
  color: #69736e;
  font: 500 7px/1.25 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-count {
  grid-area: count;
  color: var(--muted);
  font: 500 9px/1 ui-monospace, monospace;
}

.material-meta {
  grid-area: meta;
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.material-meta i {
  padding: 2px 4px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 4px;
  color: #707b75;
  background: rgba(255, 255, 255, 0.018);
  font: 650 6px/1 ui-monospace, monospace;
  font-style: normal;
  white-space: nowrap;
}

.material-meta .nbt-badge {
  color: #9decb7;
  border-color: rgba(149, 240, 178, 0.14);
  background: rgba(149, 240, 178, 0.055);
}

.material-meta .texture-badge {
  color: #a9bce7;
  border-color: rgba(133, 164, 235, 0.12);
}

.material-bar {
  grid-area: bar;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.04);
}

.material-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.72;
}

.material-empty {
  display: grid;
  min-height: 92px;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  color: var(--muted-2);
  font-size: 9px;
  text-align: center;
}

.inspector-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 15px -22px -22px;
  padding: 14px 22px 15px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.1);
}

.inspector-foot span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inspector-foot strong {
  color: #c8cfcb;
  font-size: 10px;
  font-weight: 520;
}

.tool-dock {
  position: fixed;
  z-index: 22;
  left: 24px;
  bottom: 22px;
  height: 51px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px;
  border-radius: 14px;
}

.tool-button,
.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.tool-button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.tool-button:hover,
.icon-button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.tool-button.is-active {
  color: var(--accent);
  background: rgba(149, 240, 178, 0.09);
}

.tool-button svg {
  width: 17px;
  height: 17px;
}

.tool-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #d8dedb;
  background: rgba(13, 17, 15, 0.94);
  font-size: 9px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 130ms ease, transform 130ms ease;
}

.tool-button[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.tool-separator {
  width: 1px;
  height: 19px;
  margin: 0 3px;
  background: var(--line);
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.layer-control {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: 22px;
  width: min(410px, 34vw);
  height: 51px;
  display: grid;
  grid-template-columns: 86px 1fr 46px;
  align-items: center;
  gap: 13px;
  padding: 5px 6px 5px 15px;
  border-radius: 14px;
  transform: translateX(-50%);
}

.layer-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.layer-copy strong {
  font: 550 11px/1.3 ui-monospace, monospace;
}

.layer-copy small {
  color: var(--muted-2);
  font-size: 9px;
}

input[type="range"] {
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--range-fill, 100%), rgba(255, 255, 255, 0.08) var(--range-fill, 100%));
}

input[type="range"]::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  appearance: none;
  border: 2px solid var(--panel-solid);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(149, 240, 178, 0.45), 0 0 10px rgba(149, 240, 178, 0.25);
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
}

input[type="range"]::-moz-range-progress {
  height: 3px;
  background: var(--accent);
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--panel-solid);
  border-radius: 50%;
  background: var(--accent);
}

.mini-button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 9px;
}

.mini-button:hover {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.25);
}

.view-hint {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 85px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-2);
  font-size: 9px;
  pointer-events: none;
  transform: translateX(-50%);
}

.view-hint b {
  color: var(--muted);
  font-weight: 600;
}

.view-hint i,
.performance-badge i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--muted-2);
}

.free-camera-hud {
  position: fixed;
  z-index: 36;
  inset: 0;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.free-camera-status {
  position: absolute;
  top: 92px;
  left: 50%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 7px 6px 13px;
  border-radius: 13px;
  pointer-events: auto;
  transform: translateX(-50%);
}

.free-camera-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font: 720 8px/1 ui-monospace, monospace;
  letter-spacing: 0.13em;
  white-space: nowrap;
}

.free-camera-kicker i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(149, 240, 178, 0.68);
}

.free-camera-status strong {
  min-width: 180px;
  max-width: min(520px, 48vw);
  color: #cbd3ce;
  font-size: 9px;
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.free-camera-action {
  height: 29px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 8px;
  white-space: nowrap;
  pointer-events: auto;
}

.free-camera-action:hover {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.28);
  background: rgba(149, 240, 178, 0.07);
}

.free-camera-action.exit {
  color: #dce4df;
}

.free-camera-action kbd {
  margin-left: 4px;
  color: var(--accent);
  font: inherit;
}

.free-camera-capture-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 5px;
  min-width: 154px;
  padding: 14px 18px;
  border: 1px solid rgba(149, 240, 178, 0.2);
  border-radius: 12px;
  color: #ecf3ef;
  background: rgba(8, 13, 11, 0.72);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.045);
  text-align: center;
  transform: translate(-50%, 34px);
  backdrop-filter: blur(14px);
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
}

.free-camera-capture-prompt span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

.free-camera-capture-prompt small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.free-camera-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.free-camera-crosshair::before,
.free-camera-crosshair::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  border-radius: 2px;
  background: rgba(242, 245, 240, 0.88);
  transform: translate(-50%, -50%);
}

.free-camera-crosshair::before {
  width: 18px;
  height: 1px;
}

.free-camera-crosshair::after {
  width: 1px;
  height: 18px;
}

.app.free-command-target {
  --command-target-color: #ffb56e;
}

.app.free-command-target.command-target-repeat {
  --command-target-color: #d9a3ff;
}

.app.free-command-target.command-target-chain {
  --command-target-color: #83e0a4;
}

.app.free-command-target .free-camera-crosshair::before,
.app.free-command-target .free-camera-crosshair::after {
  background: var(--command-target-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--command-target-color) 74%, transparent);
}

.free-command-card {
  position: absolute;
  top: 50%;
  left: calc(50% + 28px);
  width: min(400px, calc(50vw - 50px));
  min-width: 280px;
  padding: 14px 15px;
  border: 1px solid color-mix(in srgb, var(--command-target-color, #ffb56e) 42%, transparent);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--command-target-color, #ffb56e) 13%, transparent), transparent 62%),
    rgba(5, 9, 7, 0.96);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.07);
  transform: translateY(-12px);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.free-command-card.is-hidden {
  display: none;
}

.free-command-card-head,
.free-command-facts {
  display: flex;
  align-items: center;
}

.free-command-card-head {
  justify-content: space-between;
  gap: 10px;
}

.free-command-card-head small {
  overflow: hidden;
  color: #9aa69f;
  font: 500 9px/1 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.free-command-facts {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.free-command-facts span {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 7px;
  color: #d0dad4;
  background: rgba(255, 255, 255, 0.045);
  font-size: 9px;
  white-space: nowrap;
}

.free-command-card code {
  display: -webkit-box;
  margin-top: 10px;
  overflow: hidden;
  color: #f7faf8;
  font: 520 11px/1.6 "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.free-joystick,
.free-vertical-controls {
  display: none;
}

.app.free-camera-touch .free-camera-capture-prompt,
.app.free-camera-pointer-locked .free-camera-capture-prompt {
  display: none;
}

.app.free-camera-active .view-hint {
  opacity: 0;
  visibility: hidden;
}

.app.free-camera-active #viewport {
  cursor: crosshair;
}

.app.free-camera-dragging #viewport {
  cursor: grabbing;
}

.app.free-camera-pointer-locked #viewport {
  cursor: none;
}

.app.free-camera-touch .inspector,
.app.free-camera-touch .tool-dock,
.app.free-camera-touch .layer-control,
.app.free-camera-touch .view-hint,
.app.free-camera-touch .performance-badge {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.app.free-camera-touch .free-camera-status {
  top: max(76px, calc(env(safe-area-inset-top) + 68px));
  right: 12px;
  left: 12px;
  justify-content: center;
  transform: none;
}

.app.free-camera-touch .free-camera-status strong {
  display: none;
}

.app.free-camera-touch .free-command-card {
  top: calc(50% - 28px);
  left: 50%;
  width: min(380px, calc(100vw - 28px));
  min-width: 0;
  padding: 11px 12px;
  transform: translate(-50%, -100%);
}

.app.free-camera-touch .free-command-card code {
  font-size: 10px;
  -webkit-line-clamp: 3;
}

.app.free-camera-touch .free-joystick {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  width: 128px;
  height: 128px;
  display: block;
  border: 1px solid rgba(226, 239, 232, 0.16);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(149, 240, 178, 0.07) 0 28%, rgba(11, 16, 14, 0.46) 30% 100%);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.25), 0 12px 36px rgba(0, 0, 0, 0.2);
  touch-action: none;
  pointer-events: auto;
  user-select: none;
}

.free-joystick::before,
.free-joystick::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  background: rgba(226, 239, 232, 0.08);
  transform: translate(-50%, -50%);
}

.free-joystick::before {
  width: 70%;
  height: 1px;
}

.free-joystick::after {
  width: 1px;
  height: 70%;
}

.free-joystick span {
  --joystick-x: 0px;
  --joystick-y: 0px;
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(183, 255, 201, 0.5);
  border-radius: 50%;
  background: rgba(149, 240, 178, 0.22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transform: translate(calc(-50% + var(--joystick-x)), calc(-50% + var(--joystick-y)));
}

.app.free-camera-touch .free-vertical-controls {
  position: absolute;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(25px, calc(env(safe-area-inset-bottom) + 17px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
}

.free-vertical-controls button {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(226, 239, 232, 0.18);
  border-radius: 15px;
  color: #dce5df;
  background: rgba(12, 17, 15, 0.66);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  touch-action: none;
  user-select: none;
}

.free-vertical-controls button:active {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.4);
  background: rgba(149, 240, 178, 0.14);
}

.free-vertical-controls svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.performance-badge {
  position: fixed;
  z-index: 10;
  top: 101px;
  left: 29px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font: 650 8px/1 ui-monospace, monospace;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.performance-badge span {
  color: var(--muted);
}

.performance-panel {
  position: fixed;
  z-index: 48;
  top: 126px;
  left: 22px;
  width: min(318px, calc(100vw - 44px));
  padding: 14px;
  border-radius: 14px;
  color: #dce8e1;
  background:
    linear-gradient(145deg, rgba(65, 125, 88, 0.14), transparent 54%),
    rgba(7, 12, 10, 0.92);
  box-shadow: 0 22px 62px rgba(0, 0, 0, 0.34), inset 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px) saturate(1.15);
}

.performance-panel > header,
.performance-panel > header > div {
  display: flex;
  align-items: center;
}

.performance-panel > header {
  justify-content: space-between;
  gap: 12px;
}

.performance-panel > header > div {
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.performance-panel > header small {
  color: #7f9d8b;
  font: 700 8px/1 ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.performance-panel > header strong {
  font-size: 14px;
  font-weight: 690;
}

.performance-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 13px;
  padding: 4px;
  border: 1px solid rgba(149, 240, 178, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.performance-mode-switch button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #819087;
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}

.performance-mode-switch button:hover,
.performance-mode-switch button.is-active {
  color: #c9f5d6;
  border-color: rgba(149, 240, 178, 0.23);
  background: rgba(149, 240, 178, 0.1);
}

.performance-mode-hint,
.performance-footnote {
  margin: 10px 2px 0;
  color: #829087;
  font-size: 10px;
  line-height: 1.5;
}

.performance-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.performance-metrics > div {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(149, 240, 178, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}

.performance-metrics dt {
  color: #718078;
  font-size: 8px;
  letter-spacing: 0.05em;
}

.performance-metrics dd {
  margin: 5px 0 0;
  overflow: hidden;
  color: #d3e7da;
  font: 650 10px/1.1 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .performance-panel {
    top: auto;
    right: 12px;
    bottom: 84px;
    left: 12px;
    width: auto;
  }

  .performance-mode-switch button {
    min-height: 44px;
  }
}

.loading-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(7, 10, 9, 0.92);
  backdrop-filter: blur(26px);
  opacity: 1;
  transition: opacity 240ms ease, visibility 240ms;
}

.loader-stage {
  position: relative;
  width: 118px;
  height: 93px;
  margin-bottom: 30px;
  perspective: 500px;
}

.loader-cube {
  position: absolute;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(149, 240, 178, 0.37);
  background: rgba(149, 240, 178, 0.035);
  transform: rotate(30deg) skewY(-8deg);
  animation: cubeFloat 1.7s ease-in-out infinite;
}

.loader-cube.l1 {
  left: 16px;
  bottom: 9px;
}

.loader-cube.l2 {
  left: 48px;
  bottom: 25px;
  animation-delay: -0.25s;
}

.loader-cube.l3 {
  left: 68px;
  bottom: 4px;
  animation-delay: -0.5s;
}

.loader-scan {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 28px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 32px rgba(149, 240, 178, 0.3);
  animation: scan 1.5s ease-in-out infinite;
}

@keyframes cubeFloat {
  0%, 100% { transform: translateY(0) rotate(30deg) skewY(-8deg); opacity: 0.52; }
  50% { transform: translateY(-5px) rotate(30deg) skewY(-8deg); opacity: 1; }
}

@keyframes scan {
  0%, 100% { transform: translateY(-17px); opacity: 0.25; }
  50% { transform: translateY(43px); opacity: 1; }
}

.loading-copy {
  width: min(430px, calc(100vw - 48px));
  text-align: center;
}

.loading-copy h2 {
  margin: 9px 0 8px;
  font-size: 22px;
  font-weight: 520;
  letter-spacing: -0.02em;
}

.loading-copy p {
  min-height: 19px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  width: min(430px, calc(100vw - 48px));
  height: 2px;
  margin-top: 26px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(149, 240, 178, 0.62);
  transition: width 220ms ease;
}

.progress-meta {
  width: min(430px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted-2);
  font: 600 9px/1 ui-monospace, monospace;
}

.progress-meta button {
  padding: 0;
  border: 0;
  color: var(--muted-2);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.progress-meta button:hover {
  color: var(--danger);
}

.drop-overlay {
  position: fixed;
  z-index: 100;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(149, 240, 178, 0.52);
  border-radius: 22px;
  background: rgba(11, 18, 14, 0.88);
  backdrop-filter: blur(22px);
}

.drop-overlay > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-overlay svg {
  width: 47px;
  height: 47px;
  margin-bottom: 8px;
  color: var(--accent);
  stroke-width: 1.25;
}

.drop-overlay strong {
  font-size: 22px;
  font-weight: 520;
}

.drop-overlay span {
  color: var(--muted);
  font-size: 11px;
}

.toast-region {
  position: fixed;
  z-index: 120;
  top: 92px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transform: translateX(-50%);
}

.toast {
  max-width: min(540px, calc(100vw - 32px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: #dce2de;
  background: rgba(20, 25, 23, 0.95);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.32);
  font-size: 11px;
  line-height: 1.6;
  pointer-events: auto;
  animation: toastIn 250ms ease both;
}

.toast::before {
  content: "";
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(149, 240, 178, 0.4);
}

.toast.error::before {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 142, 134, 0.38);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-7px); }
}

.formats-dialog {
  width: min(760px, calc(100vw - 36px));
  max-height: min(720px, calc(100vh - 70px));
  padding: 25px;
  overflow: auto;
  color: var(--text);
  border-radius: 20px;
}

.formats-dialog::backdrop {
  background: rgba(4, 7, 6, 0.72);
  backdrop-filter: blur(10px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 7px 0 0;
  font-size: 23px;
  font-weight: 520;
}

.formats-dialog > p {
  width: min(580px, 100%);
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

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

.format-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
}

.format-item::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.format-item span {
  overflow: hidden;
  color: #cbd2ce;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.inspector.is-hidden {
  transform: translateX(25px);
}

.tool-dock.is-hidden,
.layer-control.is-hidden {
  transform: translateY(14px);
}

.layer-control.is-hidden {
  transform: translate(-50%, 14px);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mobile-only {
  display: none;
}

.mobile-gesture-hint {
  display: none;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .live-state {
    display: none;
  }

  .topbar .text-button.subtle {
    display: none;
  }

  .empty-state {
    left: 34px;
  }

  .viewport-frame {
    right: 22px;
    bottom: 215px;
  }

  .inspector {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 10px;
    width: auto;
    height: 184px;
    display: grid;
    grid-template-columns: 1.15fr 1fr 1.2fr;
    grid-template-rows: auto 1fr;
    gap: 12px;
    padding: 16px;
    overflow: visible;
  }

  .inspector-head {
    grid-column: 1;
    min-width: 0;
  }

  .inspector h2 {
    max-width: 230px;
  }

  .dimension-card {
    grid-column: 1;
    min-height: 70px;
    grid-template-columns: 55px 1fr;
    margin: 0;
    padding: 8px;
  }

  .dimension-graphic {
    transform: scale(0.72);
    transform-origin: center;
  }

  .stat-grid {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: stretch;
  }

  .stat-grid article {
    min-height: 0;
    padding: 7px;
  }

  .stat-icon {
    display: none;
  }

  .material-section {
    grid-column: 3;
    grid-row: 1 / 3;
    margin-top: 0;
  }

  .material-row {
    padding: 4px;
  }

  .material-swatch {
    width: 22px;
    height: 22px;
  }

  .inspector-foot {
    display: none;
  }

  .inspector.has-selection {
    width: auto;
    height: min(500px, calc(100vh - 120px));
    display: flex;
  }

  .inspector.has-selection .inspector-head,
  .inspector.has-selection .dimension-card,
  .inspector.has-selection .stat-grid,
  .inspector.has-selection .material-section {
    display: none;
  }

  .inspector.has-selection .selection-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .tool-dock {
    bottom: 205px;
  }

  .layer-control {
    right: 18px;
    left: auto;
    bottom: 205px;
    width: min(340px, 45vw);
    transform: none;
  }

  .layer-control.is-hidden {
    transform: translateY(14px);
  }

  .view-hint {
    bottom: 269px;
  }

  .mobile-only {
    display: grid;
  }
}

@media (max-width: 650px) {
  .free-command-card {
    top: calc(50% - 28px);
    left: 50%;
    width: min(380px, calc(100vw - 28px));
    min-width: 0;
    transform: translate(-50%, -100%);
  }

  .free-command-card code {
    font-size: 10px;
    -webkit-line-clamp: 3;
  }

  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    height: 56px;
    padding-left: 12px;
  }

  .brand-copy small {
    display: none;
  }

  .topbar .primary-button {
    width: 42px;
    height: 42px;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  .topbar .primary-button svg {
    position: absolute;
    color: #0b160f;
  }

  .empty-state {
    top: 49%;
    left: 20px;
    width: calc(100vw - 40px);
    transform: translateY(-46%);
  }

  .empty-state h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .hero-copy {
    font-size: 12px;
    line-height: 1.75;
  }

  .drop-zone {
    min-height: 112px;
    grid-template-columns: 57px 1fr;
    gap: 0 12px;
    padding: 15px;
  }

  .drop-visual {
    width: 55px;
    transform: scale(0.78);
    transform-origin: left center;
  }

  .extension-list {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .trust-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .inspector {
    height: 172px;
    grid-template-columns: 1fr 1fr;
  }

  .inspector-head,
  .dimension-card {
    display: none;
  }

  .stat-grid {
    grid-column: 1;
  }

  .material-section {
    grid-column: 2;
  }

  .tool-dock {
    left: 50%;
    bottom: 193px;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    transform: translateX(-50%);
  }

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

  .tool-dock.is-hidden {
    transform: translate(-50%, 14px);
  }

  .tool-button {
    flex: 0 0 37px;
    width: 37px;
  }

  .layer-control {
    left: 10px;
    right: 10px;
    bottom: 252px;
    width: auto;
    grid-template-columns: 66px 1fr 42px;
  }

  .view-hint,
  .performance-badge,
  .viewport-frame {
    display: none;
  }

  .formats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Safe AI builder and Minecraft coordinate HUD -------------------------- */

.coordinate-hud {
  position: fixed;
  z-index: 21;
  top: 92px;
  left: 24px;
  width: 286px;
  padding: 12px 14px;
  display: grid;
  gap: 7px;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.coordinate-hud > div {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: baseline;
  gap: 8px;
}

.coordinate-hud span,
.coordinate-hud small {
  color: var(--dim);
  font: 650 9px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.06em;
}

.coordinate-hud strong {
  color: rgba(242, 250, 246, 0.92);
  font: 650 11px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.coordinate-hud .coordinate-cursor-row {
  grid-template-columns: 76px 1fr auto;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-builder-panel {
  position: fixed;
  z-index: 34;
  top: 84px;
  right: 24px;
  bottom: 24px;
  width: min(440px, calc(100vw - 48px));
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: width 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.ai-builder-panel.is-generating .ai-builder-head {
  order: -2;
}

.ai-builder-panel.is-generating .ai-generation-console {
  order: -1;
}

.ai-builder-panel.is-hidden {
  transform: translateX(24px);
}

.ai-builder-head,
.ai-card-title,
.ai-inline-actions,
.ai-generate-actions,
.ai-preview-actions,
.ai-transform-actions,
.ai-capture-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-builder-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.ai-builder-head > div {
  display: grid;
  gap: 3px;
}

.ai-builder-head strong {
  font-size: 18px;
}

.ai-builder-panel label {
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 650;
}

.ai-builder-panel input,
.ai-builder-panel textarea,
.ai-builder-panel select {
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(225, 242, 233, 0.13);
  border-radius: 9px;
  color: rgba(247, 252, 249, 0.94);
  background: rgba(4, 8, 6, 0.52);
  font: 560 11px/1.4 inherit;
  outline: none;
}

.ai-builder-panel textarea {
  resize: vertical;
}

.ai-builder-panel input:focus,
.ai-builder-panel textarea:focus,
.ai-builder-panel select:focus {
  border-color: rgba(149, 240, 178, 0.48);
  box-shadow: 0 0 0 2px rgba(149, 240, 178, 0.08);
}

.ai-history-label,
.ai-config-card,
.ai-coordinate-card,
.ai-chat-card,
.ai-process-card,
.ai-preview-card {
  margin: 0 0 11px;
  padding: 12px;
  border: 1px solid rgba(225, 242, 233, 0.1);
  border-radius: 12px;
  background: rgba(4, 9, 7, 0.38);
}

.ai-history-label {
  display: grid;
}

.ai-config-card > summary,
.ai-process-card > summary {
  color: rgba(244, 250, 247, 0.9);
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
}

.ai-config-card[open] > summary,
.ai-process-card[open] > summary {
  margin-bottom: 10px;
}

.ai-security-note,
.ai-no-mutation-note,
.ai-range-summary,
.ai-connection-status {
  display: block;
  margin: 7px 0;
  color: rgba(190, 210, 199, 0.72);
  font-size: 11px;
  line-height: 1.55;
}

.ai-security-note {
  padding: 8px 9px;
  border-left: 2px solid var(--accent);
  background: rgba(149, 240, 178, 0.045);
}

.ai-provider-capabilities,
.ai-scale-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.ai-provider-capabilities span,
.ai-scale-strip > span {
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(225, 242, 233, 0.1);
  border-radius: 999px;
  color: rgba(205, 222, 213, 0.8);
  background: rgba(255, 255, 255, 0.035);
  font-size: 10px;
}

.ai-provider-capabilities .is-supported {
  border-color: rgba(93, 221, 142, 0.3);
  color: #91efb1;
  background: rgba(52, 190, 105, 0.09);
}

.ai-provider-capabilities .is-unsupported {
  border-color: rgba(244, 117, 117, 0.24);
  color: #ffaaa4;
  background: rgba(220, 72, 72, 0.08);
}

.ai-provider-capabilities .is-endpoint {
  border-color: rgba(102, 170, 255, 0.24);
  color: #a9ccff;
}

.ai-model-roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(111, 175, 239, 0.16);
  border-radius: 10px;
  background: linear-gradient(130deg, rgba(57, 120, 183, 0.08), rgba(114, 68, 178, 0.045));
}

.ai-model-roles > header,
.ai-model-roles > p {
  grid-column: 1 / -1;
}

.ai-model-roles > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-model-roles > header strong { color: rgba(237, 247, 242, 0.9); font-size: 11px; }
.ai-model-roles > header small,
.ai-model-roles > p { margin: 0; color: rgba(164, 194, 209, 0.67); font-size: 9px; line-height: 1.45; }

.ai-concept-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(174, 121, 238, 0.16);
  border-radius: 10px;
  background: rgba(97, 57, 145, 0.055);
}

.ai-concept-card > div { display: grid; gap: 2px; }
.ai-concept-card strong { color: rgba(240, 232, 250, 0.9); font-size: 11px; }
.ai-concept-card small,
.ai-concept-card figcaption { color: rgba(197, 179, 216, 0.65); font-size: 9px; line-height: 1.45; }
.ai-concept-card figure { grid-column: 1 / -1; margin: 0; }
.ai-concept-card figure.is-hidden { display: none; }
.ai-concept-card img { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 8px; background: #07100d; }
.ai-concept-card figcaption { margin-top: 6px; }

.ai-scale-strip {
  justify-content: space-between;
  margin-bottom: 9px;
  padding: 8px;
  border: 1px solid rgba(91, 194, 255, 0.12);
  border-radius: 10px;
  background: linear-gradient(110deg, rgba(50, 133, 213, 0.08), rgba(112, 70, 181, 0.04));
}

.ai-scale-strip label {
  flex: 1 1 230px;
}

.ai-two-columns,
.ai-generation-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.ai-two-columns .span-two,
.ai-generation-options .command-warning {
  grid-column: 1 / -1;
}

.ai-checkbox {
  grid-template-columns: auto 1fr !important;
  align-items: center;
  align-content: center;
}

.ai-checkbox input {
  width: auto;
}

.ai-inline-actions,
.ai-transform-actions,
.ai-capture-actions {
  margin-top: 9px;
  flex-wrap: wrap;
}

.ai-inline-actions button,
.ai-transform-actions button,
.ai-capture-actions button {
  flex: 1 1 auto;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(225, 242, 233, 0.12);
  border-radius: 8px;
  color: rgba(239, 248, 243, 0.82);
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
  cursor: pointer;
}

.ai-card-title {
  justify-content: space-between;
  margin-bottom: 9px;
}

.ai-card-title strong {
  font-size: 12px;
}

.ai-card-title small {
  max-width: 68%;
  color: var(--dim);
  font-size: 11px;
  text-align: right;
}

.ai-card-title select {
  width: auto;
  max-width: 62%;
}

.ai-coordinate-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-coordinate-fields fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid rgba(225, 242, 233, 0.1);
  border-radius: 9px;
}

.ai-coordinate-fields legend {
  padding: 0 4px;
  color: var(--dim);
  font-size: 8px;
}

.ai-coordinate-fields input {
  padding: 7px 5px;
  text-align: center;
}

.ai-chat-messages {
  max-height: 240px;
  display: grid;
  gap: 7px;
  margin-bottom: 9px;
  overflow: auto;
}

.ai-chat-message {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}

.ai-chat-message.user {
  justify-self: end;
  background: rgba(149, 240, 178, 0.1);
}

.ai-chat-message small {
  color: var(--accent);
  font-size: 11px;
}

.ai-chat-message p {
  margin: 3px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: rgba(243, 250, 246, 0.88);
  font-size: 11px;
  line-height: 1.55;
}

.ai-generation-options {
  margin-top: 9px;
}

.ai-prompt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-prompt-heading .text-button {
  min-height: 30px;
  padding: 5px 9px;
  color: rgba(143, 213, 255, 0.9);
  background: rgba(73, 145, 190, 0.08);
}

.ai-prompt-optimization {
  display: grid;
  gap: 10px;
  margin-top: 9px;
  padding: 11px;
  border: 1px solid rgba(103, 184, 255, 0.2);
  border-radius: 11px;
  background:
    radial-gradient(circle at 95% 0, rgba(80, 134, 181, 0.12), transparent 38%),
    rgba(7, 15, 18, 0.72);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.025);
  transition: border-color 200ms ease, box-shadow 200ms ease, background 200ms ease;
}

.ai-prompt-optimization.is-hidden { display: none; }
.ai-prompt-optimization[data-state="running"] { border-color: rgba(91, 178, 255, 0.42); box-shadow: 0 16px 38px rgba(7, 42, 66, 0.28), inset 0 1px rgba(255, 255, 255, 0.035); }
.ai-prompt-optimization[data-state="success"] { border-color: rgba(93, 221, 142, 0.3); }
.ai-prompt-optimization[data-state="error"] { border-color: rgba(244, 117, 117, 0.38); background: radial-gradient(circle at 95% 0, rgba(195, 69, 69, 0.11), transparent 38%), rgba(16, 10, 12, 0.76); }
.ai-prompt-optimization[data-state="cancelled"] { border-color: rgba(233, 180, 83, 0.25); }

.ai-prompt-optimization > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-prompt-optimization > header > div { display: grid; gap: 2px; }
.ai-prompt-optimization > header small { color: rgba(117, 184, 225, 0.63); font: 700 9px/1.2 ui-monospace, Consolas, monospace; letter-spacing: 0.1em; }
.ai-prompt-optimization > header strong { color: rgba(239, 248, 244, 0.91); font-size: 12px; }
.ai-prompt-optimization > header > span { color: rgba(145, 206, 238, 0.78); font-size: 10px; text-align: right; }

.ai-optimize-status-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: rgba(145, 206, 238, 0.82);
  font-size: 10px;
  text-align: right;
}

.ai-optimize-status-cluster button { min-height: 28px; padding: 4px 8px; }

.ai-optimization-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(82, 170, 235, 0.16);
  border-radius: 9px;
  background: linear-gradient(100deg, rgba(49, 120, 177, 0.1), rgba(85, 68, 162, 0.04));
}

.ai-optimization-progress.is-hidden { display: none; }
.ai-optimization-progress > div { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.ai-optimization-progress strong { overflow: hidden; color: rgba(220, 240, 250, 0.9); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.ai-optimization-progress small { color: rgba(126, 192, 232, 0.74); font: 700 10px/1 ui-monospace, Consolas, monospace; }

.ai-optimization-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #68bdff;
  box-shadow: 0 0 0 0 rgba(104, 189, 255, 0.48);
  animation: ai-optimize-pulse 1.4s ease-out infinite;
}

@keyframes ai-optimize-pulse {
  0% { box-shadow: 0 0 0 0 rgba(104, 189, 255, 0.45); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(104, 189, 255, 0); }
}

.ai-optimization-contract {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-optimization-contract span {
  padding: 4px 7px;
  border: 1px solid rgba(111, 204, 161, 0.14);
  border-radius: 999px;
  color: rgba(158, 218, 188, 0.72);
  background: rgba(66, 163, 113, 0.045);
  font-size: 9px;
}

.ai-prompt-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.ai-prompt-compare article {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(219, 239, 228, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.024);
}

.ai-prompt-compare article:last-child { border-color: rgba(103, 184, 255, 0.18); background: rgba(74, 137, 177, 0.055); }
.ai-prompt-compare small { color: rgba(157, 187, 170, 0.56); font: 650 9px/1 ui-monospace, Consolas, monospace; }
.ai-prompt-compare p { max-height: 150px; margin: 7px 0 0; overflow: auto; color: rgba(218, 235, 226, 0.79); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }

.ai-optimization-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ai-optimization-notes > div { padding: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.022); }
.ai-optimization-notes strong { color: rgba(212, 232, 220, 0.76); font-size: 10px; }
.ai-optimization-notes ul { margin: 6px 0 0; padding-left: 16px; color: rgba(175, 204, 188, 0.68); font-size: 10px; line-height: 1.5; }

.ai-optimization-footer {
  display: grid;
  gap: 4px;
  padding-top: 2px;
  border-top: 1px solid rgba(218, 239, 228, 0.065);
}

.ai-optimization-footer > small {
  color: rgba(146, 179, 194, 0.66);
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-advanced-settings {
  margin-top: 9px;
  border: 1px solid rgba(225, 242, 233, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}

.ai-advanced-settings > summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  color: rgba(226, 239, 232, 0.78);
  font-size: 11px;
  font-weight: 690;
  cursor: pointer;
  list-style: none;
}

.ai-advanced-settings > summary::-webkit-details-marker { display: none; }
.ai-advanced-settings > summary::after { color: rgba(177, 204, 189, 0.54); content: "+"; }
.ai-advanced-settings[open] > summary::after { content: "−"; }
.ai-advanced-settings > summary small { margin-left: auto; color: rgba(168, 194, 179, 0.55); font-size: 10px; font-weight: 560; }
.ai-advanced-settings .ai-generation-options,
.ai-advanced-settings .ai-skill-chips { margin: 0 9px 9px; }

.ai-skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.ai-skill-chips label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid rgba(225, 242, 233, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.ai-skill-chips input {
  width: auto;
}

.ai-skill-manager {
  margin: 0 9px 9px;
  border: 1px solid rgba(126, 183, 230, 0.12);
  border-radius: 10px;
  background: rgba(28, 50, 63, 0.12);
}

.ai-skill-manager > summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  color: rgba(229, 242, 235, 0.84);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ai-skill-manager > summary small,
.ai-skill-manager > p,
.ai-skill-editor > small {
  color: rgba(168, 197, 181, 0.62);
  font-size: 10px;
  line-height: 1.5;
}

.ai-skill-manager > p { margin: 0 9px 8px; }

.ai-skill-director {
  display: grid;
  gap: 6px;
  margin: 0 9px 9px;
  padding: 8px;
  border: 1px solid rgba(105, 224, 156, 0.18);
  border-radius: 10px;
  background:
    radial-gradient(circle at 90% 0%, rgba(87, 140, 255, 0.09), transparent 42%),
    linear-gradient(135deg, rgba(35, 117, 76, 0.12), rgba(9, 18, 24, 0.54));
}

.ai-skill-director > label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 6px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.ai-skill-director input { width: auto; margin-top: 2px; }
.ai-skill-director span { display: grid; gap: 2px; }
.ai-skill-director strong { color: rgba(237, 249, 242, 0.9); font-size: 11px; }
.ai-skill-director small { color: rgba(164, 195, 179, 0.64); font-size: 9px; line-height: 1.45; }
.ai-skill-director > small { padding: 1px 7px; color: rgba(116, 222, 161, 0.78); }
.ai-skill-director > .ai-skill-mode-field { grid-template-columns: minmax(0, 1fr) minmax(150px, auto); align-items: center; cursor: default; }
.ai-skill-mode-field select { min-height: 34px; font-size: 11px; }

.ai-skill-route-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 9px 9px;
}

.ai-skill-route-summary > small { grid-column: 1 / -1; color: rgba(164, 195, 179, 0.64); }
.ai-skill-route-group { min-width: 0; padding: 7px; border: 1px solid rgba(225, 242, 233, 0.08); border-radius: 8px; background: rgba(255, 255, 255, 0.02); }
.ai-skill-route-group > strong { display: block; margin-bottom: 5px; color: rgba(221, 239, 229, 0.74); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.ai-skill-route-group > div { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-skill-route-group span { overflow: hidden; max-width: 100%; padding: 3px 5px; border-radius: 999px; color: rgba(221, 239, 229, 0.76); background: rgba(255, 255, 255, 0.045); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.ai-skill-route-group.is-active { border-color: rgba(93, 224, 149, 0.2); }
.ai-skill-route-group.is-active span { color: rgba(144, 245, 184, 0.9); background: rgba(68, 185, 116, 0.1); }
.ai-skill-route-group.is-suggested { border-color: rgba(237, 181, 91, 0.16); }
.ai-skill-route-group.is-suggested span { color: rgba(244, 203, 132, 0.82); }
.ai-skill-route-group.is-excluded { opacity: 0.64; }
.ai-skill-route-warning { grid-column: 1 / -1; margin: 0; padding: 6px 8px; border-radius: 7px; color: rgba(255, 201, 128, 0.84); background: rgba(170, 103, 31, 0.09); font-size: 9px; }

.ai-skill-library {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 9px 8px;
}

.ai-skill-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(225, 242, 233, 0.09);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.024);
}

.ai-skill-card:has(input:checked) {
  border-color: rgba(111, 224, 154, 0.27);
  background: rgba(67, 172, 106, 0.07);
}

.ai-skill-card.is-required,
.ai-skill-card.is-active { border-color: rgba(111, 224, 154, 0.27); background: rgba(67, 172, 106, 0.07); }
.ai-skill-card.is-required { box-shadow: inset 2px 0 rgba(91, 222, 147, 0.62); }
.ai-skill-card.is-suggested { border-color: rgba(233, 180, 91, 0.17); }
.ai-skill-card.is-excluded { opacity: 0.68; }

.ai-skill-card.is-director-managed { box-shadow: inset 2px 0 rgba(91, 222, 147, 0.52); }
.ai-skill-card input:disabled { opacity: 0.72; cursor: not-allowed; }

.ai-skill-card input { width: auto; margin-top: 2px; }
.ai-skill-card div { display: grid; min-width: 0; gap: 2px; }
.ai-skill-card .ai-skill-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.ai-skill-card strong { color: rgba(237, 247, 241, 0.88); font-size: 10px; }
.ai-skill-card small { color: rgba(169, 195, 181, 0.58); font-size: 9px; line-height: 1.4; }
.ai-skill-card .ai-skill-route-reason { color: rgba(177, 211, 194, 0.72); }
.ai-skill-tier { padding: 2px 5px; border-radius: 999px; color: rgba(178, 201, 188, 0.72); background: rgba(255, 255, 255, 0.05); font-size: 8px; white-space: nowrap; }
.ai-skill-tier.is-required,
.ai-skill-tier.is-active { color: rgba(135, 241, 177, 0.92); background: rgba(55, 179, 107, 0.13); }
.ai-skill-tier.is-suggested { color: rgba(246, 201, 124, 0.88); background: rgba(190, 123, 39, 0.1); }
.ai-skill-card button { min-width: 28px; min-height: 28px; padding: 4px; border: 0; border-radius: 7px; color: rgba(175, 210, 191, 0.72); background: rgba(255, 255, 255, 0.04); cursor: pointer; }
.ai-skill-card .ai-skill-override { min-width: 50px; padding-inline: 7px; font-size: 9px; }
.ai-skill-override.is-on { color: rgba(139, 244, 180, 0.94); background: rgba(55, 179, 107, 0.14); }
.ai-skill-override.is-off { color: rgba(255, 145, 145, 0.88); background: rgba(197, 63, 63, 0.12); }
.ai-skill-override.is-required { color: rgba(133, 195, 255, 0.9); background: rgba(68, 131, 210, 0.12); cursor: not-allowed; }

.ai-skill-editor {
  display: grid;
  gap: 8px;
  margin: 8px 9px 9px;
  padding: 10px;
  border: 1px solid rgba(117, 188, 238, 0.18);
  border-radius: 9px;
  background: rgba(5, 13, 17, 0.65);
}

.ai-skill-editor.is-hidden { display: none; }
.ai-skill-editor select[multiple] { min-height: 132px; }
.ai-skill-editor #aiSkillIntents,
.ai-skill-editor #aiSkillSourceKinds { min-height: 76px; }
.ai-skill-volume-range { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }

@media (max-width: 520px) {
  .ai-skill-route-summary { grid-template-columns: 1fr; }
  .ai-skill-route-warning { grid-column: 1; }
  .ai-skill-library { grid-template-columns: 1fr; }
  .ai-skill-director > .ai-skill-mode-field { grid-template-columns: 1fr; }
}

.ai-reference-label {
  margin-top: 9px;
}

.ai-reference-label small {
  color: var(--dim);
  font-size: 11px;
}

.ai-reference-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.ai-reference-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  border: 1px solid rgba(225, 242, 233, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.ai-reference-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 5px;
  object-fit: contain;
  background: rgba(7, 12, 10, 0.88);
}

.ai-reference-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 4px;
}

.ai-reference-controls select,
.ai-reference-controls button {
  min-width: 0;
  padding: 5px 6px;
  font-size: 11px;
}

.ai-reference-card > small,
.ai-candidate-reference-stats {
  color: rgba(148, 211, 238, 0.86) !important;
  font-size: 11px;
}

.ai-candidate-skill-stats {
  color: rgba(124, 229, 170, 0.88) !important;
  font-size: 10px !important;
}

.ai-candidate-quality-badge {
  justify-self: start;
  margin-top: 2px;
  padding: 3px 7px;
  border: 1px solid rgba(174, 139, 255, 0.34);
  border-radius: 999px;
  color: rgba(225, 211, 255, 0.96);
  font: 700 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, rgba(112, 78, 212, 0.22), rgba(83, 178, 219, 0.11));
}

.ai-candidate-quality-badge.is-concept {
  border-color: rgba(92, 184, 255, 0.34);
  color: rgba(178, 224, 255, 0.96);
}

.ai-candidate-quality-stats {
  color: rgba(211, 191, 255, 0.9) !important;
  font-size: 10px !important;
}

.ai-candidate-quality-stats.is-reduced {
  color: rgba(241, 190, 112, 0.9) !important;
}

.ai-generate-actions,
.ai-preview-actions {
  margin-top: 10px;
  justify-content: flex-end;
}

.ai-generate-actions .primary-button,
.ai-preview-actions .primary-button {
  flex: 1 1 auto;
}

.ai-generate-actions .ai-fast-generate {
  display: grid;
  flex: 0 1 190px;
  min-height: 42px;
  align-content: center;
  gap: 2px;
  padding: 7px 12px;
  border: 1px solid rgba(100, 194, 255, 0.27);
  border-radius: 9px;
  color: rgba(225, 244, 255, 0.94);
  background:
    radial-gradient(circle at 12% 0%, rgba(94, 196, 255, 0.18), transparent 48%),
    linear-gradient(145deg, rgba(31, 92, 124, 0.38), rgba(10, 25, 35, 0.68));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.ai-generate-actions .ai-fast-generate:hover:not(:disabled) {
  border-color: rgba(122, 213, 255, 0.52);
  transform: translateY(-1px);
}

.ai-generate-actions .ai-fast-generate:disabled { opacity: 0.48; cursor: wait; }
.ai-fast-generate span { font-size: 11px; font-weight: 760; }
.ai-fast-generate small { margin: 0 !important; color: rgba(174, 213, 232, 0.66); font-size: 9px; }

.ai-generate-actions small {
  margin-left: 6px;
  opacity: 0.56;
}

@media (max-width: 560px) {
  .ai-generate-actions { align-items: stretch; flex-direction: column; }
  .ai-generate-actions .ai-fast-generate { flex-basis: auto; width: 100%; min-height: 44px; }
}

.ai-generation-console {
  --console-success: #78e3a0;
  --console-running: #67b8ff;
  --console-waiting: #f2c66d;
  --console-retrying: #b99cff;
  --console-failed: #ff7e73;
  position: relative;
  overflow: clip;
  padding: 0;
  border-color: rgba(143, 224, 180, 0.17);
  background:
    radial-gradient(circle at 92% 4%, rgba(72, 141, 108, 0.13), transparent 34%),
    linear-gradient(155deg, rgba(10, 18, 15, 0.91), rgba(3, 8, 6, 0.87));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 18px 55px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(18px) saturate(118%);
}

.ai-candidate-progress.is-hidden,
.ai-console-summary.is-hidden,
.ai-console-error-actions.is-hidden,
.ai-console-cancel.is-hidden {
  display: none;
}

.ai-console-header {
  position: sticky;
  z-index: 3;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(216, 240, 227, 0.09);
  background: rgba(6, 13, 10, 0.88);
  backdrop-filter: blur(16px);
}

.ai-console-current {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.ai-console-current > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.ai-console-current small {
  color: rgba(166, 194, 179, 0.58);
  font: 700 9px/1.2 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.12em;
}

.ai-console-current strong {
  overflow: hidden;
  color: rgba(247, 252, 249, 0.95);
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-console-state-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(184, 204, 192, 0.38);
  box-shadow: 0 0 0 4px rgba(184, 204, 192, 0.06);
}

.ai-console-state-dot.is-running {
  background: var(--console-running);
  box-shadow: 0 0 0 4px rgba(103, 184, 255, 0.1), 0 0 18px rgba(103, 184, 255, 0.34);
  animation: ai-console-breathe 1.8s ease-in-out infinite;
}

.ai-console-state-dot.is-succeeded { background: var(--console-success); box-shadow: 0 0 15px rgba(120, 227, 160, 0.32); }
.ai-console-state-dot.is-partial { background: var(--console-waiting); box-shadow: 0 0 15px rgba(242, 198, 109, 0.3); }
.ai-console-state-dot.is-failed { background: var(--console-failed); box-shadow: 0 0 15px rgba(255, 126, 115, 0.3); }
.ai-console-state-dot.is-cancelled { background: var(--console-waiting); }

.ai-console-elapsed {
  min-width: 48px;
  color: rgba(214, 232, 222, 0.7);
  font: 650 11px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-align: right;
}

.ai-console-cancel {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 126, 115, 0.31);
  border-radius: 9px;
  color: #ffc4bd;
  background: rgba(132, 39, 32, 0.16);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ai-console-cancel:hover {
  border-color: rgba(255, 126, 115, 0.58);
  background: rgba(159, 48, 39, 0.23);
}

.ai-console-meta,
.ai-console-context {
  display: flex;
  gap: 6px;
  padding: 9px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-console-meta::-webkit-scrollbar,
.ai-console-context::-webkit-scrollbar {
  display: none;
}

.ai-console-meta > span,
.ai-console-context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  flex: 0 0 auto;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(219, 239, 228, 0.09);
  border-radius: 999px;
  color: rgba(210, 229, 218, 0.74);
  background: rgba(255, 255, 255, 0.028);
  font-size: 10px;
  white-space: nowrap;
}

.ai-console-meta .ai-console-safe {
  border-color: rgba(120, 227, 160, 0.17);
  color: rgba(151, 239, 181, 0.88);
  background: rgba(71, 160, 101, 0.08);
}

.ai-console-safe svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.ai-console-context {
  padding-top: 7px;
}

.ai-console-context-chip {
  max-width: min(360px, 80vw);
  border-radius: 8px;
}

.ai-console-context-chip strong {
  color: rgba(235, 246, 240, 0.84);
  font-size: 10px;
}

.ai-console-context-chip small {
  max-width: 235px;
  overflow: hidden;
  color: rgba(180, 205, 191, 0.63);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-stage-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--ai-stage-count, 6), minmax(64px, 1fr));
  gap: 4px;
  margin: 0;
  padding: 16px 12px 14px;
  overflow-x: auto;
  list-style: none;
}

.ai-stage-track::before {
  position: absolute;
  top: 29px;
  right: 38px;
  left: 38px;
  height: 1px;
  background: rgba(205, 229, 216, 0.11);
  content: "";
}

.ai-stage-track li {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 64px;
  justify-items: center;
  gap: 4px;
  color: rgba(167, 190, 178, 0.5);
  text-align: center;
}

.ai-stage-marker {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid rgba(209, 232, 219, 0.13);
  border-radius: 50%;
  background: #09110d;
  font: 700 10px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.ai-stage-track strong {
  color: inherit;
  font-size: 10px;
  white-space: nowrap;
}

.ai-stage-track small {
  font-size: 9px;
  white-space: nowrap;
}

.ai-stage-track li.is-running {
  color: var(--console-running);
}

.ai-stage-track li.is-running .ai-stage-marker {
  border-color: rgba(103, 184, 255, 0.52);
  box-shadow: 0 0 0 4px rgba(103, 184, 255, 0.07), 0 0 22px rgba(103, 184, 255, 0.18);
}

.ai-stage-track li.is-running::after {
  position: absolute;
  top: 13px;
  left: calc(50% + 16px);
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, rgba(103, 184, 255, 0.85), transparent);
  content: "";
  animation: ai-stage-flow 1.7s linear infinite;
}

.ai-stage-track li.is-succeeded { color: var(--console-success); }
.ai-stage-track li.is-succeeded .ai-stage-marker { border-color: rgba(120, 227, 160, 0.4); background: rgba(43, 111, 67, 0.17); }
.ai-stage-track li.is-warning { color: var(--console-waiting); }
.ai-stage-track li.is-failed { color: var(--console-failed); }
.ai-stage-track li.is-cancelled { color: var(--console-waiting); }

.ai-candidate-progress {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.ai-candidate-progress-card {
  position: relative;
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(218, 239, 227, 0.09);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
}

.ai-candidate-progress-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: rgba(180, 204, 191, 0.16);
  content: "";
}

.ai-candidate-progress-card.is-running::before { background: var(--console-running); box-shadow: 0 0 14px rgba(103, 184, 255, 0.34); }
.ai-candidate-progress-card.is-waiting::before,
.ai-candidate-progress-card.is-queued::before { background: var(--console-waiting); }
.ai-candidate-progress-card.is-retrying::before { background: var(--console-retrying); box-shadow: 0 0 14px rgba(185, 156, 255, 0.28); }
.ai-candidate-progress-card.is-succeeded::before { background: var(--console-success); }
.ai-candidate-progress-card.is-failed::before { background: var(--console-failed); }

.ai-candidate-progress-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.ai-candidate-number {
  color: rgba(163, 196, 178, 0.52);
  font: 700 9px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.ai-candidate-progress-card strong {
  overflow: hidden;
  color: rgba(240, 249, 244, 0.89);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-candidate-state {
  padding: 3px 5px;
  border-radius: 999px;
  color: rgba(218, 232, 224, 0.68);
  background: rgba(255, 255, 255, 0.04);
  font-size: 9px;
  white-space: nowrap;
}

.ai-candidate-progress-card.is-running .ai-candidate-state { color: var(--console-running); background: rgba(103, 184, 255, 0.08); }
.ai-candidate-progress-card.is-retrying .ai-candidate-state { color: var(--console-retrying); background: rgba(185, 156, 255, 0.09); }
.ai-candidate-progress-card.is-waiting .ai-candidate-state,
.ai-candidate-progress-card.is-queued .ai-candidate-state { color: var(--console-waiting); background: rgba(242, 198, 109, 0.07); }
.ai-candidate-progress-card.is-succeeded .ai-candidate-state { color: var(--console-success); background: rgba(120, 227, 160, 0.08); }
.ai-candidate-progress-card.is-failed .ai-candidate-state { color: var(--console-failed); background: rgba(255, 126, 115, 0.08); }

.ai-candidate-progress-card p {
  min-height: 32px;
  margin: 0;
  overflow-wrap: anywhere;
  color: rgba(192, 213, 201, 0.72);
  font-size: 11px;
  line-height: 1.45;
}

.ai-candidate-attempt {
  color: rgba(162, 188, 173, 0.54);
  font: 600 9px/1.3 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.ai-candidate-retry {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(185, 156, 255, 0.28);
  border-radius: 8px;
  color: rgba(215, 199, 255, 0.9);
  background: rgba(116, 82, 187, 0.1);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.ai-candidate-retry:disabled { cursor: wait; opacity: 0.55; }

.ai-console-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 12px 12px;
  padding: 9px 10px;
  overflow-x: auto;
  border: 1px solid rgba(120, 227, 160, 0.16);
  border-radius: 9px;
  background: rgba(67, 151, 96, 0.07);
  white-space: nowrap;
}

.ai-console-summary strong { color: var(--console-success); font-size: 11px; }
.ai-console-summary span { color: rgba(203, 224, 212, 0.7); font-size: 10px; }

.ai-research-details {
  margin: 0 12px 12px;
  border: 1px solid rgba(103, 184, 255, 0.14);
  border-radius: 9px;
  background: rgba(40, 91, 123, 0.055);
}

.ai-research-details.is-hidden { display: none; }
.ai-research-details.is-warning { border-color: rgba(242, 198, 109, 0.16); background: rgba(128, 91, 35, 0.05); }
.ai-research-details > summary { display: flex; min-height: 39px; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: rgba(211, 231, 242, 0.8); font-size: 11px; font-weight: 700; cursor: pointer; list-style: none; }
.ai-research-details > summary::-webkit-details-marker { display: none; }
.ai-research-details > summary span:last-child { color: rgba(142, 196, 226, 0.68); font-size: 9px; font-weight: 600; }
.ai-research-details > p { margin: 0; padding: 0 10px 9px; color: rgba(183, 207, 194, 0.7); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.ai-research-sources { display: grid; gap: 5px; padding: 0 10px 10px; }
.ai-research-sources a { display: grid; gap: 2px; min-width: 0; padding: 7px 8px; border: 1px solid rgba(103, 184, 255, 0.11); border-radius: 7px; color: rgba(148, 208, 242, 0.88); text-decoration: none; background: rgba(62, 126, 165, 0.05); }
.ai-research-sources a:hover { border-color: rgba(103, 184, 255, 0.3); background: rgba(62, 126, 165, 0.1); }
.ai-research-sources strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ai-research-sources small { overflow: hidden; color: rgba(145, 177, 194, 0.55); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.ai-process-log-details {
  border-top: 1px solid rgba(216, 239, 226, 0.08);
}

.ai-process-log-details > summary {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  color: rgba(213, 230, 220, 0.72);
  font-size: 11px;
  font-weight: 680;
  cursor: pointer;
  list-style: none;
}

.ai-process-log-details > summary::-webkit-details-marker { display: none; }
.ai-process-log-details > summary::after { margin-left: 6px; color: rgba(180, 205, 191, 0.5); content: "+"; }
.ai-process-log-details[open] > summary::after { content: "−"; }

.ai-process-log-count {
  margin-left: auto;
  color: rgba(165, 191, 176, 0.48);
  font: 600 9px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.ai-generation-process {
  max-height: 220px;
  display: grid;
  gap: 1px;
  padding: 0 12px 10px;
  overflow: auto;
}

.ai-process-row,
.ai-process-row > summary {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 6px;
  padding: 6px 4px;
  color: rgba(189, 211, 199, 0.7);
}

.ai-process-row {
  border-bottom: 1px solid rgba(220, 240, 229, 0.035);
}

.ai-process-row > summary {
  padding: 0;
  cursor: pointer;
  list-style: none;
}

.ai-process-row > summary::-webkit-details-marker { display: none; }
.ai-process-symbol { color: var(--console-running); font-weight: 800; }
.ai-process-row.is-succeeded .ai-process-symbol { color: var(--console-success); }
.ai-process-row.is-waiting .ai-process-symbol,
.ai-process-row.is-queued .ai-process-symbol { color: var(--console-waiting); }
.ai-process-row.is-retrying .ai-process-symbol { color: var(--console-retrying); }
.ai-process-row.error,
.ai-process-row.error .ai-process-symbol { color: var(--console-failed); }

.ai-process-row p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.45;
}

.ai-process-row > small {
  display: block;
  margin: 4px 0 2px 20px;
  color: rgba(255, 172, 162, 0.7);
  font: 550 10px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace;
  overflow-wrap: anywhere;
}

.ai-console-error-actions {
  display: flex;
  gap: 8px;
  padding: 0 12px 12px;
}

.ai-console-error-actions button {
  min-height: 36px;
  flex: 1 1 0;
}

@keyframes ai-console-breathe {
  0%, 100% { transform: scale(0.92); opacity: 0.74; }
  50% { transform: scale(1); opacity: 1; }
}

@keyframes ai-stage-flow {
  from { opacity: 0.28; transform: scaleX(0.25); transform-origin: left; }
  to { opacity: 0.9; transform: scaleX(1); transform-origin: left; }
}

.ai-candidates {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 82%);
  gap: 9px;
  padding: 2px 1px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x mandatory;
}

.ai-candidates > button {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(225, 242, 233, 0.11);
  border-radius: 9px;
  color: rgba(242, 249, 245, 0.88);
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  scroll-snap-align: start;
  overflow: hidden;
}

.ai-candidates > button.is-active {
  border-color: rgba(149, 240, 178, 0.48);
  background: rgba(149, 240, 178, 0.09);
}

.ai-candidate-failed-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 126, 115, 0.2);
  border-radius: 9px;
  color: rgba(242, 249, 245, 0.88);
  background: linear-gradient(145deg, rgba(116, 37, 31, 0.1), rgba(255, 255, 255, 0.018));
  scroll-snap-align: start;
}

.ai-candidate-failed-card .ai-candidate-thumbnail { border: 1px dashed rgba(255, 126, 115, 0.25); color: rgba(255, 169, 160, 0.8); text-align: center; }
.ai-candidate-failed-card .ai-candidate-thumbnail strong { font: 750 22px/1 ui-monospace, Consolas, monospace; }
.ai-candidate-failed-card .ai-candidate-thumbnail small { max-width: 80%; color: rgba(232, 183, 176, 0.7); white-space: pre-line; }
.ai-candidate-failed-card > strong { font-size: 11px; }
.ai-candidate-failed-card > .ai-candidate-retry { width: 100%; }

.ai-candidate-thumbnail {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(31, 50, 43, 0.9), rgba(9, 15, 12, 0.96));
}

.ai-candidate-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.ai-thumbnail-loading {
  max-width: 75%;
  color: rgba(220, 239, 229, 0.62);
  font-size: 9px;
  text-align: center;
}

.ai-thumbnail-error {
  max-width: 82%;
  color: rgba(255, 181, 170, 0.9);
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
}

.ai-candidate-summary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ai-candidates small,
.ai-preview-card > p {
  color: var(--dim);
  font-size: 11px;
  line-height: 1.45;
}

.ai-preview-card > label {
  margin-top: 9px;
}

.ai-refine-card {
  display: grid;
  gap: 9px;
  margin: 12px 0 4px;
  padding: 11px;
  border: 1px solid rgba(103, 170, 255, 0.2);
  border-radius: 11px;
  background:
    linear-gradient(135deg, rgba(45, 112, 184, 0.11), rgba(82, 48, 138, 0.07)),
    rgba(3, 10, 12, 0.48);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.ai-refine-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-refine-card > header > div { display: grid; gap: 2px; }
.ai-refine-card > header small:first-child { color: rgba(116, 183, 255, 0.72); font-size: 8px; letter-spacing: 0.14em; }
.ai-refine-card > header strong { color: rgba(239, 247, 255, 0.94); font-size: 12px; }
.ai-refine-card > header > span { max-width: 48%; color: rgba(166, 203, 236, 0.72); font-size: 9px; text-align: right; }
.ai-refine-card > textarea { min-height: 68px; resize: vertical; }
.ai-refine-card > small { color: rgba(179, 202, 217, 0.62); font-size: 9px; line-height: 1.5; }

.ai-refine-options {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(170px, 1.2fr) auto;
  align-items: end;
  gap: 8px;
}

.ai-refine-options label { display: grid; gap: 5px; color: var(--dim); font-size: 9px; }
.ai-refine-options .ai-checkbox { display: flex; min-height: 32px; align-items: center; }
.ai-refine-options button { min-height: 34px; }

@media (min-width: 1200px) {
  .ai-builder-panel.is-generating {
    width: min(640px, calc(100vw - 48px));
  }
}

@media (max-width: 900px) {
  .coordinate-hud {
    top: 80px;
    left: 12px;
    width: min(270px, calc(100vw - 24px));
  }

  .ai-builder-panel {
    top: 72px;
    right: 12px;
    bottom: 12px;
    width: min(440px, calc(100vw - 24px));
  }
}

@media (max-width: 520px) {
  .coordinate-hud {
    width: calc(100vw - 24px);
    padding: 9px 11px;
  }

  .coordinate-hud > div:nth-child(-n + 2) {
    display: none;
  }

  .ai-builder-panel {
    top: 64px;
    padding: 12px;
  }

  .ai-two-columns,
  .ai-generation-options,
  .ai-coordinate-fields {
    grid-template-columns: 1fr;
  }

  .ai-refine-options { grid-template-columns: 1fr; }
  .ai-refine-options .ai-checkbox,
  .ai-refine-options button { min-height: 44px; }
  .ai-refine-card > header { align-items: flex-start; }

  .ai-candidates {
    grid-auto-columns: minmax(240px, 92%);
  }

  .ai-reference-cards {
    grid-template-columns: 1fr;
  }

  .ai-prompt-compare,
  .ai-optimization-notes {
    grid-template-columns: 1fr;
  }

  .ai-console-header {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 60px;
  }

  .ai-console-cancel:not(.is-hidden) {
    position: fixed;
    z-index: 48;
    right: 24px;
    bottom: 24px;
    min-width: 132px;
    min-height: 44px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.44);
  }

  .ai-stage-track {
    grid-auto-flow: column;
    grid-auto-columns: 78px;
    grid-template-columns: none;
    scroll-snap-type: x proximity;
  }

  .ai-stage-track li {
    scroll-snap-align: center;
  }

  .ai-candidate-progress {
    grid-auto-flow: column;
    grid-auto-columns: minmax(248px, 88%);
    grid-template-columns: none;
    padding-bottom: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .ai-candidate-progress-card {
    min-height: 122px;
    scroll-snap-align: start;
  }

  .ai-console-meta > span,
  .ai-console-context-chip,
  .ai-process-log-details > summary,
  .ai-console-error-actions button {
    min-height: 44px;
  }

  .ai-two-columns .span-two,
  .ai-generation-options .command-warning {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-builder-panel,
  .ai-console-state-dot,
  .ai-stage-track li::after {
    transition: none !important;
    animation: none !important;
  }

  html:focus-within {
    scroll-behavior: auto;
  }
}

/* Structure editor ------------------------------------------------------ */

.edit-panel {
  position: fixed;
  z-index: 28;
  left: 24px;
  bottom: 84px;
  width: min(390px, calc(100vw - 48px));
  max-height: calc(100vh - 170px);
  padding: 15px;
  overflow: auto;
  color: var(--text);
  border-radius: 16px;
  transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
}

.edit-panel.is-hidden {
  transform: translateY(12px);
}

.edit-panel-head,
.edit-card-title,
.edit-history-row,
.edit-save-row,
.edit-head-actions,
.edit-inline {
  display: flex;
  align-items: center;
}

.edit-panel-head,
.edit-card-title {
  justify-content: space-between;
  gap: 10px;
}

.edit-panel-head > div:first-child {
  display: grid;
  gap: 3px;
}

.edit-panel-head strong {
  font-size: 15px;
}

.edit-head-actions,
.edit-inline {
  gap: 7px;
}

.edit-inline.wrap {
  flex-wrap: wrap;
}

.edit-dirty-badge,
.edit-revision-badge {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  font: 650 8px/1 ui-monospace, monospace;
  letter-spacing: 0.05em;
}

.edit-dirty-badge.is-dirty {
  color: #ffd890;
  border-color: rgba(255, 198, 93, 0.3);
  background: rgba(255, 198, 93, 0.08);
}

.edit-history-row {
  gap: 6px;
  margin-top: 12px;
}

.edit-history-row button {
  flex: 1;
}

.edit-save-row {
  gap: 6px;
  margin-top: 6px;
}

.edit-save-row .primary-button {
  flex: 1.2;
}

.edit-save-row .text-button {
  flex: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.edit-save-row .primary-button.is-saving {
  box-shadow: 0 0 0 2px rgba(149, 240, 178, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.primary-button.compact,
.text-button.compact {
  min-height: 34px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  justify-content: center;
}

.edit-panel kbd {
  padding: 1px 3px;
  color: currentColor;
  background: rgba(0, 0, 0, 0.16);
  border-radius: 3px;
  font: 600 7px/1 ui-monospace, monospace;
}

.edit-tool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 9px 0;
}

.edit-tool-grid button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.edit-tool-grid button.is-active {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.35);
  background: rgba(149, 240, 178, 0.09);
}

.edit-card {
  display: grid;
  gap: 9px;
  margin-top: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 11, 9, 0.52);
}

.edit-card.is-disabled {
  opacity: 0.58;
}

.edit-card-title strong,
.edit-details summary {
  font-size: 11px;
  font-weight: 650;
}

.edit-card-title small {
  max-width: 220px;
  overflow: hidden;
  color: var(--dim);
  font: 550 8px/1.35 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-panel label,
.edit-save-dialog label {
  display: grid;
  gap: 5px;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.edit-panel input[type="text"],
.edit-panel input[type="number"],
.edit-panel textarea,
.edit-panel select,
.edit-save-dialog select {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  color: var(--text);
  background: rgba(2, 5, 4, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font: 500 10px/1.45 ui-monospace, "Microsoft YaHei UI", sans-serif;
}

.edit-panel textarea {
  min-height: 48px;
  resize: vertical;
}

.edit-panel input:focus,
.edit-panel textarea:focus,
.edit-panel select:focus,
.edit-save-dialog select:focus {
  border-color: rgba(149, 240, 178, 0.48);
  box-shadow: 0 0 0 2px rgba(149, 240, 178, 0.07);
}

.edit-check {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 6px !important;
  cursor: pointer;
}

.edit-check input {
  accent-color: var(--accent);
}

.edit-details {
  padding: 8px;
  border: 1px solid rgba(230, 239, 233, 0.08);
  border-radius: 9px;
}

.edit-details[open] {
  display: grid;
  gap: 9px;
}

.edit-details summary {
  color: var(--muted);
  cursor: pointer;
}

.edit-details.is-hidden {
  display: none;
}

.edit-side-grid,
.edit-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edit-side-grid fieldset {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.edit-side-grid legend {
  padding: 0 4px;
  color: var(--dim);
  font-size: 9px;
}

.edit-side-grid input[type="color"] {
  width: 38px;
  height: 28px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
}

.edit-two-columns .span-two {
  grid-column: 1 / -1;
}

.edit-save-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 23px;
  overflow: auto;
  color: var(--text);
  border-radius: 18px;
}

.edit-save-dialog::backdrop {
  background: rgba(4, 7, 6, 0.74);
  backdrop-filter: blur(10px);
}

.edit-save-dialog > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.save-format-label {
  margin-top: 14px;
}

.edit-preflight-state {
  margin-top: 12px;
  padding: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.55;
}

.edit-preflight-state.is-safe {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.28);
}

.edit-preflight-state.is-lossy {
  color: #ffd890;
  border-color: rgba(255, 198, 93, 0.28);
}

.edit-loss-list {
  display: grid;
  gap: 5px;
  margin: 10px 0;
  padding-left: 20px;
  color: #f0c99a;
  font-size: 10px;
  line-height: 1.45;
}

.edit-save-dialog button:disabled,
.edit-panel button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.app.is-editing #viewport {
  cursor: crosshair;
}

.app.is-editing .tool-button#editButton {
  color: var(--accent);
  background: rgba(149, 240, 178, 0.12);
}

@media (max-width: 900px) {
  .edit-panel {
    left: 12px;
    bottom: 78px;
    width: min(380px, calc(100vw - 24px));
    max-height: min(66vh, 650px);
  }
}

@media (max-width: 500px) {
  .edit-side-grid,
  .edit-two-columns {
    grid-template-columns: 1fr;
  }

  .edit-two-columns .span-two {
    grid-column: auto;
  }

  .edit-history-row {
    flex-wrap: wrap;
  }

  .edit-history-row button {
    flex: 1 1 30%;
  }

  .edit-save-row .text-button kbd {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Container inventory ---------------------------------------------------- */

@media (min-width: 901px) {
  .inspector.has-selection.has-container {
    width: 430px;
  }
}

.container-section {
  flex: 0 0 auto;
  max-height: min(560px, 58vh);
  margin-top: 11px;
  padding: 14px;
  overflow: auto;
  border: 1px solid rgba(122, 204, 173, 0.29);
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 2%, rgba(112, 216, 173, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(18, 32, 26, 0.96), rgba(4, 8, 6, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.055), 0 16px 38px rgba(0, 0, 0, 0.2);
  scrollbar-color: rgba(149, 240, 178, 0.25) transparent;
  scrollbar-width: thin;
}

.container-section.is-hidden {
  display: none;
}

.container-head,
.container-summary,
.item-detail-head,
.container-subtitle,
.free-container-card-head,
.free-container-metrics {
  display: flex;
  align-items: center;
}

.container-head,
.free-container-card-head {
  justify-content: space-between;
  gap: 12px;
}

.container-head > div,
.free-container-card-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.container-head strong,
.free-container-card-head strong {
  overflow: hidden;
  color: #f3faf6;
  font-size: 14px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.container-source-badge {
  flex: 0 0 auto;
  padding: 5px 7px;
  border: 1px solid color-mix(in srgb, var(--source-color, #8d9992) 34%, transparent);
  border-radius: 7px;
  color: var(--source-color, #aab4ae);
  background: color-mix(in srgb, var(--source-color, #8d9992) 8%, transparent);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.container-source-badge.complete { --source-color: #86e6aa; }
.container-source-badge.partial { --source-color: #f2c46f; }
.container-source-badge.missing { --source-color: #a8b0ab; }
.container-source-badge.player-bound { --source-color: #bd9bff; }

.container-summary {
  gap: 8px;
  margin-top: 10px;
}

.container-summary > span {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.container-summary small {
  color: #8f9c95;
  font-size: 9px;
}

.container-summary strong {
  color: #edf7f1;
  font: 650 12px/1 ui-monospace, monospace;
}

.container-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.container-breadcrumbs:empty {
  display: none;
}

.container-breadcrumbs button {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #aebbb4;
  background: rgba(255, 255, 255, 0.025);
  font-size: 9px;
  cursor: pointer;
}

.container-breadcrumbs button:last-child {
  color: var(--accent);
  border-color: rgba(149, 240, 178, 0.22);
}

.container-breadcrumbs i {
  color: #59645e;
  font-style: normal;
  font-size: 9px;
}

.container-notice {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(245, 196, 111, 0.18);
  border-radius: 9px;
  color: #d8c69e;
  background: rgba(113, 84, 28, 0.09);
  font-size: 10px;
  line-height: 1.55;
}

.container-notice.is-hidden,
.unpositioned-section.is-hidden,
.item-detail.is-hidden,
.item-components.is-hidden {
  display: none;
}

.container-grid {
  --slot-size: 38px;
  --columns: 9;
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--slot-size));
  justify-content: center;
  gap: 3px;
  margin-top: 11px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 8px 28px rgba(0, 0, 0, 0.16);
}

.container-grid.loose {
  --columns: 8;
  justify-content: start;
}

.container-grid[data-layout="furnace"] {
  grid-template-columns: repeat(3, var(--slot-size));
  grid-template-rows: repeat(2, var(--slot-size));
  column-gap: 18px;
}

.container-grid[data-layout="furnace"] .inventory-slot:nth-child(1) { grid-area: 1 / 1; }
.container-grid[data-layout="furnace"] .inventory-slot:nth-child(2) { grid-area: 2 / 1; }
.container-grid[data-layout="furnace"] .inventory-slot:nth-child(3) { grid-area: 1 / 3 / span 2; align-self: center; }

.container-grid[data-layout="brewing"] {
  grid-template-columns: repeat(5, var(--slot-size));
  grid-template-rows: repeat(2, var(--slot-size));
}

.container-grid[data-layout="brewing"] .inventory-slot:nth-child(1) { grid-area: 2 / 2; }
.container-grid[data-layout="brewing"] .inventory-slot:nth-child(2) { grid-area: 2 / 3; }
.container-grid[data-layout="brewing"] .inventory-slot:nth-child(3) { grid-area: 2 / 4; }
.container-grid[data-layout="brewing"] .inventory-slot:nth-child(4) { grid-area: 1 / 3; }
.container-grid[data-layout="brewing"] .inventory-slot:nth-child(5) { grid-area: 1 / 1; }

.inventory-slot {
  position: relative;
  width: var(--slot-size);
  height: var(--slot-size);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(220, 235, 227, 0.11);
  border-radius: 5px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.008)),
    rgba(2, 5, 4, 0.7);
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.035), inset -1px -1px rgba(0, 0, 0, 0.35);
  cursor: default;
}

.inventory-slot.has-item {
  cursor: pointer;
}

.inventory-slot.has-item:hover,
.inventory-slot.has-item:focus-visible,
.inventory-slot.is-selected {
  z-index: 1;
  outline: none;
  border-color: rgba(149, 240, 178, 0.58);
  background: rgba(83, 157, 112, 0.13);
  box-shadow: 0 0 0 1px rgba(149, 240, 178, 0.12), 0 7px 18px rgba(0, 0, 0, 0.28);
}

.inventory-slot .item-count {
  position: absolute;
  right: 2px;
  bottom: 1px;
  z-index: 3;
  color: #fff;
  font: 800 11px/1 "Minecraft", ui-monospace, monospace;
  text-shadow: 1px 1px #111, -1px 1px #111, 1px -1px #111, -1px -1px #111;
}

.inventory-slot .durability-bar {
  position: absolute;
  right: 4px;
  bottom: 3px;
  left: 4px;
  z-index: 2;
  height: 2px;
  overflow: hidden;
  border-radius: 1px;
  background: rgba(0, 0, 0, 0.8);
}

.inventory-slot .durability-bar i {
  display: block;
  width: var(--durability, 100%);
  height: 100%;
  background: hsl(var(--durability-hue, 110) 76% 55%);
}

.item-icon {
  position: relative;
  width: 32px;
  height: 32px;
  display: inline-block;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.34));
}

.item-icon.large {
  width: 42px;
  height: 42px;
}

.item-icon.is-placeholder {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.9);
  background: var(--placeholder-color, #4f665a);
  font: 760 9px/1 ui-monospace, monospace;
}

.item-icon.is-placeholder::after {
  content: attr(data-short);
}

.inventory-slot.is-enchanted::after,
.free-container-icons .is-enchanted::after {
  position: absolute;
  inset: 2px;
  content: "";
  border-radius: 4px;
  background: linear-gradient(115deg, transparent 15%, rgba(196, 142, 255, 0.34) 43%, transparent 67%);
  mix-blend-mode: screen;
  animation: enchant-glint 2.8s linear infinite;
  pointer-events: none;
}

@keyframes enchant-glint {
  from { transform: translateX(-70%); }
  to { transform: translateX(70%); }
}

.container-subtitle {
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  color: #d7e3dc;
  font-size: 10px;
}

.container-subtitle small {
  color: #7f8c85;
  font-size: 8px;
}

.item-detail {
  margin-top: 11px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.22);
}

.item-detail-head {
  gap: 9px;
}

.item-detail-head > div {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.item-detail-head strong,
.item-detail-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-detail-head strong {
  color: #f3f8f5;
  font-size: 12px;
}

.item-detail-head small {
  color: #88958e;
  font: 500 9px/1.35 ui-monospace, monospace;
}

.item-detail-facts,
.item-enchantments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.item-detail-facts span,
.item-enchantments span {
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 6px;
  color: #b9c6bf;
  background: rgba(255, 255, 255, 0.025);
  font-size: 9px;
}

.item-enchantments span {
  color: #d9b8ff;
  border-color: rgba(199, 145, 255, 0.2);
}

.item-lore {
  margin-top: 8px;
  color: #b8a3d5;
  font-size: 10px;
  line-height: 1.55;
  white-space: pre-line;
}

.item-components {
  margin-top: 9px;
  color: #91a098;
  font-size: 9px;
}

.item-components summary {
  cursor: pointer;
}

.item-components pre {
  max-height: 150px;
  margin: 7px 0 0;
  padding: 8px;
  overflow: auto;
  border-radius: 7px;
  color: #a9cbb4;
  background: rgba(0, 0, 0, 0.28);
  font: 500 9px/1.5 ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.item-tooltip {
  position: fixed;
  z-index: 220;
  width: min(300px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid rgba(194, 151, 255, 0.34);
  border-radius: 9px;
  color: #f8f3ff;
  background: rgba(10, 5, 18, 0.97);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.52), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
  transform: translate(12px, 12px);
  pointer-events: none;
}

.item-tooltip.is-hidden {
  display: none;
}

.item-tooltip strong { font-size: 11px; }
.item-tooltip small { color: #9c8ab2; font: 500 9px/1.35 ui-monospace, monospace; }
.item-tooltip span { color: #d4cde0; font-size: 9px; }
.item-tooltip div { color: #b59bd5; font-size: 9px; line-height: 1.45; }

.app.free-container-target .free-camera-crosshair::before,
.app.free-container-target .free-camera-crosshair::after {
  background: #72e3bd;
  box-shadow: 0 0 9px rgba(114, 227, 189, 0.74);
}

.free-container-card {
  position: absolute;
  top: 50%;
  left: calc(50% + 28px);
  width: min(380px, calc(50vw - 50px));
  min-width: 280px;
  padding: 14px 15px;
  border: 1px solid rgba(114, 227, 189, 0.38);
  border-radius: 14px;
  background:
    radial-gradient(circle at 90% 0, rgba(114, 227, 189, 0.14), transparent 38%),
    rgba(5, 10, 8, 0.96);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.07);
  transform: translateY(-12px);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.free-container-card.is-hidden {
  display: none;
}

.free-container-card-head small {
  color: #98a79f;
  font: 500 9px/1 ui-monospace, monospace;
}

.free-container-metrics {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.free-container-metrics > span:not(.container-source-badge) {
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: #d0ddd6;
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
}

.free-container-icons {
  display: flex;
  gap: 4px;
  min-height: 36px;
  margin-top: 10px;
}

.free-container-icons > span {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
}

.free-container-card p {
  margin: 9px 0 0;
  color: #b5c2bb;
  font-size: 10px;
  line-height: 1.5;
}

.free-container-card p.is-hidden {
  display: none;
}

.free-container-card button {
  margin-top: 10px;
  padding: 7px 9px;
  border: 1px solid rgba(114, 227, 189, 0.25);
  border-radius: 7px;
  color: #aaf0d4;
  background: rgba(114, 227, 189, 0.075);
  font-size: 9px;
  cursor: pointer;
  pointer-events: auto;
}

.app.free-sign-target .free-camera-crosshair::before,
.app.free-sign-target .free-camera-crosshair::after {
  background: #f1c46f;
  box-shadow: 0 0 9px rgba(241, 196, 111, 0.78);
}

.free-sign-card {
  position: absolute;
  top: 50%;
  left: calc(50% + 28px);
  width: min(390px, calc(50vw - 50px));
  min-width: 300px;
  padding: 14px 15px;
  border: 1px solid rgba(241, 196, 111, 0.4);
  border-radius: 14px;
  background:
    radial-gradient(circle at 90% 0, rgba(241, 196, 111, 0.15), transparent 38%),
    rgba(10, 8, 5, 0.96);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.07);
  transform: translateY(-12px);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.free-sign-card.is-hidden {
  display: none;
}

.free-sign-card-head,
.free-sign-statuses,
.free-sign-side-head {
  display: flex;
  align-items: center;
}

.free-sign-card-head {
  justify-content: space-between;
  gap: 12px;
}

.free-sign-card-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.free-sign-card-head strong {
  color: #fff4dd;
  font-size: 14px;
  font-weight: 680;
}

.free-sign-card-head small {
  color: #a99e89;
  font: 500 9px/1 ui-monospace, monospace;
  white-space: nowrap;
}

.free-sign-statuses {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.free-sign-statuses .is-muted,
.free-sign-side-head .is-muted {
  opacity: 0.58;
}

.free-sign-side-head {
  gap: 6px;
  margin-top: 9px;
}

.free-sign-side-head > small {
  margin-right: auto;
  color: #887e6d;
  font: 600 8px/1 ui-monospace, monospace;
  white-space: nowrap;
}

.free-sign-side-tabs {
  display: inline-flex;
  padding: 2px;
  border: 1px solid rgba(241, 196, 111, 0.17);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.18);
  pointer-events: auto;
}

.free-sign-side-tabs button {
  min-width: 38px;
  padding: 5px 7px;
  border: 0;
  border-radius: 5px;
  color: #9f9686;
  background: transparent;
  font-size: 9px;
  cursor: pointer;
  touch-action: manipulation;
}

.free-sign-side-tabs button.is-active {
  color: #fff0cf;
  background: rgba(241, 196, 111, 0.16);
  box-shadow: inset 0 0 0 1px rgba(241, 196, 111, 0.12);
}

.free-sign-side-tabs button:disabled {
  cursor: default;
  opacity: 0.48;
}

.free-sign-lines {
  margin-top: 9px;
}

.free-sign-placeholder {
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 7px;
  color: #b5aa96;
  background: rgba(0, 0, 0, 0.17);
  font-size: 10px;
}

.free-sign-message {
  margin: 9px 0 0;
  padding: 7px 8px;
  border: 1px solid rgba(241, 196, 111, 0.14);
  border-radius: 7px;
  color: #cdbb94;
  background: rgba(113, 84, 28, 0.08);
  font-size: 9px;
  line-height: 1.5;
}

.free-sign-message.is-hidden {
  display: none;
}

.sign-source-badge.error {
  --sign-status-color: #ff9388;
}

.app.free-camera-touch .free-sign-card {
  top: calc(50% - 28px);
  left: 50%;
  width: min(390px, calc(100vw - 28px));
  min-width: 0;
  padding: 11px 12px;
  transform: translate(-50%, -100%);
}

.app.free-camera-touch .free-sign-side-tabs button {
  min-width: 48px;
  min-height: 32px;
  font-size: 10px;
}

@media (max-width: 650px) {
  .free-sign-card {
    top: calc(50% - 28px);
    left: 50%;
    width: min(390px, calc(100vw - 28px));
    min-width: 0;
    padding: 11px 12px;
    transform: translate(-50%, -100%);
  }

  .free-sign-side-head {
    flex-wrap: wrap;
  }
}

/* Sign text ------------------------------------------------------------- */

.sign-text-section {
  flex: 0 0 auto;
  margin-top: 11px;
  padding: 14px;
  border: 1px solid rgba(220, 175, 96, 0.28);
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 0%, rgba(225, 176, 87, 0.11), transparent 35%),
    linear-gradient(145deg, rgba(35, 27, 16, 0.95), rgba(9, 8, 6, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05), 0 16px 38px rgba(0, 0, 0, 0.18);
}

.sign-text-section.is-hidden {
  display: none;
}

.sign-text-head,
.sign-text-statuses,
.sign-side-card header,
.sign-text-load-row {
  display: flex;
  align-items: center;
}

.sign-text-head {
  justify-content: space-between;
  gap: 10px;
}

.sign-text-head > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sign-text-head strong {
  color: #fff4dd;
  font-size: 14px;
  font-weight: 680;
}

.sign-text-statuses {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.sign-source-badge,
.sign-waxed-badge {
  padding: 4px 6px;
  border: 1px solid color-mix(in srgb, var(--sign-status-color, #a8b0ab) 34%, transparent);
  border-radius: 6px;
  color: var(--sign-status-color, #a8b0ab);
  background: color-mix(in srgb, var(--sign-status-color, #a8b0ab) 8%, transparent);
  font-size: 8px;
  font-weight: 720;
  white-space: nowrap;
}

.sign-source-badge.complete { --sign-status-color: #86e6aa; }
.sign-source-badge.partial { --sign-status-color: #f2c46f; }
.sign-source-badge.missing { --sign-status-color: #a8b0ab; }
.sign-source-badge.loading { --sign-status-color: #88bff0; }
.sign-waxed-badge { --sign-status-color: #d5b4ff; }
.sign-waxed-badge.is-hidden { display: none; }

.sign-text-load-row {
  justify-content: space-between;
  margin-top: 8px;
  color: #8f8675;
  font-size: 9px;
}

.sign-notice {
  margin: 9px 0 0;
  padding: 8px 9px;
  border: 1px solid rgba(242, 196, 111, 0.18);
  border-radius: 8px;
  color: #d8c69e;
  background: rgba(113, 84, 28, 0.09);
  font-size: 9px;
  line-height: 1.55;
}

.sign-notice.is-hidden {
  display: none;
}

.sign-side-card {
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
}

.sign-side-card.unavailable {
  opacity: 0.68;
}

.sign-side-card header {
  gap: 6px;
  min-height: 24px;
}

.sign-side-card header > strong {
  margin-right: auto;
  color: #f5ead5;
  font-size: 11px;
}

.sign-side-card .copy-button {
  padding: 4px 6px;
  font-size: 8px;
}

.sign-color-badge,
.sign-glow-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  color: #a8a196;
  background: rgba(255, 255, 255, 0.025);
  font: 650 8px/1 ui-monospace, monospace;
}

.sign-color-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: var(--sign-text-color, #1d1d21);
  box-shadow: 0 0 6px color-mix(in srgb, var(--sign-text-color, #1d1d21) 55%, transparent);
}

.sign-glow-badge.active {
  color: #fff1a8;
  border-color: rgba(255, 226, 112, 0.24);
  background: rgba(255, 226, 112, 0.07);
  box-shadow: 0 0 10px rgba(255, 222, 103, 0.08);
}

.sign-lines {
  display: grid;
  gap: 3px;
  margin-top: 7px;
}

.sign-line {
  min-width: 0;
  min-height: 25px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  padding: 4px 7px;
  border-radius: 6px;
  color: #ede5d7;
  background: rgba(0, 0, 0, 0.17);
}

.sign-line small {
  color: #746d61;
  font: 650 8px/1 ui-monospace, monospace;
}

.sign-line b {
  overflow-wrap: anywhere;
  font: 560 10px/1.45 "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  white-space: pre-wrap;
}

.sign-line.empty b,
.sign-line.unavailable {
  color: #77736c;
  font-weight: 500;
}

.sign-line.unavailable {
  display: flex;
  font-size: 9px;
}

@media (max-width: 900px) {
  .inspector.has-selection.has-container {
    height: min(580px, calc(100vh - 96px));
  }

  .container-section {
    max-height: none;
  }
}

@media (max-width: 650px) {
  .container-section {
    padding: 11px;
  }

  .container-grid {
    --slot-size: min(9vw, 36px);
    gap: 2px;
    padding: 6px;
  }

  .free-container-card,
  .app.free-camera-touch .free-container-card {
    top: calc(50% - 28px);
    left: 50%;
    width: min(380px, calc(100vw - 28px));
    min-width: 0;
    padding: 11px 12px;
    transform: translate(-50%, -100%);
  }

  .free-container-card button {
    min-height: 32px;
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .inventory-slot.is-enchanted::after,
  .free-container-icons .is-enchanted::after {
    animation: none;
  }
}

/* Crosshair block editing and backpack --------------------------------- */

.app.free-edit-target .free-camera-crosshair::before,
.app.free-edit-target .free-camera-crosshair::after {
  background: #9dffbb;
  box-shadow: 0 0 10px rgba(157, 255, 187, 0.82);
}

.free-edit-target-card {
  position: absolute;
  top: 50%;
  left: calc(50% - 28px);
  width: min(370px, calc(50vw - 50px));
  min-width: 300px;
  padding: 13px 14px;
  border: 1px solid rgba(157, 255, 187, 0.36);
  border-radius: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0, rgba(157, 255, 187, 0.13), transparent 38%),
    rgba(5, 10, 8, 0.96);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.07);
  transform: translate(-100%, -12px);
  backdrop-filter: blur(16px);
  pointer-events: none;
}

.free-edit-target-card.is-hidden,
.free-edit-hotbar.is-hidden {
  display: none;
}

.free-edit-target-head,
.free-edit-placement,
.block-inventory-selected,
.block-inventory-result-head {
  display: flex;
  align-items: center;
}

.free-edit-target-head {
  gap: 9px;
}

.free-edit-target-head > div {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 2px;
}

.free-edit-target-head strong,
.free-edit-placement strong {
  overflow: hidden;
  color: #effbf3;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.free-edit-target-head small,
.free-edit-placement code,
.block-inventory-selected code {
  overflow: hidden;
  color: #90a99a;
  font: 500 8px/1.35 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.free-edit-target-head > span:last-child {
  color: #94a098;
  font: 500 8px/1 ui-monospace, monospace;
  white-space: nowrap;
}

.free-edit-target-swatch,
.free-edit-placement > span,
.block-inventory-selected > span:first-child,
.block-inventory-entry-swatch,
.free-edit-hotbar-swatch {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  background-color: #38423b;
  background-repeat: no-repeat;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.free-edit-target-swatch {
  width: 36px;
  height: 36px;
}

.free-edit-placement {
  gap: 8px;
  margin-top: 9px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.16);
}

.free-edit-placement > span {
  width: 30px;
  height: 30px;
}

.free-edit-placement > div {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 1px;
}

.free-edit-placement small {
  color: var(--dim);
  font-size: 7px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.free-edit-target-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 9px;
  pointer-events: auto;
}

.free-edit-target-actions button {
  min-width: 0;
  min-height: 37px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 3px;
  border: 1px solid rgba(157, 255, 187, 0.17);
  border-radius: 8px;
  color: #dcebe1;
  background: rgba(157, 255, 187, 0.055);
  cursor: pointer;
  touch-action: manipulation;
}

.free-edit-target-actions button:hover,
.free-edit-target-actions button:focus-visible {
  color: var(--accent);
  border-color: rgba(157, 255, 187, 0.38);
  background: rgba(157, 255, 187, 0.12);
}

.free-edit-target-actions button:disabled {
  opacity: 0.38;
  cursor: wait;
}

.free-edit-target-actions b {
  overflow: hidden;
  font-size: 9px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.free-edit-target-actions small {
  color: #789083;
  font: 600 7px/1 ui-monospace, monospace;
}

.free-edit-hotbar {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(225, 238, 230, 0.16);
  border-radius: 12px;
  background: rgba(5, 9, 7, 0.88);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.46), inset 0 1px rgba(255, 255, 255, 0.06);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.free-edit-hotbar-slots {
  display: grid;
  grid-template-columns: repeat(9, 42px);
  gap: 3px;
}

.free-edit-hotbar-slot {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  touch-action: manipulation;
}

.free-edit-hotbar-slot.is-active {
  border-color: rgba(157, 255, 187, 0.78);
  background: rgba(157, 255, 187, 0.13);
  box-shadow: 0 0 0 2px rgba(157, 255, 187, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.free-edit-hotbar-slot > small {
  position: absolute;
  top: 2px;
  left: 4px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.7);
  font: 650 7px/1 ui-monospace, monospace;
  text-shadow: 0 1px 2px #000;
}

.free-edit-hotbar-slot > i {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 2;
  padding: 2px;
  border-radius: 3px;
  color: #ffdd8a;
  background: rgba(45, 31, 4, 0.88);
  font: 700 5px/1 ui-monospace, monospace;
  font-style: normal;
}

.free-edit-hotbar-swatch {
  width: 32px;
  height: 32px;
}

.free-edit-hotbar-actions {
  min-width: 58px;
  height: 42px;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 3px;
}

.free-edit-hotbar-action {
  display: grid;
  place-items: center;
  grid-template-columns: auto auto;
  gap: 4px;
  min-height: 0;
  padding: 2px 6px;
  border: 1px solid rgba(157, 255, 187, 0.22);
  border-radius: 8px;
  color: var(--accent);
  background: rgba(157, 255, 187, 0.07);
  cursor: pointer;
  touch-action: manipulation;
}

.free-edit-hotbar-action:hover:not(:disabled),
.free-edit-hotbar-action:focus-visible {
  border-color: rgba(157, 255, 187, 0.5);
  background: rgba(157, 255, 187, 0.13);
}

.free-edit-hotbar-action:disabled {
  opacity: 0.4;
  cursor: wait;
}

.free-edit-hotbar-action > span {
  font-size: 14px;
  line-height: 1;
}

.free-edit-hotbar-action > small {
  font: 650 7px/1 ui-monospace, monospace;
  white-space: nowrap;
}

.block-inventory-dialog,
.item-inventory-dialog {
  width: min(920px, calc(100vw - 34px));
  height: min(780px, calc(100vh - 42px));
  padding: 22px;
  overflow: hidden;
  color: var(--text);
  border-radius: 19px;
}

.block-inventory-dialog::backdrop,
.item-inventory-dialog::backdrop {
  background: rgba(3, 6, 5, 0.8);
  backdrop-filter: blur(11px);
}

.block-inventory-dialog[open] {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  gap: 11px;
}

.item-inventory-dialog[open] {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 11px;
}

.block-inventory-dialog > p,
.item-inventory-dialog > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.block-inventory-search,
.block-inventory-options label,
.item-inventory-editor label {
  display: grid;
  gap: 5px;
  color: var(--dim);
  font-size: 9px;
}

.block-inventory-search input,
.block-inventory-options textarea,
.item-inventory-editor input,
.item-inventory-editor textarea {
  width: 100%;
  min-height: 37px;
  padding: 8px 10px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: rgba(2, 5, 4, 0.76);
  font: 500 10px/1.45 ui-monospace, "Microsoft YaHei UI", sans-serif;
}

.block-inventory-search input:focus,
.block-inventory-options textarea:focus,
.item-inventory-editor input:focus,
.item-inventory-editor textarea:focus {
  border-color: rgba(157, 255, 187, 0.45);
  box-shadow: 0 0 0 2px rgba(157, 255, 187, 0.07);
}

.block-inventory-selected {
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(157, 255, 187, 0.17);
  border-radius: 11px;
  background: rgba(157, 255, 187, 0.045);
}

.block-inventory-selected > span:first-child {
  width: 40px;
  height: 40px;
}

.block-inventory-selected > div {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 3px;
}

.block-inventory-selected strong {
  font-size: 13px;
}

.block-inventory-selected > span:last-child {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(157, 255, 187, 0.09);
  font: 650 8px/1 ui-monospace, monospace;
}

.block-inventory-options {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
}

.block-inventory-options textarea {
  min-height: 37px;
  resize: vertical;
}

.block-inventory-result-head {
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.block-inventory-result-head strong {
  font-size: 11px;
}

.block-inventory-result-head small {
  color: var(--dim);
  font: 500 8px/1 ui-monospace, monospace;
}

.block-inventory-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  gap: 6px;
  min-height: 0;
  padding-right: 5px;
  overflow: auto;
}

.edit-container-notice {
  margin: 7px 0 10px;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.5;
}

.edit-container-notice.is-warning {
  color: #ffcf78;
}

.item-inventory-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(157, 255, 187, 0.17);
  border-radius: 11px;
  background: rgba(157, 255, 187, 0.045);
}

.item-inventory-context > .item-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  image-rendering: pixelated;
}

.item-inventory-context > div {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 3px;
}

.item-inventory-context strong,
.item-inventory-context code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-inventory-context strong {
  color: #effbf3;
  font-size: 13px;
}

.item-inventory-context code {
  color: #90a99a;
  font: 500 8px/1.35 ui-monospace, monospace;
}

.item-inventory-context > span:last-child {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(157, 255, 187, 0.09);
  font: 650 8px/1 ui-monospace, monospace;
}

.item-inventory-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.item-inventory-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.item-inventory-categories button {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-size: 9px;
  cursor: pointer;
}

.item-inventory-categories button:hover,
.item-inventory-categories button:focus-visible,
.item-inventory-categories button.is-active {
  color: var(--accent);
  border-color: rgba(157, 255, 187, 0.36);
  background: rgba(157, 255, 187, 0.1);
}

.item-inventory-body {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 12px;
  min-height: 0;
}

.item-inventory-catalog,
.item-inventory-editor {
  min-height: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.13);
}

.item-inventory-catalog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 9px;
}

.item-inventory-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(48px, 1fr));
  align-content: start;
  gap: 5px;
  min-height: 0;
  padding-right: 4px;
  overflow: auto;
}

.item-inventory-entry {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  color: #dce5df;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.item-inventory-entry:hover,
.item-inventory-entry:focus-visible,
.item-inventory-entry.is-active {
  border-color: rgba(157, 255, 187, 0.42);
  background: rgba(157, 255, 187, 0.1);
}

.item-inventory-entry > .item-icon {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.item-inventory-entry > small {
  position: absolute;
  right: 3px;
  bottom: 3px;
  max-width: calc(100% - 6px);
  overflow: hidden;
  color: rgba(232, 244, 236, 0.78);
  font: 600 6px/1 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}

.item-inventory-entry.has-nbt::before {
  content: "NBT";
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 1;
  padding: 2px 3px;
  border-radius: 4px;
  color: #ffdd8a;
  background: rgba(52, 35, 5, 0.86);
  font: 700 5px/1 ui-monospace, monospace;
}

.item-inventory-editor {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow: auto;
}

.item-inventory-editor textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
}

.item-inventory-nbt-hint {
  color: var(--dim);
  font-size: 8px;
  line-height: 1.5;
}

.item-inventory-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.block-inventory-entry {
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 3px 7px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  color: #dce5df;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
}

.block-inventory-entry:hover,
.block-inventory-entry:focus-visible,
.block-inventory-entry.is-active {
  color: var(--accent);
  border-color: rgba(157, 255, 187, 0.34);
  background: rgba(157, 255, 187, 0.08);
}

.block-inventory-entry-swatch {
  grid-row: 1 / -1;
  width: 34px;
  height: 34px;
}

.block-inventory-entry strong,
.block-inventory-entry small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-inventory-entry strong {
  font-size: 9px;
}

.block-inventory-entry small {
  color: #75867c;
  font: 500 7px/1.3 ui-monospace, monospace;
}

.app.free-edit-ui-open .free-camera-capture-prompt,
.app.free-edit-ui-open .free-edit-target-card,
.app.free-edit-ui-open .free-command-card,
.app.free-edit-ui-open .free-sign-card,
.app.free-edit-ui-open .free-container-card {
  display: none;
}

@media (max-width: 1000px) {
  .block-inventory-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .item-inventory-grid {
    grid-template-columns: repeat(6, minmax(46px, 1fr));
  }
}

@media (max-width: 650px) {
  .free-edit-target-card,
  .app.free-camera-touch .free-edit-target-card {
    top: calc(50% + 30px);
    left: 50%;
    width: min(390px, calc(100vw - 24px));
    min-width: 0;
    padding: 10px 11px;
    transform: translateX(-50%);
  }

  .free-edit-target-actions button {
    min-height: 44px;
  }

  .free-edit-target-actions small {
    display: none;
  }

  .free-edit-hotbar,
  .app.free-camera-touch .free-edit-hotbar {
    top: max(132px, calc(env(safe-area-inset-top) + 122px));
    bottom: auto;
    gap: 4px;
    padding: 4px;
  }

  .free-edit-hotbar-slots {
    grid-template-columns: repeat(9, 32px);
    gap: 2px;
  }

  .free-edit-hotbar-slot {
    width: 32px;
    height: 34px;
    padding: 2px;
  }

  .free-edit-hotbar-swatch {
    width: 27px;
    height: 27px;
  }

  .free-edit-hotbar-actions {
    min-width: 42px;
    height: auto;
    grid-template-rows: repeat(2, 32px);
  }

  .free-edit-hotbar-action {
    grid-template-columns: 1fr;
    padding: 3px;
  }

  .free-edit-hotbar-action > span {
    font-size: 17px;
  }

  .free-edit-hotbar-action > small {
    display: none;
  }

  .block-inventory-dialog,
  .item-inventory-dialog {
    width: calc(100vw - 18px);
    height: calc(100vh - 18px);
    padding: 14px;
  }

  .block-inventory-dialog > p,
  .item-inventory-dialog > p {
    display: none;
  }

  .block-inventory-dialog[open] {
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
  }

  .block-inventory-options {
    grid-template-columns: 1fr 1fr;
  }

  .block-inventory-options label:first-child {
    grid-column: 1 / -1;
  }


  .block-inventory-options label:nth-child(2) {
    grid-column: 1 / -1;
  }

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


  .item-inventory-dialog[open] {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .item-inventory-toolbar {
    grid-template-columns: 1fr;
  }

  .item-inventory-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 1fr) auto;
    overflow: auto;
  }

  .item-inventory-grid {
    grid-template-columns: repeat(5, minmax(44px, 1fr));
  }

  .item-inventory-editor {
    overflow: visible;
  }
}

/* Bedrock world region -------------------------------------------------- */

.world-dialog {
  width: min(820px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 48px));
  padding: 25px;
  overflow: auto;
  color: var(--text);
  border-radius: 20px;
}

.world-dialog::backdrop {
  background: rgba(4, 7, 6, 0.72);
  backdrop-filter: blur(10px);
}

.world-summary {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 0.8fr;
  gap: 8px;
  margin: 19px 0 12px;
}

.world-summary > div,
.world-region-metrics > span {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.world-summary small,
.world-region-metrics small,
.world-section-head small {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font: 650 8px/1 ui-monospace, monospace;
  letter-spacing: 0.12em;
}

.world-summary strong {
  display: block;
  overflow: hidden;
  color: #dce4df;
  font-size: 11px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-dialog-section {
  margin-top: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 12, 10, 0.62);
}

.world-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.world-section-head strong {
  font-size: 12px;
  font-weight: 560;
}

.world-dimension-tabs,
.world-presets {
  display: flex;
  gap: 6px;
}

.world-dimension-tabs {
  margin-top: 12px;
}

.world-dimension-tabs button,
.world-presets button {
  min-height: 31px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font: 620 9px/1 ui-monospace, monospace;
  cursor: pointer;
}

.world-dimension-tabs button {
  flex: 1;
}

.world-dimension-tabs button.is-active,
.world-presets button.is-active {
  border-color: rgba(149, 240, 178, 0.45);
  color: var(--accent);
  background: rgba(149, 240, 178, 0.08);
}

.world-dimension-tabs button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.world-bounds {
  margin: 10px 0 0;
  color: var(--dim);
  font: 500 9px/1.6 ui-monospace, monospace;
}

.world-coordinate-grid {
  display: grid;
  grid-template-columns: 30px 1fr 1fr;
  gap: 7px;
  align-items: center;
  margin-top: 13px;
}

.world-coordinate-grid > small {
  color: var(--dim);
  font: 650 8px/1 ui-monospace, monospace;
  letter-spacing: 0.12em;
  text-align: center;
}

.world-coordinate-grid label {
  color: var(--accent);
  font: 700 10px/1 ui-monospace, monospace;
}

.world-coordinate-grid input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: #e0e8e3;
  background: rgba(0, 0, 0, 0.24);
  font: 560 11px/1 ui-monospace, monospace;
}

.world-coordinate-grid input:focus {
  border-color: rgba(149, 240, 178, 0.52);
  box-shadow: 0 0 0 2px rgba(149, 240, 178, 0.08);
}

.world-region-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.world-region-metrics strong {
  font: 620 11px/1.2 ui-monospace, monospace;
}

.world-region-metrics strong.error {
  color: var(--danger);
}

.world-region-error {
  min-height: 17px;
  margin: 9px 0 0;
  color: var(--danger);
  font-size: 10px;
  line-height: 1.55;
}

.world-region-error.is-info {
  color: #8fb8d8;
}

.world-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.world-dialog-actions button {
  min-height: 39px;
}

.world-dialog-actions .primary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.world-region-reopen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(149, 240, 178, 0.24);
  border-radius: 11px;
  color: var(--accent);
  background: rgba(149, 240, 178, 0.055);
  cursor: pointer;
}

.world-region-reopen span {
  color: var(--dim);
  font: 650 8px/1 ui-monospace, monospace;
  letter-spacing: 0.1em;
}

.world-region-reopen strong {
  font-size: 10px;
  font-weight: 570;
}

.world-region-reopen.is-hidden {
  display: none;
}

@media (max-width: 650px) {
  .world-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 17px;
  }

  .world-summary {
    grid-template-columns: 1fr 1fr;
  }

  .world-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .world-presets,
  .world-presets button {
    width: 100%;
  }

  .world-dimension-tabs {
    flex-wrap: wrap;
  }

  .world-dimension-tabs button {
    flex: 1 1 30%;
  }
}

/* File opening mode selector ------------------------------------------------ */
.open-mode-dialog {
  width: min(920px, calc(100vw - 36px));
  padding: 26px;
  overflow: hidden;
  color: var(--text);
  border-radius: 22px;
  background:
    radial-gradient(circle at 82% 12%, rgba(89, 190, 126, 0.12), transparent 34%),
    rgba(13, 18, 16, 0.96);
}

.open-mode-dialog::backdrop {
  background: rgba(3, 6, 5, 0.8);
  backdrop-filter: blur(13px);
}

.open-mode-file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 8, 6, 0.46);
}

.open-mode-file-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(149, 240, 178, 0.28);
  border-radius: 9px;
  color: var(--accent);
  background: rgba(149, 240, 178, 0.07);
  font-size: 11px;
}

.open-mode-file div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.open-mode-file strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.open-mode-file small {
  color: var(--muted);
  font: 520 9px/1.35 ui-monospace, monospace;
}

.open-mode-quality {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(149, 240, 178, 0.14);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(149, 240, 178, 0.055), rgba(5, 10, 7, 0.42));
}

.open-mode-quality-copy {
  display: grid;
  gap: 4px;
}

.open-mode-quality-copy small {
  color: var(--accent);
  font: 700 8px/1 ui-monospace, monospace;
  letter-spacing: 0.14em;
}

.open-mode-quality-copy strong { font-size: 12px; }
.open-mode-quality-copy span { color: var(--muted); font-size: 9px; line-height: 1.45; }

.open-mode-quality-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(149, 240, 178, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.open-mode-quality-switch button {
  min-height: 48px;
  display: grid;
  place-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #849189;
  background: transparent;
  cursor: pointer;
}

.open-mode-quality-switch button strong { font-size: 10px; font-weight: 650; }
.open-mode-quality-switch button small { color: inherit; font-size: 8px; }
.open-mode-quality-switch button:hover,
.open-mode-quality-switch button.is-active {
  color: #cff7da;
  border-color: rgba(149, 240, 178, 0.26);
  background: rgba(149, 240, 178, 0.1);
  box-shadow: inset 0 0 18px rgba(149, 240, 178, 0.025);
}

.open-mode-recommendation {
  padding: 5px 8px;
  border: 1px solid rgba(124, 183, 255, 0.22);
  border-radius: 999px;
  color: #9bc5f3;
  background: rgba(63, 124, 190, 0.08);
  font-size: 9px;
  white-space: nowrap;
}

.open-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.open-mode-card {
  position: relative;
  min-height: 286px;
  display: grid;
  grid-template-rows: 105px 1fr auto;
  gap: 15px;
  padding: 17px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--text);
  background: linear-gradient(155deg, rgba(30, 38, 34, 0.84), rgba(7, 11, 9, 0.72));
  cursor: pointer;
  transition: transform 190ms ease, border-color 190ms ease, box-shadow 190ms ease;
}

.open-mode-card:hover,
.open-mode-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(149, 240, 178, 0.38);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 30px rgba(105, 219, 143, 0.05);
}

.open-mode-card.is-device-recommended {
  border-color: rgba(149, 240, 178, 0.28);
  box-shadow: inset 0 0 36px rgba(91, 202, 127, 0.025);
}

.open-mode-card.is-recommended::after {
  content: "低配 / 大型建筑推荐";
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 8px;
  border: 1px solid rgba(149, 240, 178, 0.25);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(8, 18, 12, 0.78);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.open-mode-card-visual {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    radial-gradient(circle at 52% 60%, rgba(149, 240, 178, 0.17), transparent 40%),
    linear-gradient(145deg, #121b17, #080c0a);
}

.open-mode-card-visual.render i {
  position: absolute;
  left: calc(50% - 27px);
  top: calc(50% - 27px);
  width: 54px;
  height: 54px;
  border: 1px solid rgba(149, 240, 178, 0.58);
  background: rgba(149, 240, 178, 0.06);
  transform: rotate(30deg) skewY(-8deg);
}

.open-mode-card-visual.render i:nth-child(2) { transform: translate(-19px, 12px) rotate(30deg) skewY(-8deg); opacity: 0.45; }
.open-mode-card-visual.render i:nth-child(3) { transform: translate(19px, -12px) rotate(30deg) skewY(-8deg); opacity: 0.75; }

.open-mode-card-visual.gallery {
  display: grid;
  grid-template-columns: repeat(2, 60px);
  grid-template-rows: repeat(2, 36px);
  align-content: center;
  justify-content: center;
  gap: 5px;
}

.open-mode-card-visual.gallery i {
  border: 1px solid rgba(149, 240, 178, 0.38);
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(149, 240, 178, 0.18), rgba(45, 78, 58, 0.04));
}

.open-mode-card-copy {
  display: grid;
  align-content: start;
  gap: 7px;
}

.open-mode-card-copy small {
  color: var(--accent);
  font: 700 8px/1 ui-monospace, monospace;
  letter-spacing: 0.15em;
}

.open-mode-card-copy strong { font-size: 17px; font-weight: 620; }
.open-mode-card-copy em { color: #c9d3ce; font-size: 10px; font-style: normal; }
.open-mode-card-copy span { color: var(--muted); font-size: 10px; line-height: 1.6; }

.open-mode-card > b {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(149, 240, 178, 0.22);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(149, 240, 178, 0.065);
  font-size: 11px;
  font-weight: 600;
}

.open-mode-note {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.55;
}

/* Low-memory nine-view gallery -------------------------------------------- */
.multi-view-gallery {
  position: absolute;
  z-index: 22;
  inset: 92px 18px 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  opacity: 1;
  transition: opacity 220ms ease, transform 220ms ease;
}

.app.is-multiview #viewport,
.app.is-multiview .inspector,
.app.is-multiview .tool-dock,
.app.is-multiview .layer-control,
.app.is-multiview .view-hint,
.app.is-multiview .performance-badge,
.app.is-multiview .viewport-frame,
.app.is-multiview .coordinate-hud,
.app.is-multiview .edit-panel,
.app.is-multiview .ai-builder-panel {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.app.is-multiview .empty-state { opacity: 0; visibility: hidden; }

.multi-view-gallery-head,
.multi-view-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 14px;
}

.multi-view-gallery-head { padding: 13px 14px 13px 17px; }
.multi-view-gallery-title { min-width: 0; }
.multi-view-gallery-title h2 { margin: 3px 0 2px; font-size: 15px; font-weight: 620; }
.multi-view-gallery-title p { margin: 0; color: var(--muted); font-size: 9px; }
.multi-view-gallery-actions { display: flex; align-items: center; gap: 7px; flex: none; }

.multi-view-status {
  min-height: 47px;
  padding: 8px 12px;
  background: rgba(15, 21, 18, 0.72);
}

.multi-view-status > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  align-items: center;
  gap: 2px 9px;
}

.multi-view-stage-dot {
  grid-row: 1 / 3;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7fb4f0;
  box-shadow: 0 0 0 5px rgba(92, 153, 223, 0.08), 0 0 12px rgba(92, 153, 223, 0.35);
  animation: multi-view-pulse 1.8s ease-in-out infinite;
}

.multi-view-status.is-ready .multi-view-stage-dot { background: var(--accent); box-shadow: 0 0 0 5px rgba(149, 240, 178, 0.08); animation: none; }
.multi-view-status.is-error .multi-view-stage-dot { background: var(--danger); box-shadow: 0 0 0 5px rgba(255, 142, 134, 0.08); animation: none; }
.multi-view-status strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.multi-view-status small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.multi-view-status > span { margin-left: auto; color: var(--accent); font: 650 10px/1 ui-monospace, monospace; white-space: nowrap; }

@keyframes multi-view-pulse { 50% { opacity: 0.45; transform: scale(0.82); } }

.multi-view-gallery-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 10px;
}

.multi-view-main,
.multi-view-rail { min-height: 0; border-radius: 15px; }
.multi-view-main { display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }

.multi-view-image-viewport {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, #18221e 0%, #090d0b 72%);
  background-size: 32px 32px, 32px 32px, auto;
}

.multi-view-image-viewport.is-panning { cursor: grabbing; }
.multi-view-image-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--gallery-zoom, 1));
  transform-origin: center;
  transition: transform 180ms ease, opacity 180ms ease;
}

.multi-view-image-viewport img:not([src]) { opacity: 0; }
.multi-view-image-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.multi-view-image-placeholder.is-hidden { display: none; }
.multi-view-image-placeholder strong { color: #d6dfda; font-size: 11px; }
.multi-view-image-placeholder small { font-size: 9px; }
.multi-view-placeholder-cube {
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  border: 1px solid rgba(149, 240, 178, 0.5);
  background: rgba(149, 240, 178, 0.06);
  transform: rotate(30deg) skewY(-8deg);
  animation: multi-view-pulse 1.8s ease-in-out infinite;
}

.multi-view-direction-badge {
  position: absolute;
  top: 13px;
  left: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(149, 240, 178, 0.2);
  border-radius: 8px;
  background: rgba(4, 8, 6, 0.72);
  backdrop-filter: blur(12px);
}

.multi-view-direction-badge strong { color: var(--accent); font: 700 10px/1 ui-monospace, monospace; }
.multi-view-direction-badge span { color: #d6dfda; font-size: 9px; }

.multi-view-main-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: rgba(6, 10, 8, 0.72);
}

.multi-view-main-toolbar button {
  min-width: 38px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #c5cfca;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 9px;
}

.multi-view-main-toolbar button:hover:not(:disabled) { color: var(--accent); border-color: rgba(149, 240, 178, 0.28); }
.multi-view-main-toolbar button:disabled { opacity: 0.35; cursor: not-allowed; }
.multi-view-main-toolbar button.is-primary { color: #08100b; border-color: var(--accent); background: var(--accent); font-weight: 650; }
.multi-view-toolbar-spacer { flex: 1; }

.multi-view-rail { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 13px; }
.multi-view-rail-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 10px; }
.multi-view-rail-head > div { display: grid; gap: 4px; }
.multi-view-rail-head strong { font-size: 11px; }
.multi-view-rail-head > small { color: var(--accent); font: 650 10px/1 ui-monospace, monospace; }

.multi-view-thumbnails {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.multi-view-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #d7e0db;
  background: #0a0f0d;
  cursor: pointer;
}

.multi-view-thumb.is-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(149, 240, 178, 0.08); }
.multi-view-thumb.is-error { border-color: rgba(255, 142, 134, 0.32); }
.multi-view-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.multi-view-thumb span {
  position: absolute;
  inset: auto 4px 4px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 5px;
  border-radius: 5px;
  color: #edf3ef;
  background: rgba(2, 5, 4, 0.76);
  font-size: 8px;
  backdrop-filter: blur(8px);
}

.multi-view-thumb span em { overflow: hidden; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }

.multi-view-thumb-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted-2); font: 700 11px/1 ui-monospace, monospace; }
.multi-view-export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding-top: 10px; }
.multi-view-export-actions button { min-height: 38px; font-size: 9px; }

@media (max-width: 900px) {
  .multi-view-gallery { inset: 84px 10px 10px; }
  .multi-view-gallery-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .multi-view-rail { min-height: 150px; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 1fr; align-items: center; gap: 10px; }
  .multi-view-rail-head { margin: 0; writing-mode: vertical-rl; transform: rotate(180deg); }
  .multi-view-rail-head > small { display: none; }
  .multi-view-thumbnails { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; }
  .multi-view-thumb { flex: 0 0 150px; scroll-snap-align: center; }
  .multi-view-export-actions { display: flex; flex-direction: column; padding: 0; }
}

@media (max-width: 650px) {
  .open-mode-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); padding: 17px; overflow-y: auto; }
  .open-mode-file { grid-template-columns: auto minmax(0, 1fr); }
  .open-mode-recommendation { grid-column: 1 / -1; justify-self: start; }
  .open-mode-quality { grid-template-columns: 1fr; gap: 10px; }
  .open-mode-quality-switch button { min-height: 44px; }
  .open-mode-grid { grid-template-columns: 1fr; }
  .open-mode-card { min-height: 220px; grid-template-columns: 108px minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .open-mode-card-visual { grid-row: 1 / 3; min-height: 100%; }
  .open-mode-card > b { grid-column: 2; }

  .multi-view-gallery { inset: max(76px, calc(env(safe-area-inset-top) + 68px)) 7px max(7px, env(safe-area-inset-bottom)); gap: 7px; }
  .multi-view-gallery-head { padding: 10px; }
  .multi-view-gallery-title p, .multi-view-gallery-actions .text-button { display: none; }
  .multi-view-status { min-height: 52px; }
  .multi-view-status > span { display: none; }
  .multi-view-status button { min-height: 44px; }
  .multi-view-gallery-body { gap: 7px; grid-template-rows: minmax(0, 1fr) 125px; }
  .multi-view-main-toolbar { overflow-x: auto; }
  .multi-view-main-toolbar button { min-width: 44px; min-height: 44px; flex: none; }
  .multi-view-main-toolbar .multi-view-toolbar-spacer { display: none; }
  .multi-view-rail { min-height: 125px; padding: 8px; grid-template-columns: minmax(0, 1fr); }
  .multi-view-rail-head, .multi-view-export-actions { display: none; }
  .multi-view-thumb { flex-basis: 138px; }
}

@media (prefers-reduced-motion: reduce) {
  .open-mode-card,
  .multi-view-gallery,
  .multi-view-image-viewport img,
  .multi-view-stage-dot,
  .multi-view-placeholder-cube { transition: none !important; animation: none !important; }
}

/* Mobile application shell ------------------------------------------------- */

button,
a,
input,
select,
textarea,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
select,
summary,
input[type="button"],
input[type="checkbox"],
input[type="radio"],
input[type="range"] {
  touch-action: manipulation;
}

@media (max-width: 700px) {
  :root {
    --topbar-height: 52px;
    --mobile-edge: max(8px, env(safe-area-inset-left));
    --mobile-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--app-height, 100dvh);
  }

  button,
  [role="button"] {
    user-select: none;
    -webkit-user-select: none;
  }

  .glass-panel {
    backdrop-filter: blur(16px) saturate(118%);
    -webkit-backdrop-filter: blur(16px) saturate(118%);
  }

  .topbar {
    top: max(6px, calc(env(safe-area-inset-top) + 4px));
    right: max(7px, env(safe-area-inset-right));
    left: max(7px, env(safe-area-inset-left));
    height: var(--topbar-height);
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 0 5px 0 10px;
    border-radius: 14px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    transform: scale(0.88) rotate(30deg) skewY(-7deg);
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .top-actions {
    gap: 4px;
  }

  .topbar .primary-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 11px;
  }

  .icon-button,
  .icon-button.compact {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .primary-button,
  .primary-button.compact,
  .text-button,
  .text-button.compact,
  .mini-button {
    width: auto;
    min-height: 44px;
    height: auto;
    padding: 0 14px;
    color: inherit;
    overflow: visible;
  }

  .primary-button,
  .primary-button.compact {
    color: #0b160f;
  }

  .empty-state {
    top: max(76px, calc(env(safe-area-inset-top) + 68px));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 16px;
    width: calc(100vw - 32px);
    max-width: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
    transform: none;
  }

  .empty-state h1 {
    margin-top: 12px;
    font-size: clamp(34px, 10.5vw, 48px);
    line-height: 1.03;
  }

  .hero-copy {
    margin-top: 14px;
    font-size: 12px;
    line-height: 1.65;
  }

  .drop-zone {
    width: 100%;
    min-height: 104px;
    margin-top: 18px;
  }

  .trust-row {
    margin-top: 13px;
  }

  .inspector:not(.has-selection) {
    display: none;
  }

  .inspector.has-selection {
    z-index: 58;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(76dvh, calc(var(--app-height, 100dvh) - env(safe-area-inset-top) - 18px));
    max-height: none;
    padding: 22px 14px max(16px, calc(env(safe-area-inset-bottom) + 10px));
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    background: rgba(10, 15, 13, 0.97);
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.05);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .inspector.has-selection::before,
  .edit-panel::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(226, 239, 232, 0.2);
    transform: translateX(-50%);
  }

  .inspector.has-selection .selection-section {
    padding-bottom: 8px;
  }

  .tool-dock {
    z-index: 26;
    right: max(7px, env(safe-area-inset-right));
    bottom: var(--mobile-bottom);
    left: max(7px, env(safe-area-inset-left));
    width: auto;
    max-width: none;
    height: 58px;
    gap: 3px;
    padding: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 16px;
    scrollbar-width: none;
    scroll-padding-inline: 6px;
    scroll-snap-type: x proximity;
    transform: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

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

  .tool-dock.is-hidden {
    transform: translateY(14px);
  }

  .tool-button {
    width: 46px;
    min-width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 11px;
    scroll-snap-align: center;
  }

  .tool-button svg {
    width: 19px;
    height: 19px;
  }

  .tool-button[data-tooltip]::after,
  .tool-separator {
    display: none;
  }

  .app.has-structure:not(.free-camera-active):not(.is-multiview) .mobile-gesture-hint:not(.is-dismissed) {
    position: fixed;
    z-index: 23;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom) + 124px);
    left: max(10px, env(safe-area-inset-left));
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 6px 7px 6px 12px;
    border: 1px solid rgba(149, 240, 178, 0.16);
    border-radius: 13px;
    color: #b7c2bc;
    background: rgba(8, 13, 11, 0.9);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.32);
    font-size: 9px;
    backdrop-filter: blur(14px);
  }

  .mobile-gesture-hint i {
    width: 1px;
    height: 14px;
    background: rgba(226, 239, 232, 0.12);
  }

  .mobile-gesture-hint b {
    margin-right: 3px;
    color: var(--accent);
    font-weight: 650;
  }

  .mobile-gesture-hint button {
    min-width: 58px;
    min-height: 36px;
    margin-left: auto;
    border: 1px solid rgba(149, 240, 178, 0.18);
    border-radius: 9px;
    color: var(--accent);
    background: rgba(149, 240, 178, 0.07);
    font-size: 9px;
  }

  .layer-control {
    z-index: 25;
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom) + 66px);
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    height: 48px;
    grid-template-columns: 62px minmax(0, 1fr) 48px;
    gap: 8px;
    padding: 4px 5px 4px 11px;
    border-radius: 14px;
    transform: none;
  }

  .layer-control.is-hidden {
    transform: translateY(12px);
  }

  .layer-copy .section-kicker {
    display: none;
  }

  input[type="range"] {
    min-height: 32px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -8.5px;
  }

  .coordinate-hud {
    z-index: 24;
    top: max(66px, calc(env(safe-area-inset-top) + 62px));
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 6px;
    border-radius: 12px;
  }

  .coordinate-hud > div {
    min-width: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 5px 7px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
  }

  .coordinate-hud > div:nth-child(1),
  .coordinate-hud > div:nth-child(2),
  .coordinate-hud > div:nth-child(5) {
    display: none;
  }

  .coordinate-hud span,
  .coordinate-hud small {
    font-size: 8px;
  }

  .coordinate-hud strong {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ai-builder-panel {
    z-index: 70;
    top: var(--visual-viewport-top, 0px);
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    max-width: none;
    height: var(--app-height, 100dvh);
    padding: max(12px, env(safe-area-inset-top)) 12px max(14px, calc(env(safe-area-inset-bottom) + 10px));
    border: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 86% 4%, rgba(67, 155, 101, 0.13), transparent 31%),
      rgba(7, 12, 10, 0.985);
    transform: none;
    -webkit-overflow-scrolling: touch;
  }

  .ai-builder-panel.is-hidden {
    transform: translateY(18px);
  }

  .ai-builder-head {
    position: sticky;
    z-index: 8;
    top: 0;
    min-height: 58px;
    margin: 0 -12px 12px;
    padding: 0 12px 10px;
    background: linear-gradient(rgba(7, 12, 10, 0.99), rgba(7, 12, 10, 0.94));
    border-bottom: 1px solid rgba(226, 239, 232, 0.08);
    backdrop-filter: blur(18px);
  }

  .ai-builder-panel input:not([type="checkbox"]):not([type="radio"]),
  .ai-builder-panel textarea,
  .ai-builder-panel select,
  .edit-panel input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
  .edit-panel textarea,
  .edit-panel select,
  dialog input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
  dialog textarea,
  dialog select {
    min-height: 44px;
    font-size: 16px;
    line-height: 1.35;
  }

  .ai-model-roles,
  .ai-two-columns,
  .ai-generation-options,
  .ai-coordinate-fields,
  .ai-refine-options {
    grid-template-columns: 1fr;
  }

  .ai-inline-actions,
  .ai-capture-actions,
  .ai-transform-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-inline-actions button,
  .ai-capture-actions button,
  .ai-transform-actions button {
    min-height: 44px;
  }

  .ai-generate-actions,
  .ai-preview-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ai-generate-actions .primary-button,
  .ai-generate-actions .ai-fast-generate,
  .ai-preview-actions .primary-button,
  .ai-preview-actions .text-button {
    width: 100%;
    min-height: 48px;
  }

  .ai-candidates {
    grid-auto-columns: minmax(264px, 88%);
    padding-bottom: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .ai-candidate-card {
    scroll-snap-align: center;
  }

  .ai-console-cancel:not(.is-hidden) {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, calc(env(safe-area-inset-bottom) + 8px));
  }

  .edit-panel {
    z-index: 68;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(82dvh, calc(var(--app-height, 100dvh) - env(safe-area-inset-top) - 12px));
    padding: 22px 12px max(14px, calc(env(safe-area-inset-bottom) + 10px));
    border-radius: 22px 22px 0 0;
    background: rgba(9, 14, 12, 0.975);
    box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.05);
    -webkit-overflow-scrolling: touch;
  }

  .edit-panel-head {
    position: sticky;
    z-index: 5;
    top: -22px;
    min-height: 56px;
    margin: -22px -12px 8px;
    padding: 14px 12px 7px;
    background: rgba(9, 14, 12, 0.97);
    border-bottom: 1px solid rgba(226, 239, 232, 0.08);
    backdrop-filter: blur(16px);
  }

  .edit-history-row,
  .edit-save-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edit-history-row button,
  .edit-save-row button,
  .edit-tool-grid button,
  .edit-inline button {
    min-height: 44px;
  }

  .edit-save-row .primary-button,
  .edit-save-row .text-button {
    display: inline-flex;
    width: 100%;
  }

  .edit-panel kbd {
    display: none;
  }

  .performance-panel {
    z-index: 66;
    right: max(8px, env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom) + 66px);
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    max-height: calc(var(--app-height, 100dvh) - 96px);
    overflow-y: auto;
  }

  .formats-dialog,
  .open-mode-dialog,
  .world-dialog,
  .edit-save-dialog,
  .block-inventory-dialog,
  .item-inventory-dialog {
    width: calc(100vw - 12px);
    max-width: none;
    max-height: calc(var(--app-height, 100dvh) - 12px);
    padding: 16px;
    border-radius: 18px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .block-inventory-dialog,
  .item-inventory-dialog {
    height: calc(var(--app-height, 100dvh) - 12px);
  }

  .formats-dialog .dialog-head,
  .open-mode-dialog .dialog-head,
  .world-dialog .dialog-head,
  .edit-save-dialog .dialog-head,
  .block-inventory-dialog .dialog-head,
  .item-inventory-dialog .dialog-head {
    position: sticky;
    z-index: 6;
    top: -16px;
    margin: -16px -16px 10px;
    padding: max(12px, env(safe-area-inset-top)) 16px 10px;
    background: rgba(10, 15, 13, 0.97);
    border-bottom: 1px solid rgba(226, 239, 232, 0.08);
    backdrop-filter: blur(16px);
  }

  .dialog-head h2 {
    margin-top: 4px;
    font-size: 19px;
  }

  .world-dialog-actions {
    position: sticky;
    z-index: 6;
    bottom: -16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 14px -16px -16px;
    padding: 10px 16px max(12px, env(safe-area-inset-bottom));
    background: rgba(10, 15, 13, 0.97);
    border-top: 1px solid rgba(226, 239, 232, 0.08);
    backdrop-filter: blur(16px);
  }

  .world-dialog-actions button {
    width: 100%;
    min-height: 46px;
  }

  .open-mode-dialog .world-dialog-actions {
    grid-template-columns: 1fr;
  }

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

  .world-dialog-section {
    padding: 12px;
  }

  .world-presets {
    width: 100%;
    padding-bottom: 3px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .world-presets button {
    width: auto;
    min-width: 92px;
    min-height: 44px;
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .world-dimension-tabs button {
    min-height: 44px;
  }

  .world-coordinate-grid {
    grid-template-columns: 24px repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .world-region-metrics {
    grid-template-columns: 1fr;
  }

  .open-mode-file {
    margin-top: 8px;
  }

  .open-mode-quality {
    padding: 11px;
  }

  .open-mode-card {
    min-height: 174px;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .open-mode-card-copy {
    gap: 5px;
  }

  .open-mode-card-copy strong {
    font-size: 15px;
  }

  .open-mode-card-copy span {
    line-height: 1.45;
  }

  .open-mode-card > b {
    min-height: 44px;
  }

  .block-inventory-dialog[open] {
    grid-template-rows: auto auto auto auto auto minmax(150px, 1fr);
  }

  .item-inventory-dialog[open] {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .block-inventory-options {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .block-inventory-options label:first-child,
  .block-inventory-options label:nth-child(2) {
    grid-column: 1 / -1;
  }

  .block-inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  .item-inventory-categories {
    flex-wrap: nowrap;
    padding-bottom: 3px;
    overflow-x: auto;
  }

  .item-inventory-categories button {
    min-height: 44px;
    flex: 0 0 auto;
  }

  .item-inventory-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(190px, 1fr) auto;
    overflow-y: auto;
  }

  .item-inventory-grid {
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  }

  .item-inventory-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .item-inventory-actions button {
    min-height: 46px;
  }

  .loading-overlay {
    min-height: var(--app-height, 100dvh);
    padding: max(28px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  }

  .loading-copy,
  .progress-track,
  .progress-meta {
    width: min(430px, calc(100vw - 40px));
  }

  .loading-copy h2 {
    font-size: 20px;
  }

  .loading-copy p {
    min-height: 38px;
    line-height: 1.55;
  }

  .progress-meta button {
    min-width: 64px;
    min-height: 44px;
    color: #d8dedb;
  }

  .toast-region {
    top: max(68px, calc(env(safe-area-inset-top) + 62px));
    width: calc(100vw - 20px);
  }

  .toast {
    width: 100%;
    max-width: none;
  }

  .app.free-camera-touch .free-camera-status {
    top: max(66px, calc(env(safe-area-inset-top) + 60px));
    right: max(8px, env(safe-area-inset-right));
    left: max(8px, env(safe-area-inset-left));
    min-height: 50px;
    justify-content: space-between;
  }

  .app.free-camera-touch .free-camera-status button {
    min-height: 44px;
  }

  .app.free-camera-touch .coordinate-hud {
    top: max(122px, calc(env(safe-area-inset-top) + 116px));
  }

  .app.free-camera-touch.is-editing .coordinate-hud {
    display: none;
  }

  .app.free-camera-touch .free-joystick {
    left: max(12px, env(safe-area-inset-left));
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px));
    width: clamp(104px, 31vw, 124px);
    height: clamp(104px, 31vw, 124px);
  }

  .app.free-camera-touch .free-vertical-controls {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(15px, calc(env(safe-area-inset-bottom) + 11px));
    gap: 9px;
  }

  .free-vertical-controls button {
    width: 50px;
    height: 50px;
  }

  .free-edit-hotbar,
  .app.free-camera-touch .free-edit-hotbar {
    --mobile-hotbar-slot: clamp(27px, 8vw, 32px);
    max-width: calc(100vw - 16px);
  }

  .free-edit-hotbar-slots {
    grid-template-columns: repeat(9, var(--mobile-hotbar-slot));
  }

  .free-edit-hotbar-slot {
    width: var(--mobile-hotbar-slot);
    height: calc(var(--mobile-hotbar-slot) + 2px);
  }

  .free-edit-hotbar-swatch {
    width: calc(var(--mobile-hotbar-slot) - 5px);
    height: calc(var(--mobile-hotbar-slot) - 5px);
  }

  .free-edit-target-card,
  .free-command-card,
  .free-sign-card,
  .free-container-card {
    max-height: min(44dvh, 330px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .multi-view-gallery {
    top: max(66px, calc(env(safe-area-inset-top) + 60px));
    bottom: max(6px, env(safe-area-inset-bottom));
  }

  .multi-view-gallery-head {
    min-height: 54px;
  }

  .multi-view-gallery-actions .icon-button {
    width: 44px;
    min-width: 44px;
  }

  .multi-view-status small {
    max-width: 62vw;
  }

  .mobile-keyboard-open .topbar,
  .mobile-keyboard-open .tool-dock,
  .mobile-keyboard-open .layer-control,
  .mobile-keyboard-open .coordinate-hud,
  .mobile-keyboard-open .mobile-gesture-hint,
  .mobile-keyboard-open .performance-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .mobile-keyboard-open .ai-builder-panel,
  .mobile-keyboard-open .edit-panel {
    top: var(--visual-viewport-top, 0px);
    bottom: auto;
    height: var(--app-height, 100dvh);
    max-height: none;
    border-radius: 0;
  }
}

@media (max-width: 370px) {
  .brand-copy {
    display: none;
  }

  .coordinate-hud {
    grid-template-columns: 1fr;
  }

  .coordinate-hud > div:nth-child(4) {
    display: none;
  }

  .mobile-gesture-hint span:nth-of-type(2),
  .mobile-gesture-hint i:nth-of-type(2) {
    display: none;
  }

  .ai-inline-actions,
  .ai-capture-actions,
  .ai-transform-actions,
  .edit-history-row,
  .edit-save-row,
  .world-dialog-actions,
  .item-inventory-actions {
    grid-template-columns: 1fr;
  }

  .open-mode-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .topbar {
    right: auto;
    width: min(250px, calc(48vw - 10px));
  }

  .tool-dock {
    top: max(66px, calc(env(safe-area-inset-top) + 60px));
    right: auto;
    bottom: max(7px, env(safe-area-inset-bottom));
    left: max(7px, env(safe-area-inset-left));
    width: 58px;
    height: auto;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y proximity;
  }

  .layer-control {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(74px, calc(env(safe-area-inset-left) + 66px));
  }

  .coordinate-hud {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    left: auto;
    width: min(360px, 48vw);
  }

  .inspector.has-selection,
  .edit-panel {
    top: max(7px, env(safe-area-inset-top));
    right: 0;
    bottom: 0;
    left: auto;
    width: min(430px, 62vw);
    height: auto;
    max-height: none;
    border-radius: 20px 0 0 0;
  }

  .ai-builder-panel {
    right: 0;
    left: auto;
    width: min(560px, 76vw);
  }

  .app.free-camera-touch .free-joystick {
    width: 94px;
    height: 94px;
  }

  .free-edit-target-card,
  .app.free-camera-touch .free-edit-target-card {
    left: 50%;
    width: min(370px, 48vw);
  }

  .multi-view-gallery-body {
    grid-template-columns: minmax(0, 1fr) 190px;
    grid-template-rows: minmax(0, 1fr);
  }

  .multi-view-rail {
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }
}

@media (hover: none) {
  .primary-button:hover,
  .open-mode-card:hover,
  .tool-button:hover,
  .icon-button:hover {
    transform: none;
  }

  .tool-button[data-tooltip]::after {
    display: none;
  }
}
