/* ===== Tokens (from DESIGN.md) ===== */
:root {
  --color-fresh-grass: #8ed462;
  --color-cream-paper: #f5f1e4;
  --color-ink-black: #2c2e2a;
  --color-pure-white: #ffffff;
  --color-sandstone: #e0dbce;
  --color-stone-gray: #80827f;
  /* stone gray is too light for text (3.9:1); this passes WCAG AA on white and cream */
  --color-muted-text: #646662;
  --color-hairline-mist: #d5d5d4;
  --color-sky-pop: #2ba0ff;
  --color-coral-pop: #ff705d;
  --color-sunshine-pop: #f5e211;

  --font-inter: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Type scale, fluid so it holds up from 320px phones to wide screens */
  --text-body-sm: 15px;
  --text-body: 17px;
  --text-body-lg: 18px;
  --text-subheading: 20px;
  --text-heading-sm: clamp(24px, 3vw, 30px);
  --text-heading: clamp(36px, 5.4vw, 53px);
  --text-display: clamp(52px, 11.2vw, 144px);

  --radius-card: clamp(28px, 5vw, 50px);
  --radius-pill: 50px;
  --radius-small: 10px;
  --radius-art: 63.75px;

  --page-max: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-gap: clamp(72px, 10vw, 120px);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; color-scheme: only light; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--color-cream-paper);
  color: var(--color-ink-black);
  font-family: var(--font-inter);
  font-size: var(--text-body);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
strong { font-weight: 500; }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--color-pure-white); padding: 10px 18px; border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-black); text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--color-sky-pop); outline-offset: 3px; }

/* ===== Type ===== */
.display {
  font-size: var(--text-display);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.06em;
}
.heading {
  font-size: var(--text-heading);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.04em;
}
.heading-sm { font-size: var(--text-heading-sm); font-weight: 500; line-height: 1.2; letter-spacing: -0.02em; }
.subheading { font-size: var(--text-subheading); font-weight: 500; line-height: 1.25; }
.lead { font-size: var(--text-body-lg); max-width: 60ch; }
.muted { color: var(--color-muted-text); font-size: var(--text-body-sm); }
.small { font-size: 13px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-body-sm); font-weight: 500; margin-bottom: 16px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 46px;
  padding: 11px 14px 11px 22px;
  border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-black);
  font-size: var(--text-body-sm); font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: var(--color-pure-white); }
.btn-ghost:hover { background: var(--color-cream-paper); }
.btn-ink { background: var(--color-ink-black); color: var(--color-cream-paper); }
.btn-ink:hover:not(:disabled) { background: #444740; }
/* ink text: white on coral is only 2.7:1 */
.btn-coral { background: var(--color-coral-pop); border-color: var(--color-coral-pop); color: var(--color-ink-black); }
.btn-coral:hover { background: #f4604c; }

.dot { display: inline-block; width: 18px; height: 18px; border-radius: 50%; flex: none; }
.dot-blue { background: var(--color-sky-pop); }
.dot-green { background: var(--color-fresh-grass); }
.dot-coral { background: var(--color-coral-pop); }
.dot-white { background: var(--color-pure-white); }

.text-link {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-size: var(--text-body-sm); color: var(--color-ink-black);
  text-decoration: none; border-bottom: 1.5px solid var(--color-stone-gray);
}
.text-link:hover { border-bottom-color: var(--color-ink-black); }

/* ===== Nav ===== */
.nav-wrap {
  position: sticky; top: 0; z-index: 50;
  padding: 14px var(--gutter) 0;
}
.nav {
  max-width: var(--page-max); margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--color-pure-white);
  border: 1.5px solid var(--color-ink-black);
  border-radius: var(--radius-pill);
  padding: 7px 7px 7px 10px;
  position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--color-ink-black);
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 6px;
}
.brand-mark i { border-radius: 3px; }
.brand-name { font-size: 17px; letter-spacing: -0.01em; }
.nav-links {
  list-style: none; margin: 0 0 0 auto; padding: 0;
  display: flex; gap: 2px;
}
.nav-links a {
  display: block; padding: 10px 16px; border-radius: var(--radius-pill);
  text-decoration: none; font-size: var(--text-body-sm); font-weight: 500;
}
.nav-links a:hover { background: var(--color-cream-paper); }
.menu-toggle {
  display: none;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--color-fresh-grass); border: 0; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  margin-left: auto;
}
.menu-toggle span { display: block; width: 16px; height: 2px; background: var(--color-ink-black); border-radius: 2px; transition: transform .2s; }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 860px) {
  .menu-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute; left: 0; right: 0; top: calc(100% + 8px);
    flex-direction: column; gap: 0;
    background: var(--color-pure-white);
    border: 1.5px solid var(--color-ink-black);
    border-radius: 28px; padding: 10px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 14px 18px; font-size: 17px; }
}
@media (max-width: 460px) {
  .nav-cta { display: none; }
  .brand-name { font-size: 16px; }
}

/* ===== Layout ===== */
main { padding: 0 var(--gutter); }
.section { max-width: var(--page-max); margin: var(--section-gap) auto 0; scroll-margin-top: 90px; }
.section-head { margin-bottom: clamp(24px, 4vw, 40px); display: grid; gap: 12px; }
.card {
  background: var(--color-pure-white);
  border-radius: var(--radius-card);
  padding: clamp(20px, 3.5vw, 40px);
}

/* ===== Hero ===== */
.hero {
  max-width: var(--page-max); margin: 0 auto;
  padding-top: clamp(48px, 9vw, 110px);
  text-align: center;
}
.hero .display { max-width: 11ch; margin: 0 auto; }
.hero-sub { font-size: clamp(17px, 1.8vw, 20px); max-width: 46ch; margin: 28px auto 0; }
.hero-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 16px 24px; margin-top: 32px;
}
.hero-art { max-width: 760px; margin: clamp(32px, 6vw, 56px) auto 0; }
.hero-art svg { width: 100%; height: auto; overflow: visible; }

/* ===== Solver shell ===== */
.solver { padding: clamp(16px, 3vw, 32px); }
.stepper {
  list-style: none; margin: 0 0 clamp(20px, 3vw, 28px); padding: 6px;
  display: flex; gap: 6px;
  background: var(--color-cream-paper); border-radius: var(--radius-pill);
  overflow-x: auto;
}
.stepper li { flex: 1; }
.step-tab {
  width: 100%; min-height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: var(--radius-pill); background: transparent;
  font-size: var(--text-body-sm); font-weight: 500; cursor: pointer; white-space: nowrap;
  padding: 8px 14px;
}
.step-tab:disabled { color: var(--color-muted-text); cursor: not-allowed; }
.step-tab.is-active { background: var(--color-pure-white); outline: 1.5px solid var(--color-ink-black); }
.step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-grid; place-items: center; font-size: 13px;
  border: 1.5px solid currentColor;
}
.step-tab.is-active .step-num { background: var(--color-fresh-grass); border-color: var(--color-fresh-grass); color: var(--color-ink-black); }
.step-tab.is-done .step-num { background: var(--color-ink-black); border-color: var(--color-ink-black); color: var(--color-cream-paper); }

.panel-intro {
  background: var(--color-cream-paper); border-radius: 24px;
  padding: 16px 20px; margin-bottom: 20px; font-size: var(--text-body-sm);
}
.panel-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--color-hairline-mist);
}
.foot-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; }

/* ===== Step 1: faces ===== */
.face-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}
.face-card {
  border: 1.5px solid var(--color-hairline-mist);
  border-radius: 28px; padding: 16px;
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start;
  transition: border-color .15s;
}
.face-card.is-done { border-color: var(--color-ink-black); }
.face-card.is-drop { border-color: var(--color-sky-pop); background: #f2f9ff; }
.face-visual { width: 84px; }
.face-guide, .face-thumb {
  width: 84px; height: 84px; border-radius: 16px; overflow: hidden;
  display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 3px; padding: 5px;
  background: var(--color-ink-black);
}
.face-guide i, .face-thumb i { border-radius: 4px; }
.face-guide i { background: var(--color-sandstone); }
.face-guide i.c { box-shadow: inset 0 0 0 2px var(--color-ink-black); }
.top-mark {
  height: 8px; width: 60%; margin: 0 auto 4px; border-radius: 4px;
  border: 1.5px solid var(--color-ink-black);
}
.top-mark-label { display: block; text-align: center; font-size: 11px; color: var(--color-muted-text); margin-top: 6px; line-height: 1.3; }
.face-body { min-width: 0; display: grid; gap: 6px; }
.face-name { font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.face-name .tag {
  font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: var(--radius-small);
  border: 1.5px solid var(--color-ink-black);
}
.face-how { font-size: 14px; color: #4b4e48; line-height: 1.45; }
.face-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 6px; }
.face-actions .btn { min-height: 40px; padding: 7px 10px 7px 16px; font-size: 14px; }
.face-actions .dot { width: 14px; height: 14px; }

/* ===== Step 2: colors ===== */
.colors-layout {
  display: grid; gap: clamp(20px, 4vw, 40px);
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
  align-items: start;
}
.net-wrap { background: var(--color-cream-paper); border-radius: 28px; padding: clamp(12px, 2.5vw, 24px); }
.net {
  --cell: clamp(18px, 3.2vw, 40px);
  display: grid;
  grid-template-columns: repeat(4, auto);
  grid-template-areas:
    ".  U  .  ."
    "L  F  R  B"
    ".  D  .  .";
  column-gap: 6px; row-gap: 22px; padding-top: 16px; justify-content: center;
}
.net-face {
  display: grid; grid-template-columns: repeat(var(--n, 3), var(--cell)); gap: 3px;
  padding: 4px; background: var(--color-ink-black); border-radius: 10px;
  position: relative;
}
.net-face[data-face="U"] { grid-area: U; }
.net-face[data-face="R"] { grid-area: R; }
.net-face[data-face="F"] { grid-area: F; }
.net-face[data-face="D"] { grid-area: D; }
.net-face[data-face="L"] { grid-area: L; }
.net-face[data-face="B"] { grid-area: B; }
.sticker {
  width: var(--cell); height: var(--cell);
  border: 0; border-radius: 5px; padding: 0; cursor: pointer;
  background: var(--color-sandstone);
  background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(44,46,42,.08) 4px 6px);
  position: relative;
}
.sticker.has-color { background-image: none; }
.sticker.is-center { cursor: default; }
.sticker.is-center::after {
  content: ""; position: absolute; inset: 30%; border-radius: 50%;
  border: 2px solid rgba(44,46,42,.35);
}
.sticker.is-flagged { outline: 3px solid var(--color-coral-pop); outline-offset: -1px; z-index: 1; }
.sticker:not(.is-center):hover { transform: scale(1.07); }
.face-label {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 2px);
  font-size: 11px; text-align: center; color: var(--color-muted-text);
  white-space: nowrap;
}

/* Small screens: faces in two columns, labelled, bigger tap targets */
@media (max-width: 560px) {
  .net {
    --cell: clamp(26px, 9vw, 38px);
    grid-template-columns: repeat(2, auto);
    grid-template-areas: "U F" "R B" "L D";
    row-gap: 26px; column-gap: 14px; padding-top: 16px;
  }
}

.color-tools { display: grid; gap: 14px; }
.palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; min-height: 46px;
  border: 1.5px solid var(--color-hairline-mist); border-radius: 16px;
  background: var(--color-pure-white); cursor: pointer; text-align: left;
}
.swatch[aria-checked="true"] { border-color: var(--color-ink-black); outline: 2px solid var(--color-ink-black); }
.swatch-chip { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--color-ink-black); flex: none; }
.swatch-text { display: grid; line-height: 1.15; min-width: 0; }
.swatch-name { font-size: 13px; font-weight: 500; }
.swatch-count { font-size: 12px; color: var(--color-muted-text); }
.swatch-count.is-off { color: #c2412f; font-weight: 500; }
.status {
  border-radius: 20px; padding: 14px 16px; font-size: var(--text-body-sm);
  background: var(--color-cream-paper);
}
.status.is-good { background: #eef8e6; }
.status.is-bad { background: #fff0ed; }
.status:empty { display: none; }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }

@media (max-width: 860px) {
  .colors-layout { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .palette { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Step 3: moves ===== */
.hold-note {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--color-cream-paper); border-radius: 24px;
  padding: 14px 18px; font-size: var(--text-body-sm); margin-bottom: 20px;
}
.hold-note .dot { margin-top: 1px; }
.moves-layout {
  display: grid; gap: clamp(20px, 4vw, 40px);
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
}
.viewer { display: grid; gap: 16px; }
.player-box {
  background: var(--color-cream-paper); border-radius: var(--radius-art);
  aspect-ratio: 1 / 1; max-height: 520px; width: 100%;
  display: grid; place-items: center; overflow: hidden;
}
.player-box twisty-player { width: 100%; height: 100%; }
.player-loading { color: var(--color-muted-text); font-size: var(--text-body-sm); padding: 20px; text-align: center; }
.mini-net-wrap { background: var(--color-cream-paper); border-radius: 24px; padding: 14px 16px 18px; }
.mini-label { font-size: 12px; color: var(--color-muted-text); margin-bottom: 10px; }
.net.net-mini {
  --cell: clamp(12px, 1.6vw, 16px); gap: 4px; padding-top: 0;
  grid-template-columns: repeat(4, auto);
  grid-template-areas: ".  U  .  ." "L  F  R  B" ".  D  .  .";
}
.net-mini .net-face { gap: 2px; padding: 3px; border-radius: 6px; }
.net-mini .sticker { border-radius: 3px; cursor: default; }
.net-mini .sticker:hover { transform: none; }
.net-mini .sticker.is-center::after { display: none; }
.player-box.is-fallback { display: none; }
.viewer.no-3d .mini-net-wrap .net.net-mini { --cell: clamp(18px, 4vw, 32px); }

.move-panel { display: grid; gap: 10px; align-content: start; }
.move-count { font-size: var(--text-body-sm); color: var(--color-muted-text); }
.move-code {
  font-size: clamp(64px, 10vw, 120px); font-weight: 500; line-height: 0.95; letter-spacing: -0.05em;
  min-height: 0.95em;
}
.move-title { font-size: clamp(20px, 2.4vw, 26px); font-weight: 500; line-height: 1.25; }
.move-hint { color: #4b4e48; min-height: 1.5em; }
.controls { display: flex; gap: 10px; margin: 10px 0 6px; flex-wrap: wrap; }
.ctrl {
  width: 54px; height: 54px; border-radius: 50%;
  border: 2px solid var(--color-ink-black); background: var(--color-pure-white);
  display: grid; place-items: center; cursor: pointer;
}
.ctrl:hover:not(:disabled) { background: var(--color-cream-paper); }
.ctrl:disabled { opacity: .35; cursor: not-allowed; }
.ctrl svg { width: 22px; height: 22px; fill: none; stroke: var(--color-ink-black); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ctrl-play svg path { fill: var(--color-ink-black); }
.ctrl-play .i-pause path { fill: none; stroke-width: 3; }
.ctrl-play .i-pause { display: none; }
.ctrl-play.is-playing .i-play { display: none; }
.ctrl-play.is-playing .i-pause { display: block; }
.ctrl-next { background: var(--color-fresh-grass); border-color: var(--color-fresh-grass); width: 64px; }
.ctrl-next:hover:not(:disabled) { background: #7fc653; }

.move-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.move-chip {
  min-width: 44px; height: 36px; padding: 0 10px;
  border-radius: var(--radius-small); border: 1.5px solid var(--color-hairline-mist);
  background: var(--color-pure-white); font-size: 14px; font-weight: 500; cursor: pointer;
}
.move-chip.is-done { color: var(--color-muted-text); background: var(--color-cream-paper); border-color: var(--color-cream-paper); }
.move-chip.is-current { border-color: var(--color-ink-black); background: var(--color-fresh-grass); color: var(--color-ink-black); }
.notation { font-size: var(--text-body-sm); border-top: 1px solid var(--color-hairline-mist); padding-top: 12px; margin-top: 6px; }
.notation summary { cursor: pointer; font-weight: 500; }
.notation p { margin-top: 8px; color: #4b4e48; }
#start-over { justify-self: start; margin-top: 8px; }

@media (max-width: 860px) {
  .moves-layout { grid-template-columns: 1fr; }
  .player-box { max-height: 420px; max-width: 520px; margin: 0 auto; }
}

/* ===== How it works ===== */
.how-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.how-card { display: grid; gap: 10px; align-content: start; }
.how-art { width: 100%; max-width: 240px; height: auto; margin-bottom: 8px; }
.how-num { font-size: var(--text-body-sm); color: var(--color-muted-text); }
.how-card p:last-child { color: #4b4e48; }

/* ===== Learn mode ===== */
.learn-layout {
  display: grid; gap: clamp(24px, 5vw, 56px);
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); align-items: center;
}
.learn-copy .heading { max-width: 14ch; }
.learn-copy .lead { margin-top: 18px; }
.stage-list {
  list-style: none; padding: 0; margin: 28px 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px;
}
.stage-list li {
  display: flex; align-items: center; gap: 12px;
  background: var(--color-sandstone); border-radius: var(--radius-pill);
  padding: 8px 18px 8px 8px; font-size: var(--text-body-sm); font-weight: 500;
}
.stage-num {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--color-pure-white); font-size: 13px;
}
.price-card { border: 2px solid var(--color-coral-pop); display: grid; gap: 14px; }
.price-name { font-weight: 500; }
.price { font-size: var(--text-body-sm); color: var(--color-muted-text); }
.price-amount { font-size: clamp(48px, 6vw, 64px); font-weight: 500; letter-spacing: -0.05em; color: var(--color-ink-black); line-height: 1; }
.price-list { list-style: none; padding: 0; margin: 4px 0 8px; display: grid; gap: 10px; font-size: var(--text-body-sm); }
.price-list li { display: flex; gap: 10px; align-items: flex-start; }
.price-list li::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: none;
  background: var(--color-coral-pop);
}
.price-card .btn { justify-self: start; }
@media (max-width: 860px) { .learn-layout { grid-template-columns: 1fr; } }

/* ===== FAQ ===== */
.faq { padding-top: 8px; padding-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--color-hairline-mist); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 20px 0; font-size: var(--text-body-lg); font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px; font-weight: 400;
  border: 1.5px solid var(--color-ink-black);
}
.faq details[open] summary::after { content: "–"; background: var(--color-fresh-grass); border-color: var(--color-fresh-grass); }
.faq details p { padding: 0 0 20px; max-width: 68ch; color: #4b4e48; }

/* ===== Footer ===== */
.footer {
  background: var(--color-sunshine-pop);
  margin-top: var(--section-gap);
  padding: clamp(40px, 6vw, 72px) var(--gutter);
}
.footer-inner {
  max-width: var(--page-max); margin: 0 auto;
  display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
}
.footer-brand { font-size: var(--text-heading-sm); font-weight: 500; letter-spacing: -0.03em; }
.footer-note { margin-top: 6px; font-size: var(--text-body-sm); }
.footer-credits { font-size: var(--text-body-sm); }
.footer-credits a { text-decoration: none; border-bottom: 1.5px solid var(--color-ink-black); }
@media (max-width: 700px) { .footer-inner { grid-template-columns: 1fr; } }

/* ===== Dialogs ===== */
.modal {
  border: 0; padding: 0; background: transparent; color: inherit;
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
.modal::backdrop { background: rgba(44, 46, 42, .55); }
.modal-body {
  background: var(--color-pure-white); border-radius: clamp(24px, 4vw, 40px);
  padding: clamp(18px, 3vw, 28px); display: grid; gap: 12px;
}
.small-modal { width: min(440px, calc(100vw - 24px)); }
.crop-stage {
  background: var(--color-ink-black); border-radius: 20px; overflow: hidden;
  height: min(60dvh, 460px);
}
.crop-stage img { max-width: 100%; display: block; }
.modal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 4px; }
.modal-actions .spacer { flex: 1; }

/* Cropper: show a solid 3x3 grid so it reads like a cube face */
.cropper-view-box { outline: 2px solid var(--color-fresh-grass); outline-color: var(--color-fresh-grass); }
.cropper-dashed { border-color: var(--color-fresh-grass); border-style: solid; opacity: .9; }
.cropper-line { background-color: var(--color-fresh-grass); }
.cropper-point { background-color: var(--color-fresh-grass); width: 10px; height: 10px; opacity: 1; border-radius: 50%; }
.cropper-point.point-se { width: 14px; height: 14px; }
@media (max-width: 560px) {
  .cropper-point { width: 16px; height: 16px; }
}

/* ===== Small-screen tuning ===== */
@media (max-width: 860px) {
  /* On phones keep the cube and the current move close together */
  .viewer { display: contents; }
  .moves-layout .player-box { order: 1; max-height: 360px; }
  .moves-layout .move-panel { order: 2; }
  .moves-layout .mini-net-wrap { order: 3; }
}
@media (max-width: 480px) {
  .stepper { gap: 4px; padding: 4px; }
  .step-tab { gap: 6px; padding: 6px 6px; font-size: 14px; min-height: 42px; }
  .step-num { width: 22px; height: 22px; font-size: 12px; }
  .ctrl { width: 50px; height: 50px; }
  .ctrl-next { width: 60px; }
}

/* ===== Cube size switch ===== */
.size-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px; margin-bottom: 14px; padding: 0 6px;
}
.size-label { font-size: var(--text-body-sm); font-weight: 500; }
.size-switch {
  display: inline-flex; gap: 4px; padding: 4px;
  border: 1.5px solid var(--color-ink-black); border-radius: var(--radius-pill);
}
.size-opt {
  min-width: 72px; min-height: 40px; padding: 6px 16px;
  border: 0; border-radius: var(--radius-pill); background: transparent;
  font-size: var(--text-body-sm); font-weight: 500; cursor: pointer;
}
.size-opt[aria-checked="true"] { background: var(--color-fresh-grass); }
.size-opt:not([aria-checked="true"]):hover { background: var(--color-cream-paper); }

/* ===== 4x4 sizing ===== */
.net.is-4 { --n: 4; --cell: clamp(14px, 2.5vw, 30px); }
.net.is-4 .net-face { gap: 2px; }
.net.net-mini.is-4 { --cell: clamp(9px, 1.2vw, 12px); }
.viewer.no-3d .mini-net-wrap .net.net-mini.is-4 { --cell: clamp(14px, 3vw, 24px); }
@media (max-width: 560px) {
  .net.is-4 { --cell: clamp(18px, 6.4vw, 30px); }
}
.only-4 { display: none; }
.is-size-4 .only-4 { display: block; }

/* Crop grid drawn by us, so it can be 3x3 or 4x4 */
.cropper-dashed { display: none; }
.grid-overlay {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--color-fresh-grass) 2px, transparent 2px),
    linear-gradient(to bottom, var(--color-fresh-grass) 2px, transparent 2px);
  background-size: calc(100% / var(--n, 3)) calc(100% / var(--n, 3));
  background-position: -1px -1px;
}
.stage-tag {
  display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: var(--radius-small);
  border: 1.5px solid var(--color-hairline-mist); color: var(--color-ink-black); font-size: 12px; font-weight: 500;
}
.status .fix-btn { margin-top: 12px; min-height: 40px; padding: 7px 10px 7px 16px; }
.status .fix-btn .dot { width: 14px; height: 14px; }

/* Phones: show the check result above the stickers so a problem (and the
   "Turn it" fix) is seen without scrolling; palette stays right under the net. */
@media (max-width: 860px) {
  .color-tools { display: contents; }
  .color-tools > .subheading { order: 1; }
  #colors-help { order: 2; margin-top: -10px; }
  .colors-layout .status { order: 3; }
  .colors-layout .net-wrap { order: 4; }
  .colors-layout .palette { order: 5; }
  .colors-layout .tool-actions { order: 6; }
}
/* name on one line, center tag always under it, so every card lines up the same */
.face-name { flex-direction: column; align-items: flex-start; gap: 6px; }

/* Reference picture: the face plus the sides you can see around it */
.face-visual { width: 104px; }
.face-ref {
  display: grid; gap: 4px;
  grid-template-columns: 8px 84px 8px;
  grid-template-rows: 8px 84px 8px;
  grid-template-areas: ". t ." "l g r" ". b .";
}
.face-ref .face-guide { grid-area: g; }
.ref-bar { display: block; border: 1.5px solid var(--color-ink-black); border-radius: 4px; }
.ref-top { grid-area: t; }
.ref-bottom { grid-area: b; }
.ref-left { grid-area: l; }
.ref-right { grid-area: r; }
.face-card.is-done .face-visual { width: 84px; }

.face-visual .top-mark-label { margin: 0 0 5px; }

/* ===== Footer policy links ===== */
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: var(--text-body-sm); }
.footer-links a { text-decoration: none; border-bottom: 1.5px solid var(--color-ink-black); }
.doc-page .footer-links { margin-top: 0; align-self: center; }

/* ===== Policy pages ===== */
.doc { max-width: 820px; margin: clamp(32px, 6vw, 64px) auto 0; padding: 0 var(--gutter); }
.doc-card { display: grid; gap: 14px; }
.doc-card h2 { font-size: var(--text-subheading); font-weight: 500; margin-top: 14px; }
.doc-card p, .doc-card li { color: #3d403a; max-width: 68ch; }
.doc-card ul { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.doc-card a { text-decoration: none; border-bottom: 1.5px solid var(--color-stone-gray); }
.contact-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 4px 0; }
.contact-list dt { color: var(--color-muted-text); }
.contact-list dd { margin: 0; }
.doc-back { margin-left: auto; }
@media (max-width: 460px) { .doc-page .nav-cta { display: inline-flex; padding: 8px 10px 8px 14px; font-size: 13px; } }

.panel:focus { outline: none; }
