/* Printable sheets (printables/*.html): A4 pages that can be filled in on screen, printed, or exported to PDF
   with tools/export_printables.mjs. Not part of the published site. */
:root {
  --orange: #d9480f; --ink: #1c1410; --amber: #ffc21a; --soft: #ffe8c2; --mist: #fff7ee; --muted: #6e5a4c; --line: #c9b6a4;
  --grass: #7fae5d; --grass-dark: #5f8f44;
  color-scheme: light;
}
@page { size: A4; margin: 0; }
* { box-sizing: border-box; }
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body { margin: 0; background: #eadfd3; color: var(--ink); font: 400 11pt/1.4 Figtree, system-ui, sans-serif; }
h1, h2, h3, .pix { font-family: "Jersey 15", monospace; font-weight: 400; font-synthesis: none; letter-spacing: .01em; }
.tag { font-family: Silkscreen, monospace; font-size: 7pt; letter-spacing: .06em; text-transform: uppercase; }
.pixel { image-rendering: pixelated; }
.sprite { display: inline-block; line-height: 0; }
.sprite svg { display: block; }
:root[data-lang="pt"] body [lang="en"], :root[data-lang="en"] body [lang="pt"] { display: none !important; }

/* ---------------------------------------------------------------- the sheet */
.sheet { position: relative; width: 210mm; height: 296.8mm; margin: 0 auto 24px; padding: 13mm 13mm 0; overflow: hidden; background: #fff;
  display: flex; flex-direction: column; gap: 4.5mm; break-after: page; box-shadow: 0 6px 24px rgba(28, 20, 16, .18); }
.landscape .sheet { width: 297mm; height: 209.8mm; }
.sheet:last-of-type { break-after: auto; }
.sheet-body { flex: 1; display: flex; flex-direction: column; gap: 4.5mm; min-height: 0; }

.sheet-head { display: flex; align-items: flex-end; gap: 6mm; padding-bottom: 3.5mm; border-bottom: 1mm solid var(--ink); }
.sheet-head > div:first-child { flex: 1; display: grid; gap: 1mm; }
.sheet-head .tag { color: var(--orange); }
.sheet-head h1 { margin: 0; font-size: 34pt; line-height: .9; color: var(--ink); }
.sheet-head p { margin: 0; color: var(--muted); font-size: 10pt; max-width: 125mm; }
.sheet-head .sprite { flex: none; margin-bottom: -3.5mm; }

.sheet-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 6mm; height: 13mm; margin: 0 -13mm; padding: 0 13mm;
  border-top: .6mm solid var(--ink); background: var(--mist); font-size: 8pt; color: var(--muted); }
.sheet-foot img { height: 7mm; width: auto; }
.sheet-foot .turf { position: absolute; left: 0; right: 0; bottom: 13mm; height: 1.4mm;
  background: linear-gradient(90deg, var(--grass) 50%, var(--grass-dark) 50%) 0 0 / 4mm 100% repeat-x; }

/* ---------------------------------------------------------------- building blocks */
.fields { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 3mm 5mm; }
.field { display: grid; gap: .6mm; min-width: 0; }
.field > span, .label { font-family: Silkscreen, monospace; font-size: 6.5pt; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.line, .lines textarea { width: 100%; min-width: 0; border: 0; border-bottom: .35mm solid var(--ink); background: transparent; padding: .6mm .5mm; font: inherit; color: var(--ink); }
.line:focus, [contenteditable]:focus, .lines textarea:focus { outline: none; background: var(--mist); }
.lines textarea { display: block; resize: none; border: 0; line-height: 7mm; padding: 0 .5mm; overflow: hidden;
  background: repeating-linear-gradient(transparent 0 calc(7mm - .3mm), var(--line) calc(7mm - .3mm) 7mm); }

h2 { margin: 0; font-size: 18pt; line-height: 1; display: flex; align-items: center; gap: 2.5mm; }
h2 .num { display: grid; place-items: center; width: 7mm; height: 7mm; background: var(--orange); color: #fff; font-size: 13pt; }
h3 { margin: 0; font-size: 14pt; line-height: 1; }
.note { margin: 0; font-size: 9pt; color: var(--muted); }
.box { border: .5mm solid var(--ink); box-shadow: 1.2mm 1.2mm 0 var(--ink); background: #fff; }
.soft { background: var(--soft); }
.cols { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: 5mm; }

/* Tables with editable cells */
table.grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 9pt; }
table.grid th { background: var(--soft); text-align: left; font-family: Silkscreen, monospace; font-size: 6.5pt; letter-spacing: .03em; text-transform: uppercase;
  font-weight: 400; padding: 1.6mm 1.6mm; border: .35mm solid var(--ink); vertical-align: bottom; }
table.grid td { border: .3mm solid var(--ink); padding: 1mm 1.6mm; height: var(--row, 9mm); vertical-align: top; overflow: hidden; }
table.grid td.day { background: var(--mist); font-family: "Jersey 15", monospace; font-size: 13pt; vertical-align: middle; }
table.grid td.c, table.grid th.c { text-align: center; vertical-align: middle; }

/* Check boxes: real checkboxes, drawn as pixel squares that print */
input.tick { appearance: none; -webkit-appearance: none; display: inline-block; width: 4.6mm; height: 4.6mm; margin: 0; vertical-align: middle;
  border: .45mm solid var(--ink); background: #fff; cursor: pointer; }
input.tick:checked { background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7'%3E%3Cpath fill='%23fff' d='M5 1h1v1h1v1H6v1H5v1H4v1H3V5H2V4H1V3h1v1h1v1h1V4h1V3h1V2H5z'/%3E%3C/svg%3E") center / 80% no-repeat; }
.choice { display: inline-flex; align-items: center; gap: 1.5mm; margin-right: 4mm; white-space: nowrap; }

/* ---------------------------------------------------------------- screen-only toolbar */
.toolbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; margin-bottom: 24px;
  background: #fff; border-bottom: 3px solid var(--ink); font-size: 14px; }
.toolbar .grow { flex: 1; }
.toolbar a, .toolbar button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; font: 400 18px/1 "Jersey 15", monospace; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); text-decoration: none; cursor: pointer; }
.toolbar a:hover, .toolbar button:hover { background: var(--soft); }
.toolbar .primary { background: var(--amber); }
.toolbar .lang-switch { display: flex; border: 3px solid var(--ink); }
.toolbar .lang-switch button { border: 0; box-shadow: none; font: 400 12px/1 Silkscreen, monospace; padding: 8px 10px; }
.toolbar .lang-switch button[aria-pressed="true"] { background: var(--orange); color: #fff; }
.toolbar .hint { color: var(--muted); font-size: 13px; }
@media (max-width: 820px) { .sheet { transform-origin: top left; } }

@media print {
  body { background: #fff; }
  .toolbar { display: none; }
  .sheet { margin: 0; box-shadow: none; }
  ::placeholder { color: transparent; }
  .line:focus, [contenteditable]:focus { background: transparent; }
}

/* ---------------------------------------------------------------- dog selector (dog-select.js), screen only */
.ds { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(20, 14, 10, .72); overflow-y: auto; }
.ds-panel { position: relative; width: min(920px, 100%); display: grid; gap: 16px; padding: 22px 24px 18px; color: #fff7ee; background: #1c1410;
  border: 4px solid #000; box-shadow: 0 0 0 4px var(--amber), 10px 10px 0 4px #000; font-family: Figtree, system-ui, sans-serif; animation: ds-in .25s steps(5, end); }
.ds-panel::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(transparent 0 3px, rgba(0, 0, 0, .18) 3px 4px); }
@keyframes ds-in { from { transform: scale(.92); opacity: 0; } }
.ds-head h2 { margin: 0; font-size: clamp(34px, 6vw, 52px); line-height: .9; color: var(--amber); text-transform: uppercase; text-shadow: 3px 3px 0 var(--orange); }
.ds-head p { margin: 6px 0 0; color: #d9c6b4; font-size: 15px; }
.ds-close { position: absolute; z-index: 2; top: 12px; right: 12px; width: 38px; height: 38px; font: 400 20px/1 "Jersey 15", monospace; color: #fff7ee;
  background: #2b211b; border: 3px solid #6e5a4c; cursor: pointer; }
.ds-close:hover { border-color: var(--amber); }
.ds-body { display: grid; grid-template-columns: 1fr 250px; gap: 18px; align-items: start; }
@media (max-width: 760px) { .ds-body { grid-template-columns: 1fr; } }
.ds-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .ds-grid { grid-template-columns: repeat(3, 1fr); } }
.ds-tile { position: relative; display: grid; justify-items: center; gap: 2px; padding: 4px 4px 8px; min-width: 0; color: #fff7ee; cursor: pointer;
  background: #2b211b; border: 3px solid #6e5a4c; font: inherit; transition: transform .1s steps(2, end); }
.ds-tile:hover, .ds-tile[aria-selected="true"] { border-color: var(--amber); background: #3a2b20; }
.ds-tile[aria-selected="true"] { transform: translateY(-3px); box-shadow: 4px 4px 0 var(--orange); }
.ds-tile:focus-visible { outline: 3px solid #fff7ee; outline-offset: 2px; }
.ds-p1 { position: absolute; top: -12px; left: 50%; translate: -50% 0; padding: 1px 5px; font: 400 9px/1.4 Silkscreen, monospace; color: #1c1410; background: var(--amber);
  visibility: hidden; animation: ds-blink 1s steps(2, start) infinite; }
.ds-tile[aria-selected="true"] .ds-p1 { visibility: visible; }
@keyframes ds-blink { 50% { opacity: .35; } }
.ds-stage { position: relative; width: 100%; height: 78px; overflow: hidden; }
.ds-dog { position: absolute; left: calc(50% - 64px); bottom: -6px; }
.ds-dog--pack { bottom: 4px; }
.ds-dog--0 { left: calc(50% - 62px); } .ds-dog--1 { left: calc(50% - 32px); } .ds-dog--2 { left: calc(50% - 4px); }
.ds-name { font: 400 18px/1 "Jersey 15", monospace; text-align: center; }
.ds-variant { min-height: 13px; font: 400 9px/1.3 Silkscreen, monospace; color: #bfa58f; text-transform: uppercase; text-align: center; }
.ds-hero { display: grid; gap: 10px; padding: 14px; background: #2b211b; border: 3px solid #6e5a4c; }
.ds-hero-stage { position: relative; height: 150px; overflow: hidden; background: linear-gradient(#3b2c20 0 78%, var(--grass) 78% 82%, var(--grass-dark) 82%); border: 3px solid #000; }
.ds-hero-dog { position: absolute; left: calc(50% - 96px); bottom: 12px; }
.ds-hero-name { font: 400 28px/1 "Jersey 15", monospace; color: var(--amber); }
.ds-hero-note { margin-top: -6px; font-size: 13px; color: #d9c6b4; min-height: 17px; }
.ds-stats { display: grid; gap: 6px; }
.ds-stat { display: grid; grid-template-columns: 1fr 70px 38px; align-items: center; gap: 8px; font: 400 9px/1.2 Silkscreen, monospace; text-transform: uppercase; color: #d9c6b4; }
.ds-stat i { height: 10px; border: 2px solid #000; background: #000; }
.ds-stat i b { display: block; height: 100%; width: 100%; background: repeating-linear-gradient(90deg, var(--grass) 0 6px, transparent 6px 8px); animation: ds-fill .6s steps(8, end); }
@keyframes ds-fill { from { width: 0; } }
.ds-stat em { font-style: normal; color: var(--amber); text-align: right; }
.ds-start, .ds-use { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; font: 400 22px/1 "Jersey 15", monospace; text-decoration: none; cursor: pointer; border: 3px solid #000; }
.ds-start { color: #1c1410; background: var(--amber); box-shadow: 4px 4px 0 var(--orange); }
.ds-start:hover { transform: translate(-1px, -1px); }
.ds-caret { animation: ds-blink .8s steps(2, start) infinite; }
.ds-use { margin-top: -2px; font-size: 18px; color: #fff7ee; background: transparent; border-color: #6e5a4c; }
.ds-use:hover { border-color: var(--amber); }
.ds-hint { margin: 0; font: 400 9px/1.3 Silkscreen, monospace; text-transform: uppercase; color: #8f7d6f; text-align: center; }
@media (prefers-reduced-motion: reduce) { .ds-panel, .ds-p1, .ds-caret, .ds-stat i b { animation: none; } }
@media print { .ds { display: none; } }
@media (max-width: 760px) {
  .ds { place-items: start center; }
  .ds-hero { position: sticky; bottom: 0; z-index: 2; grid-template-columns: 1fr 1fr; align-items: center; box-shadow: 0 -10px 18px rgba(0, 0, 0, .55); }
  .ds-hero-stage, .ds-stats, .ds-hero-note { display: none; }
  .ds-hero-name { grid-column: 1 / -1; font-size: 22px; }
  .ds-use { margin-top: 0; }
  .ds-start, .ds-use { font-size: 17px; padding: 10px 6px; }
}
