/* Päivän täsmäytys -peli. Brändin muuttujat tulevat tiedostosta tyyli.css. */
.tm-sivu { padding: clamp(24px, 5vw, 56px) 0 clamp(40px, 7vw, 80px); }
.tm-ylä { max-width: 620px; margin: 0 auto 24px; text-align: center; }
.tm-ylä .lead { margin-top: 10px; }

.tm-peli {
  --tm-n: 6;
  max-width: 620px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tm-tiedot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.tm-tieto { padding: 5px 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tm-tieto.on-aihe { background: var(--hero); color: var(--ink); }

.tm-budjetti { margin-top: 16px; }
.tm-budjetti-rivi { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); }
.tm-budjetti-rivi strong { font-size: 24px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.tm-palkki { height: 10px; margin-top: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.tm-palkki i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.25s ease; }

.tm-paivakirja { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.tm-rivi-otsikko { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm-solut { display: grid; grid-template-columns: repeat(var(--tm-n), minmax(0, 46px)); justify-content: center; gap: clamp(2px, 0.8vw, 5px); }
.tm-solu {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1.5px solid var(--line-strong);
  border-radius: clamp(6px, 1.4vw, 12px);
  background: var(--surface);
  color: var(--ink);
  font-size: min(22px, calc((100vw - 90px) / var(--tm-n) * 0.58));
  font-weight: 800;
  text-transform: uppercase;
}
.tm-solu.on-taytetty { border-color: var(--ink-2); }
.tm-solu.on-lukittu { border-style: dashed; border-color: var(--lehti); background: var(--hero); }
.tm-solu i { position: absolute; top: 1px; right: 3px; font-size: 10px; font-style: normal; font-weight: 800; line-height: 1.2; }
.tm-solu.on-ok { border-color: var(--lehti); background: var(--lehti); color: var(--kuusi); }
.tm-solu.on-near { border-color: var(--accent); background: var(--accent); color: var(--kuusi); }
.tm-solu.on-no { border-color: var(--surface-2); background: var(--surface-2); color: var(--muted); }
@media (max-width: 460px) { .tm-solu i { font-size: 8px; right: 2px; } }

.tm-selite { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 14px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.tm-selite li { display: inline-flex; align-items: center; gap: 6px; }
.tm-selite b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; font-size: 11px; color: var(--kuusi); }
.tm-selite .on-ok { background: var(--lehti); }
.tm-selite .on-near { background: var(--accent); }
.tm-selite .on-no { background: var(--surface-2); color: var(--muted); }

.tm-ilmoitus { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--late-soft); color: var(--late-text); font-size: 14px; font-weight: 600; text-align: center; }
.tm-ilmoitus[hidden], .tm-vihje[hidden], .tm-tulos[hidden], .tm-vinkit[hidden], .tm-napisto[hidden] { display: none; }

.tm-vinkit { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.tm-vinkki { min-height: 40px; padding: 0 16px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer; }
.tm-vinkki:hover:not(:disabled) { border-color: var(--ink-2); }
.tm-vinkki:disabled { opacity: 0.5; cursor: not-allowed; }

.tm-vihje { margin-top: 12px; padding: 12px 16px; border-radius: 16px; background: var(--voi); color: var(--kuusi); font-size: 15px; }
.tm-vihje b { display: block; font-family: "Caveat", cursive; font-size: 22px; line-height: 1.1; color: var(--pinkki-tumma); }

.tm-napisto { display: grid; gap: 6px; margin-top: 16px; touch-action: manipulation; user-select: none; }
.tm-nappirivi { display: flex; justify-content: center; gap: clamp(2px, 0.8vw, 5px); }
.tm-nappi {
  flex: 1 1 0;
  min-width: 0;
  max-width: 46px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.tm-nappi:hover { background: var(--line); }
.tm-nappi.tm-leveä { flex: 1.7 1 0; max-width: 80px; font-size: 13px; text-transform: none; background: var(--line); }
.tm-nappi.on-ok { background: var(--lehti); color: var(--kuusi); }
.tm-nappi.on-near { background: var(--accent); color: var(--kuusi); }
.tm-nappi.on-no { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

.tm-tulos { position: relative; margin-top: 18px; padding: 20px; border-radius: var(--radius); background: var(--hero); text-align: center; }
.tm-tulos img { display: block; width: 120px; height: 120px; object-fit: contain; margin: 0 auto 4px; }
.tm-tulos .hand { display: block; font-size: 28px; transform: rotate(-3deg); }
.tm-tulos h2 { margin: 4px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.tm-sana { margin: 10px 0 2px; font-size: 22px; font-weight: 800; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.tm-tulos p { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.tm-kuvaus { max-width: 46ch; margin-inline: auto !important; text-wrap: pretty; }
.tm-kuvaus b { display: block; font-family: "Caveat", cursive; font-size: 22px; line-height: 1.2; color: var(--pinkki-tumma); }
[data-theme="dark"] .tm-kuvaus b { color: var(--accent-soft); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm-kuvaus b { color: var(--accent-soft); } }
.tm-tilastot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.tm-tilastot div { padding: 10px 4px; border-radius: 14px; background: var(--surface); }
.tm-tilastot strong { display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tm-tilastot span { font-size: 12px; color: var(--muted); }
.tm-tulos-napit { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tm-jaatila { min-height: 20px; font-size: 13px; white-space: pre-line; }

.tm-ohje { max-width: 620px; margin: 20px auto 0; padding: 0 4px; font-size: 15px; color: var(--ink-2); }
.tm-ohje summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.tm-ohje ul { margin: 10px 0 0; padding-left: 20px; }
.tm-ohje li + li { margin-top: 6px; }
.tm-lahde { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.tm-lahde a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .tm-palkki i { transition: none; }
}
