/* Editorial dark guide. Amber is the only accent. */
:root {
  --bg: #12110f;
  --bg-2: #1a1814;
  --bg-3: #221f1a;
  --line: rgba(232, 214, 176, 0.14);
  --ink: #f3ecdf;
  --muted: #b3a794;
  --faint: #7d7364;
  --amber: #e2a322;
  --amber-2: #f0c56a;
  --danger: #d4654a;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", Helvetica, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", "Segoe UI Mono", ui-monospace, monospace;
  --size: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(226, 163, 34, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 380;
  letter-spacing: 0.01em;
  line-height: 1.55;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--amber-2); text-decoration: none; }

.shell {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) minmax(340px, 430px);
  min-height: 100vh;
}

.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.35rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.brand span { display: block; color: var(--amber); font-style: italic; font-weight: 500; }
.nav-links { display: flex; flex-direction: column; gap: 6px; }
.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 6px 0 6px 12px;
  border-left: 2px solid transparent;
}
.nav-links a.is-active {
  color: var(--ink);
  border-left-color: var(--amber);
}
.nav-foot { margin-top: auto; color: var(--faint); font-size: 0.75rem; }

.main {
  padding: 42px 48px 80px;
  max-width: 860px;
}
.hero { margin-bottom: 36px; }
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--amber);
  margin: 0 0 12px;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(2.4rem, 4vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
}
.hero p { color: var(--muted); font-size: 1.08rem; max-width: 40rem; }

.guide-section { padding: 28px 0 10px; scroll-margin-top: 18px; }
.section-head h2 {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 2.1rem;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
.eyebrow {
  margin: 0;
  color: var(--amber);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
}
.lede { color: var(--muted); max-width: 42rem; }

.callout {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 12px 0;
}
.callout.accented { border-color: rgba(226, 163, 34, 0.45); }
.callout h3 {
  font-family: var(--serif);
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 560;
}
.callout p { margin: 0 0 8px; color: var(--muted); }
.callout p:last-child { margin-bottom: 0; }
.callout code, .alg-inline, .move-chip {
  font-family: var(--mono);
}
.callout code {
  background: var(--bg-3);
  padding: 0.05em 0.35em;
  border-radius: 4px;
  color: var(--amber-2);
}

.case-grid { display: grid; gap: 14px; margin-top: 8px; }
.case-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%), var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px 14px;
}
.case-card h3 {
  font-family: var(--serif);
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 560;
}
.case-card p { margin: 0 0 8px; color: var(--muted); }
.case-card strong { color: var(--ink); font-weight: 500; }
.case-alg {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}
.alg-inline {
  background: #0e0d0b;
  color: var(--amber-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.86rem;
}
.note { font-size: 0.92rem; color: var(--faint); }
.fineprint { color: var(--faint); font-size: 0.88rem; }

.btn {
  border: 1px solid var(--line);
  background: var(--bg-3);
  border-radius: 999px;
  padding: 7px 14px;
}
.btn:hover { border-color: var(--amber); }
.btn-accent { background: var(--amber); color: #1a1203; border-color: transparent; font-weight: 500; }
.btn-accent:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kbd-hint { color: var(--faint) !important; font-size: 0.9rem; }
kbd {
  font-family: var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  color: var(--ink);
}

.compare-table-wrap { overflow-x: auto; }
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px;
  font-size: 0.95rem;
}
.compare-table th, .compare-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
.compare-table thead th {
  color: var(--amber);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.compare-table tbody th { font-family: var(--serif); font-weight: 560; white-space: nowrap; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #0e0d0b;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 14px;
}
.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.stage-head h2 {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin: 0;
  font-weight: 560;
}
.badge {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}
.badge.ok { color: #d7e7c8; border-color: rgba(120, 160, 90, 0.5); }
.badge.bad { color: var(--danger); }

.cube-scene { flex: 1; min-height: 280px; }
.cube-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  perspective: 980px;
  cursor: grab;
  touch-action: none;
}
.cube-stage:active { cursor: grabbing; }
.cube-rotator, .cube-root, .cube-pivot, .cubie, .sticker {
  transform-style: preserve-3d;
}
.cube-root, .cube-pivot {
  position: relative;
  width: 0;
  height: 0;
}
.cubie {
  position: absolute;
  width: var(--size);
  height: var(--size);
  left: 0;
  top: 0;
  margin-left: calc(var(--size) / -2);
  margin-top: calc(var(--size) / -2);
}
.sticker {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}
.sticker i {
  display: block;
  width: 84%;
  height: 84%;
  margin: 8%;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
}
.sticker i.plastic { background: #16130f; box-shadow: none; }
.sticker-U { transform: rotateX(90deg) translateZ(calc(var(--size) / 2)); }
.sticker-D { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.sticker-F { transform: rotateY(0deg) translateZ(calc(var(--size) / 2)); }
.sticker-B { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.sticker-R { transform: rotateY(90deg) translateZ(calc(var(--size) / 2)); }
.sticker-L { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }

.player {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.85rem; }
#alg-label { font-family: var(--mono); color: var(--amber-2); }
#setup-label { margin: 0; color: var(--faint); font-size: 0.78rem; }
.move-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.move-chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.8rem;
  color: var(--muted);
}
.move-chip.is-done { color: var(--faint); }
.move-chip.is-current {
  background: var(--amber);
  color: #1a1203;
  border-color: transparent;
}
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.speed {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--faint);
  font-size: 0.8rem;
}
input[type="range"] { accent-color: var(--amber); width: 90px; }
#player-status { margin: 0; min-height: 1.2em; color: var(--muted); font-size: 0.82rem; }
.drag-hint { margin: 0; color: var(--faint); font-size: 0.75rem; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    position: sticky;
    top: 0;
    height: auto;
    z-index: 5;
    background: rgba(18, 17, 15, 0.92);
    backdrop-filter: blur(8px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
  }
  .nav-links { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
  .nav-links a { border-left: 0; padding: 4px 0; border-bottom: 2px solid transparent; }
  .nav-links a.is-active { border-bottom-color: var(--amber); }
  .nav-foot { display: none; }
  .stage { position: relative; height: auto; border-left: 0; border-bottom: 1px solid var(--line); order: -1; }
  .cube-scene { height: 340px; flex: none; }
  .main { padding: 24px 18px 64px; }
}

.case-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.case-head h3 { margin: 0; }
.case-preview {
  width: 112px;
  height: 112px;
  flex: none;
}
.case-preview.cube-scene {
  flex: none;
  min-height: 0;
  height: 112px;
}
.case-preview .cube-stage { cursor: default; }
