/* Shared style for Dzeal Chess static pages (privacy, how to play, rules,
   about, contact). Walnut + cream to match the app and badges. */
:root {
  --bg: #f7efe2;
  --surface: #fffaf2;
  --ink: #2e1b10;
  --muted: #6d5646;
  --accent: #8b5a2b;
  --accent-ink: #fffaf2;
  --line: #e4d4bd;
  --gold: #b9863a;
  --ok: #2f855a;
  --err: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b120c;
    --surface: #271a11;
    --ink: #f4e8d6;
    --muted: #c4ad96;
    --accent: #e0b36a;
    --accent-ink: #1b120c;
    --line: #3d2b1d;
    --gold: #e8c170;
    --ok: #68d391;
    --err: #fc8181;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.site-header .wrap {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-top: 10px; padding-bottom: 10px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; letter-spacing: .3px; color: var(--ink); text-decoration: none;
  font-size: 1.1rem; margin-right: auto;
}
.brand .mark { font-size: 1.6rem; line-height: 1; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom: 2px solid var(--accent); }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn.small { padding: 6px 12px; font-size: .9rem; }

/* Layout */
.wrap { max-width: 860px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
main.wrap { padding-top: 28px; padding-bottom: 56px; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.3rem); line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 1.35rem; margin: 36px 0 8px; padding-top: 4px; }
h3 { font-size: 1.08rem; margin: 22px 0 6px; }
.lead { font-size: 1.12rem; color: var(--muted); margin-top: 4px; }
.updated { color: var(--muted); font-size: .9rem; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px 20px; margin: 16px 0;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid .card { margin: 0; }
.card h3 { margin-top: 0; }
.pill {
  display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .3px;
  padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.toc { columns: 2 220px; padding-left: 20px; }
.toc li { margin: 2px 0; }
.note {
  border-left: 4px solid var(--gold); background: var(--surface);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 16px 0;
}
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .97rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface); }
.table-scroll { overflow-x: auto; }
code, kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px;
}
ul, ol { padding-left: 22px; }
li { margin: 4px 0; }

/* Forms */
form .row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
label .opt { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 150px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin-top: 14px; font-weight: 600; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }
.hint { color: var(--muted); font-size: .9rem; margin-top: 6px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer .wrap { padding-top: 20px; padding-bottom: 28px; font-size: .9rem; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* Small screens: brand + button on one row, links below, header scrolls away */
@media (max-width: 640px) {
  .site-header { position: static; }
  .site-header .btn { order: 2; }
  .site-nav { order: 3; width: 100%; gap: 2px 14px; font-size: .9rem; }
}

/* Board diagrams (Chess basics page) */
.diagrams { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 12px 0 20px; }
.diagram { margin: 0; }
.diagram figcaption { font-size: .92rem; color: var(--muted); margin-top: 6px; }
.board {
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: 100%; max-width: 300px; aspect-ratio: 1 / 1;
  border: 2px solid #7a5230; border-radius: 6px; overflow: hidden;
}
.board.big { max-width: 380px; }
.sq { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; aspect-ratio: 1 / 1; overflow: hidden; }
.sq.l { background: #efd9b5; }
.sq.d { background: #b58863; }
.sq.hl { box-shadow: inset 0 0 0 100px rgba(63, 167, 214, .55); }
.sq .p { font-size: clamp(16px, 6.4vw, 30px); line-height: 1; }
.board.big .sq .p { font-size: clamp(18px, 8vw, 40px); }
.sq .p.w { color: #fff; text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000; }
.sq .p.b { color: #1b1b1b; }
.sq.dot::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(0,0,0,.45); }
.sq.cap::after { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 3px solid rgba(180,30,30,.75); }
.sq .c { position: absolute; font-size: 9px; font-weight: 700; opacity: .75; color: #3b2414; }
.sq .c.f { right: 2px; bottom: 0; }
.sq .c.r { left: 2px; top: 0; }
.glossary { columns: 2 300px; column-gap: 28px; }
.glossary div { break-inside: avoid; margin: 0 0 10px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; color: var(--muted); font-size: .95rem; }
.values { display: flex; flex-wrap: wrap; gap: 10px; }
.values span { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }

.site-header .wrap { max-width: 1040px; }
