/* Unlike — playunlike.com
   Light is the in-app Parchment theme, dark is Midnight. */
:root {
  --bg: #F4F1EA; --panel: #FFFDF8; --edge: #DDD8CE;
  --ink: #1B1E23; --muted: #5F646D;
  --solid-a: #33373F; --solid-b: #21242A; --solid-ink: #F8F6F1;
  --out-fill: #FAF7F1; --out-ring: #1B1E23;
  --unk-fill: #E4DFD5; --unk-edge: #C6C0B4;
  --accent: #3A5AA8; --accent-hover: #27407E;
  --good: #2C6B4F; --bad: #B2402A; --bad-on-solid: #F2957F; --pin: #A8712C;
  --btn: #1B1E23; --btn-ink: #F8F6F1;
  --scrim: rgba(27, 30, 35, .42);
  --shadow: 0 1px 0 var(--edge), 0 12px 32px -18px rgba(27, 30, 35, .35);
  --display: 'Fraunces', Georgia, serif;
  --body: 'Figtree', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0A0D1A; --panel: #1A2140; --edge: #2C355C;
    --ink: #E8ECFF; --muted: #8E97BE;
    --solid-a: #7C8CFF; --solid-b: #5665D8; --solid-ink: #0A0D1A;
    --out-fill: #161C36; --out-ring: #B9C2FF;
    --unk-fill: #222A4C; --unk-edge: #39426E;
    --accent: #8AA4EC; --accent-hover: #B3C4F5;
    --good: #6FCF9F; --bad: #FF8A75; --bad-on-solid: #7A1608; --pin: #E0A860;
    --btn: #E8ECFF; --btn-ink: #0A0D1A;
    --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 12px 32px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--edge); }
.bar {
  max-width: 1280px; margin: 0 auto; height: 64px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.mark { display: grid; grid-template-columns: repeat(2, 11px); gap: 3px; }
.mark i { width: 11px; height: 11px; border-radius: 3px; }
.mark i:nth-child(1), .mark i:nth-child(4) { background: var(--solid-b); }
.mark i:nth-child(2), .mark i:nth-child(3) { border: 2px solid var(--out-ring); }
.wordmark { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button {
  height: 40px; padding: 0 12px; display: flex; align-items: center;
  border: 0; background: none; border-radius: 8px; cursor: pointer;
  color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none;
}
.nav a:hover, .nav button:hover { background: var(--unk-fill); color: var(--ink); }
.nav a[aria-current="page"] { font-weight: 700; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }
.nav .get {
  margin-left: 8px; height: 36px; padding: 0 14px; font-weight: 600;
  border: 1.5px solid var(--ink); border-radius: 999px;
}
.icon-btn {
  width: 44px; height: 44px; border: 0; background: none; padding: 0; cursor: pointer;
  display: none; align-items: center; justify-content: center; border-radius: 8px; color: var(--ink);
}

@media (max-width: 640px) {
  .bar { height: 56px; padding: 0 12px 0 16px; }
  .wordmark { font-size: 23px; }
  .mark { grid-template-columns: repeat(2, 9px); }
  .mark i { width: 9px; height: 9px; border-radius: 2px; }
  .nav { display: none; }
  .icon-btn { display: flex; }
  .subnav {
    display: flex; gap: 2px; padding: 0 10px; height: 38px; align-items: center; font-size: 13px;
  }
  .subnav a { padding: 9px 8px; color: var(--muted); font-weight: 500; text-decoration: none; }
  .subnav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
  .subnav .get { margin-left: auto; color: var(--accent); font-weight: 600; }
}
@media (min-width: 641px) { .subnav { display: none; } }

/* ---------- game ---------- */
.game {
  flex: 1; width: 100%; display: flex; flex-direction: column; align-items: center;
  gap: 22px; padding: 40px 16px 24px;
}
.intro { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.intro h1 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 36px; line-height: 1.1; letter-spacing: -.015em; }
.rule { margin: 4px 0 0; max-width: 420px; color: var(--muted); }
.rule em { color: var(--ink); }

.play { display: flex; flex-direction: column; gap: 10px; }
.meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer { display: flex; align-items: center; gap: 6px; }

.board {
  --cell: 64px; --gap: 7px;
  display: grid; gap: var(--gap); padding: 12px;
  background: var(--panel); border: 1px solid var(--edge); border-radius: 18px; box-shadow: var(--shadow);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.cell {
  position: relative; width: var(--cell); height: var(--cell); padding: 0; cursor: pointer;
  border-radius: calc(var(--cell) * .2);
  border: 3px dashed var(--unk-edge); background: var(--unk-fill);
  display: flex; align-items: center; justify-content: center;
  font: 700 calc(var(--cell) * .4)/1 var(--body); font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: background-color .12s ease, border-color .12s ease, transform .08s ease;
}
.cell:active { transform: scale(.94); }
.cell.solid { border: 3px solid var(--solid-b); background: linear-gradient(var(--solid-a), var(--solid-b)); color: var(--solid-ink); }
.cell.outlined { border: 3px solid var(--out-ring); background: var(--out-fill); }
.cell.done .n { opacity: .4; }
.cell.bad .n { color: var(--bad); }
.cell.solid.bad .n { color: var(--bad-on-solid); }
.cell.pinned { cursor: default; }
.cell.pinned::after {
  content: ''; position: absolute; top: calc(var(--cell) * .07); right: calc(var(--cell) * .07);
  width: 8px; height: 8px; border-radius: 50%; background: var(--pin);
}
.board.solved .cell { cursor: default; }
.board.solved .cell:active { transform: none; }

.msg { min-height: 24px; text-align: center; font-size: 14px; color: var(--muted); }
.msg.warn { color: var(--bad); }
.msg.good { color: var(--good); }

.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pill {
  height: 44px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--unk-edge); background: var(--panel); border-radius: 999px;
  font-size: 15px; font-weight: 600; cursor: pointer; color: var(--ink); text-decoration: none;
}
.pill:hover { border-color: var(--ink); color: var(--ink); }
.pill:disabled { opacity: .45; cursor: default; border-color: var(--unk-edge); }
.pill.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); padding: 0 22px; }
.pill.primary:hover { color: var(--btn-ink); opacity: .9; }

.fineprint { margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }
.fineprint a { color: var(--muted); }

@media (max-width: 640px) {
  .game { padding-top: 22px; gap: 16px; }
  .intro h1 { font-size: 28px; }
  .rule { font-size: 15px; }
  .board { padding: 10px; border-radius: 16px; }
}

/* ---------- dialogs ---------- */
dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 36px 36px 30px; border: 0; border-radius: 24px;
  background: var(--panel); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
}
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.close {
  position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; padding: 0;
  border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.dlg { display: flex; flex-direction: column; gap: 18px; }
.dlg h2 { margin: 0; font-family: var(--display); font-weight: 500; font-size: 30px; line-height: 1.1; letter-spacing: -.015em; }
.dlg p { margin: 0; }
.dlg ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.example { display: flex; gap: 18px; align-items: center; padding: 16px; background: var(--bg); border-radius: 14px; font-size: 14px; }
.example .mini { display: grid; grid-template-columns: repeat(3, 34px); gap: 5px; flex-shrink: 0; }
.example .mini span { width: 34px; height: 34px; border-radius: 7px; }
.example .s { background: var(--solid-b); color: var(--solid-ink); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.example .o { border: 2.5px solid var(--out-ring); background: var(--out-fill); }

.solved-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.minigrid { display: grid; gap: 3px; }
.minigrid span { width: 12px; height: 12px; border-radius: 3px; }
.minigrid .s { background: var(--solid-b); }
.minigrid .o { border: 2px solid var(--out-ring); }
.badge-ok { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--good); margin-top: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge); }
.stats div { padding: 14px 0; text-align: center; }
.stats div + div { border-left: 1px solid var(--edge); }
.stats b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--muted); }
.more { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.more h3 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.more p { color: var(--muted); font-size: 15px; max-width: 340px; }
.store {
  align-self: center; height: 56px; padding: 0 26px; display: flex; align-items: center; gap: 12px;
  background: #000; color: #fff; border-radius: 14px; text-decoration: none;
}
.store:hover { color: #fff; opacity: .88; }
@media (prefers-color-scheme: dark) { .store { box-shadow: 0 0 0 1px #5A6390; } }
.store small { display: block; font-size: 11px; font-weight: 500; opacity: .85; line-height: 1.1; }
.store strong { display: block; font-size: 19px; line-height: 1.15; }
.sub-cta { text-align: center; font-size: 13px; color: var(--muted); margin-top: -8px !important; }
.share-row { display: flex; justify-content: center; }
.share-row .pill { height: 40px; font-size: 14px; }

@media (max-width: 640px) {
  dialog {
    width: 100vw; max-width: 100vw; margin: auto 0 0; padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0; max-height: 92dvh;
  }
  dialog[open] { animation: rise .22s ease-out; }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
}

/* ---------- document pages ---------- */
.doc { width: 100%; max-width: 712px; margin: 0 auto; padding: 72px 16px 96px; font-size: 17px; line-height: 1.65; }
.doc h1 { margin: 8px 0 6px; font-family: var(--display); font-weight: 500; font-size: 48px; line-height: 1.08; letter-spacing: -.02em; }
.doc .updated { margin: 0 0 36px; color: var(--muted); font-size: 15px; }
.doc .lede { background: var(--panel); border: 1px solid var(--edge); border-radius: 16px; padding: 22px 26px; }
.doc .lede p { margin: 0; }
.doc h2 { margin: 44px 0 10px; font-size: 20px; letter-spacing: -.01em; }
.doc h2.section { margin-top: 56px; font-family: var(--display); font-weight: 500; font-size: 30px; letter-spacing: -.015em; }
.doc h3 { margin: 28px 0 8px; font-size: 18px; }
.doc p { margin: 0 0 14px; }
.doc ul { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin: 6px 0; }
.contact-card {
  background: var(--panel); border: 1px solid var(--edge); border-radius: 16px; padding: 22px 26px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px 24px; flex-wrap: wrap;
}
.contact-card small { display: block; font-size: 15px; color: var(--muted); }
.doc footer, .site-foot {
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--edge);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted);
}
@media (max-width: 640px) {
  .doc { padding-top: 40px; }
  .doc h1 { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Illustrated companions stay outside the playing area. */
.mascot-stage { position: relative; overflow: clip; }
.side-mascot { position: absolute; pointer-events: none; user-select: none; width: clamp(180px, 23vw, 350px); height: auto; }
.mascot-wave { right: calc(50% + 310px); top: 320px; transform: rotate(-12deg); }
.mascot-detective { left: calc(50% + 310px); top: 55px; transform: scaleX(-1) rotate(-10deg); }
.mascot-lane { position: relative; flex: 1; min-width: 60px; height: 64px; overflow: hidden; pointer-events: none; }
.mascot-travel { width: 100%; height: 64px; animation: mascot-cross 140s linear infinite; }
.mascot-jog { position: relative; width: 64px; height: 64px; animation: mascot-bob 1.2s ease-in-out infinite; }
.mascot-jog img { position: absolute; inset: 0; width: 64px; height: 64px; }
.runner-body { clip-path: inset(0 0 29% 0); }
.runner-legs { clip-path: inset(71% 0 0 0); transform-origin: 53% 73%; animation: mascot-stride 1.2s ease-in-out infinite alternate; }
.mascot-toggle { flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.mascot-toggle:hover { background: var(--unk-fill); color: var(--ink); }
@keyframes mascot-cross { 0% { transform: translateX(-64px); } 85.7142857%, 100% { transform: translateX(100%); } }
@keyframes mascot-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-2px) rotate(1deg); } }
@keyframes mascot-stride { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }
.mascot-paused .mascot-travel, .mascot-paused .mascot-jog, .mascot-paused .runner-legs { animation-play-state: paused; }
@media (max-width: 1050px) { .side-mascot { display: none; } }
@media (min-width: 641px) and (max-width: 850px) { .mascot-lane, .mascot-toggle { display: none; } }
@media (max-width: 640px) { .mascot-lane { height: 56px; } .mascot-travel, .mascot-jog { height: 56px; } .mascot-jog img { width: 56px; height: 56px; } .mascot-toggle { margin-right: -8px; } }
@media (prefers-reduced-motion: reduce) {
  .mascot-travel, .mascot-jog, .runner-legs { animation: none; }
  .mascot-travel { transform: translateX(35%); }
  .mascot-toggle { display: none; }
}
