/* ── Flat minimal variant (same layout, different feel) ── */

:root {
  /* Base canvas */
  --guide-bg: #1d1d23;

  /* Original #1e2128 / #252930 / #2e333c / #363b45 shifted for #1d1d23 */
  --md-surface: #25262f;
  --md-surface-2: #2c2e37;
  --md-surface-3: #31333d;
  --md-surface-hover: #353843;
  --md-surface-active: #3d404c;
  --md-toggle-bg: rgba(58, 64, 74, 0.96);

  --md-raised: rgba(255, 255, 255, 0.055);
  --md-border: rgba(255, 255, 255, 0.07);
  --md-border-strong: rgba(255, 255, 255, 0.11);

  --md-on-surface: #e6e8ec;
  --md-on-surface-dim: rgba(230, 232, 236, 0.45);

  --md-accent: #00bfff;
  --md-accent-dim: rgba(0, 191, 255, 0.18);
  --md-accent-strong: rgba(0, 191, 255, 0.26);
  --md-accent-border: rgba(0, 191, 255, 0.28);
  --md-accent-border-strong: rgba(0, 191, 255, 0.42);

  --md-toggle-on-bg: rgba(0, 191, 255, 0.36);
  --md-toggle-on-bg-hover: rgba(0, 191, 255, 0.46);
  --md-toggle-on-border: rgba(0, 191, 255, 0.78);
  --md-toggle-on-glow: 0 0 0 1px rgba(0, 191, 255, 0.26), 0 0 18px rgba(0, 191, 255, 0.32);
  --md-toggle-on-glow-hover: 0 0 0 1px rgba(0, 191, 255, 0.34), 0 0 22px rgba(0, 191, 255, 0.4);
  --md-toggle-on-icon: #f0fbff;
  --md-toggle-on-ring: 0 0 0 2px rgba(0, 191, 255, 0.55);

  --md-elevation-1: none;
  --md-elevation-2: none;
  --md-elevation-3: none;
  --md-radius-fab: 12px;
  --md-radius-card: 16px;

  --guide-ease-soft: cubic-bezier(0.33, 0, 0.1, 1);
  --guide-ease-fade: cubic-bezier(0.33, 0, 0.1, 1);
  --guide-reveal-opacity: 0.32s var(--guide-ease-fade);
}

body,
#container,
#loading-screen {
  background: var(--guide-bg);
}

#loading-screen {
  gap: 16px;
  transition: opacity 0.12s var(--guide-ease-fade) !important;
}

#loading-screen.is-hiding,
#loading-screen.hidden {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.12s var(--guide-ease-fade) !important;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 2px;
  border-color: rgba(239, 241, 246, 0.08);
  border-top-color: var(--md-accent);
  border-radius: 50%;
  animation: guideSpinnerSpin 0.9s linear infinite !important;
  transition: opacity 0.04s linear;
  transform: translateZ(0);
  backface-visibility: hidden;
}

@keyframes guideSpinnerSpin {
  to {
    transform: translateZ(0) rotate(360deg);
  }
}

#loading-screen.is-hiding .loading-spinner {
  animation: none;
  opacity: 0;
  visibility: hidden;
  transform: translateZ(0);
}

.loading-label {
  display: inline-block;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  color: rgba(239, 241, 246, 0.82);
  white-space: nowrap;
  transition: opacity 0.04s linear;
}

#loading-screen.is-hiding .loading-label {
  opacity: 0;
  visibility: hidden;
}

#loading-screen.is-hiding .loading-dots span {
  animation: none;
  opacity: 0;
}

.loading-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 0.4em;
  margin-left: 0.14em;
  vertical-align: bottom;
  padding-bottom: 0.1em;
}

.loading-dots span {
  flex: 0 0 auto;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.2;
  animation: loading-dot-pulse 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading-dot-pulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

.loading-sublabel:empty {
  display: none;
}

/* Guide reveal after loading */
body.guide-is-loading #container,
body.guide-is-loading #build-indicator,
body.guide-is-loading #b-top,
body.guide-is-loading #b-bottom,
body.guide-is-loading .nav-arrow,
body.guide-is-loading #hud {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: none;
}

body.guide-is-loading #build-indicator,
body.guide-is-loading #b-top,
body.guide-is-loading #b-bottom,
body.guide-is-loading .nav-arrow {
  transform: none;
}

body.guide-is-loaded #container,
body.guide-is-revealing #container {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity var(--guide-reveal-opacity);
  transition-delay: 0s;
}

body.guide-is-loaded #build-indicator {
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
  transition: opacity 0.28s var(--guide-ease-fade);
  transition-delay: 0.03s;
}

body.guide-is-loaded #b-top {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.26s var(--guide-ease-fade);
  transition-delay: 0.05s;
}

body.guide-is-loaded #b-bottom {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.26s var(--guide-ease-fade);
  transition-delay: 0.07s;
}

body.guide-is-loaded #arrow-left,
body.guide-is-loaded #arrow-right {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.24s var(--guide-ease-fade);
  transition-delay: 0.09s;
}

@media (prefers-reduced-motion: reduce) {
  body.guide-is-loading #container,
  body.guide-is-loading #build-indicator,
  body.guide-is-loading #b-top,
  body.guide-is-loading #b-bottom,
  body.guide-is-loading .nav-arrow,
  body.guide-is-loaded #container,
  body.guide-is-loaded #b-top,
  body.guide-is-loaded #b-bottom,
  body.guide-is-loaded .nav-arrow,
  #loading-screen.is-hiding .loading-spinner,
  #loading-screen.is-hiding .loading-label {
    transition: opacity 0.202s ease-out !important;
    transform: none !important;
    opacity: 1 !important;
    transition-delay: 0s !important;
  }

  body.guide-is-loading #build-indicator,
  body.guide-is-loaded #build-indicator {
    transform: translateX(-50%) !important;
  }
}

.loading-sublabel {
  font-size: 13px;
  font-weight: 400;
  color: rgba(239, 241, 246, 0.38);
  letter-spacing: 0;
  min-height: 1em;
  margin-top: -10px;
}

.md-fab,
.nav-arrow,
.md-fab-extended,
#build-indicator,
#fov-slider-container,
#block-tooltip {
  box-shadow: none !important;
  border: 1px solid var(--md-border);
  transition:
    background 0.202s ease-out,
    border-color 0.202s ease-out,
    color 0.202s ease-out,
    transform 0.16s cubic-bezier(0.34, 1.28, 0.64, 1),
    box-shadow 0.16s ease-out;
}

.md-fab,
.nav-arrow {
  background: var(--md-surface);
}

.md-fab > i,
.md-fab--accent > i {
  font-size: 19px;
}

.md-fab:hover,
.nav-arrow:hover {
  background: var(--md-surface-hover);
  border-color: var(--md-border-strong);
}

.md-fab--accent:hover {
  background: var(--md-accent-dim);
  border-color: var(--md-accent-border);
  color: var(--md-accent);
  box-shadow: none;
}

/* ON state — clearly brighter than hover, with glow + dot */
.md-fab.active-toggle,
.md-fab--accent.active-toggle,
.md-fab-extended.active-toggle {
  background: var(--md-toggle-on-bg);
  border-color: var(--md-toggle-on-border);
  color: var(--md-toggle-on-icon);
  box-shadow: var(--md-toggle-on-glow);
}

.md-fab.active-toggle::before,
.md-fab--accent.active-toggle::before,
.md-fab-extended.active-toggle::before {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--md-accent);
  box-shadow:
    0 0 0 2px rgba(0, 191, 255, 0.28),
    0 0 10px rgba(0, 191, 255, 0.95);
  transform: translateX(-50%);
  opacity: 1;
  pointer-events: none;
  z-index: 1;
}

.md-fab-extended.active-toggle::before {
  bottom: 6px;
}

/* ── Unified ON / selected (chips, tabs, nav) ── */

.view-tab.active,
.explode-mode-btn.active,
.craft-tab.active,
#layer-mode-options .layer-mode-btn.selected,
.block-arrow.block-nav-active,
#block-scroll-center.block-nav-active {
  background: var(--md-toggle-on-bg);
  border-color: var(--md-toggle-on-border);
  color: var(--md-toggle-on-icon);
  box-shadow: var(--md-toggle-on-glow);
}

.view-tab.active > i,
.explode-mode-btn.active > i {
  color: var(--md-toggle-on-icon);
  opacity: 1;
}

.view-tab.active:hover,
.explode-mode-btn.active:hover,
.craft-tab.active:hover,
#layer-mode-options .layer-mode-btn.selected:hover,
.block-arrow.block-nav-active:hover,
#block-scroll-center.block-nav-active:hover {
  background: var(--md-toggle-on-bg-hover);
  border-color: rgba(0, 191, 255, 0.88);
  color: #fff;
  box-shadow: var(--md-toggle-on-glow-hover);
}

#wireframe-color-options .color-btn.selected,
#bg-color-options .color-btn.selected {
  border-color: var(--md-toggle-on-border);
  box-shadow: var(--md-toggle-on-ring), var(--md-toggle-on-glow);
  transform: scale(1.08);
}

#bg-color-options .color-btn[data-default-sky='true'],
#bg-color-options .color-btn[data-default-sky='true'].selected {
  border-color: rgba(0, 0, 0, 0.3);
  box-shadow: var(--md-elevation-1, 0 2px 6px rgba(0, 0, 0, 0.35));
  transform: none;
  outline: none;
}

#bg-color-options .color-btn::after {
  display: none;
}

#bg-color-options .color-btn:active {
  transform: scale(0.94);
}

#wireframe-color-options .color-btn[data-mode='0'].selected {
  background: var(--md-toggle-on-bg) !important;
  color: var(--md-toggle-on-icon) !important;
}

#layer-mode-options .layer-mode-btn.selected :is(i, svg, .layer-mode-icon) {
  color: var(--md-toggle-on-icon) !important;
}

#layer-mode-options .layer-mode-btn.selected {
  background: var(--md-toggle-on-bg) !important;
}

#layer-mode-options .layer-mode-btn[data-default-layer-mode='true'],
#layer-mode-options .layer-mode-btn[data-default-layer-mode='true'].selected {
  background: var(--md-surface) !important;
  border-color: var(--md-border-strong);
  box-shadow: none;
  transform: none;
  color: var(--md-accent);
}

#layer-mode-options .layer-mode-btn[data-default-layer-mode='true'].selected :is(i, svg, .layer-mode-icon) {
  color: var(--md-accent) !important;
}

.md-fab.active-toggle :is(i, svg, img),
.md-fab--accent.active-toggle :is(i, svg, img),
.md-fab-extended.active-toggle :is(i, svg, img),
.md-fab-extended.active-toggle .fab-icon {
  color: var(--md-toggle-on-icon);
}

.md-fab.active-toggle:hover,
.md-fab--accent.active-toggle:hover,
.md-fab-extended.active-toggle:hover,
.nav-arrow.active-toggle:hover {
  background: var(--md-toggle-on-bg-hover);
  border-color: rgba(0, 191, 255, 0.82);
  color: #fff;
  box-shadow: var(--md-toggle-on-glow-hover);
}

.md-fab-extended.active-toggle .fab-icon {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.md-fab-extended.active-toggle:hover .fab-icon {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.md-fab-extended {
  background: var(--md-surface);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.md-fab-extended .fab-icon {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.md-fab-extended:hover {
  background: var(--md-surface-hover);
  border-color: var(--md-border-strong);
}

.md-fab-extended:hover .fab-icon {
  background: rgba(255, 255, 255, 0.1);
}

#mat-progress-badge {
  border-radius: 6px !important;
  transition: color 0.354s ease-out, background 0.354s ease-out, border-color 0.354s ease-out;
}

#mat-progress-badge.complete {
  color: unset;
  background: unset;
  border-color: unset;
}

#build-indicator {
  background: var(--md-surface);
  padding: 9px 26px;
  font-size: 1.1em;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 17px;
  cursor: default;
  user-select: none;
}

#material-button {
  border-radius: 17px;
}

#material-button.active-toggle::before {
  display: none;
}

#material-button .fab-icon {
  border-radius: var(--md-radius-fab);
}

#popup-overlay .popup-handle {
  margin: 8px auto 4px;
}

#popup-overlay .popup-header,
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: none;
  padding: 12px 14px;
  min-height: 52px;
  box-sizing: border-box;
}

#popup-overlay .popup-header-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

#popup-overlay .popup-title,
.popup-title {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#popup-overlay .popup-subtitle,
.popup-subtitle {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: rgba(0, 191, 255, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#popup-overlay .popup-subtitle-count,
.popup-subtitle-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--md-accent, #00bfff);
  letter-spacing: -0.02em;
}

#popup-overlay .close-btn {
  position: relative;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border-radius: var(--md-radius-fab) !important;
  background: var(--md-surface-3);
  border: 1px solid var(--md-border);
  color: rgba(255, 255, 255, 0.65);
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

#popup-overlay .close-btn::before,
#popup-overlay .close-btn::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  pointer-events: none;
}

#popup-overlay .close-btn::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

#popup-overlay .close-btn::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

#popup-overlay .close-btn:hover {
  background: var(--md-surface-hover);
  border-color: var(--md-border-strong);
  color: #fff;
}

.ui-glyph-svg {
  display: block;
  flex-shrink: 0;
}

.ui-glyph-svg--sm {
  width: 12px;
  height: 12px;
}

.close-btn {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--md-radius-fab) !important;
  background: var(--md-surface-3);
  border: 1px solid var(--md-border);
  color: rgba(255, 255, 255, 0.65);
  box-shadow: none;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.close-btn > i,
.close-btn > span,
.close-btn > svg {
  display: none;
}

.close-btn:hover {
  background: var(--md-surface-hover);
  border-color: var(--md-border-strong);
  color: #fff;
}

.popup-content {
  width: calc(420px * 1.04);
  max-height: calc(72vh * 1.02);
  background: var(--guide-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: none;
  border-radius: var(--md-radius-card);
}

@media (min-width: 769px) {
  #popup-overlay {
    justify-content: center;
    align-items: center;
  }

  .popup-content {
    margin: 0;
    border-radius: var(--md-radius-card);
    max-height: calc(78vh * 1.02);
    transform: translateY(24px) scale(0.97);
  }

  #popup-overlay.show .popup-content {
    transform: translateY(0) scale(1);
  }

  .popup-handle {
    display: none;
  }
}

#popup-overlay::before {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition:
    opacity 0.35s ease,
    backdrop-filter 0.35s ease,
    -webkit-backdrop-filter 0.35s ease;
}

#popup-overlay.show::before {
  backdrop-filter: blur(0.5px);
  -webkit-backdrop-filter: blur(0.5px);
}

.popup-handle {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}

.popup-progress-wrap {
  flex-shrink: 0;
  position: relative;
  padding: 10px 14px 6px;
  border-top: none;
  box-sizing: border-box;
}

.popup-progress-wrap::before {
  display: none;
}

.popup-progress-bar {
  height: 4px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: none;
  outline: none;
}

.popup-view-tabs {
  display: flex;
  padding: 10px 14px;
  gap: 8px;
}

.view-tab {
  flex: 1;
  background: var(--md-surface-3);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-fab);
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  min-height: 36px;
  padding: 0 12px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition:
    background 0.202s ease-out,
    border-color 0.202s ease-out,
    color 0.202s ease-out,
    transform 0.16s cubic-bezier(0.34, 1.28, 0.64, 1);
}

.view-tab > i {
  font-size: 13px;
  line-height: 1;
  opacity: 0.85;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
}

.view-tab > span {
  line-height: 1;
}

.view-tab:hover {
  background: var(--md-surface-hover);
  border-color: var(--md-border-strong);
  color: rgba(255, 255, 255, 0.72);
}

.view-tab.active {
  font-weight: 600;
}

.popup-search-wrap {
  padding: 8px 14px 0;
  position: relative;
  display: grid;
  align-items: center;
}

.popup-search-wrap > .popup-search,
.popup-search-wrap > .popup-search-icon,
.popup-search-wrap > .popup-search-clear {
  grid-area: 1 / 1;
}

.popup-search {
  background: var(--md-surface-3);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-fab);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  padding: 9px 36px 9px 34px;
  box-sizing: border-box;
  width: 100%;
}

.popup-search:focus {
  border-color: var(--md-accent-border-strong);
  background: var(--md-surface-hover);
}

.popup-search::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.popup-search-icon {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  justify-self: start;
  margin-left: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  color: rgba(255, 255, 255, 0.28);
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.popup-search-clear {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  transform: none !important;
  justify-self: end;
  margin-right: 4px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--md-radius-fab);
}

.popup-search-clear > i,
.popup-search-clear > span {
  display: none;
}

.popup-search-clear:hover {
  color: rgba(255, 255, 255, 0.75);
  background: var(--md-surface-hover);
}

.table-scroll {
  padding: 4px 14px 12px;
}

.material-item,
.child-item,
.standalone-item,
.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  min-height: 52px;
  box-sizing: border-box;
}

#material-list .material-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 22px;
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
  min-height: 48px;
  padding-top: 8px;
  padding-bottom: 8px;
}

#material-list .material-item:not(:has(> .this-layer-badge)) {
  grid-template-columns: 48px minmax(0, 1fr) 22px;
}

#material-list .material-item > .material-img-wrap {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

#material-list .material-item > .material-info {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

#material-list .material-item > .this-layer-badge {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  margin: 0 0 0 8px;
  justify-self: end;
}

#material-list .material-item > .material-check {
  grid-column: -1;
  grid-row: 1;
  align-self: center;
  margin-left: 0;
}

.material-item > .material-img-wrap,
.child-item > .material-img-wrap,
.standalone-item > .material-img-wrap,
.group-header > .material-img-wrap,
.material-item > .material-info,
.child-item > .material-info,
.standalone-item > .material-info,
.group-header > .material-info,
.material-item > .material-check,
.child-item > .material-check,
.standalone-item > .material-check,
.group-header > .material-check,
.material-item > .craft-open-btn,
.child-item > .craft-open-btn,
.standalone-item > .craft-open-btn,
.group-header > .craft-open-btn {
  align-self: center;
}

.material-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
  height: 44px;
  gap: 3px;
}

.material-name {
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 16px;
  height: 16px;
  color: #fff;
}

.material-qty {
  margin: 0;
  padding: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.38);
}

.material-info .this-layer-badge,
#material-list .material-item > .this-layer-badge {
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: none;
  color: var(--md-accent);
  background: rgba(0, 191, 255, 0.14);
  border: 1px solid rgba(0, 191, 255, 0.34);
  border-radius: 999px;
  padding: 3px 9px 3px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  white-space: nowrap;
  flex-shrink: 0;
}

.material-check {
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  box-sizing: border-box;
  transition: border-color 0.202s ease-out, background 0.202s ease-out, box-shadow 0.202s ease-out;
}

.material-check-icon {
  display: block;
  line-height: 1;
  width: 11px;
  height: 11px;
  font-size: 11px;
  text-align: center;
}

@keyframes matCheckPop {
  0% {
    transform: scale(0.88);
    box-shadow: 0 0 0 0 rgba(0, 191, 255, 0);
  }
  42% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(0, 191, 255, 0.2);
  }
  68% {
    transform: scale(0.96);
    box-shadow: 0 0 0 2px rgba(0, 191, 255, 0.06);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 191, 255, 0);
  }
}

@keyframes matCheckIconPop {
  0%,
  22% {
    opacity: 0;
    transform: scale(0.2) translateY(3px);
  }
  48% {
    opacity: 1;
    transform: scale(1.18) translateY(-1px);
  }
  68% {
    transform: scale(0.92) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes matCheckOff {
  0% {
    transform: scale(1);
    background: var(--md-accent);
    border-color: var(--md-accent);
    box-shadow: 0 0 0 0 rgba(0, 191, 255, 0);
  }
  50% {
    transform: scale(0.97);
    background: rgba(0, 191, 255, 0.42);
    border-color: rgba(0, 191, 255, 0.32);
    box-shadow: 0 0 0 2px rgba(0, 191, 255, 0.06);
  }
  100% {
    transform: scale(1);
    background: transparent;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 0 rgba(0, 191, 255, 0);
  }
}

@keyframes matCheckIconOff {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  55% {
    opacity: 0.45;
    transform: scale(0.92);
  }
  100% {
    opacity: 0;
    transform: scale(0.86);
  }
}

.material-check.bounce {
  animation: matCheckPop 0.384s cubic-bezier(0.22, 1, 0.38, 1) both;
  transition: none;
  will-change: transform, box-shadow;
}

.material-check.bounce .material-check-icon {
  transition: none;
  animation: matCheckIconPop 0.364s cubic-bezier(0.22, 1, 0.38, 1) both;
  will-change: transform, opacity;
}

.material-item.done .material-check-icon,
.group-header.done .material-check-icon,
.child-item.done .material-check-icon,
.standalone-item.done .material-check-icon {
  transition: none;
}

.material-check.uncheck {
  animation: matCheckOff 0.364s cubic-bezier(0.22, 1, 0.38, 1) both;
  transition: none;
  will-change: transform, background, border-color, box-shadow;
}

.material-check.uncheck .material-check-icon {
  opacity: 1 !important;
  transform: scale(1) !important;
  transition: none;
  animation: matCheckIconOff 0.343s cubic-bezier(0.22, 1, 0.38, 1) both;
  will-change: transform, opacity;
}

#material-list .material-item > .craft-open-btn {
  grid-column: -1;
  margin-left: 0;
}

#material-list .group-chevron {
  width: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.group-container {
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-fab);
  background: var(--md-surface-3);
  margin-bottom: 8px;
}

.material-item,
.child-item,
.standalone-item {
  border: 1px solid transparent;
  border-radius: var(--md-radius-fab);
  background: transparent;
  transition: background 0.202s ease-out;
}

.material-item:hover,
.child-item:hover,
.standalone-item:hover {
  background: var(--md-surface-hover);
}

#material-list .material-item,
#material-list .child-item,
#material-list .standalone-item {
  transition: background 0.202s ease-out;
}

#material-list .material-item:active,
#material-list .child-item:active,
#material-list .standalone-item:active {
  transform: none;
}

.material-img-wrap {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 10px;
  flex-shrink: 0;
}

#material-list .material-img-wrap {
  width: 48px;
  height: 48px;
}

#material-list .material-img-wrap img {
  width: 44px;
  height: 44px;
  image-rendering: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

#material-list .child-item .material-img-wrap {
  width: 44px;
  height: 44px;
}

#material-list .child-item .material-img-wrap img {
  width: 38px;
  height: 38px;
  image-rendering: auto;
}

.group-header {
  background: transparent;
}

.group-header:hover {
  background: var(--md-surface-hover);
}

.group-children {
  background: color-mix(in srgb, var(--guide-bg) 38%, var(--md-surface-2));
}

.section-label,
.guide-craft-guides-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.2);
}

.popup-footer {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  background: transparent;
  align-items: center;
  min-height: 52px;
  box-sizing: border-box;
}

.popup-footer-count {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.3);
}

.popup-footer-count span {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 600;
}

.popup-reset-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--md-radius-fab);
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  min-height: 34px;
  padding: 0 14px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.popup-reset-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.75);
}

.empty-state {
  color: rgba(255, 255, 255, 0.25);
}

.popup-progress-fill {
  height: 100%;
  border: none;
  border-radius: 999px;
  box-shadow: none;
  outline: none;
  background: linear-gradient(90deg, var(--md-accent), #66d4ff);
  transition: width 0.5s cubic-bezier(0.34, 1.1, 0.64, 1), background 0.35s ease;
}

#hud {
  background: var(--md-surface);
  border: 1px solid var(--md-accent-border);
  box-shadow: none;
  color: var(--md-on-surface);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

#material-list .guide-picked,
.material-list .guide-picked {
  outline: 2px solid rgba(0, 191, 255, 0.75);
  outline-offset: -2px;
  background: rgba(0, 191, 255, 0.12) !important;
  transition: background 0.25s ease, outline-color 0.25s ease;
}

#fov-slider-container,
#explode-slider-container {
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: 14px;
}

/* Exploded view — palette-style open/close animation */
#explode-slider-container {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(20px) scale(0.93);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.566s cubic-bezier(0.22, 1, 0.38, 1),
    transform 0.606s cubic-bezier(0.22, 1, 0.38, 1),
    background 0.202s ease-out,
    border-color 0.202s ease-out;
  will-change: opacity, transform;
  box-shadow: none !important;
}

#explode-slider-container.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
  background: var(--guide-bg);
  border-color: var(--md-accent-border-strong);
  box-shadow: 0 0 0 1px rgba(0, 191, 255, 0.1);
}

#explode-slider-container.closing {
  opacity: 0;
  transform: translateY(-50%) translateX(24px) scale(0.88);
  pointer-events: none;
  transition:
    opacity 0.323s cubic-bezier(0.42, 0, 0.72, 1),
    transform 0.364s cubic-bezier(0.42, 0, 0.8, 1),
    background 0.202s ease-out,
    border-color 0.202s ease-out;
}

#explode-slider-container.active > #explode-value,
#explode-slider-container.active > #explode-mode-toggle,
#explode-slider-container.active > #explode-slider {
  animation: wireframeChipIn 0.485s cubic-bezier(0.22, 1, 0.38, 1) both;
}

#explode-slider-container.active > #explode-mode-toggle {
  animation-delay: 0.061s;
}

#explode-slider-container.active > #explode-slider {
  animation-delay: 0.121s;
}

#explode-slider-container.closing > #explode-value,
#explode-slider-container.closing > #explode-mode-toggle,
#explode-slider-container.closing > #explode-slider {
  animation: guideColorChipOut 0.283s cubic-bezier(0.42, 0, 0.72, 1) both;
}

#explode-slider-container.closing > #explode-slider {
  animation-delay: 0s;
}

#explode-slider-container.closing > #explode-mode-toggle {
  animation-delay: 0.030s;
}

#explode-slider-container.closing > #explode-value {
  animation-delay: 0.061s;
}

#explode-slider-container.active + #explodeToggle,
#fov-slider-container.active + #fovToggle {
  background: var(--md-toggle-on-bg) !important;
  border-color: var(--md-toggle-on-border) !important;
  color: var(--md-toggle-on-icon) !important;
  box-shadow: var(--md-toggle-on-glow) !important;
}

#explode-slider-container.active + #explodeToggle:hover,
#fov-slider-container.active + #fovToggle:hover {
  background: var(--md-toggle-on-bg-hover) !important;
  border-color: rgba(0, 191, 255, 0.82) !important;
  color: #fff !important;
  box-shadow: var(--md-toggle-on-glow-hover) !important;
}

/* FOV — palette-style open/close animation */
#fov-slider-container {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) translateX(20px) scale(0.93);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.566s cubic-bezier(0.22, 1, 0.38, 1),
    transform 0.606s cubic-bezier(0.22, 1, 0.38, 1),
    background 0.202s ease-out,
    border-color 0.202s ease-out;
  will-change: opacity, transform;
  box-shadow: none !important;
}

#fov-slider-container.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
  background: var(--guide-bg);
  border-color: var(--md-accent-border-strong);
  box-shadow: 0 0 0 1px rgba(0, 191, 255, 0.1);
}

#fov-slider-container.closing {
  opacity: 0;
  transform: translateY(-50%) translateX(24px) scale(0.88);
  pointer-events: none;
  transition:
    opacity 0.323s cubic-bezier(0.42, 0, 0.72, 1),
    transform 0.364s cubic-bezier(0.42, 0, 0.8, 1),
    background 0.202s ease-out,
    border-color 0.202s ease-out;
}

#fov-slider-container.active > #fov-value,
#fov-slider-container.active > #fov-slider {
  animation: wireframeChipIn 0.485s cubic-bezier(0.22, 1, 0.38, 1) both;
}

#fov-slider-container.active > #fov-slider {
  animation-delay: 0.061s;
}

#fov-slider-container.closing > #fov-value,
#fov-slider-container.closing > #fov-slider {
  animation: guideColorChipOut 0.283s cubic-bezier(0.42, 0, 0.72, 1) both;
}

#fov-slider-container.closing > #fov-slider {
  animation-delay: 0s;
}

#fov-slider-container.closing > #fov-value {
  animation-delay: 0.030s;
}

#fov-slider-container label,
#explode-slider-container label,
#fov-value {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

#explode-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 5px;
  margin: 0;
}

#explode-value .explode-value-label {
  color: rgba(231, 233, 237, 0.52);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

#explode-value .explode-value-num {
  color: var(--md-on-surface);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#explode-slider-container.active #explode-value .explode-value-label {
  color: rgba(231, 233, 237, 0.58);
}

#explode-slider-container.active #explode-value .explode-value-num {
  color: var(--md-accent);
}

#explode-mode-toggle {
  background: var(--md-surface-2);
  border: 1px solid var(--md-border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

#explode-slider-container.active #explode-mode-toggle {
  background: var(--md-surface);
  border-color: var(--md-border);
}

.explode-mode-btn {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: -0.01em;
  border-radius: 7px;
  min-height: 28px;
  color: rgba(230, 232, 236, 0.45);
  border: 1px solid transparent;
}

.explode-mode-btn.active {
  font-weight: 700;
}

#fov-slider,
#explode-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin-top: 0;
}

#fov-slider::-webkit-slider-thumb,
#explode-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--md-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: none;
}

#fov-slider::-webkit-slider-thumb:hover,
#explode-slider::-webkit-slider-thumb:hover {
  background: #66d4ff;
  box-shadow: 0 0 0 5px rgba(0, 191, 255, 0.25);
}

#fov-slider::-moz-range-thumb,
#explode-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--md-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: none;
}

#fov-slider::-moz-range-thumb:hover,
#explode-slider::-moz-range-thumb:hover {
  background: #66d4ff;
  box-shadow: 0 0 0 5px rgba(0, 191, 255, 0.25);
}

.color-btn {
  border: 1px solid var(--md-border-strong);
  box-shadow: none;
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease-out,
    border-color 0.2s ease-out,
    background 0.2s ease-out,
    color 0.2s ease-out;
}

#wireframe-color-options .color-btn:hover,
#bg-color-options .color-btn:hover,
#layer-mode-options .color-btn:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

#block-tooltip {
  background: var(--md-surface);
  border: 1px solid var(--md-border-strong);
  box-shadow: none;
  border-radius: 12px;
}

#block-tooltip-name {
  font-weight: 600;
  letter-spacing: -0.02em;
}

#rulerToggle i {
  display: inline-block;
  transform: scaleX(-1);
  color: inherit;
}

/* ── Ruler mode (simple) ── */

body.guide-ruler-mode #hud {
  display: none !important;
}

#guide-ruler-strip {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 900;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--md-surface);
  border: 1px solid var(--md-accent-border);
  color: rgba(239, 241, 246, 0.78);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

body.guide-ruler-mode #guide-ruler-strip:not(.is-measuring) {
  display: flex;
}

.guide-ruler-strip__icon {
  color: var(--md-accent);
  font-size: 12px;
  transform: scaleX(-1);
  opacity: 0.9;
}

.guide-ruler-strip__text {
  white-space: nowrap;
}

#reset-camera .reset-camera-icon {
  display: block;
  width: 22px;
  height: 22px;
  transform: scaleX(-1);
  color: rgba(255, 255, 255, 0.9);
}

#reset-camera:hover .reset-camera-icon {
  color: #fff;
}

#reset-camera.active-toggle .reset-camera-icon,
#fullscreen-button.active-toggle .fullscreen-icon,
#resource-toggle.active-toggle #btn-img.wireframe-hash,
#screenshot-button.active-toggle .screenshot-icon {
  color: var(--md-toggle-on-icon);
}

#explodeToggle svg {
  width: 1.14em !important;
  height: 1.14em !important;
  stroke: currentColor;
}

#explodeToggle svg * {
  stroke-width: 2.5;
}

#resource-toggle #btn-img.wireframe-hash {
  box-sizing: border-box;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  user-select: none;
  pointer-events: none;
}

#resource-toggle #btn-img.wireframe-hash svg {
  width: 22px;
  height: 22px;
  display: block;
}

#resource-toggle #btn-img.wireframe-hash path {
  fill: currentColor;
  stroke: none;
}

#resource-toggle:hover #btn-img.wireframe-hash {
  color: #fff;
}

#wireframe-color-options {
  position: absolute;
  top: 50%;
  right: 66px;
  transform: translateY(-50%) translateX(20px) scale(0.93);
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.566s cubic-bezier(0.22, 1, 0.38, 1),
    transform 0.606s cubic-bezier(0.22, 1, 0.38, 1);
  will-change: opacity, transform;
}

#wireframe-color-options.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

#wireframe-color-options.closing,
#bg-color-options.closing,
#layer-mode-options.closing {
  opacity: 0;
  transform: translateY(-50%) translateX(24px) scale(0.88);
  pointer-events: none;
  transition:
    opacity 0.323s cubic-bezier(0.42, 0, 0.72, 1),
    transform 0.364s cubic-bezier(0.42, 0, 0.8, 1);
}

#wireframe-color-options .color-btn {
  transition: transform 0.283s cubic-bezier(0.22, 1, 0.38, 1), box-shadow 0.283s ease-out;
}

#wireframe-color-options.active .color-btn {
  animation: wireframeChipIn 0.485s cubic-bezier(0.22, 1, 0.38, 1) both;
}

#wireframe-color-options.active .color-btn:nth-child(2) {
  animation-delay: 0.061s;
}

#wireframe-color-options.active .color-btn:nth-child(3) {
  animation-delay: 0.121s;
}

#wireframe-color-options.active .color-btn:nth-child(4) {
  animation-delay: 0.182s;
}

#wireframe-color-options.closing .color-btn,
#bg-color-options.closing .color-btn {
  animation: guideColorChipOut 0.283s cubic-bezier(0.42, 0, 0.72, 1) both;
}

#wireframe-color-options.closing .color-btn:nth-child(4),
#bg-color-options.closing .color-btn:nth-child(3),
#layer-mode-options.closing .color-btn:nth-child(3) {
  animation-delay: 0s;
}

#wireframe-color-options.closing .color-btn:nth-child(3),
#bg-color-options.closing .color-btn:nth-child(2),
#layer-mode-options.closing .color-btn:nth-child(2) {
  animation-delay: 0.030s;
}

#wireframe-color-options.closing .color-btn:nth-child(2),
#bg-color-options.closing .color-btn:nth-child(1),
#layer-mode-options.closing .color-btn:nth-child(1) {
  animation-delay: 0.061s;
}

#wireframe-color-options.closing .color-btn:nth-child(1) {
  animation-delay: 0.091s;
}

#wireframe-color-options .color-btn:hover {
  transform: scale(1.08);
}

@keyframes wireframeChipIn {
  from {
    opacity: 0;
    transform: translateX(12px) scale(0.86);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes guideColorChipOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(14px) scale(0.84);
  }
}

#bg-color-options {
  position: absolute;
  top: 50%;
  right: 66px;
  transform: translateY(-50%) translateX(20px) scale(0.93);
  display: flex;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.566s cubic-bezier(0.22, 1, 0.38, 1),
    transform 0.606s cubic-bezier(0.22, 1, 0.38, 1);
  will-change: opacity, transform;
}

#layer-mode-options {
  position: absolute;
  top: 50%;
  right: var(--guide-ui-flyout, 66px);
  transform: translateY(-50%) translateX(20px) scale(0.93);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--guide-ui-gap, 6px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.566s cubic-bezier(0.22, 1, 0.38, 1),
    transform 0.606s cubic-bezier(0.22, 1, 0.38, 1);
  will-change: opacity, transform;
}

#layer-mode-options.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

#layer-mode-options .color-btn {
  transition: transform 0.283s cubic-bezier(0.22, 1, 0.38, 1), box-shadow 0.283s ease-out, border-color 0.283s ease-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

#layer-mode-options .layer-mode-icon {
  width: 1em;
  height: 1em;
  display: block;
  flex-shrink: 0;
}

#layer-mode-options .layer-mode-top {
  fill: currentColor;
  stroke: currentColor;
}

#layer-mode-options.active .color-btn {
  animation: wireframeChipIn 0.485s cubic-bezier(0.22, 1, 0.38, 1) both;
}

#layer-mode-options.active .color-btn:nth-child(2) {
  animation-delay: 0.061s;
}

#layer-mode-options.active .color-btn:nth-child(3) {
  animation-delay: 0.121s;
}

#layer-mode-options .color-btn::after {
  display: none;
}

#layer-mode-options .color-btn:active {
  transform: scale(0.94);
}

#layer-mode-options .color-btn:hover,
#layer-mode-options .layer-mode-btn[data-default-layer-mode='true']:hover {
  transform: scale(1.08);
}

#layer-mode-options .color-btn,
#wireframe-color-options .color-btn[data-mode="0"],
#bg-color-options .color-btn:not([data-color="0.565,0.835,1"]):not([data-color="0.9,0.9,0.9"]) {
  background: var(--md-surface) !important;
}

#bg-color-options.active {
  opacity: 1;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: auto;
}

#bg-color-options .color-btn {
  transition: transform 0.283s cubic-bezier(0.22, 1, 0.38, 1), box-shadow 0.283s ease-out;
}

#bg-color-options.active .color-btn {
  animation: wireframeChipIn 0.485s cubic-bezier(0.22, 1, 0.38, 1) both;
}

#bg-color-options.active .color-btn:nth-child(2) {
  animation-delay: 0.061s;
}

#bg-color-options.active .color-btn:nth-child(3) {
  animation-delay: 0.121s;
}

#bg-color-options .color-btn:hover {
  transform: scale(1.08);
}

@media (max-width: 768px) {
  #build-indicator,
  #material-button {
    border-radius: 17px;
  }

  .popup-content {
    width: calc(100vw - 24px);
    max-width: 420px;
    border-radius: var(--md-radius-card);
    max-height: calc(80vh * 1.02);
  }

  #popup-overlay {
    justify-content: center;
    align-items: center;
  }

  #wireframe-color-options,
  #bg-color-options,
  #layer-mode-options {
    right: 52px;
    gap: 6px;
  }

  #resource-toggle #btn-img.wireframe-hash svg {
    width: 20px;
    height: 20px;
  }
}

/* Craft popup + material list craft buttons */
#material-list .craft-note,
#material-list .extra-logs-badge {
  display: none !important;
}

#craft-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(8, 8, 8, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.202s ease-out;
}

#craft-popup-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#craft-popup {
  background: var(--md-surface-2);
  border: 1px solid var(--md-border-strong);
  border-radius: 20px;
  padding: 22px 22px 26px;
  width: 360px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 64px rgba(8, 8, 8, 0.75);
  transform: scale(0.94) translateY(10px);
  transition: transform 0.242s cubic-bezier(0.34, 1.15, 0.64, 1);
  font-family: var(--guide-font, "Segoe UI", system-ui, sans-serif);
}

#craft-popup-overlay.open #craft-popup {
  transform: scale(1) translateY(0);
}

.craft-popup-header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

#craft-back-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--md-border-strong);
  background: var(--md-surface);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.craft-header-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--md-raised);
  border: 1px solid var(--md-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.craft-header-img img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  object-fit: contain;
}

#craft-popup-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#craft-type-tabs {
  display: flex;
  gap: 5px;
  background: var(--md-surface-2);
  border: 1px solid var(--md-border);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}

.craft-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.craft-tab.active {
  font-weight: 700;
}

.craft-tab img {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
}

#craft-recipe-area {
  min-height: 100px;
}

.craft-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
}

.craft-grid {
  display: grid;
  grid-template-columns: repeat(3, 52px);
  gap: 4px;
}

.craft-slot {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--md-surface);
  border: 1.5px solid var(--md-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.craft-slot img {
  width: 38px;
  height: 38px;
  image-rendering: pixelated;
  object-fit: contain;
}

.craft-slot.has-recipe {
  cursor: pointer;
  border-color: rgba(0, 191, 255, 0.32);
}

.craft-slot--result {
  width: 60px;
  height: 60px;
}

.craft-slot--result img {
  width: 44px;
  height: 44px;
}

.craft-count {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(8, 8, 8, 0.9);
}

.craft-arrow {
  color: rgba(255, 255, 255, 0.28);
  font-size: 15px;
}

.craft-method-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--md-surface);
  border: 1.5px solid var(--md-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}

.craft-method-icon img {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

.craft-open-btn {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(0, 191, 255, 0.34);
  background: var(--md-accent-dim);
  color: var(--md-accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 0;
  font-size: 11px;
  flex-shrink: 0;
  box-shadow: none;
  transition: background 0.202s ease-out, border-color 0.202s ease-out, color 0.202s ease-out;
}

.craft-open-btn > i {
  display: block;
  width: 11px;
  height: 11px;
  font-size: 11px;
  line-height: 11px;
  text-align: center;
}

.craft-open-btn:hover {
  background: rgba(0, 191, 255, 0.26);
  border-color: rgba(0, 191, 255, 0.52);
  color: var(--md-accent);
}

.guide-craft-guides-label {
  color: rgba(255, 255, 255, 0.34);
}

@media (max-width: 480px) {
  #craft-popup {
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.98);
  }

  #craft-popup-overlay.open #craft-popup {
    transform: translateY(0) scale(1);
  }
}

.group-header-synth {
  background: rgba(255, 202, 66, 0.04);
}

.group-header-synth:hover {
  background: rgba(255, 202, 66, 0.08) !important;
}

/* ── Top-left actions (Material List) — spacing in UI layout rhythm below ── */

#fullscreen-button .fullscreen-icon {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  color: rgba(255, 255, 255, 0.9);
}

#screenshot-button .screenshot-icon {
  display: block;
  width: 22px;
  height: 22px;
  stroke: currentColor;
  color: rgba(255, 255, 255, 0.9);
  transition: transform 0.18s ease, color 0.18s ease;
}

#screenshot-button:hover .screenshot-icon {
  color: #fff;
}

#screenshot-button.is-capturing .screenshot-icon {
  transform: scale(0.88);
  color: var(--md-toggle-on-icon);
}

#fullscreen-button:hover .fullscreen-icon {
  color: #fff;
}

#popup-overlay {
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* ── UI layout rhythm (spacing + alignment only) ── */

:root {
  --guide-ui-inset: calc(16px * 1.02);
  --guide-ui-inset-sm: calc(12px * 1.02);
  --guide-ui-gap: 6px;
  --guide-ui-col-gap: 8px;
  --guide-btn-scale: calc(0.995 * 0.98);
  --guide-ui-flyout: calc(56px * var(--guide-btn-scale) + var(--guide-ui-gap) + 6px);
  --guide-ui-corner-bottom: calc(var(--guide-ui-inset) + 12px);
  --guide-ui-edge-nudge: 2px;
  --guide-press-ease: cubic-bezier(0.34, 1.32, 0.64, 1);
  --guide-press-release: cubic-bezier(0.22, 1, 0.36, 1);
}

.md-fab {
  width: calc(56px * var(--guide-btn-scale));
  height: calc(56px * var(--guide-btn-scale));
}

.md-fab > i,
.md-fab--accent > i {
  font-size: calc(19px * var(--guide-btn-scale));
  line-height: 1;
  margin: 0;
}

.md-fab-extended {
  height: calc(52px * var(--guide-btn-scale));
  padding: 0 16px;
  gap: 8px;
  justify-content: center;
}

.md-fab-extended .fab-icon {
  width: calc(32px * var(--guide-btn-scale));
  height: calc(32px * var(--guide-btn-scale));
  margin: 0;
  flex-shrink: 0;
}

.nav-arrow {
  width: calc(52px * var(--guide-btn-scale));
  height: calc(52px * var(--guide-btn-scale));
  margin-top: calc(-26px * var(--guide-btn-scale));
  font-size: calc(20px * var(--guide-btn-scale));
}

#help-button,
#home-button {
  width: calc(44px * var(--guide-btn-scale));
  height: calc(44px * var(--guide-btn-scale));
  font-size: calc(17px * var(--guide-btn-scale));
}

.color-btn {
  width: calc(40px * var(--guide-btn-scale));
  height: calc(40px * var(--guide-btn-scale));
}

.block-arrow,
.row-arrow {
  width: calc(44px * var(--guide-btn-scale));
  height: calc(44px * var(--guide-btn-scale));
  font-size: calc(14px * var(--guide-btn-scale));
}

.view-tab {
  min-height: calc(36px * var(--guide-btn-scale));
  font-size: calc(12px * var(--guide-btn-scale));
}

.view-tab > i {
  font-size: calc(13px * var(--guide-btn-scale));
}

.md-fab,
.nav-arrow,
.block-arrow,
.row-arrow,
.color-btn,
#help-button,
#home-button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  vertical-align: middle;
  padding: 0;
  line-height: 1;
}

:is(.md-fab, .nav-arrow, .block-arrow, .row-arrow, .color-btn, #help-button, #home-button) :is(img, svg, i) {
  display: block;
  margin: auto;
  flex-shrink: 0;
  transition: transform 0.14s cubic-bezier(0.34, 1.28, 0.64, 1);
}

.bg-color-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

#b-top {
  top: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-top, 0px));
  right: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-right, 0px));
  gap: var(--guide-ui-col-gap);
  align-items: flex-start;
}

#b-main,
#settings-panel {
  gap: var(--guide-ui-gap);
}

/* Settings column — horizontal slide-out (same direction, refined spring) */
#settings-panel {
  transform: translateX(calc(100% + var(--guide-ui-col-gap, 10px))) scale(0.95);
  transform-origin: right center;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.56s cubic-bezier(0.22, 1, 0.34, 1),
    opacity 0.36s ease-out;
  will-change: transform, opacity;
}

#settings-panel.active {
  transform: translateX(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

#settings-panel.closing {
  transform: translateX(calc(100% + 12px)) scale(0.93);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.34s cubic-bezier(0.42, 0, 0.72, 1),
    opacity 0.24s ease-in;
}

@keyframes settingsSlideChipIn {
  0% {
    opacity: 0;
    transform: translateX(16px) scale(0.9);
  }
  68% {
    opacity: 1;
    transform: translateX(-1px) scale(1.025);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes settingsSlideChipOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(12px) scale(0.88);
  }
}

#settings-panel.active > * {
  animation: settingsSlideChipIn 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#settings-panel.active > *:nth-child(1) {
  animation-delay: 0.04s;
}

#settings-panel.active > *:nth-child(2) {
  animation-delay: 0.08s;
}

#settings-panel.active > *:nth-child(3) {
  animation-delay: 0.12s;
}

#settings-panel.active > *:nth-child(4) {
  animation-delay: 0.16s;
}

#settings-panel.active > *:nth-child(5) {
  animation-delay: 0.2s;
}

#settings-panel.active > *:nth-child(6) {
  animation-delay: 0.24s;
}

#settings-panel.closing > * {
  animation: settingsSlideChipOut 0.26s cubic-bezier(0.42, 0, 0.72, 1) both;
}

#settings-panel.closing > *:nth-child(6) {
  animation-delay: 0s;
}

#settings-panel.closing > *:nth-child(5) {
  animation-delay: 0.025s;
}

#settings-panel.closing > *:nth-child(4) {
  animation-delay: 0.05s;
}

#settings-panel.closing > *:nth-child(3) {
  animation-delay: 0.075s;
}

#settings-panel.closing > *:nth-child(2) {
  animation-delay: 0.1s;
}

#settings-panel.closing > *:nth-child(1) {
  animation-delay: 0.125s;
}

#settings-button > i {
  transition: transform 0.48s cubic-bezier(0.34, 1.28, 0.64, 1);
}

#settings-button.active-toggle > i {
  transform: rotate(90deg);
}

#b-bottom {
  top: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-top, 0px));
  bottom: auto;
  left: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-left, 0px));
  flex-direction: column;
  align-items: flex-start;
  gap: var(--guide-ui-gap);
}

#build-indicator {
  top: calc(var(--guide-ui-inset) + env(safe-area-inset-top, 0px));
  padding: 8px 22px;
}

#arrow-left {
  left: calc(var(--guide-ui-inset) + env(safe-area-inset-left, 0px));
}

#arrow-right {
  right: calc(var(--guide-ui-inset) + env(safe-area-inset-right, 0px));
}

#help-button {
  bottom: calc(var(--guide-ui-corner-bottom) - var(--guide-ui-edge-nudge) + env(safe-area-inset-bottom, 0px));
  right: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-right, 0px));
  margin: 0;
}

#home-button {
  bottom: calc(var(--guide-ui-corner-bottom) - var(--guide-ui-edge-nudge) + env(safe-area-inset-bottom, 0px));
  left: calc(var(--guide-ui-inset) - var(--guide-ui-edge-nudge) + env(safe-area-inset-left, 0px));
  margin: 0;
}

#wireframe-color-options,
#bg-color-options,
#layer-mode-options {
  gap: var(--guide-ui-gap, 6px);
  right: var(--guide-ui-flyout);
}

#fov-slider-container,
#explode-slider-container {
  right: var(--guide-ui-flyout);
  padding: 12px 16px;
  gap: 10px;
}

.popup-view-tabs {
  padding: 10px 12px;
  gap: var(--guide-ui-gap);
}

.view-tab {
  padding: 0 10px;
  gap: 6px;
  justify-content: center;
}

@media (max-width: 768px) {
  :root {
    --guide-ui-inset: var(--guide-ui-inset-sm);
    --guide-ui-gap: 5px;
    --guide-ui-col-gap: 6px;
    --guide-ui-flyout: calc(44px * var(--guide-btn-scale) + var(--guide-ui-gap) + 6px);
    --guide-ui-corner-bottom: calc(var(--guide-ui-inset-sm) + 10px);
  }

  .md-fab {
    width: calc(44px * var(--guide-btn-scale));
    height: calc(44px * var(--guide-btn-scale));
  }

  .md-fab-extended,
  #material-button {
    height: calc(44px * var(--guide-btn-scale));
  }

  .nav-arrow {
    width: calc(44px * var(--guide-btn-scale));
    height: calc(44px * var(--guide-btn-scale));
    margin-top: calc(-22px * var(--guide-btn-scale));
    font-size: calc(17px * var(--guide-btn-scale));
  }

  .block-arrow,
  .row-arrow {
    width: calc(36px * var(--guide-btn-scale));
    height: calc(36px * var(--guide-btn-scale));
  }

  #wireframe-color-options,
  #bg-color-options,
  #layer-mode-options {
    right: var(--guide-ui-flyout);
  }

  #fov-slider-container,
  #explode-slider-container {
    right: var(--guide-ui-flyout);
  }
}

/* ── Icon press feedback (all toolbar + popup controls) ── */

.md-btn,
.nav-arrow,
.block-arrow,
.row-arrow,
.color-btn,
#help-button,
#home-button,
.view-tab,
.explode-mode-btn,
#block-scroll-center,
.popup-reset-btn,
.close-btn,
#popup-overlay .close-btn,
.material-item,
.child-item,
.standalone-item {
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.18s ease-out,
    border-color 0.18s ease-out,
    color 0.18s ease-out,
    box-shadow 0.16s ease-out,
    transform 0.15s var(--guide-press-ease);
}

.md-btn::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.24) 0%, transparent 72%);
  transition: opacity 0.3s ease, transform 0.32s var(--guide-press-release);
}

.md-btn:active::after {
  opacity: 1;
  transform: scale(2.15);
  transition: opacity 0.07s ease, transform 0.12s var(--guide-press-ease);
}

.md-fab--accent::after,
.md-fab--accent.active-toggle::after,
.md-fab-extended.active-toggle::after {
  background: radial-gradient(circle, rgba(0, 191, 255, 0.34) 0%, transparent 72%);
}

.nav-arrow::after,
.color-btn::after,
.block-arrow::after,
.row-arrow::after,
#help-button::after,
#home-button::after,
.view-tab::after,
.explode-mode-btn::after,
#block-scroll-center::after,
.popup-reset-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, transparent 72%);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.3s ease, transform 0.32s var(--guide-press-release);
  pointer-events: none;
}

.nav-arrow:active::after,
.color-btn:active::after,
.block-arrow:active::after,
.row-arrow:active::after,
#help-button:active::after,
#home-button:active::after,
.view-tab:active::after,
.explode-mode-btn:active::after,
#block-scroll-center:active::after,
.popup-reset-btn:active::after {
  opacity: 1;
  transform: scale(2.15);
  transition: opacity 0.07s ease, transform 0.12s var(--guide-press-ease);
}

.color-btn,
.block-arrow,
.row-arrow,
#help-button,
#home-button,
.view-tab,
.explode-mode-btn,
#block-scroll-center,
.popup-reset-btn {
  position: relative;
  overflow: hidden;
}

.md-btn:active:not(:disabled),
.nav-arrow:active,
.block-arrow:active,
.row-arrow:active,
#help-button:active,
#home-button:active,
.view-tab:active,
.explode-mode-btn:active,
#block-scroll-center:active,
.popup-reset-btn:active,
.material-item:active,
.child-item:active,
.standalone-item:active {
  transform: scale(0.91) translateY(1px);
}

.md-fab-extended:active {
  transform: scale(0.955) translateY(1px);
}

.color-btn:active {
  transform: scale(0.94);
  border-color: rgba(255, 255, 255, 0.42);
}

.close-btn:active,
#popup-overlay .close-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.md-fab:active,
.md-fab--accent:active {
  background: var(--md-surface-active);
}

.md-fab--accent:active {
  background: rgba(0, 191, 255, 0.24);
  border-color: rgba(0, 191, 255, 0.42);
}

.md-fab.active-toggle:active,
.md-fab--accent.active-toggle:active {
  background: rgba(0, 191, 255, 0.48);
  border-color: rgba(0, 191, 255, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.18), var(--md-toggle-on-glow);
}

:is(.md-fab, .nav-arrow, .block-arrow, .row-arrow, .color-btn, #help-button, #home-button, .view-tab, .explode-mode-btn, .popup-reset-btn) :is(img, svg, i) {
  transition: transform 0.14s var(--guide-press-ease);
}

.md-btn:active:not(:disabled) :is(i, svg, img),
.nav-arrow:active :is(i, svg, img),
.block-arrow:active :is(i, svg, img),
.row-arrow:active :is(i, svg, img),
.color-btn:active :is(i, svg, img),
#help-button:active :is(i, svg, img),
#home-button:active :is(i, svg, img),
.view-tab:active :is(i, svg, img),
.explode-mode-btn:active :is(i, svg, img),
.popup-reset-btn:active :is(i, svg, img) {
  transform: scale(0.86);
}

@media (prefers-reduced-motion: reduce) {
  .md-btn:active,
  .nav-arrow:active,
  .block-arrow:active,
  .row-arrow:active,
  .color-btn:active,
  #help-button:active,
  #home-button:active,
  .view-tab:active,
  .explode-mode-btn:active,
  #block-scroll-center:active,
  .popup-reset-btn:active,
  .close-btn:active,
  #popup-overlay .close-btn:active,
  .material-item:active,
  .child-item:active,
  .standalone-item:active,
  .md-fab-extended:active {
    transform: none;
  }

  .md-btn:active :is(i, svg, img),
  .nav-arrow:active :is(i, svg, img),
  .color-btn:active :is(i, svg, img),
  .view-tab:active :is(i, svg, img) {
    transform: none;
  }

  #settings-panel,
  #settings-panel.active,
  #settings-panel.closing {
    transition-duration: 0.01ms !important;
  }

  #settings-panel.active > *,
  #settings-panel.closing > * {
    animation: none !important;
  }

  #settings-button.active-toggle > i {
    transform: none;
  }

  .view-tab.active,
  .explode-mode-btn.active,
  .craft-tab.active,
  #layer-mode-options .layer-mode-btn.selected,
  .block-arrow.block-nav-active,
  #block-scroll-center.block-nav-active,
  .md-fab.active-toggle,
  .md-fab--accent.active-toggle {
    box-shadow: inset 0 0 0 1px var(--md-toggle-on-border) !important;
  }

  .md-fab.active-toggle::before,
  .md-fab--accent.active-toggle::before,
  .md-fab-extended.active-toggle::before {
    display: none;
  }

  #wireframe-color-options .color-btn.selected,
  #bg-color-options .color-btn.selected {
    transform: none;
  }
}

/* Deep Sky Blue — override guide-base hardcoded accent remnants */
.this-layer-badge {
  color: var(--md-accent);
  background: rgba(0, 191, 255, 0.12);
  border-color: rgba(0, 191, 255, 0.25);
}

.block-arrow.block-nav-active {
  color: var(--md-toggle-on-icon);
}

#hud {
  border-color: rgba(0, 191, 255, 0.38);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 191, 255, 0.08);
}

#help-button:hover,
#home-button:hover {
  border-color: rgba(0, 191, 255, 0.22);
}

.nav-arrow:hover {
  border-color: rgba(0, 191, 255, 0.22);
}

.tutorial-icon {
  border-color: rgba(0, 191, 255, 0.2);
}
