:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --ink: #1b1f24;
  --muted: #5d6670;
  --line: #e3e6ea;
  --accent: #2f5d8a;
  --accent-ink: #ffffff;
  --accent-soft: #e4edf6;
  --board: #e9d9b4;
  --board-line: #a8895a;
  --dark-stone: #1f2328;
  --light-stone: #fbfaf6;
  --win: #2e7d4f;
  --lose: #a33a2b;
  --radius: 10px;
  color-scheme: light;
}

html[data-theme=dark] {
  --bg: #0b0d12; --surface: #151a20; --ink: #e7eaee; --muted: #9aa4ae; --line: #232a33;
  --accent: #79a9d8; --accent-ink: #0c1117; --accent-soft: #1d2a38; --board: #7d6a48; --board-line: #4a3c25;
  --win: #6cc28f; --lose: #e07b6a; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
header.top { border-bottom: 1px solid var(--line); background: var(--surface); }
header.top .wrap { display: flex; align-items: center; gap: 18px; height: 56px; }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 22px; height: 22px; }
nav.main { display: flex; gap: 14px; margin-left: auto; font-size: 15px; }
nav.main a { color: var(--muted); text-decoration: none; }
nav.main a:hover, nav.main a.on { color: var(--ink); }
#me { font-size: 14px; color: var(--muted); }
main { padding: 24px 0 48px; }
h1 { font-size: 30px; line-height: 1.2; margin: 8px 0 10px; }
h2 { font-size: 21px; margin: 28px 0 10px; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.btn { display: inline-block; border: 0; border-radius: 8px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.btn-small { padding: 6px 12px; font-size: 14px; }
.games { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { margin-top: 0; }
.card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notice { background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text] { font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 200px; }
table { border-collapse: collapse; width: 100%; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { font-size: 14px; color: var(--muted); font-weight: 600; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tabs button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.play { display: grid; grid-template-columns: minmax(0, 560px) minmax(220px, 1fr); gap: 20px; align-items: start; }
.board svg { width: 100%; height: auto; display: block; border-radius: var(--radius); touch-action: manipulation; }
.board .cell { cursor: pointer; }
.board .cell:hover { fill: rgba(0, 0, 0, .06); }
.side .player { display: flex; justify-content: space-between; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; }
.side .player.turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.side .who { display: flex; align-items: center; gap: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid #0003; }
.dot.dark { background: var(--dark-stone); }
.dot.light { background: var(--light-stone); }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.clock.low { color: var(--lose); }
#status { margin: 10px 0; min-height: 1.5em; }
.win { color: var(--win); font-weight: 700; }
.lose { color: var(--lose); font-weight: 700; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.prose { max-width: 720px; }
.prose li { margin: 4px 0; }
footer { border-top: 1px solid var(--line); padding: 18px 0 30px; font-size: 14px; color: var(--muted); }
footer a { color: var(--muted); }
.hidden { display: none !important; }
@media (max-width: 760px) {
  .play { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
  nav.main { gap: 10px; font-size: 14px; }
  #me { display: none; }
}

/* Makerio style v1 footer line */
.mk-footer{border-top:1px solid rgba(127,127,127,.25);opacity:.8;font-size:14px;padding:12px 16px;text-align:center}
.mk-footer a{color:inherit}

/* ---- Makerio style v2 (marketing/brand/BRAND.md "Modern look"): orange/ink buttons, bigger H1, no underlined links in cards, theme fields ---- */
:root { --btn: #f59e2c; --btn-ink: #0b0d12; --link: #a85a07; --radius: 14px; }

html[data-theme=dark] { --link: #ffb347; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); }
.btn { background: var(--btn); color: var(--btn-ink); border-radius: 10px; }
.btn:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--link); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--btn) 60%, var(--line)); }
h1 { font-size: clamp(36px, 5.5vw, 52px); line-height: 1.08; letter-spacing: -0.025em; font-weight: 700; }
main > h1:first-child, main .hero h1 { margin-top: 24px; }
.lead { font-size: clamp(18px, 2.2vw, 20px); }
.card a:not(.btn) { text-decoration: none; }
.card a:not(.btn):hover { text-decoration: underline; }
.card { transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: color-mix(in srgb, var(--btn) 45%, var(--line)); box-shadow: 0 8px 24px rgba(16,24,40,.07); }
input[type=text] { background: var(--bg); border-radius: 10px; }
input[type=text]:focus { outline: 2px solid color-mix(in srgb, var(--btn) 60%, transparent); outline-offset: 1px; }
.tabs button.on { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
@media (max-width: 600px) { h1 { font-size: 34px; } }
.side .player.turn { border-color: var(--btn); box-shadow: 0 0 0 1px var(--btn); }
/* BRAND v3: Makerio mark + product name + "by Makerio" */
.brand-wrap { display: inline-flex; align-items: center; gap: 8px; }
.mk-mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
.by-mk { font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; padding-top: 3px; }
.by-mk:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 420px) { .by-mk { display: none; } }

/* theme button (ops/brand/theme.mjs): light <-> dark */
.mk-theme{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;flex:0 0 36px;padding:0;margin:0 0 0 4px;border-radius:999px;border:1px solid rgba(127,127,127,.35);background:transparent;color:inherit;cursor:pointer}
.mk-theme:hover{border-color:#f59e2c;color:#f59e2c}.mk-theme svg{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;display:none}
html[data-theme=dark] .mk-theme .i-sun,html:not([data-theme=dark]) .mk-theme .i-moon{display:block}
html:not([data-theme]) .mk-theme{display:none}
header.top .mk-theme{margin-left:4px}
/* a dark stone marker stays visible on a dark panel */

html[data-theme=dark] .dot.dark { box-shadow: 0 0 0 1.5px #8a939c; }

/* product mark in the header (inline SVG): light tile by default, dark tile with the dark theme */
.mk-mark .mk-it{fill:#fff4e5;stroke:#f2d6ae}.mk-mark .mk-ia{stroke:#b45309}.mk-mark .mk-ib{stroke:#ea580c}.mk-mark .mk-if{fill:#ea580c}
html[data-theme=dark] .mk-mark .mk-it{fill:#0b0d12;stroke:#2e3742}html[data-theme=dark] .mk-mark .mk-ia{stroke:#f59e2c}html[data-theme=dark] .mk-mark .mk-ib{stroke:#ffb347}html[data-theme=dark] .mk-mark .mk-if{fill:#ffb347}


/* shell v1 (marketing/brand/shell.md): the same 1160 px container as every Makerio site */
.wrap { max-width: var(--mk-wrap, 1160px); padding: 0 var(--mk-pad, 24px); }
@media (max-width: 760px) { .wrap { padding: 0 18px; } }
.mk-actions #me { font-size: 14px; color: var(--muted); }
@media (max-width: 760px) { .mk-actions #me { display: none; } }

/* shell link colour must not repaint filled buttons inside main */
.mk-page main a.btn:not(.btn-ghost), .mk-page main a.btn:not(.btn-ghost):hover { color: #0b0d12; }

/* shell v1 components on this site's own classes (marketing/brand/shell.md): same H1, lead, buttons, cards, badges as every Makerio page */
.mk-page main h1 { font-size: clamp(30px, 4.4vw, 48px); line-height: 1.08; letter-spacing: -.03em; font-weight: 800; }
.mk-page main .hero h1, .mk-page main > h1:first-child { font-size: clamp(34px, 5.2vw, 56px); max-width: 20ch; }
.mk-page main .lead { font-size: clamp(17px, 1.8vw, 20px); color: var(--mk-m); max-width: 60ch; }
.mk-page .btn { display: inline-flex; align-items: center; gap: 8px; background: var(--mk-o); color: var(--mk-ink); font: 700 15px/1.2 var(--mk-font); border: 0; border-radius: var(--mk-r); padding: 11px 18px; text-decoration: none; box-shadow: none; }
.mk-page .btn:hover { background: var(--mk-o2); color: var(--mk-ink); }
.mk-page .btn-small { padding: 8px 14px; font-size: 14px; }
.mk-page .btn-ghost, .mk-page main a.btn-ghost { background: transparent; color: var(--mk-t); border: 1px solid var(--mk-l); }
.mk-page .btn-ghost:hover, .mk-page main a.btn-ghost:hover { background: transparent; border-color: var(--mk-m); color: var(--mk-t); }
.mk-page .card, .mk-page .hcard { background: var(--mk-s); border: 1px solid var(--mk-l); border-radius: var(--mk-rc); }
.mk-page .badge { font: 700 11px/1 var(--mk-font); letter-spacing: .06em; padding: 4px 7px; border-radius: 999px; background: #fff4e5; color: #9a3412; border: 1px solid #f2d6ae; }
html[data-theme=dark] .mk-page .badge { background: rgba(245,158,44,.14); color: #ffb347; border-color: rgba(245,158,44,.35); }
.mk-page main a.btn-ghost.btn-ghost.btn-ghost, .mk-page main a.btn-ghost.btn-ghost.btn-ghost:hover { color: var(--mk-t); }

/* collapsed examples (owner 23.11: no walls of text on view) */
details.more { border-top: 1px solid var(--line); padding: 10px 0; }
details.more summary { cursor: pointer; font-weight: 600; }

/* header icon colours follow the theme (same rules as makerio.net, <style data-mk-icons>) */
.mk-ft{fill:#fff4e5;stroke:#f2d6ae;stroke-width:1}.mk-fg{fill:#c2410c}.mk-fgs{stroke:#c2410c}.mk-fc{fill:#fff4e5}.mk-fcs{stroke:#fff4e5}html[data-theme=dark] .mk-ft{fill:#f59e2c;stroke:none}html[data-theme=dark] .mk-fg{fill:#0b0d12}html[data-theme=dark] .mk-fgs{stroke:#0b0d12}html[data-theme=dark] .mk-fc{fill:#f59e2c}html[data-theme=dark] .mk-fcs{stroke:#f59e2c}

/* ui-patterns (24.11): orange only for actions; links in text plain with a quiet underline */
.mk-page main a:not(.btn):not(.mk-btn):not(.mk-row):not(.mk-chip):not(.mk-card) { color: var(--mk-t); text-decoration: underline; text-decoration-color: var(--mk-l); text-underline-offset: 3px; }
.mk-page main a:not(.btn):not(.mk-btn):not(.mk-row):not(.mk-chip):not(.mk-card):hover { color: var(--mk-link); text-decoration-color: currentColor; }
.mk-page main .mk-facts { margin: 14px 0 22px; }

/* one orange button per screen: where the hero has its own main action, the header button is quiet (QA 24.11) */
.mk-page:has(main .mk-cta) .mk-header .mk-actions > .mk-btn { background: transparent; color: var(--mk-t); border: 1px solid var(--mk-l); box-shadow: none; }
.mk-page:has(main .mk-cta) .mk-header .mk-actions > .mk-btn:hover { background: transparent; border-color: var(--mk-m); color: var(--mk-t); transform: none; }

/* one light palette (owner 24.11): white tile + orange mark in light, orange tile + dark mark in dark (rules as makerio.net) */
.mk-ft{fill:#ffffff;stroke:#e3e6ea;stroke-width:1}.mk-fg{fill:#f59e2c}.mk-fgs{stroke:#f59e2c}.mk-fc{fill:#ffffff}.mk-fcs{stroke:#ffffff}html[data-theme=dark] .mk-ft{fill:#f59e2c;stroke:none}html[data-theme=dark] .mk-fg{fill:#0b0d12}html[data-theme=dark] .mk-fgs{stroke:#0b0d12}html[data-theme=dark] .mk-fc{fill:#f59e2c}html[data-theme=dark] .mk-fcs{stroke:#f59e2c}
