/* Same look as okak0.com: dark dot-grid page, charcoal cards, white pill buttons.
   Always dark until the visitor flips the toggle; the choice is a cookie the server turns into
   data-theme on <html>, so it works with JavaScript blocked. */
:root {
  --bg: #121212;
  --dot: rgba(255, 255, 255, 0.075);
  --card: #1d1d1d;
  --card-line: rgba(255, 255, 255, 0.07);
  --panel: #161616;
  --panel-line: rgba(255, 255, 255, 0.05);
  --chip: #232323;
  --text: #ececec;
  --dim: #9a9a9a;
  --faint: #6a6a6a;
  --yellow: #f2d633;
  --green: #3fd77f;
  --red: #ff5b54;
  --blue: #4c9dff;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --btn: #f5f5f5;
  --btn-hover: #ffffff;
  --btn-ink: #121212;
  --hover: #2a2a2a;
  --shadow: rgba(0, 0, 0, 0.4);
  --card-hover-line: rgba(255, 255, 255, 0.12);
  --dot-main: #f0f0f0;
  --dot-ring: rgba(255, 255, 255, 0.06);
  --dot-off: #5c5c5c;
  --dashed: rgba(255, 255, 255, 0.14);
  --toggle: #5a5a5a;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f3f1;
    --toggle: #2b2b2b;
    --dot: rgba(0, 0, 0, 0.11);
    --card: #ffffff;
    --card-line: rgba(0, 0, 0, 0.08);
    --panel: #f6f6f4;
    --panel-line: rgba(0, 0, 0, 0.05);
    --chip: #e9e9e6;
    --text: #161616;
    --dim: #5d5d5d;
    --faint: #8a8a8a;
    --btn: #161616;
    --btn-hover: #000000;
    --btn-ink: #f5f5f5;
    --hover: #e2e2de;
    --shadow: rgba(0, 0, 0, 0.08);
    --card-hover-line: rgba(0, 0, 0, 0.16);
    --dot-main: #161616;
    --dot-ring: rgba(0, 0, 0, 0.06);
    --dot-off: #b5b5b5;
    --dashed: rgba(0, 0, 0, 0.18);
    --yellow: #d9b600;
    --green: #1fa85a;
    --red: #e0443d;
    --blue: #2f7fe0;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f3f1;
  --toggle: #2b2b2b;
  --dot: rgba(0, 0, 0, 0.11);
  --card: #ffffff;
  --card-line: rgba(0, 0, 0, 0.08);
  --panel: #f6f6f4;
  --panel-line: rgba(0, 0, 0, 0.05);
  --chip: #e9e9e6;
  --text: #161616;
  --dim: #5d5d5d;
  --faint: #8a8a8a;
  --btn: #161616;
  --btn-hover: #000000;
  --btn-ink: #f5f5f5;
  --hover: #e2e2de;
  --shadow: rgba(0, 0, 0, 0.08);
  --card-hover-line: rgba(0, 0, 0, 0.16);
  --dot-main: #161616;
  --dot-ring: rgba(0, 0, 0, 0.06);
  --dot-off: #b5b5b5;
  --dashed: rgba(0, 0, 0, 0.18);
  --yellow: #d9b600;
  --green: #1fa85a;
  --red: #e0443d;
  --blue: #2f7fe0;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
main.wrap { max-width: 880px; }

/* ---------- header ---------- */

.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 88px;
}
.logo { display: flex; align-items: center; gap: 12px; font-weight: 400; font-size: 17px; }
.logo svg { width: 30px; height: 30px; }
.top nav { display: flex; align-items: center; gap: 8px; }
.tab {
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--dim);
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: var(--chip); }

/* ---------- dots ---------- */

.dot { display: inline-block; width: 9px; height: 1.5px; border-radius: 1px; background: currentColor; flex: none; }
.dot.status.green { background: var(--green); }
.dot.status.yellow { background: var(--yellow); }
.dot.status.red { background: var(--red); }
.dot.status.blue { background: var(--blue); }
.dot.status.gray { background: var(--dot-off); }
.eyebrow .dot.green, .dot.status { width: 8px; height: 8px; border-radius: 50%; }
.eyebrow .dot.green { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }

/* ---------- hero ---------- */

.hero { padding: 56px 0 32px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--card-line);
  font-size: 13px;
  color: var(--dim);
}
.hero h1 {
  font-size: clamp(38px, 6vw, 60px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 22px 0 16px;
}
.hero .lead { color: var(--dim); font-size: 18px; margin: 0; max-width: 560px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 22px 0 0; padding: 0; }
.chips li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-line);
  font-size: 13.5px;
  color: var(--dim);
}

/* ---------- cards & panels ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--card-line);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 18px 40px var(--shadow);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
}
.card > .panel + .panel,
.card > * + .panel { margin-top: 10px; }

/* ---------- buttons (pills) ---------- */

.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  border: 1px solid var(--card-line);
  background: var(--chip);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform .12s, background .15s, color .15s;
}
.btn:hover { background: var(--hover); }
.btn.solid {
  background: var(--btn);
  color: var(--btn-ink);
  border-color: transparent;
  box-shadow: 0 6px 20px var(--shadow);
}
.btn.solid:hover { background: var(--btn-hover); transform: translateY(-1px); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); padding: 8px 10px; }
.btn.ghost:hover { background: var(--chip); color: var(--text); }
.btn.ghost.danger:hover { color: var(--red); }
.btn.copied { background: var(--green); border-color: var(--green); color: #fff; }
.btn:focus-visible, .drop input:focus-visible + * { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- footer ---------- */

.foot { margin-top: 96px; border-top: 1px solid var(--card-line); }
.foot .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 22px;
  padding-bottom: 36px;
  color: var(--faint);
  font-size: 13.5px;
}
.foot a:hover { color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- theme toggle ---------- */

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--chip);
  border: 1px solid var(--card-line);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: background .15s;
}
.theme-toggle:hover { background: var(--hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top .wrap { height: 72px; }
  .top nav .hide-sm { display: none; }
  .tab { padding: 10px 12px; }
  .hero { padding-top: 24px; }
  .hero .lead { font-size: 16px; }
}

.top, main, .foot { position: relative; z-index: 1; }
.toast { z-index: 10; }


/* ---------- paint ---------- */

.hero.small { padding: 20px 0 22px; }
.hero.small h1 { font-size: clamp(30px, 4.4vw, 42px); margin: 16px 0 8px; }
.hero.small .lead { font-size: 16px; max-width: 640px; }

#paint { scroll-margin-top: 10px; }
.bar { padding: 10px; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.group form { display: flex; gap: 6px; margin: 0; }
.group.acts { margin-left: auto; }
.btn.on { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
.btn[disabled] { opacity: .4; cursor: default; }
.btn[disabled]:hover { background: var(--chip); }

.sz {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--chip); border: 1px solid var(--card-line);
}
.sz:hover { background: var(--hover); }
.sz b { display: block; border-radius: 50%; background: var(--text); }
.sz.on { background: var(--btn); border-color: transparent; }
.sz.on b { background: var(--btn-ink); }
.sz .d1 { width: 4px; height: 4px; border-radius: 1px; }
.sz .d2 { width: 8px; height: 8px; }
.sz .d3 { width: 14px; height: 14px; }
.sz .d4 { width: 22px; height: 22px; }

.cur {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  border: 2px solid var(--text); box-shadow: inset 0 0 0 2px var(--panel);
  margin-right: 6px;
}
.swatches { display: grid; grid-template-columns: repeat(10, 20px); gap: 3px; }
.sw { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--dashed); display: block; }
.sw:hover { transform: scale(1.18); }
.k0 { background: #000000; } .k1 { background: #7f7f7f; } .k2 { background: #880015; } .k3 { background: #ed1c24; }
.k4 { background: #ff7f27; } .k5 { background: #fff200; } .k6 { background: #22b14c; } .k7 { background: #00a2e8; }
.k8 { background: #3f48cc; } .k9 { background: #a349a4; } .k10 { background: #ffffff; } .k11 { background: #c3c3c3; }
.k12 { background: #b97a57; } .k13 { background: #ffaec9; } .k14 { background: #ffc90e; } .k15 { background: #efe4b0; }
.k16 { background: #b5e61d; } .k17 { background: #99d9ea; } .k18 { background: #7092be; } .k19 { background: #c8bfe7; }
.pick { margin-left: 8px; }
.pick input[type="color"] {
  width: 44px; height: 36px; padding: 2px; border-radius: 10px; cursor: pointer;
  background: var(--chip); border: 1px solid var(--card-line);
}

.stage { padding: 0; overflow-x: auto; }
.board {
  position: relative; display: block; width: 800px; height: 500px; margin: 0 auto;
  background-color: #fff; overflow: hidden; border-radius: 4px;
  cursor: crosshair; user-select: none; -webkit-user-select: none;
}
.board input[type="image"] { display: block; width: 800px; height: 500px; border: 0; padding: 0; cursor: crosshair; outline: none; }

/* The brush: 16 000 little cells over the picture. While the mouse button is held on the board,
   every cell the pointer crosses takes the ink colour instantly (rule in the per-page p.css), and
   the "transition" back to transparent is delayed for a day, so the paint stays put. The same
   rule gives the cell a background-image whose address is the cell's number: that request is how
   the server learns what was painted, with no script anywhere. */
.board.live { background-size: 800px 500px; isolation: isolate; }
.board.live .under { position: absolute; left: 0; top: 0; width: 800px; height: 500px; z-index: -1; pointer-events: none; }
.board.live i {
  display: block; float: left; width: 5px; height: 5px;
  background-repeat: no-repeat; background-size: 0 0;
  transition: background-color 0s 99999s, box-shadow 0s 99999s;
}
.mark {
  position: absolute; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%;
  border: 2px solid #fff; background: #ff3b30; box-shadow: 0 0 0 1.5px #000; pointer-events: none;
}

.hint { color: var(--dim); font-size: 14.5px; margin: 14px 4px 0; }
.hint.touch { display: none; }
@media (hover: none) { .hint.touch { display: block; } }
.foot { margin-top: 56px; }
main.wrap { max-width: 880px; }
@media (max-width: 640px) { .group.acts { margin-left: 0; } }

/* the optional JavaScript brush draws on a canvas laid over the cells */
.board.live canvas.ink { position: absolute; left: 0; top: 0; width: 800px; height: 500px; z-index: 1; touch-action: none; cursor: crosshair; }
.js .hint.touch { display: none; }
