/* ColorPath browser demo — matches the app's board look (Edge Tile 8A) inside
   the slocc.io page chrome. No external assets, no webfonts. */

:root {
  --page: #161412;
  --page-2: #1f1d1b;
  --fg: #faf9f6;
  --fg-2: #afaeac;
  --muted: #868584;
  --border: rgba(226, 226, 226, .22);
  --brand: #2447d6;
  --brand-lift: #8ba3f7;

  --cream: #F6EFE3;
  --ink: #4a4038;
  --ink-2: #8a7d70;
  --card: #fff;

  --gap: clamp(5px, 1.6vmin, 9px);
  --radius: clamp(9px, 2.6vmin, 15px);

  --font: "Matter Regular", "Matter", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  background: var(--page);
  color: var(--fg);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
a { color: var(--fg-2); text-underline-offset: 4px; }
a:hover { color: var(--fg); }
:focus-visible { outline: 2px solid var(--brand-lift); outline-offset: 3px; border-radius: 6px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.skip-link { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 8px 14px; background: var(--fg); color: var(--page); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

/* ---------- page chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px max(14px, env(safe-area-inset-left)) 12px max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  background: rgba(22, 20, 18, .94);
  backdrop-filter: blur(12px);
}
.wordmark { color: var(--fg); font: 14px var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.hud { display: flex; align-items: center; gap: 10px; font: 13px var(--mono); letter-spacing: .04em; }
.hud-item { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg-2); }
.hud-item b { color: var(--fg); font-weight: 400; }
.hud .dim { color: var(--muted); }
#timer { min-width: 5.5ch; text-align: center; }

/* ---------- stage ---------- */
.stage { position: relative; width: min(100% - 24px, 460px); margin: clamp(14px, 3vh, 30px) auto 0; }

.cartridge {
  background: var(--cream);
  border-radius: 22px;
  padding: clamp(12px, 3.4vmin, 20px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.cartridge.hidden { display: none; }

/* the prompt line doubles as the message slot, so nothing ever covers the board */
.headline { position: relative; display: grid; align-items: center; min-height: 3.4em; margin-bottom: 10px; }
.prompt, .banner { grid-area: 1 / 1; margin: 0; text-align: center; text-wrap: balance; }
.prompt {
  color: var(--ink-2);
  font-size: 14px; line-height: 1.3;
  transition: opacity .18s ease;
}
.prompt b { color: var(--ink); font-weight: 700; }
.headline.messaging .prompt { opacity: 0; }

/* ---------- board ---------- */
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  aspect-ratio: 1;
  padding: var(--gap);
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 6px 18px rgba(74, 64, 56, .10);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.board.shake { animation: shake .34s ease; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

.tile {
  position: relative;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 24%, #fff);
  transition: background .12s ease, transform .12s ease;
}
.tile .glyph {
  position: absolute; inset: 0; margin: auto;
  width: 34%; height: 34%;
  opacity: 0; transition: opacity .15s ease;
  color: color-mix(in srgb, var(--c) 72%, #6b5f54);
}
.markers .tile .glyph { opacity: .85; }
.markers .tile.filled .glyph, .markers .tile.preview .glyph { color: rgba(255, 255, 255, .9); }

/* a traced-but-not-committed cell */
.tile.preview {
  background: color-mix(in srgb, var(--pc) 62%, #fff);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pc) 80%, #fff);
}

/* a committed bead — the app's extruded tile */
.tile.filled {
  background: var(--c);
  box-shadow:
    inset 0 -14% 0 rgba(0, 0, 0, .16),
    inset 0 22% 0 rgba(255, 255, 255, .17),
    0 3px 0 color-mix(in srgb, var(--c) 62%, #000),
    0 5px 10px rgba(74, 64, 56, .22);
}
.tile.filled.lifting { transform: scale(.94); }

/* clasps: the white bar bridging two cells of one path */
.tile.cx-right::after, .tile.cx-down::after {
  content: ""; position: absolute; z-index: 2;
  background: rgba(255, 255, 255, .92);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(74, 64, 56, .14);
}
.tile.cx-right::after { top: 50%; right: calc(var(--gap) * -1 - 1px); width: calc(var(--gap) + 2px); height: 14%; transform: translateY(-50%); }
.tile.cx-down::after { left: 50%; bottom: calc(var(--gap) * -1 - 1px); height: calc(var(--gap) + 2px); width: 14%; transform: translateX(-50%); }

.tile.blocked { animation: blink .5s ease 2; }
@keyframes blink { 50% { background: #ffd9d4; } }

.banner {
  justify-self: center; align-self: center;
  max-width: 100%;
  padding: 7px 15px; border-radius: 999px;
  background: rgba(38, 32, 27, .94); color: #fff;
  font-size: 13px; line-height: 1.25;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.banner.show { opacity: 1; transform: none; }

/* ---------- tray ---------- */
.tray {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0 12px;
}
.path {
  display: flex; gap: 4px; justify-content: center;
  padding: 7px; border: 0; border-radius: 999px;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(74, 64, 56, .12);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, opacity .18s ease;
}
.path:hover { transform: translateY(-1px); }
.path.active { box-shadow: 0 0 0 3px var(--ink) inset, 0 4px 12px rgba(74, 64, 56, .2); }
.path.used { opacity: .3; pointer-events: none; }
.path .bead {
  position: relative;
  width: clamp(20px, 6vmin, 30px); aspect-ratio: 1;
  border-radius: 8px;
  background: var(--c);
  box-shadow: inset 0 -18% 0 rgba(0, 0, 0, .15), inset 0 24% 0 rgba(255, 255, 255, .2), 0 2px 0 color-mix(in srgb, var(--c) 62%, #000);
}
.path .bead .glyph { position: absolute; inset: 0; margin: auto; width: 42%; height: 42%; color: rgba(255, 255, 255, .9); opacity: 0; }
.markers .path .bead .glyph { opacity: 1; }

/* ---------- buttons ---------- */
.controls { display: flex; gap: 8px; justify-content: center; }
.btn {
  padding: 9px 16px; border: 0; border-radius: 999px;
  background: var(--card); color: var(--ink);
  font: 600 14px var(--font); cursor: pointer;
  box-shadow: 0 2px 5px rgba(74, 64, 56, .13);
}
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px rgba(74, 64, 56, .2); }
.btn.ghost[aria-pressed="true"] { background: var(--ink); color: var(--cream); box-shadow: none; }

/* ---------- App Store link / win / done ---------- */
.store-link {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 12px 0 0; color: var(--muted); font-size: 13px; text-align: center;
}
.store-link a { color: var(--fg); font-weight: 600; text-decoration-thickness: 1px; }
.win { text-align: center; padding: 30px 20px 34px; background: var(--page-2); border: 1px solid var(--border); border-radius: 22px; }
.win-kicker { margin: 0; color: var(--fg-2); font: 13px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.win-kicker b { color: var(--fg); font-weight: 400; }
.win-time { margin: 6px 0 10px; font-size: clamp(38px, 12vw, 54px); line-height: 1; letter-spacing: -.03em; }
.win-note { margin: 0 auto 20px; max-width: 34ch; color: var(--fg-2); font-size: 15px; }
.cta { display: inline-block; padding: 14px 26px; border: 0; border-radius: 999px; background: var(--fg); color: #17130d; font: 700 16px var(--font); text-decoration: none; cursor: pointer; }
.cta:hover { background: #fff; color: #17130d; }
.done-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.done-actions .btn.ghost { color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--border); }
.splits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 18px; max-width: 300px; margin: 22px auto 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; text-align: left; }
.splits li { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(226, 226, 226, .08); padding: 3px 0; }
.splits b { color: var(--fg-2); font-weight: 400; }

/* ---------- about ---------- */
.about { width: min(100% - 32px, 620px); margin: clamp(28px, 6vh, 56px) auto 0; padding-bottom: 60px; }
.about h1 { margin: 0 0 14px; font-size: clamp(21px, 4vw, 27px); letter-spacing: -.03em; font-weight: 400; }
.about p { margin: 0 0 14px; color: var(--fg-2); font-size: 16px; }
.about b { color: var(--fg); font-weight: 600; }
.fineprint { font-size: 13px !important; color: var(--muted) !important; }

@media (max-width: 380px) {
  .store-link { display: block; }
  .store-link span, .store-link a { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
