 :root {
  --bg: #06111b;
  --panel: rgba(10, 22, 35, 0.82);
  --panel-strong: rgba(18, 37, 56, 0.96);
  --text: #e8f3ff;
  --muted: #92a9bd;
  --line: rgba(111, 185, 255, 0.22);
  --accent: #6ee7ff;
  --accent-strong: #30b7ff;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 15%, rgba(59, 179, 255, 0.20), transparent 26%),
    radial-gradient(circle at 80% 0%, rgba(111, 231, 255, 0.12), transparent 24%),
    linear-gradient(145deg, #030811, #07131d 48%, #0d1f31);
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.hero,
.controls,
.preview-panel,
.numbering-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 0.95;
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}

.hero-actions,
.numbering-actions,
.preview-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  color: var(--text);
  background: var(--panel-strong);
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04111b;
  border-color: rgba(110, 231, 255, 0.4);
}

.button.is-active {
  background: rgba(48, 183, 255, 0.24);
  color: var(--text);
  border-color: rgba(48, 183, 255, 0.55);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 460px) 1fr;
  gap: 20px;
  margin-top: 20px;
}

.controls,
.preview-panel,
.numbering-panel {
  border-radius: 24px;
  padding: 20px;
}

.controls {
  display: grid;
  gap: 14px;
}

.priority-cycle {
  order: -30;
}

.priority-scrambler-top {
  order: -40;
}

.priority-quick-scramble {
  order: -50;
}

.priority-scramble {
  order: -20;
}

.priority-algorithm {
  order: -15;
}

.priority-mask-row {
  order: -18;
}

.priority-mask-help {
  order: -17;
}


.grid {
  display: grid;
  gap: 14px;
}

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

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

label {
  display: grid;
  gap: 6px;
  font-size: 0.94rem;
  color: var(--muted);
}

.control-pair {
  display: grid;
  gap: 8px;
}

.control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.94rem;
}

.control-head output {
  min-width: 2.5rem;
  text-align: right;
  color: var(--accent-strong);
  font-weight: 700;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 10px;
  align-items: center;
}

.control-stack {
  display: grid;
  gap: 10px;
}

.mask-help-card,
.cycle-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(111, 185, 255, 0.16);
  border-radius: 18px;
  background: rgba(8, 18, 29, 0.74);
}

.mask-help-card,
.cycle-card {
  align-content: start;
  color: var(--muted);
  font-size: 0.9rem;
}

.drag-help,
.download-help,
.cycle-help,
.cycle-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  font: inherit;
  color: var(--text);
  background: rgba(7, 19, 31, 0.92);
}

input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--accent);
}

.preview-panel {
  display: grid;
  gap: 18px;
}

.preview-frame {
  min-height: 560px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(110, 231, 255, 0.12), transparent 30%),
    linear-gradient(160deg, rgba(4, 12, 19, 0.96), rgba(11, 25, 39, 0.96)),
    repeating-linear-gradient(
      45deg,
      rgba(48, 183, 255, 0.04),
      rgba(48, 183, 255, 0.04) 8px,
      rgba(255, 255, 255, 0) 8px,
      rgba(255, 255, 255, 0) 16px
    );
  border: 1px solid rgba(111, 185, 255, 0.18);
}

.preview-cube {
  position: relative;
  width: min(100%, 680px);
  min-height: 500px;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.preview-cube svg,
.preview-cube img,
.preview-cube canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.preview-cube.is-dragging {
  cursor: grabbing;
}

.preview-status {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.numbering-panel {
  margin-top: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
}

.section-head h2 {
  margin: 0;
  font-size: 1.8rem;
}

.section-copy {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
}

.numbering-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.numbering-controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

.numbering-status {
  margin: 0;
  min-height: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.numbering-net {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 16px;
  align-items: start;
}

.net-face {
  display: grid;
  gap: 8px;
}

.net-face[data-face="U"] {
  grid-column: 2;
}

.net-face[data-face="L"] {
  grid-column: 1;
}

.net-face[data-face="F"] {
  grid-column: 2;
}

.net-face[data-face="R"] {
  grid-column: 3;
}

.net-face[data-face="B"] {
  grid-column: 4;
}

.net-face[data-face="D"] {
  grid-column: 2;
}

.net-face-label {
  font-weight: 700;
  color: var(--accent-strong);
}

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

.net-sticker {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.net-sticker input,
.net-sticker button {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  text-align: center;
  padding: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #081018;
}

.net-sticker button {
  cursor: default;
}

.net-sticker input:focus {
  outline: 2px solid rgba(111, 29, 20, 0.35);
  outline-offset: -2px;
}

.net-sticker.is-center {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}

.preview-label-layer {
  pointer-events: none;
}

.preview-label {
  font-family: "Segoe UI", sans-serif;
  font-size: 0.11px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  fill: #f6fbff;
  paint-order: stroke;
  stroke: rgba(4, 10, 16, 0.82);
  stroke-width: 0.02px;
}

.cycle-status[data-state="error"] {
  color: var(--accent-strong);
  font-weight: 600;
}

@media (max-width: 980px) {
  .workspace,
  .numbering-layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .numbering-net {
    grid-template-columns: repeat(4, minmax(90px, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 100%);
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .numbering-net {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 8px;
  }

  .net-face {
    gap: 4px;
  }

  .net-face-label {
    font-size: 0.72rem;
  }

  .net-grid {
    gap: 4px;
  }

  .net-sticker {
    border-radius: 8px;
  }

  .net-sticker input,
  .net-sticker button {
    font-size: 0.9rem;
  }

  .numbering-presets {
    gap: 6px;
  }

  .numbering-presets .button {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .preset-label {
    font-size: 0.78rem;
    flex-basis: 100%;
  }

  .control-row {
    grid-template-columns: 1fr;
  }
}
.workspace > .preview-panel {
  order: -1;
}

.workspace > .controls {
  order: 1;
}


.numbering-presets {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.preset-label {
  color: var(--muted);
  font-size: 0.86rem;
}

/* BEGIN_ADDED_BLD_SCRAMBLER_STYLES */
.bld-scrambler-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px dashed rgba(110, 231, 255, 0.5);
  border-radius: 18px;
  background: rgba(6, 18, 28, 0.85);
}

.quick-scramble-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(110, 231, 255, 0.28);
  border-radius: 18px;
  background: rgba(7, 20, 31, 0.86);
}

.quick-scramble-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.bld-scr-row {
  display: grid;
  grid-template-columns: auto auto minmax(100px, 160px);
  gap: 10px;
  align-items: end;
}

.bld-scr-row-top {
  grid-template-columns: minmax(0, 1fr) minmax(100px, 160px);
}

.bld-parity-row {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.bld-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(18, 37, 56, 0.6);
  color: var(--text);
}

.bld-inline-check input {
  width: auto;
}

.bld-filter-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(111, 185, 255, 0.2);
  background: rgba(9, 23, 36, 0.7);
}

.bld-filter-card strong {
  color: var(--accent);
  font-size: 0.88rem;
}

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

.bld-slider-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.bld-slider-row > span {
  text-align: right;
  white-space: nowrap;
}

.bld-range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.bld-range-value {
  min-width: 72px;
  text-align: right;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.bld-range-container {
  position: relative;
  height: 20px;
}

.bld-range-selected {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(110, 231, 255, 0.9), rgba(48, 183, 255, 0.9));
  pointer-events: none;
}

.bld-range-slider {
  position: absolute;
  inset: 0;
  margin: 0;
  pointer-events: none;
  appearance: none;
  background: transparent;
}

.bld-range-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(111, 185, 255, 0.2);
  border-radius: 999px;
}

.bld-range-slider::-moz-range-track {
  height: 6px;
  background: rgba(111, 185, 255, 0.2);
  border-radius: 999px;
}

.bld-range-slider::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #e8f3ff;
  border: 2px solid #30b7ff;
  margin-top: -4px;
  cursor: pointer;
}

.bld-range-slider::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #e8f3ff;
  border: 2px solid #30b7ff;
  cursor: pointer;
}

@media (max-width: 640px) {
  .bld-scr-row {
    grid-template-columns: 1fr;
  }
  .bld-scr-row-top {
    grid-template-columns: 1fr;
  }
  .bld-parity-row {
    justify-content: flex-start;
  }
  .quick-scramble-buttons {
    grid-template-columns: 1fr 1fr;
  }
  .bld-slider-row {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}
/* END_ADDED_BLD_SCRAMBLER_STYLES */
