:root {
  --bg: #08090d;
  --panel: #12131a;
  --panel-border: #23252f;
  --glass: rgba(20, 22, 30, 0.6);
  --text: #e9e9f2;
  --text-dim: #9294a6;
  --text-faint: #5c5f70;
  --accent: #b9c8ff;
  --accent-glow: #7c8fff;
  --accent-soft: rgba(124, 143, 255, 0.15);
  --violet: #a78bfa;
  --success: #7ee0b0;
  --radius: 14px;
  --radius-sm: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 500px at 20% -10%, rgba(124,143,255,0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 90% 10%, rgba(167,139,250,0.08), transparent 60%),
    radial-gradient(ellipse 900px 600px at 50% 100%, rgba(124,143,255,0.06), transparent 60%);
}

.site-header {
  position: relative;
  z-index: 1;
  padding: 56px 24px 32px;
  text-align: center;
}

.header-inner { max-width: 720px; margin: 0 auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.brand-mark {
  color: var(--accent-glow);
  font-size: 22px;
  filter: drop-shadow(0 0 8px rgba(124,143,255,0.6));
}

.tagline {
  margin: 14px 0 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.5;
}

main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.panel {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
}

.panel-head {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(124,143,255,0.35);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 20px;
}

.panel-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
  max-width: 60ch;
}

/* Upload grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 640px) {
  .upload-grid { grid-template-columns: repeat(2, 1fr); }
}

.upload-slot {
  position: relative;
  aspect-ratio: 1;
  border: 1.5px dashed #33364a;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: rgba(255,255,255,0.015);
  overflow: hidden;
}
.upload-slot:hover { border-color: var(--accent-glow); background: var(--accent-soft); }
.upload-slot.filled { border-style: solid; border-color: rgba(126, 224, 176, 0.4); }
.upload-slot input { display: none; }
.upload-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.upload-slot .slot-label {
  position: relative;
  z-index: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-dim);
}
.upload-slot.filled .slot-label {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(8,9,13,0.75);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--success);
  font-size: 12px;
}
.upload-slot .slot-icon { font-size: 20px; opacity: .5; }
.upload-slot .slot-desc { font-size: 11px; color: var(--text-faint); }

.upload-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.hint {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* Buttons */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .1s, opacity .15s, background .15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-glow), var(--violet));
  color: #0a0a10;
  box-shadow: 0 0 24px rgba(124,143,255,0.25);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--panel-border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent-glow); }

.btn-small { padding: 8px 14px; font-size: 13px; }

.btn-icon {
  background: var(--panel);
  border-color: var(--panel-border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-icon:hover:not(:disabled) { border-color: var(--accent-glow); color: var(--accent); }
.btn-play.playing { background: var(--accent-soft); border-color: var(--accent-glow); color: var(--accent); }

/* Net editor */
.net-editor-wrap {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
}

.net-editor {
  display: grid;
  grid-template-columns: repeat(12, 22px);
  grid-template-rows: repeat(9, 22px);
  gap: 3px;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .net-editor { grid-template-columns: repeat(12, 18px); grid-template-rows: repeat(9, 18px); }
}

.facelet {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: transform .08s, box-shadow .15s;
}
.facelet:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 0 0 2px var(--accent-glow); }
.facelet.empty { background: #1a1c26 !important; border-style: dashed; }
.facelet.center { cursor: default; box-shadow: 0 0 0 1px rgba(255,255,255,0.3) inset; }
.facelet.center:hover { transform: none; box-shadow: 0 0 0 1px rgba(255,255,255,0.3) inset; }

.palette-panel {
  min-width: 200px;
}
.palette-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.palette {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
}
.swatch.selected { border-color: var(--accent); box-shadow: 0 0 10px rgba(124,143,255,0.5); }
.swatch .swatch-tag {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
}

.net-status {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 20px;
  min-height: 40px;
}
.net-status.ok { color: var(--success); }
.net-status.error { color: #ff9d9d; }

/* Solver stage */
.solver-wrap {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.cube-stage {
  position: relative;
  flex-shrink: 0;
  width: 380px;
  height: 380px;
  border-radius: var(--radius-sm);
  background: radial-gradient(ellipse at center, rgba(124,143,255,0.06), transparent 70%);
}
#cube3d { width: 100%; height: 100%; }
@media (max-width: 480px) {
  .cube-stage { width: 100%; height: 320px; }
}

.move-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(8,9,13,0.7);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 0 16px rgba(124,143,255,0.25);
}

.solver-side {
  flex: 1;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.progress-row { display: flex; flex-direction: column; gap: 8px; }
.progress-track {
  height: 6px;
  background: var(--panel-border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-glow), var(--violet));
  transition: width .25s;
}
.progress-label { font-size: 13px; color: var(--text-dim); }

.step-controls { display: flex; gap: 8px; }

.move-list-wrap { flex: 1; min-height: 0; }
.move-list-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.move-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
}
.move-chip {
  font-family: 'Space Grotesk', monospace;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--text-faint);
  background: rgba(255,255,255,0.03);
}
.move-chip.done { color: var(--text-dim); }
.move-chip.current {
  color: #0a0a10;
  background: var(--accent);
  font-weight: 600;
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  color: var(--text-faint);
  font-size: 12px;
}
