/* tammipeli.com — ulkoasu. Rakenne ja tyylin lähtökohta: Pixl-teema (Automattic, GPL-2.0+), yksi palsta, kovat reunat ja siirretyt varjot. */
@font-face{font-family:'DM Mono';font-style:normal;font-weight:400;font-display:swap;src:url(/ruudukko/kirjaimet/dmmono-400.woff2) format('woff2')}
@font-face{font-family:'DM Mono';font-style:normal;font-weight:500;font-display:swap;src:url(/ruudukko/kirjaimet/dmmono-500.woff2) format('woff2')}
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:400;font-display:swap;src:url(/ruudukko/kirjaimet/instr-400.woff2) format('woff2')}
@font-face{font-family:'Instrument Sans';font-style:normal;font-weight:600;font-display:swap;src:url(/ruudukko/kirjaimet/instr-600.woff2) format('woff2')}
:root {
  --tp-tausta: #e9e3fb; --tp-pinta: #fbfaff; --tp-muste: #16154a; --tp-sininen: #2a2edb; --tp-sininen-tumma: #1b1e9c;
  --tp-reuna: 3px solid var(--tp-muste); --tp-varjo: 6px 6px 0 var(--tp-muste); --tp-keltainen: #f5c400; --tp-vihrea: #1f9d55;
  --tp-ruutu-vaalea: #f3eeff; --tp-ruutu-tumma: #4a46b8; --tp-haalea: #5b5a86;
  --tp-mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; --tp-teksti: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--tp-tausta); color: var(--tp-muste); font-family: var(--tp-teksti); font-size: 17px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: var(--tp-sininen); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--tp-sininen-tumma); }
h1, h2, h3, h4 { font-family: var(--tp-mono); font-weight: 500; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 0.5em; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; margin-top: 1.8em; } h3 { font-size: 1.1rem; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1em; }
li { margin: 0.25em 0; }
code, kbd { font-family: var(--tp-mono); background: var(--tp-pinta); border: 1px solid var(--tp-muste); padding: 0 0.3em; font-size: 0.92em; }
table { border-collapse: collapse; width: 100%; margin: 1em 0 1.5em; font-size: 0.88rem; background: var(--tp-pinta); border: var(--tp-reuna); }
th, td { border: 1px solid var(--tp-muste); padding: 0.4em 0.5em; text-align: left; vertical-align: top; }
th { font-family: var(--tp-mono); font-weight: 500; background: var(--tp-tausta); }
.tp-taulukko { overflow-x: auto; margin: 1em -4px; padding: 4px; }
.tp-taulukko table { margin: 0; min-width: 480px; }
figure { margin: 1.5em 0; }
figcaption { font-size: 0.9rem; color: var(--tp-haalea); margin-top: 0.4em; }
hr { border: 0; border-top: 3px solid var(--tp-muste); margin: 2.5em 0; }
.tp-sivu { max-width: 840px; margin: 0 auto; padding: 24px 20px 48px; }
.tp-sivu.tp-levea { max-width: 920px; }

/* ---- ylätunniste ---- */
.tp-ylatunniste { display: flex; flex-wrap: wrap; align-items: stretch; gap: 14px; margin-bottom: 26px; }
.tp-tunnus { font-family: var(--tp-mono); font-weight: 500; font-size: 1.35rem; text-decoration: none; color: var(--tp-muste); background: var(--tp-pinta); border: var(--tp-reuna); box-shadow: var(--tp-varjo); padding: 10px 16px; display: inline-flex; align-items: center; gap: 10px; }
.tp-tunnus svg { width: 28px; height: 28px; }
.tp-tunnus span { color: var(--tp-sininen); }
.tp-valikko { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; align-content: flex-start; }
.tp-valikko a { font-family: var(--tp-mono); font-size: 0.92rem; text-decoration: none; color: var(--tp-muste); background: var(--tp-pinta); border: var(--tp-reuna); padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; }
.tp-valikko a:hover, .tp-valikko a[aria-current] { background: var(--tp-sininen); color: #fff; }
.tp-polku { font-family: var(--tp-mono); font-size: 0.82rem; margin: 0 0 1em; color: var(--tp-haalea); }
.tp-polku a { color: var(--tp-haalea); }
.tp-polku ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4em; }
.tp-polku li + li::before { content: '›'; margin-right: 0.4em; }

/* ---- laatikot ---- */
.tp-laatikko { background: var(--tp-pinta); border: var(--tp-reuna); box-shadow: var(--tp-varjo); padding: 20px 22px; margin: 0 0 28px; }
.tp-laatikko > :first-child { margin-top: 0; }
.tp-laatikko > :last-child { margin-bottom: 0; }
.tp-laatikko.tp-sininen { background: var(--tp-sininen); color: #fff; }
.tp-laatikko.tp-sininen a { color: #fff; }
.tp-laatikko.tp-sininen h2, .tp-laatikko.tp-sininen h3 { color: var(--tp-keltainen); }
.tp-ingressi { font-size: 1.12rem; }
.tp-ruudukko { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin: 1em 0 1.5em; padding: 0; list-style: none; }
.tp-ruudukko li { margin: 0; }
.tp-kortti { display: block; height: 100%; background: var(--tp-pinta); border: var(--tp-reuna); box-shadow: 4px 4px 0 var(--tp-muste); padding: 14px 16px; text-decoration: none; color: var(--tp-muste); }
.tp-kortti:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--tp-muste); }
.tp-kortti strong { font-family: var(--tp-mono); font-weight: 500; display: block; margin-bottom: 4px; color: var(--tp-sininen); }
.tp-kortti small { color: var(--tp-haalea); display: block; font-size: 0.86rem; }
.tp-merkki { font-family: var(--tp-mono); font-size: 0.78rem; display: inline-block; border: 2px solid var(--tp-muste); padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
.tp-merkki.tp-pelattava { background: var(--tp-keltainen); }
.tp-faq details { border: var(--tp-reuna); background: var(--tp-pinta); margin: 0 0 10px; }
.tp-faq summary { cursor: pointer; font-family: var(--tp-mono); font-weight: 500; padding: 12px 16px; list-style: none; position: relative; padding-right: 44px; min-height: 48px; }
.tp-faq summary::after { content: '+'; position: absolute; right: 14px; top: 8px; font-size: 1.5rem; }
.tp-faq details[open] summary::after { content: '–'; }
.tp-faq summary::-webkit-details-marker { display: none; }
.tp-faq .tp-vastaus { padding: 0 16px 14px; }
.tp-vaiheet { counter-reset: v; list-style: none; padding: 0; }
.tp-vaiheet li { counter-increment: v; position: relative; padding-left: 52px; margin: 0 0 14px; min-height: 40px; }
.tp-vaiheet li::before { content: counter(v); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border: var(--tp-reuna); background: var(--tp-keltainen); font-family: var(--tp-mono); font-weight: 500; display: flex; align-items: center; justify-content: center; }
.tp-huomio { border-left: 8px solid var(--tp-keltainen); background: var(--tp-pinta); padding: 12px 16px; margin: 1.2em 0; }
.tp-pieni { font-size: 0.9rem; color: var(--tp-haalea); }
.tp-lahteet { font-size: 0.92rem; }
.tp-lahteet li { word-break: break-word; }

/* ---- kaavio (SVG-laudat tekstissä) ---- */
.tp-kaavio { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin: 1.2em 0; }
.tp-kaavio figure { margin: 0; }
.tp-kaavio svg { width: 100%; height: auto; border: var(--tp-reuna); background: var(--tp-ruutu-vaalea); display: block; }

/* ---- pelipöytä ---- */
.np-peli { background: var(--tp-pinta); border: var(--tp-reuna); box-shadow: var(--tp-varjo); padding: 16px; margin: 0 0 28px; }
.np-ohjaus { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 10px; }
.np-ryhma { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.np-nimio { font-family: var(--tp-mono); font-size: 0.82rem; color: var(--tp-haalea); margin-right: 4px; }
.np-nappi { font: 500 0.9rem var(--tp-mono); color: var(--tp-muste); background: var(--tp-pinta); border: var(--tp-reuna); padding: 8px 14px; min-height: 44px; cursor: pointer; box-shadow: 3px 3px 0 var(--tp-muste); }
.np-nappi:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--tp-muste); }
.np-nappi[aria-pressed="true"] { background: var(--tp-sininen); color: #fff; }
.np-nappi:disabled { opacity: 0.45; cursor: default; }
.np-nappi.np-paa { background: var(--tp-keltainen); }
.np-valinta { font: 500 0.9rem var(--tp-mono); min-height: 44px; border: var(--tp-reuna); background: var(--tp-pinta); padding: 6px 10px; color: var(--tp-muste); }
.np-pois { opacity: 0.45; }
.np-tila { font-family: var(--tp-mono); font-size: 0.95rem; min-height: 1.6em; margin: 0 0 12px; padding: 8px 12px; background: var(--tp-tausta); border: 2px dashed var(--tp-muste); }
.np-lauta { display: grid; grid-template-columns: repeat(var(--n, 8), 1fr); aspect-ratio: 1; width: 100%; max-width: 620px; margin: 0 auto; border: var(--tp-reuna); background: var(--tp-ruutu-vaalea); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.np-lauta[data-koko="10"] { max-width: 680px; } .np-lauta[data-koko="12"] { max-width: 720px; }
.np-ruutu { position: relative; aspect-ratio: 1; padding: 0; margin: 0; border: 0; background: var(--tp-ruutu-vaalea); display: flex; align-items: center; justify-content: center; font: inherit; }
.np-tumma { background: var(--tp-ruutu-tumma); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.np-tumma:focus-visible { outline: 3px solid var(--tp-keltainen); outline-offset: -3px; z-index: 1; }
.np-nappula { width: 78%; height: 78%; border-radius: 50%; display: block; box-shadow: inset 0 -4px 0 rgba(0,0,0,0.25); border: 2px solid var(--tp-muste); transition: opacity 0.18s; }
.np-valkoinen { background: #fff7e6; }
.np-musta { background: var(--tp-muste); border-color: #fff7e6; }
.np-kuningas::after { content: ''; position: absolute; left: 50%; top: 50%; width: 36%; height: 36%; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid var(--tp-keltainen); }
.np-lyoty { opacity: 0.15; }
.np-voi::before { content: ''; position: absolute; inset: 0; border: 3px solid rgba(245, 196, 0, 0.55); pointer-events: none; }
.np-valittu { background: #6f6bd6; box-shadow: inset 0 0 0 4px var(--tp-keltainen); }
.np-kohde::after { content: ''; position: absolute; width: 34%; height: 34%; border-radius: 50%; background: var(--tp-keltainen); border: 2px solid var(--tp-muste); }
.np-viime { background: #5b57c6; }
.np-vihje { box-shadow: inset 0 0 0 4px var(--tp-vihrea); }
.np-toiminnot { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.np-alaosa { display: grid; grid-template-columns: 1fr; gap: 10px; }
.np-tulos { font-family: var(--tp-mono); font-size: 0.85rem; margin: 0; color: var(--tp-haalea); }
.np-loki { font-family: var(--tp-mono); font-size: 0.82rem; max-height: 120px; overflow: auto; margin: 0; padding-left: 2.4em; border: 2px solid var(--tp-muste); background: var(--tp-tausta); padding-top: 4px; padding-bottom: 4px; white-space: pre; }
.np-loki:empty { display: none; }

/* ---- alatunniste ---- */
.tp-alatunniste { margin-top: 48px; border-top: 3px solid var(--tp-muste); padding-top: 18px; font-size: 0.9rem; color: var(--tp-haalea); }
.tp-alatunniste ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; }
.tp-alatunniste a { color: var(--tp-muste); }

@media (max-width: 600px) {
  html { font-size: 16px; }
  .tp-sivu { padding: 14px 14px 40px; }
  h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; }
  .tp-ylatunniste { flex-direction: column; gap: 10px; }
  .tp-tunnus { justify-content: center; }
  .tp-valikko { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .tp-valikko a { justify-content: center; font-size: 0.85rem; padding: 6px 8px; text-align: center; }
  .tp-laatikko { padding: 14px 14px; box-shadow: 4px 4px 0 var(--tp-muste); }
  .np-peli { padding: 8px 4px; margin-left: -14px; margin-right: -14px; border-left: 0; border-right: 0; box-shadow: none; }
  .np-ohjaus, .np-tila, .np-toiminnot, .np-alaosa { margin-left: 6px; margin-right: 6px; }
  .np-ohjaus { gap: 8px 14px; }
  .np-nappi { padding: 6px 10px; font-size: 0.82rem; }
  .np-nappula { width: 82%; height: 82%; }
  .tp-ruudukko { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tp-kortti { padding: 10px 12px; }
}
@media (max-width: 360px) { .tp-ruudukko { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .np-nappula { transition: none; } }
