/* Tiny Go: a small kaya board on a slate-green table */
@font-face { font-family: "Young Serif"; font-display: swap; src: url(../fonts/young-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  --bg: #D9E2DF;
  --card: #FFFFFF;
  --ink: #1E2A27;
  --muted: #5A6763;
  --line: #C3CFCB;
  --wood: #E0B46A;
  --wood2: #D29F52;
  --grid: #5A3E1B;
  --mark: #D7263D;
  --display: "Young Serif", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141B19; --card: #1D2624; --ink: #E3ECE9; --muted: #9AAAA5; --line: #2C3835; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); line-height: 1.45; min-height: 100vh; }
a { color: inherit; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

.wrap { max-width: 520px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.icon-btn:hover { background: var(--card); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 0 8px; }
h1 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; margin: 0; line-height: 1; }
.sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.task { margin: 0 0 8px; font-size: 1.05rem; }
.hud { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.hud p { margin: 0; color: var(--muted); }
.hud b { color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 1.5rem; margin-left: 4px; }
.tries { display: flex; gap: 6px; }
.tries i { width: 14px; height: 14px; border-radius: 50%; background: #1B1B1B; display: inline-block; }
.tries i.used { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }

.board-wrap { display: flex; justify-content: center; }
.board { width: min(100%, 460px); aspect-ratio: 1; border-radius: 10px; touch-action: manipulation; cursor: pointer; user-select: none; -webkit-user-select: none;
  background: linear-gradient(135deg, var(--wood) 0%, var(--wood2) 100%); box-shadow: 0 2px 0 #B98840, 0 16px 30px -18px rgba(60, 40, 10, .6); }
.board .ln { stroke: var(--grid); stroke-width: 2.2; }
.board .edge { stroke: var(--grid); stroke-width: 3.4; fill: none; }
.board .hit { fill: transparent; }
.stone.b { fill: url(#gB); }
.stone.w { fill: url(#gW); stroke: #8C7A5C; stroke-width: 1.2; }
.stone.ghost { opacity: .45; }
.stone.place { animation: drop .16s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes drop { from { transform: scale(1.18); } to { transform: scale(1); } }
.target { fill: var(--mark); }
.last { fill: none; stroke-width: 3.5; }
.last.on-b { stroke: #F4F1EA; } .last.on-w { stroke: #1B1B1B; }
.cross { stroke: var(--mark); stroke-width: 6; stroke-linecap: round; }
.board.locked { cursor: default; }

.fine { color: var(--muted); font-size: 0.88rem; text-align: center; margin: 10px 0 0; min-height: 1.3em; }
.fine.bad { color: var(--mark); font-weight: 600; }

.card { background: var(--card); border-radius: 20px; padding: 20px 18px; box-shadow: 0 1px 0 var(--line); }
.done { margin-top: 14px; }
.kicker { margin: 0; color: var(--muted); font-weight: 600; }
.big { font-family: var(--display); font-size: 2.4rem; line-height: 1.1; margin: 6px 0 6px; }
.res-line { margin: 0 0 14px; }
.tool { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 18px; font-weight: 700; cursor: pointer; }
.tool.wide { width: 100%; margin-bottom: 12px; }
.go { width: 100%; border: 0; border-radius: 16px; padding: 14px; background: var(--ink); color: var(--card); font-weight: 800; font-size: 1.1rem; cursor: pointer; }

/* ads */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.ad-label { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 4px; }

.foot { display: flex; justify-content: center; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: 0.9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dlg { border: 0; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
.dlg::backdrop { background: rgba(10, 16, 14, .5); }
.dlg h2 { font-family: var(--display); font-weight: 400; margin: 0 0 10px; font-size: 1.6rem; }
.dlg p { color: var(--muted); }
.dlg p b { color: var(--ink); }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--bg); border-radius: 10px; padding: 10px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .stone.place { animation: none; } .toast { transition: none; } }
