:root {
  --bg: #080b12;
  --panel: rgba(18, 22, 34, .86);
  --panel-solid: #131724;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --text: #f7f8fc;
  --muted: #9ba3b7;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --green: #34d399;
  --danger: #fb7185;
  --cubie: clamp(54px, 7vw, 74px);
  --step: calc(var(--cubie) + 5px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 9% -12%, rgba(124, 58, 237, .28), transparent 34%),
    radial-gradient(circle at 90% 9%, rgba(6, 182, 212, .13), transparent 28%),
    linear-gradient(155deg, #080b12, #0c1019 46%, #080b12);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}
button, a { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(34, 211, 238, .8); outline-offset: 3px; }

.app-shell { width: min(1420px, calc(100% - 34px)); margin: 0 auto; padding: 26px 0 46px; position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 40px; }
.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 13px; }
.brand > span:last-child { display: flex; flex-direction: column; gap: 4px; }
.brand strong { font-size: 19px; letter-spacing: -.035em; }
.brand small { color: var(--muted); font-size: 11px; }
.brand-cube { width: 43px; height: 43px; position: relative; transform: rotate(30deg) skew(-4deg); border-radius: 12px; background: linear-gradient(145deg, #8b5cf6, #4f46e5); box-shadow: 0 12px 30px rgba(99,102,241,.34), inset 0 1px rgba(255,255,255,.4); }
.brand-cube i { position: absolute; background: rgba(255,255,255,.55); border-radius: 2px; }
.brand-cube i:nth-child(1) { width: 19px; height: 3px; left: 12px; top: 12px; }
.brand-cube i:nth-child(2) { width: 3px; height: 19px; left: 12px; top: 12px; }
.brand-cube i:nth-child(3) { width: 14px; height: 14px; right: 7px; bottom: 7px; border-radius: 4px; background: rgba(34,211,238,.8); }
.runtime-pill { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); background: rgba(8,11,18,.7); border-radius: 999px; color: #b8bed0; }
.runtime-pill span { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 14px currentColor; }
.runtime-pill b { font-size: 11px; font-weight: 650; }
.runtime-pill.ready span { background: var(--green); }
.runtime-pill.error span { background: var(--danger); }

.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr); gap: 50px; align-items: end; margin-bottom: 30px; padding: 0 7px; }
.eyebrow { margin: 0 0 12px; color: #b9a6ff; font-size: 10px; font-weight: 850; letter-spacing: .17em; text-transform: uppercase; }
.intro h1 { font-size: clamp(36px, 5.4vw, 69px); line-height: .96; letter-spacing: -.06em; margin: 0; }
.intro h1 span { color: transparent; background: linear-gradient(90deg, #c4b5fd, #67e8f9); background-clip: text; -webkit-background-clip: text; }
.intro > p { color: #aab1c3; font-size: 14px; line-height: 1.7; margin: 0 0 4px; max-width: 580px; }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 355px; gap: 20px; align-items: stretch; }
.stage-card, .control-card, .timeline-card { border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(22px); box-shadow: 0 26px 80px rgba(0,0,0,.35); border-radius: 25px; }
.stage-card { padding: 20px; min-height: 650px; overflow: hidden; }
.stage-head { display: flex; align-items: center; justify-content: space-between; color: #ccd0de; padding: 2px 4px 0; position: relative; z-index: 5; }
.stage-head > div { display: flex; align-items: center; gap: 9px; }
.stage-head strong { font-size: 13px; }
.stage-head > span { color: #7d859c; font-size: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px rgba(34,211,238,.55); }

.cube-viewport {
  position: relative;
  height: 530px;
  overflow: hidden;
  perspective: 1050px;
  perspective-origin: 50% 47%;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(107,114,255,.13), transparent 38%),
    linear-gradient(to bottom, rgba(255,255,255,.018), transparent 62%);
}
.cube-viewport.dragging { cursor: grabbing; }
.coach-slot {
  position: relative;
  z-index: 20;
  height: 78px;
  display: grid;
  place-items: center;
  margin: 7px 0 8px;
  pointer-events: none;
}
.move-coach {
  width: min(430px, calc(100% - 28px));
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 12px 18px;
  box-sizing: border-box;
  text-align: center;
  pointer-events: none;
  border: 1px solid rgba(103,232,249,.3);
  border-radius: 16px;
  background: rgba(7,10,18,.9);
  box-shadow: 0 14px 40px rgba(0,0,0,.38), inset 0 1px rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
}
.move-coach[hidden] { display: grid; visibility: hidden; opacity: 0; }
.turn-guide[hidden] { display: none; }
.coach-face { color: #67e8f9; font-size: 9px; font-weight: 900; letter-spacing: .17em; }
.move-coach strong { color: #f4f4f5; font-size: 15px; }
.move-coach small { color: #aeb6c9; font-size: 10px; line-height: 1.4; }
.turn-guide {
  position: absolute;
  z-index: 19;
  left: 50%;
  top: 49%;
  transform: translate(-50%, -50%);
  width: 174px;
  height: 174px;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.55));
}
.turn-guide::before { content: ""; position: absolute; inset: 0; border: 3px dashed rgba(255,255,255,.74); border-radius: 50%; }
.turn-guide strong { position: absolute; right: -25px; top: 50%; min-width: 58px; min-height: 58px; transform: translateY(-50%); display: grid; place-items: center; padding: 0 7px; box-sizing: border-box; border: 2px solid rgba(103,232,249,.66); border-radius: 50%; background: rgba(5,8,14,.9); font-size: 38px; line-height: 1; color: white; text-shadow: 0 0 15px rgba(34,211,238,.58), 0 4px 14px #000; }
.turn-guide span { position: absolute; left: 50%; bottom: -35px; transform: translateX(-50%); white-space: nowrap; padding: 6px 10px; color: #071019; background: #67e8f9; border-radius: 999px; font-size: 9px; font-weight: 950; letter-spacing: .12em; }
.cube-viewport[data-motion-phase="camera"] .move-coach,
.cube-viewport[data-motion-phase="turning"] .move-coach { border-color: rgba(167,139,250,.68); }
.cube-viewport[data-motion-phase="turning"] .turn-guide::before { border-color: #67e8f9; box-shadow: 0 0 45px rgba(34,211,238,.22); }
.scene-glow { position: absolute; left: 50%; top: 48%; width: 370px; height: 370px; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle, rgba(123,97,255,.18), transparent 66%); filter: blur(8px); }
.cube-shadow { position: absolute; left: 50%; top: 73%; width: 245px; height: 62px; transform: translateX(-50%); border-radius: 50%; background: rgba(0,0,0,.65); filter: blur(23px); opacity: .85; }
.cube-rig { position: absolute; left: 50%; top: 47%; width: 0; height: 0; transform-style: preserve-3d; transform: rotateX(-24deg) rotateY(-36deg); transition: transform .55s cubic-bezier(.2,.8,.2,1); }
.cube-rig.no-transition { transition: none; }
.cube-3d, .turn-layer { position: absolute; inset: 0; width: 0; height: 0; transform-style: preserve-3d; }
.turn-layer { transform-origin: 0 0 0; will-change: transform; }
.cubie { position: absolute; width: var(--cubie); height: var(--cubie); margin-left: calc(var(--cubie) / -2); margin-top: calc(var(--cubie) / -2); transform-style: preserve-3d; }
.plastic-face, .cube-sticker { position: absolute; inset: 0; backface-visibility: hidden; }
.plastic-face { background: linear-gradient(145deg, #171a22, #050609 72%); border: 1px solid #252a35; box-shadow: inset 0 0 14px rgba(255,255,255,.035); }
.surface-F { transform: translateZ(calc(var(--cubie) / 2)); }
.surface-B { transform: rotateY(180deg) translateZ(calc(var(--cubie) / 2)); }
.surface-R { transform: rotateY(90deg) translateZ(calc(var(--cubie) / 2)); }
.surface-L { transform: rotateY(-90deg) translateZ(calc(var(--cubie) / 2)); }
.surface-U { transform: rotateX(90deg) translateZ(calc(var(--cubie) / 2)); }
.surface-D { transform: rotateX(-90deg) translateZ(calc(var(--cubie) / 2)); }
.cube-sticker {
  inset: 5px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: linear-gradient(145deg, #313644, #242833);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 1px rgba(255,255,255,.14), inset 0 -7px 15px rgba(0,0,0,.16), 0 2px 5px rgba(0,0,0,.42);
  transition: filter .14s ease, box-shadow .14s ease, background .18s ease;
}
.cube-sticker.surface-F { transform: translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker.surface-B { transform: rotateY(180deg) translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker.surface-R { transform: rotateY(90deg) translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker.surface-L { transform: rotateY(-90deg) translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker.surface-U { transform: rotateX(90deg) translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker.surface-D { transform: rotateX(-90deg) translateZ(calc(var(--cubie) / 2 + 1px)); }
.cube-sticker::after { content: ""; position: absolute; inset: 7% 10% auto; height: 19%; border-radius: 999px; background: linear-gradient(to bottom, rgba(255,255,255,.24), transparent); opacity: .46; }
.cube-sticker:hover { filter: brightness(1.16); box-shadow: inset 0 1px rgba(255,255,255,.28), 0 0 0 2px rgba(34,211,238,.76), 0 5px 14px rgba(0,0,0,.42); }
.cube-sticker.selected { box-shadow: 0 0 0 3px #0a0d15, 0 0 0 6px var(--cyan), 0 0 24px rgba(34,211,238,.48); }
.cube-sticker.locked { cursor: default; }
.cube-sticker.locked:hover { filter: none; box-shadow: inset 0 1px rgba(255,255,255,.14), inset 0 -7px 15px rgba(0,0,0,.16), 0 2px 5px rgba(0,0,0,.42); }
.cube-sticker.center-fixed { box-shadow: inset 0 1px rgba(255,255,255,.2), inset 0 -7px 15px rgba(0,0,0,.12), 0 0 0 1px rgba(103,232,249,.2), 0 2px 5px rgba(0,0,0,.42); }
.cube-sticker.active-turn-face {
  filter: brightness(1.09) saturate(1.06);
  box-shadow: inset 0 1px rgba(255,255,255,.3), 0 0 0 2px rgba(103,232,249,.76), 0 0 13px rgba(34,211,238,.38), 0 3px 9px rgba(0,0,0,.48) !important;
}
.drag-hint { position: absolute; left: 50%; bottom: 15px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; color: #7f879c; font-size: 10px; background: rgba(7,9,15,.58); padding: 7px 10px; border: 1px solid rgba(255,255,255,.06); border-radius: 999px; pointer-events: none; }
.drag-hint span { color: #b5bbcd; }

.view-dock { min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px; background: rgba(5,7,12,.47); border: 1px solid var(--line); border-radius: 15px; overflow-x: auto; }
.view-dock > span { color: #6f778e; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; margin-right: 3px; }
.view-dock button { border: 1px solid transparent; background: transparent; color: #a8afc1; border-radius: 9px; min-height: 33px; padding: 0 12px; cursor: pointer; font-size: 10px; font-weight: 700; white-space: nowrap; }
.view-dock button:hover, .view-dock button.active { background: rgba(139,92,246,.12); color: #e4ddff; border-color: rgba(139,92,246,.22); }
.view-dock .view-home { font-size: 17px; padding: 0 10px; }

.control-card { padding: 25px; }
.scheme-card { margin: -3px 0 22px; border: 1px solid rgba(139,92,246,.23); border-radius: 17px; background: linear-gradient(145deg, rgba(139,92,246,.09), rgba(34,211,238,.035)); overflow: hidden; }
.scheme-card summary { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; list-style: none; }
.scheme-card summary::-webkit-details-marker { display: none; }
.scheme-card summary::after { content: "+"; flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #c4b5fd; font-size: 16px; }
.scheme-card[open] summary::after { content: "−"; }
.scheme-card summary > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.scheme-card summary small { color: #9f8cff; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.scheme-card summary strong { font-size: 12px; }
.scheme-card summary em { min-width: 0; margin-left: auto; color: #8d96ab; font-size: 8px; font-style: normal; line-height: 1.35; text-align: right; }
.scheme-card[open] summary em { display: none; }
.scheme-body { padding: 0 13px 14px; border-top: 1px solid rgba(255,255,255,.06); }
.reference-rule { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; margin: 13px 0 15px; padding: 11px; border: 1px solid rgba(34,211,238,.16); border-radius: 12px; background: rgba(7,12,20,.45); }
.reference-rule > i { width: 34px; height: 34px; border-radius: 10px; border: 2px solid rgba(255,255,255,.38); box-shadow: inset 0 1px rgba(255,255,255,.35), 0 5px 14px rgba(0,0,0,.3); }
.reference-rule p { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.reference-rule strong { color: #e8eaf2; font-size: 10px; }
.reference-rule span { color: #8992a8; font-size: 8px; line-height: 1.45; }
.scheme-label { display: grid; grid-template-columns: 23px 1fr; gap: 8px; align-items: start; margin: 13px 0 8px; }
.scheme-label > span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 7px; color: #c4b5fd; background: rgba(139,92,246,.13); font-size: 9px; font-weight: 850; }
.scheme-label p { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.scheme-label strong { font-size: 10px; }
.scheme-label small { color: #798298; font-size: 8px; line-height: 1.35; }
.palette-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.palette-slot { min-width: 0; height: 36px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.palette-slot > i { width: 27px; height: 27px; border: 1px solid rgba(255,255,255,.34); border-radius: 7px; box-shadow: inset 0 1px rgba(255,255,255,.3), 0 3px 8px rgba(0,0,0,.25); }
.palette-slot select { min-width: 0; width: 100%; height: 27px; padding: 0 3px; border: 0; outline: 0; color: #d9dce6; background: #151a27; font-size: 9px; cursor: pointer; }
.palette-slot select:disabled { color: #9ea6ba; cursor: default; opacity: 1; }
.palette-slot:focus-within { border-color: rgba(34,211,238,.5); box-shadow: 0 0 0 2px rgba(34,211,238,.08); }
.topology-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.topology-grid label { min-width: 0; display: flex; flex-direction: column; gap: 4px; color: #8d96aa; font-size: 8px; font-weight: 700; }
.topology-grid label:last-child { grid-column: 1 / -1; }
.topology-grid select { width: 100%; min-height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: #e4e7ef; background: #151a27; font-size: 9px; cursor: pointer; }
.topology-grid select:focus { border-color: rgba(34,211,238,.55); }
.scheme-error { min-height: 0; margin-top: 8px; color: #fda4af; font-size: 8px; line-height: 1.4; }
.scheme-error:not(:empty) { min-height: 23px; padding: 6px 8px; border-radius: 8px; background: rgba(251,113,133,.08); }
.apply-scheme { width: 100%; min-height: 40px; margin-top: 9px; border: 1px solid rgba(139,92,246,.3); border-radius: 11px; color: white; background: linear-gradient(100deg, rgba(124,58,237,.9), rgba(8,145,178,.88)); cursor: pointer; font-size: 10px; font-weight: 800; }
.apply-scheme:hover { filter: brightness(1.12); }
.scheme-warning { margin: 7px 0 0; color: #6f788e; font-size: 7px; text-align: center; }
.panel-step { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 0 0 18px; }
.panel-step > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: #c4b5fd; border: 1px solid rgba(139,92,246,.22); background: rgba(139,92,246,.1); font-size: 11px; font-weight: 850; }
.panel-step strong { display: block; font-size: 13px; margin: 2px 0 4px; }
.panel-step p { margin: 0; color: #7f879d; font-size: 11px; line-height: 1.45; }
.entry-progress { margin: 8px 0 17px; }
.progress-top { display: flex; justify-content: space-between; align-items: center; color: #9ba2b5; font-size: 10px; margin-bottom: 8px; }
.progress-top strong { color: #d8dbe5; }
.progress-track, .player-progress { height: 5px; background: rgba(255,255,255,.055); border-radius: 999px; overflow: hidden; }
.progress-track i, .player-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: inherit; transition: width .28s ease; }
.guide-message { min-height: 64px; display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 14px; padding: 12px; margin-bottom: 16px; }
.guide-message > span { color: var(--cyan); font-size: 15px; }
.guide-message p { margin: 0; color: #aab0c2; font-size: 10px; line-height: 1.5; }
.preset-row { display: grid; grid-template-columns: .7fr 1.25fr 1fr; gap: 7px; margin-bottom: 9px; }
.soft-btn, .solve-btn, .transport button, .start-over { border-radius: 11px; cursor: pointer; font-weight: 750; }
.soft-btn { min-height: 39px; padding: 0 7px; color: #aeb5c7; border: 1px solid var(--line); background: rgba(255,255,255,.03); font-size: 9px; }
.soft-btn:hover { background: rgba(255,255,255,.065); color: white; }
.soft-btn.accent { color: #c9bdff; border-color: rgba(139,92,246,.2); background: rgba(139,92,246,.08); }
.solve-btn { position: relative; width: 100%; min-height: 54px; border: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: linear-gradient(105deg, #7c3aed, #5b63ed 56%, #0891b2); box-shadow: 0 12px 28px rgba(99,102,241,.25); font-size: 13px; }
.solve-btn i { font-style: normal; font-size: 20px; }
.solve-btn:disabled { filter: saturate(.25); opacity: .42; cursor: not-allowed; box-shadow: none; }
.solve-btn:not(:disabled):hover { filter: brightness(1.1); transform: translateY(-1px); }
.solve-btn.busy span, .solve-btn.busy i { visibility: hidden; }
.solve-btn.busy::after { content: ""; position: absolute; left: 50%; width: 19px; height: 19px; margin-left: -10px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-message { display: none; margin-top: 10px; border-radius: 11px; padding: 10px 11px; font-size: 10px; line-height: 1.45; }
.status-message.show { display: block; }
.status-message.error { color: #fecdd3; background: rgba(251,113,133,.09); border: 1px solid rgba(251,113,133,.2); }
.status-message.success { color: #bbf7d0; background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.2); }

.solution-panel[hidden] { display: none; }
.solution-complete { display: flex; align-items: center; gap: 11px; padding: 11px; margin-bottom: 25px; border: 1px solid rgba(52,211,153,.18); background: rgba(52,211,153,.065); border-radius: 13px; }
.solution-complete > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #07150f; background: var(--green); font-weight: 900; }
.solution-complete div { display: flex; flex-direction: column; gap: 3px; }
.solution-complete small { color: #6ee7b7; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.solution-complete strong { font-size: 12px; }
.step-number { color: #aa96ff; font-size: 9px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.move-hero { margin: 17px 0 7px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.move-hero strong { font-size: clamp(48px, 6vw, 74px); line-height: .9; letter-spacing: -.06em; }
.move-hero span { max-width: 128px; color: #9ca4b8; font-size: 10px; line-height: 1.45; text-align: right; }
.human-instruction { min-height: 58px; padding: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 12px; color: #c4c9d7; font-size: 11px; line-height: 1.5; margin: 18px 0; }
.player-progress { margin-bottom: 15px; }
.transport { display: grid; grid-template-columns: 1fr 49px 1fr; gap: 8px; }
.transport button { min-height: 47px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.045); color: #e6e8ef; font-size: 11px; }
.transport button:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.transport button:disabled { opacity: .32; cursor: not-allowed; }
.transport .play-button { padding: 0; border: 0; background: linear-gradient(145deg, #7c3aed, #4f46e5); }
.solution-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 18px; }
.solution-stats > div { padding: 10px 8px; border: 1px solid var(--line); background: rgba(255,255,255,.022); border-radius: 11px; }
.solution-stats small { display: block; color: #707890; font-size: 8px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 5px; }
.solution-stats strong { font-size: 11px; }
.start-over { width: 100%; margin-top: 13px; min-height: 39px; background: transparent; color: #8f97ab; border: 1px solid var(--line); font-size: 10px; }
.start-over:hover { color: white; background: rgba(255,255,255,.04); }

.timeline-card { margin-top: 20px; padding: 18px 20px; display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.timeline-card[hidden] { display: none; }
.timeline-card > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.timeline-card strong { font-size: 12px; }
.timeline-card span { color: #777f94; font-size: 9px; }
.timeline { display: flex; align-items: center; gap: 7px; overflow-x: auto; padding: 3px 2px 8px; scrollbar-color: #3b4153 transparent; }
.move-chip { flex: 0 0 auto; width: 41px; height: 38px; border: 1px solid var(--line); color: #a7aec0; background: rgba(255,255,255,.025); border-radius: 10px; cursor: pointer; font-weight: 850; font-size: 11px; }
.move-chip.active { border-color: rgba(139,92,246,.7); color: white; background: rgba(139,92,246,.17); }
.move-chip.done { color: #86efac; border-color: rgba(52,211,153,.17); }

.color-menu { position: fixed; z-index: 1000; width: min(285px, calc(100vw - 24px)); padding: 15px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(18,21,31,.97); backdrop-filter: blur(24px); box-shadow: 0 24px 70px rgba(0,0,0,.56), 0 0 0 1px rgba(0,0,0,.35); animation: menuIn .16s ease both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.color-menu[hidden] { display: none; }
.color-menu-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 12px; }
.color-menu-head div { display: flex; flex-direction: column; gap: 3px; }
.color-menu-head small { color: #7f879c; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.color-menu-head strong { font-size: 12px; }
.color-menu-head button { width: 28px; height: 28px; border: 0; border-radius: 9px; background: rgba(255,255,255,.05); color: #a6adbf; cursor: pointer; font-size: 18px; }
.color-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.color-option { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 11px; cursor: pointer; color: #d9dce6; font-size: 10px; font-weight: 750; }
.color-option:hover { background: rgba(255,255,255,.075); border-color: var(--line-strong); }
.color-option i { width: 22px; height: 22px; border-radius: 7px; border: 1px solid rgba(255,255,255,.42); box-shadow: inset 0 1px rgba(255,255,255,.38), 0 3px 8px rgba(0,0,0,.25); }
.color-option > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.color-option-count { flex: 0 0 auto; margin-left: auto; color: #858da0; font-size: 8px; font-weight: 850; }
.color-option.current { border-color: rgba(139,92,246,.48); background: rgba(139,92,246,.1); }
.color-option.current .color-option-count { color: #c4b5fd; }
.color-option:disabled, .color-option.exhausted { opacity: .28; filter: grayscale(.9); cursor: not-allowed; }
.color-option:disabled:hover { background: rgba(255,255,255,.03); border-color: var(--line); }
.remove-color { width: 100%; min-height: 35px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: #888fa2; cursor: pointer; font-size: 9px; }
.remove-color:hover { color: #fecdd3; border-color: rgba(251,113,133,.22); }

.modal-open { overflow: hidden; }
.validation-modal { position: fixed; inset: 0; z-index: 2200; display: grid; place-items: center; padding: 22px; }
.validation-modal[hidden] { display: none; }
.validation-backdrop { position: absolute; inset: 0; background: rgba(3,5,10,.82); backdrop-filter: blur(10px); }
.validation-dialog { position: relative; width: min(500px, 100%); padding: 32px; border: 1px solid rgba(251,113,133,.28); border-radius: 22px; background: #15171c; box-shadow: 0 34px 110px rgba(0,0,0,.72), 0 0 0 1px rgba(255,255,255,.035); animation: validationIn .2s ease both; }
@keyframes validationIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.validation-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; color: #aeb4c4; background: rgba(255,255,255,.035); cursor: pointer; font-size: 19px; }
.validation-icon { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 20px; border: 1px solid rgba(251,113,133,.32); border-radius: 16px; color: #fecdd3; background: rgba(251,113,133,.11); font-size: 25px; font-weight: 900; }
.validation-dialog > p { margin: 0 0 8px; color: #fb7185; font-size: 9px; font-weight: 900; letter-spacing: .16em; }
.validation-dialog h2 { max-width: 390px; margin: 0 0 14px; font-size: clamp(23px, 4vw, 31px); line-height: 1.08; letter-spacing: -.035em; }
.validation-message { color: #d7d9e2; font-size: 13px; line-height: 1.65; }
.validation-help { display: flex; flex-direction: column; gap: 4px; margin: 20px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; color: #8f96a8; background: rgba(255,255,255,.025); font-size: 11px; line-height: 1.55; }
.validation-help strong { color: #e8e9ee; }
.validation-review { width: 100%; min-height: 48px; border: 0; border-radius: 11px; color: white; background: #7457e8; cursor: pointer; font-size: 12px; font-weight: 800; }
.validation-review:hover { background: #8065ec; }

footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 11px; color: #626a7f; font-size: 9px; margin-top: 28px; }
footer i { width: 3px; height: 3px; border-radius: 50%; background: #34394a; }

@media (max-width: 1040px) {
  .intro { grid-template-columns: 1fr; gap: 18px; }
  .intro > p { max-width: 750px; }
  .workbench { grid-template-columns: 1fr; }
  .control-card { padding: 22px; }
  #entryPanel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
  .panel-step { grid-column: span 1; }
  .scheme-card, .entry-progress, .guide-message, .preset-row, .solve-btn, .status-message { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  :root { --cubie: clamp(48px, 15vw, 61px); }
  .app-shell { width: min(100% - 16px, 1420px); padding-top: 14px; }
  .topbar { margin-bottom: 27px; }
  .runtime-pill b { display: none; }
  .intro { padding: 0 4px; margin-bottom: 21px; }
  .intro h1 { font-size: clamp(35px, 11vw, 50px); }
  .intro > p { font-size: 12px; }
  .stage-card { min-height: 555px; padding: 12px; border-radius: 20px; }
  .cube-viewport { height: 450px; perspective: 900px; }
  .coach-slot { height: 74px; margin: 5px 0 8px; }
  .turn-guide { width: 158px; height: 158px; }
  .turn-guide strong { min-width: 52px; min-height: 52px; font-size: 34px; }
  .view-dock { justify-content: flex-start; }
  .view-dock > span { display: none; }
  .view-dock button { padding: 0 10px; }
  .control-card { padding: 19px; border-radius: 20px; }
  #entryPanel { display: block; }
  .preset-row { grid-template-columns: 1fr 1fr 1fr; }
  .timeline-card { grid-template-columns: 1fr; padding: 16px; }
  .color-menu { left: 12px !important; right: 12px; bottom: 12px; top: auto !important; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .color-menu { animation: none; }
  .validation-dialog { animation: none; }
  .cube-rig { transition-duration: .35s; }
}

/* Minimal tool-first layout ------------------------------------------------ */
:root {
  --bg: #0b0d10;
  --panel: #131519;
  --panel-solid: #15171b;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --text: #f3f4f6;
  --muted: #8b929f;
  --violet: #7c5cff;
  --cyan: #57c7d8;
}

body {
  background: #0b0d10;
}
body::before { display: none; }

.app-shell {
  width: min(1180px, calc(100% - 24px));
  padding: 16px 0 30px;
}

.topbar {
  margin-bottom: 16px;
}
.brand { gap: 10px; }
.brand > span:last-child { gap: 1px; }
.brand strong { font-size: 16px; letter-spacing: -.025em; }
.brand small { font-size: 10px; }
.brand-cube {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: none;
  background: #7457e8;
}
.brand-cube i:nth-child(1) { width: 15px; left: 10px; top: 9px; }
.brand-cube i:nth-child(2) { height: 15px; left: 10px; top: 9px; }
.brand-cube i:nth-child(3) { width: 11px; height: 11px; right: 6px; bottom: 6px; }
.runtime-pill {
  padding: 7px 11px;
  background: #111318;
}

.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 16px;
  padding: 0 2px;
}
.eyebrow {
  margin: 0 0 5px;
  color: #8e96a3;
  font-size: 9px;
  letter-spacing: .12em;
}
.intro h1 {
  max-width: 700px;
  margin: 0;
  font-size: clamp(25px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -.045em;
}
.intro h1 span {
  color: #9da4af;
  background: none;
  -webkit-text-fill-color: currentColor;
}
.intro > p {
  max-width: 370px;
  margin: 0 0 2px;
  color: #8f96a2;
  font-size: 12px;
  line-height: 1.5;
}

.workbench {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
}
.stage-card,
.control-card,
.timeline-card {
  border-radius: 16px;
  background: #131519;
  backdrop-filter: none;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .24);
}
.stage-card {
  min-height: 550px;
  padding: 14px;
}
.stage-head { padding: 0 2px; }
.stage-head > span { padding: 5px 8px; }
.mode-dot { width: 6px; height: 6px; box-shadow: none; }
.cube-viewport {
  height: 455px;
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 48%, rgba(124, 92, 255, .09), transparent 43%);
}
.scene-glow { opacity: .45; }
.view-dock {
  min-height: 42px;
  padding: 4px;
  border-radius: 11px;
  background: #0f1115;
}
.view-dock button {
  min-height: 31px;
  border-radius: 7px;
  padding: 0 10px;
}
.view-dock button:hover,
.view-dock button.active {
  background: #1d2027;
  border-color: #2c3039;
  color: #f3f4f6;
}

.control-card { padding: 16px; }
.scheme-card {
  margin: 0 0 14px;
  border-radius: 12px;
  border-color: var(--line);
  background: #17191e;
}
.scheme-card summary {
  min-height: 50px;
  padding: 9px 11px;
}
.scheme-card summary::after { border-radius: 7px; }
.scheme-card summary small { color: #8d94a0; }
.scheme-card summary strong { font-size: 11px; }
.scheme-body { padding: 0 11px 12px; }
.reference-rule { margin: 11px 0 13px; background: #111318; }
.apply-scheme {
  background: #7457e8;
  border-color: transparent;
}
.panel-step {
  grid-template-columns: 27px 1fr;
  gap: 9px;
  padding: 0 0 11px;
}
.panel-step > span {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  color: #b8a9ff;
  background: #1b1a28;
}
.panel-step strong { margin: 0 0 2px; font-size: 11px; }
.panel-step p { font-size: 9px; }
.entry-progress { margin: 3px 0 12px; }
.guide-message {
  min-height: 0;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  background: #17191d;
}
.preset-row { margin-bottom: 8px; }
.soft-btn { min-height: 35px; border-radius: 9px; background: #17191d; }
.solve-btn {
  min-height: 48px;
  border-radius: 10px;
  background: #7457e8;
  box-shadow: none;
}
.solve-btn:not(:disabled):hover { background: #8065ec; }

.solution-complete,
.human-instruction,
.solution-stats > div,
.timeline-card,
.color-menu { background: #17191e; }
.transport .play-button { background: #7457e8; }
.timeline-card { margin-top: 12px; border-radius: 14px; }
.color-menu { border-radius: 14px; }
footer { margin-top: 18px; }

@media (max-height: 760px) and (min-width: 1041px) {
  .app-shell { padding-top: 12px; }
  .topbar { margin-bottom: 11px; }
  .intro { margin-bottom: 12px; }
  .intro h1 { font-size: 28px; }
  .stage-card { min-height: 515px; }
  .cube-viewport { height: 420px; }
}

@media (max-width: 1040px) {
  .app-shell { width: min(920px, calc(100% - 20px)); }
  .intro { display: grid; grid-template-columns: 1fr; gap: 7px; }
  .intro > p { max-width: 620px; }
  .workbench { grid-template-columns: 1fr; }
  .stage-card { min-height: 530px; }
  .cube-viewport { height: 435px; }
}

@media (max-width: 680px) {
  .app-shell { width: calc(100% - 12px); padding-top: 10px; }
  .topbar { margin-bottom: 12px; }
  .brand small { display: none; }
  .intro { margin-bottom: 12px; padding: 0 2px; }
  .intro h1 { font-size: 25px; }
  .intro > p { font-size: 11px; }
  .stage-card { min-height: 492px; padding: 10px; border-radius: 13px; }
  .cube-viewport { height: 400px; }
  .control-card { padding: 13px; border-radius: 13px; }
  .scheme-card { margin-bottom: 12px; }
  footer { gap: 7px; font-size: 8px; }
  .validation-modal { padding: 12px; }
  .validation-dialog { padding: 24px 19px 19px; border-radius: 16px; }
}
