/* =====================
   CSS Variables & Reset
   ===================== */
:root {
  --ink:      #1a1209;
  --paper:    #f5f0e8;
  --paper2:   #ede8dc;
  --gold:     #b8860b;
  --gold-lt:  #d4a017;
  --red:      #7a1f1f;
  --green:    #2e5c0e;
  --blue:     #0d3d6e;
  --border:   #c8bfa8;
  --muted:    #6b5e4a;
  --shadow:   0 2px 12px rgba(26,18,9,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* =====================
   Taustakuva — vaihda tästä yhdestä paikasta
   ===================== */
:root {
  --bg-image: url('kuvat/Tausta1.webp');
  --bg-size:  420px auto;   /* kasvata = isompi kuva, vähemmän toistoja */
  --bg-dim:   0.82;         /* 0 = täysin läpinäkyvä, 1 = täysin peittävä */
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background-color: var(--paper);
  min-height: 100vh;
  position: relative;
}

/* Himmentävä overlay kaikille sivuille */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--bg-image);
  background-repeat: repeat;
  background-size: var(--bg-size);
  opacity: var(--bg-dim);
  pointer-events: none;
}

/* =====================
   Topbar
   ===================== */
.topbar {
  background: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--gold);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.topbar-logo { font-size: 1.25rem; }

.topbar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.1rem;
  letter-spacing: .04em;
  color: var(--gold-lt);
}

.topbar-back {
  color: var(--gold-lt);
  text-decoration: none;
  font-size: 1.1rem;
  line-height: 1;
  transition: opacity .15s;
}
.topbar-back:hover { opacity: .7; }

.topbar-nav {
  display: flex;
  gap: .25rem;
  margin-left: 1.5rem;
}

.topbar-nav-item {
  color: rgba(212,160,23,.65);
  text-decoration: none;
  font-size: .85rem;
  padding: .3rem .75rem;
  border-radius: 2px;
  transition: background .15s, color .15s;
  cursor: default;
  font-family: 'Inter', sans-serif;
  letter-spacing: .02em;
}

a.topbar-nav-item {
  cursor: pointer;
}

a.topbar-nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--gold-lt);
}

.topbar-nav-item.active {
  color: var(--gold-lt);
  background: rgba(255,255,255,.1);
  font-weight: 600;
}

/* Seuraa Facebookissa -linkki yläpalkin oikeassa reunassa */
.topbar-fb {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--gold-lt);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
  letter-spacing: .02em;
  padding: .35rem .7rem;
  border: 1px solid var(--gold);
  border-radius: 2px;
  transition: background .15s, color .15s, border-color .15s;
}
.topbar-fb svg { width: 18px; height: 18px; }
.topbar-fb:hover {
  background: rgba(255,255,255,.1);
  border-color: var(--gold-lt);
}

/* Mobiilissa yläpalkki ei seuraa vieritystä vaan rullaa pois näkyvistä,
   jolloin koko näyttö jää pelialueen käyttöön */
@media (max-width: 700px) {
  .topbar { position: static; }
  .topbar-inner { padding: .6rem .75rem; gap: .5rem; }
  .topbar-nav { margin-left: .25rem; gap: 0; }
  .topbar-nav-item { padding: .3rem .5rem; font-size: .8rem; }
  /* Kapealla näytöllä pelkkä f-kuvake ilman tekstiä */
  .topbar-fb-text { display: none; }
  .topbar-fb { padding: .35rem .5rem; }
}

/* Hyvin kapealla näytöllä (puhelin pystyssä) piilotetaan sivuston nimi,
   jotta valikko ja fb-linkki mahtuvat — suurennuslasilogo jää tunnisteeksi */
@media (max-width: 480px) {
  .topbar-title { display: none; }
}

/* ── Palauteosio etusivun alalaidassa ─────────────────── */
.feedback-section {
  text-align: center;
  max-width: 560px;
  margin: 3.5rem auto 3rem;
  padding: 2rem 1.5rem 2.25rem;
  background: rgba(245, 240, 232, 0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
/* Iso Facebook-nappi laatikon kärkeen */
.feedback-fb {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  background: var(--ink);
  color: var(--gold-lt);
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none;
  padding: .85rem 1.6rem;
  border-radius: 3px;
  margin: .75rem 0 1.75rem;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.feedback-fb:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0,0,0,.25);
}

.feedback-fb-note {
  margin-top: -1.25rem;
  margin-bottom: 1.5rem;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}

/* Kehotus ratkaisun jälkeen — näkyy onnistumisviestin alla */
.solved-prompt {
  text-align: center;
  margin-top: 1.25rem;
  padding: 1.25rem 1rem;
  background: rgba(245, 240, 232, 0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Jaettava tulos — upotettuna ratkaisulaatikkoon, samaa vihreää palettia */
.share-result-inline {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #97c459;
  text-align: center;
}

.share-result-label {
  font-family: 'Inter', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #4a7a1f;
  margin-bottom: .6rem;
}

.share-result-text {
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
  line-height: 1.6;
  color: #1d3d09;
  background: rgba(255,255,255,.5);
  border: 1px solid #97c459;
  border-radius: 3px;
  padding: .85rem 1rem;
  margin-bottom: .75rem;
}

.share-fb-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #1877f2;
  color: #fff;
  border-color: #1877f2;
  font-weight: 600;
}

.share-fb-btn:hover {
  background: #166fe0;
  border-color: #166fe0;
}

.share-copy-link {
  display: block;
  margin: .6rem auto 0;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: .78rem;
  color: #4a7a1f;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.share-copy-link:hover { color: #2e5c0e; }

.solved-prompt-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .75rem;
}

.solved-prompt-fb {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--ink);
  color: var(--gold-lt);
  font-family: 'Inter', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  padding: .6rem 1.2rem;
  border-radius: 3px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}

.solved-prompt-fb:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0,0,0,.25);
}

.solved-prompt-note {
  margin-top: .6rem;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
}
@media (max-width: 480px) {
  .feedback-fb { font-size: .95rem; padding: .75rem 1.1rem; }
}
.feedback-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 700;
  margin: .75rem 0;
}
.feedback-text {
  font-size: .98rem;
  line-height: 1.65;
  opacity: .85;
  margin-bottom: 1.5rem;
}
.feedback-mail {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  letter-spacing: .02em;
  text-decoration: none;
  color: inherit;
  padding: .7rem 1.4rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.feedback-mail:hover {
  background: rgba(0,0,0,.05);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.feedback-mail-icon {
  font-size: 1.15rem;
  line-height: 1;
}
@media (max-width: 480px) {
  .feedback-mail { font-size: .85rem; padding: .6rem 1rem; }
}

/* =====================
   Screens
   ===================== */
.screen { display: none; }
.screen.active { display: block; }

/* =====================
   Home / Etusivu
   ===================== */
.home-main {
  display: flex;
  justify-content: center;
  padding: 4rem 1.5rem;
  min-height: calc(100vh - 56px);
}

.home-hero {
  text-align: center;
  width: 100%;
  max-width: 820px;
  background: rgba(245, 240, 232, 0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  backdrop-filter: blur(2px);
}

.home-eyebrow {
  font-family: 'Inter', sans-serif;
  font-style: italic;
  font-size: .9rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .5rem;
}

.home-heading {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 1rem;
}

.home-heading em {
  font-style: italic;
  color: var(--gold);
}

.home-sub {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.home-deco-line {
  width: 80px;
  height: 1px;
  background: var(--gold);
  margin: 1rem auto;
  opacity: .6;
}

/* =====================
   Buttons
   ===================== */
.btn-primary {
  display: inline-block;
  padding: .8rem 2.5rem;
  background: var(--ink);
  color: var(--gold-lt);
  border: 1.5px solid var(--gold);
  border-radius: 2px;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  letter-spacing: .08em;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-primary:hover {
  background: var(--gold);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  transition: background .15s;
}
.btn:hover { background: var(--paper2); }

.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: #0a2d54; }

.btn.success { background: var(--green); color: #fff; border-color: var(--green); }
.btn.success:hover { background: #1d3d09; }

.btn.danger  { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger:hover  { background: #551515; }

/* =====================
   Week cards (peli.html)
   ===================== */
.select-wrap {
  max-width: 640px;
  margin: 3rem auto;
  padding: 1.5rem 1.5rem 2rem;
  background: rgba(245, 240, 232, 0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
  backdrop-filter: blur(2px);
}

/* Pelisivun sisältöalue — oma tausta jotta erottuu */
#game-wrap {
  background: var(--paper);
  border-radius: 4px;
}

.select-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 2rem;
}

.week-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 520px) {
  .week-cards { grid-template-columns: 1fr; }
}

.week-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .15s;
  position: relative;
}
.week-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.week-badge {
  font-family: 'Inter', sans-serif;
  font-style: italic;
  font-size: .85rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .5rem;
}
.week-badge.faded { color: var(--muted); }

.week-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--ink);
}

.week-card-desc {
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.55;
}

.week-card-arrow {
  position: absolute;
  bottom: 1rem;
  right: 1.25rem;
  color: var(--gold);
  font-size: 1.2rem;
}

/* Vaikeustaso-merkintä pelikortin oikeassa yläkulmassa */
.week-difficulty-badge {
  position: absolute;
  top: .85rem;
  right: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
}

.week-difficulty-badge.helppo {
  background: #e3edd8;
  color: var(--green);
}

.week-difficulty-badge.vaikea {
  background: #f3ddd8;
  color: #a3341f;
}

/* =====================
   Login (admin.html)
   ===================== */
.login-wrap {
  display: flex;
  justify-content: center;
  padding: 5rem 1.5rem;
}

.login-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  margin-bottom: .5rem;
}

.login-input {
  width: 100%;
  padding: .65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  margin-bottom: 1rem;
  display: block;
}
.login-input:focus { outline: 1.5px solid var(--gold); }

.login-error {
  color: var(--red);
  font-size: .9rem;
  margin-top: .5rem;
  min-height: 1.2em;
}

/* =====================
   Layout helpers
   ===================== */
.flex-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.spacer { flex: 1; }

/* =====================
   Section title
   ===================== */
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hint-text {
  font-size: .9rem;
  color: var(--muted);
}

/* =====================
   Hints
   ===================== */
.hint-box {
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .75rem 1rem;
  margin-bottom: 8px;
  font-size: .95rem;
  line-height: 1.6;
}

.hint-badge {
  display: inline-block;
  background: var(--ink);
  color: var(--gold-lt);
  border-radius: 2px;
  font-size: 11px;
  padding: 2px 8px;
  margin-right: 8px;
  font-weight: 700;
  letter-spacing: .05em;
}

/* ── Lisävihjeet ─────────────────────────────────────────────────────────── */
.extra-hints-intro {
  font-size: .92rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: .75rem;
}

.extra-hint-closed {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #f5f0d8;
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: .75rem 1rem;
  margin-bottom: 8px;
}

.extra-hint-closed-icon {
  font-size: 1.3rem;
  flex: none;
}

.extra-hint-btn {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  font-weight: 600;
}

.extra-hint-btn:hover {
  background: var(--gold-lt);
  border-color: var(--gold-lt);
}

.extra-hint-box {
  background: var(--paper2);
  border: 1px solid var(--gold);
  border-radius: 4px;
  padding: .75rem 1rem;
  margin-bottom: 8px;
  font-size: .95rem;
  line-height: 1.6;
}

/* =====================
   Logic grid
   ===================== */
.logic-wrap { overflow-x: auto; margin-bottom: 1.5rem; max-width: 100%; }

.logic-table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.logic-table th {
  background: var(--paper2);
  padding: 8px 10px;
  text-align: center;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.logic-table td {
  border: 1px solid var(--border);
  padding: 0;
  text-align: center;
  width: 44px;
  min-width: 44px;
}

.logic-table .row-label {
  text-align: left;
  padding: 6px 12px;
  font-weight: 600;
  background: var(--paper2);
  white-space: nowrap;
  min-width: 120px;
}

.logic-table .cat-header {
  background: var(--paper2);
  font-weight: 700;
  font-size: 10px;
  color: var(--muted);
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.cell-btn {
  width: 100%;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  transition: background .1s;
}
.cell-btn:hover:not(:disabled) { background: var(--paper2); }
.cell-btn.check      { color: var(--green); }
.cell-btn.cross      { color: var(--red); }
.cell-btn.cross-auto { color: #e8b4b4; cursor: default; }

.cat-color-bar {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

.blocked-cell {
  background: repeating-linear-gradient(
    45deg, #e0d8cc 0, #e0d8cc 4px, #ede8dc 4px, #ede8dc 8px
  );
}

/* =====================
   Result & banners
   ===================== */
.result-box {
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.result-box .result-heading {
  font-family: 'Playfair Display', serif;
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: .95rem;
}
.result-label { color: var(--muted); width: 100px; flex-shrink: 0; }
.result-val   { font-weight: 600; font-size: 1rem; }
.badge-ok  { background: #dff0c8; color: #1d3d09; border-radius: 2px; padding: 2px 10px; font-size: 12px; }
.badge-err { background: #fce8e8; color: #551515; border-radius: 2px; padding: 2px 10px; font-size: 12px; }

.success-banner {
  background: #dff0c8; color: #1d3d09;
  border: 1px solid #97c459;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: .95rem;
  font-weight: 600;
}
.error-banner {
  background: #fce8e8; color: #551515;
  border: 1px solid #f09595;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: .95rem;
}

/* =====================
   Editor (admin.html)
   ===================== */
.editor-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.editor-section h3 {
  font-family: 'Playfair Display', serif;
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .75rem;
  color: var(--muted);
}
.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.input-row input,
.input-row select,
.input-row textarea {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
}
.input-row textarea { min-height: 60px; resize: vertical; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 3px 10px;
  font-size: .85rem;
  margin: 3px;
}
.tag button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 0; line-height: 1;
}

.editor-cat-block {
  border-radius: 4px;
  padding: .75rem;
  margin-bottom: 8px;
  background: var(--paper2);
}

.hint-editor-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.hint-editor-row select {
  width: 100px;
  flex-shrink: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
}
.hint-editor-row textarea {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  font-family: 'Inter', sans-serif;
  min-height: 52px;
  resize: vertical;
}
/* Tarinan sisäiset korostukset */
.game-story strong,
.ed-story-preview strong {
  font-weight: 700;
  color: var(--red);
  font-style: normal;   /* story on italic, tämä nollaa sen korostukselle */
}

.story-highlight {
  font-weight: 700;
  font-style: normal;
  color: var(--red);
  background: rgba(122,31,31,.08);
  padding: 0 3px;
  border-radius: 2px;
}

/* =====================
   Answer form
   ===================== */
.answer-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  width: 100%;
}

.answer-heading {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .75rem;
}

.answer-label {
  font-size: .95rem;
  color: var(--muted);
  width: 110px;
  flex-shrink: 0;
}

.answer-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
}
.answer-select:focus { outline: 1.5px solid var(--gold); }

/* =====================
   Answer form — Malli B (matching)
   ===================== */
.answer-box-wide {
  max-width: 100%;
}

.answer-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .95rem;
}

.answer-table-th {
  background: var(--paper2);
  border: 1px solid var(--border);
  padding: 7px 12px;
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}

.answer-table-td {
  border: 1px solid var(--border);
  padding: 5px 8px;
}

.answer-table-anchor {
  border: 1px solid var(--border);
  padding: 7px 12px;
  font-weight: 700;
  background: var(--paper2);
  white-space: nowrap;
}

/* =====================
   Game story
   ===================== */
.game-header {
  width: 100%;
  margin-bottom: 1.25rem;
}

.game-story {
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.75;
  font-style: italic;
  width: 100%;
  margin-top: .5rem;
  padding: .75rem 1.25rem;
  background: rgba(245,240,232,0.85);
  border-left: 3px solid var(--gold);
  border-radius: 0 4px 4px 0;
  box-sizing: border-box;
}

/* =====================
   Sisältöalueiden taustat
   — erottuvat taustakuvasta
   ===================== */

/* Pelivalintasivu */
.select-wrap > * {
  position: relative;
}

.week-card {
  background: var(--paper) !important;
}

/* Viikkokorttien alue — yhtenäinen pohja */
.week-cards-area {
  background: var(--paper);
  border-radius: 6px;
  padding: 2rem;
}

/* Admin login-boksi on jo valkoinen, ok */

/* Varmistetaan että kaikki editor-sectionit erottuvat */
.editor-section {
  background: var(--paper) !important;
}

/* Vihjeet */
.hint-box {
  background: var(--paper2) !important;
}

/* Answer form */
.answer-box {
  background: var(--paper) !important;
}

/* Logiikkataulukko */
.logic-wrap {
  background: var(--paper);
  border-radius: 4px;
  padding: .5rem;
}

/* =====================
   Ruudukon vasemman reunan kategorialabel
   ===================== */
.row-cat-label {
  padding: 2px 4px;
  text-align: center;
  vertical-align: middle;
  background: var(--paper2);
  border: 1px solid var(--border);
  width: 22px;
  min-width: 22px;
  max-width: 22px;
}

.row-cat-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'Playfair Display', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  display: block;
}

.hint-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--ink);
  color: var(--gold-lt);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
}

/* =====================
   Etusivun etsiväkortit
   ===================== */
.home-main {
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.5rem 2rem;
  min-height: calc(100vh - 56px);
}

.detective-cards {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 820px;
}

@media (max-width: 500px) {
  .detective-cards { flex-direction: column; }
}

.detective-card {
  background: rgba(245, 240, 232, 0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.detective-img-wrap {
  width: 100%;
  height: 180px;
  background: var(--paper2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 10px;      /* pieni väli kortin yläreunan ja kuvan välissä */
  box-sizing: border-box;
}

.detective-img {
  max-width: 100%;
  max-height: 160px;      /* mahtuu kehykseen yläväli huomioiden */
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;     /* pyöristetyt kulmat kaikille korttikuville */
}

.detective-info {
  padding: .75rem 1rem 1rem;
  text-align: center;
}

.detective-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: .25rem;
}

.detective-deco {
  width: 40px;
  height: 2px;
  background: var(--gold);
  margin: .5rem auto .75rem;
  opacity: .7;
}

.detective-bio {
  font-size: .95rem;
  color: var(--muted);
  line-height: 1.7;
  font-style: italic;
}

.detective-subtitle {
  font-family: 'Playfair Display', serif;
  font-size: .85rem;
  font-style: italic;
  color: var(--ink);
  margin-bottom: .5rem;
  letter-spacing: .03em;
}

/* =====================
   Pelisivun kuva-asettelu
   ===================== */
.game-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem;
}

#game-wrap {
  flex: 1;
  min-width: 0;
  padding: 1.5rem;
}

.photos-col {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 2rem;
}

.photos-col-left  { align-items: flex-end;   }
.photos-col-right { align-items: flex-start; }

@media (max-width: 1000px) {
  .photos-col { display: none; }
}

/* ── Polaroid-nastakortti ─────────────────────────────── */

.photo-pin-card {
  position: relative;
  display: inline-block;
  transform: rotate(var(--rot, 0deg));
  background: #f8f7f4;
  /* polaroid: kapea reuna sivuilla/ylhäällä, leveä alhaalla */
  padding: 8px 8px 44px;
  width: 176px;
  /* Vahva varjo alustaan */
  box-shadow:
    0 4px 6px rgba(0,0,0,.2),
    0 8px 24px rgba(0,0,0,.45),
    0 16px 40px rgba(0,0,0,.25);
  transition: transform .3s ease, box-shadow .3s ease;
  cursor: default;
}

.photo-pin-card:hover {
  transform: rotate(0deg) scale(1.07);
  z-index: 10;
  box-shadow:
    0 6px 10px rgba(0,0,0,.25),
    0 14px 36px rgba(0,0,0,.6),
    0 24px 56px rgba(0,0,0,.3);
}

/* Nasta */
.photo-pin {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffaaaa, #dd0000 50%, #880000);
  box-shadow: 0 3px 7px rgba(0,0,0,.55), inset 0 1px 3px rgba(255,255,255,.4);
  z-index: 5;
}

.photo-pin::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 12px;
  background: linear-gradient(to bottom, #aaa, #555);
  border-radius: 0 0 2px 2px;
}

/* Kuva-wrapper — overflow:hidden leikkaa kuvan ja captions siististi */
.photo-pin-img-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 170px;
  /* Sisävarjo joka näkyy aina kuvan päällä */
  box-shadow: inset 0 0 12px rgba(0,0,0,.3);
}

.photo-pin-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;      /* oli: cover */
  background: #111;          /* täyttää tyhjän tilan siististi */
  filter: contrast(1.05) saturate(1.08);
}

/* Teksti kehyksen valkoisessa alapalkissa — ei kuvan päällä */
.photo-pin-caption {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  font-weight: 700;
  color: #1a1209;
  text-align: center;
  line-height: 1.25;
  padding: 6px 4px 0;
  /* Ei absoluuttista sijoittelua — normaali flow kortin padding-alueella */
}

/* Alareunan liukuväri — aina kuvan päällä riippumatta captionista */
.photo-pin-img-wrap::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0)    0%,
    rgba(0,0,0,.55)  70%,
    rgba(0,0,0,.75) 100%
  );
  pointer-events: none;
  z-index: 2;
}

/* Sisävarjo reunoissa */
.photo-pin-img-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 14px rgba(0,0,0,.35);
  pointer-events: none;
  z-index: 3;
}

/* =====================
   Editorin kuvat-osio
   ===================== */
.photo-editor-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  background: var(--paper2);
  border-radius: 4px;
  padding: .75rem;
}

.photo-preview-wrap {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-preview-empty {
  color: var(--muted);
  font-size: 1.5rem;
}

/* =====================
   Ratkaisuteksti
   ===================== */
.solution-text {
  background: #dff0c8;
  border: 1px solid #97c459;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-top: .75rem;
  font-size: .95rem;
  line-height: 1.75;
  color: #1d3d09;
}

.solution-text p {
  margin: 0 0 .75rem;
}

.solution-text p:last-child {
  margin-bottom: 0;
}

/* Kappalejako tarinatekstissä */
.game-story p {
  margin: 0 0 .75rem;
}

.game-story p:last-child {
  margin-bottom: 0;
}

/* =====================
   Yläpalkin erotin Peliohjeelle
   ===================== */
.topbar-nav-sep {
  margin-left: .75rem;
  padding-left: 1rem !important;
  border-left: 1px solid rgba(212,160,23,.3);
}

/* =====================
   Ohjesivun tyylit
   ===================== */
.ohje-main {
  display: flex;
  justify-content: center;
  padding: 2.5rem 1.5rem 4rem;
}

.ohje-wrap {
  width: 100%;
  max-width: 680px;
  background: rgba(245,240,232,0.93);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2.5rem 2.5rem 2rem;
}

.ohje-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
}

.ohje-steps {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.ohje-step {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.ohje-step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: var(--ink);
  color: var(--gold-lt);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  margin-top: 2px;
}

.ohje-step-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--ink);
}

.ohje-step-body p {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--ink);
}

.ohje-grid-legend {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin: .75rem 0;
  padding: .75rem 1rem;
  background: var(--paper2);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.ohje-legend-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  line-height: 1.5;
}

.ohje-legend-x {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--red);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.ohje-legend-v {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--green);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.ohje-legend-empty {
  font-size: 1.1rem;
  color: var(--muted);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.ohje-tip {
  background: #f5f0d8;
  border: 1px solid #c8b860;
  border-radius: 4px;
  padding: .9rem 1.1rem;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--ink);
}

/* Ohjeen kuvaesimerkit — kevyt polaroid-henkinen kortti käsinkirjoitetulla
   kuvatekstillä, samaan tyyliin kuin pelin todistuskuvat */
/* =====================
   Tietoja-sivu
   ===================== */
.tietoja-teksti p {
  font-size: .98rem;
  line-height: 1.8;
  color: var(--ink);
  margin-bottom: 1.1rem;
}

.tietoja-teksti p:last-child { margin-bottom: 0; }

.tietoja-teksti strong { font-weight: 700; }

.tietoja-alaotsikko {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

.tietoja-allekirjoitus {
  font-family: 'Caveat', cursive;
  font-size: 1.35rem !important;
  font-weight: 700;
  color: var(--ink);
  margin-top: 1.5rem;
}

.tietoja-kuva-block {
  margin: 1.75rem auto;
  max-width: 460px;
}

.tietoja-kuva {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.ohje-image-block {
  margin-top: 1.25rem;
  max-width: 380px;
}

.ohje-image {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.ohje-image-caption {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  line-height: 1.5;
  margin-top: .5rem;
}

.ohje-tip-label {
  display: inline-block;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
  margin-right: .5rem;
  vertical-align: middle;
}

.ohje-minipelit-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  margin-bottom: .5rem;
}

.ohje-minipelit p { font-size: .92rem; line-height: 1.6; color: var(--muted); margin-bottom: .6rem; }

.ohje-minipelit-list { list-style: none; padding: 0; margin: 0; }

.ohje-minipelit-list li { margin-bottom: .4rem; }

.ohje-minipelit-list a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}

.ohje-minipelit-list a:hover { color: var(--gold); }

/* =====================
   Ratkaisukuva
   ===================== */
.solution-img-wrap {
  margin-top: 1rem;
  text-align: center;
}

.solution-img {
  max-width: 280px;
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

/* =====================
   Ratkaisupaljastus — teksti vasemmalla, kuva oikealla
   ===================== */
.solution-reveal {
  margin-top: .75rem;
  background: #dff0c8;
  border: 1px solid #97c459;
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
}

.solution-reveal-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.solution-reveal-text {
  flex: 1;
  font-size: .95rem;
  line-height: 1.75;
  color: #1d3d09;
}

.solution-reveal-text p {
  margin: 0 0 .75rem;
}

.solution-reveal-text p:last-child {
  margin-bottom: 0;
}

.solution-reveal-img {
  flex-shrink: 0;
  width: 200px;
}

.solution-reveal-img-only {
  text-align: center;
}

.solution-img {
  width: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow);
  display: block;
}

@media (max-width: 600px) {
  .solution-reveal {
    flex-direction: column;
  }
  .solution-reveal-img {
    width: 100%;
  }
}

/* =====================
   Sormenjälkiosio
   ===================== */
.fp-section {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.fp-intro {
  font-size: .95rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.fp-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.fp-label {
  font-family: 'Playfair Display', serif;
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .6rem;
}

.fp-scene-wrap {
  flex-shrink: 0;
}

.fp-scene-card {
  position: relative;
  display: inline-block;
  background: #111;
  padding: 6px;
  border-radius: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}

.fp-scene-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 2px 8px;
  border-radius: 2px;
  white-space: nowrap;
}

.fp-img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 1px;
  filter: grayscale(30%) contrast(1.1);
}

.fp-suspects-wrap {
  flex: 1;
  min-width: 260px;
}

.fp-suspects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.fp-suspect-card {
  background: var(--paper2);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  text-align: center;
  width: 130px;
}

.fp-suspect-card:hover {
  border-color: var(--gold);
}

.fp-suspect-card.fp-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26,18,9,.15);
  background: #fff;
}

.fp-suspect-card .fp-img {
  width: 118px;
  height: 118px;
}

.fp-suspect-name {
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  color: var(--ink);
}

/* Editorin sormenjälkirivi */
.fp-suspect-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--paper2);
  border-radius: 4px;
  padding: .75rem;
  margin-bottom: 8px;
}

.fp-waiting {
  border-color: var(--border) !important;
  opacity: .75;
}

.fp-waiting-text {
  font-size: .95rem;
  color: var(--muted);
  font-style: italic;
  line-height: 1.6;
}

/* =====================
   Todistajanlausunnot
   ===================== */
.testimony-section {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.testimony-intro {
  font-size: .95rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-style: italic;
}

.testimony-cards {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}

.testimony-card {
  background: var(--paper2);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: .9rem 1.1rem;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}

.testimony-card:hover {
  border-color: var(--gold);
}

.testimony-card.testimony-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(122,31,31,.12);
  background: #fff;
}

.testimony-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink);
  margin-bottom: .35rem;
}

.testimony-text {
  font-size: .9rem;
  color: var(--ink);
  line-height: 1.6;
  font-style: italic;
}

/* Editorin todistajarivi */
.testimony-editor-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--paper2);
  border-radius: 4px;
  padding: .75rem;
  margin-bottom: 8px;
}

/* =====================
   Puhelin vaakatasossa — iso ruudukko (4 kategoriaa × 5 kohdetta)
   mahtumaan näytölle: turha sivutila pois ja solut pienemmiksi
   ===================== */
@media (orientation: landscape) and (max-height: 560px) {
  /* Yläpalkki ei seuraa vieritystä myöskään vaakatasossa */
  .topbar { position: static; }

  /* Sivusuuntaiset täytteet minimiin */
  .game-layout { padding: .25rem; }
  #game-wrap   { padding: .4rem; }
  .logic-wrap  { padding: .2rem; margin-bottom: .75rem; }

  /* Ruudukko tiiviimmäksi */
  .logic-table { font-size: 11px; }
  .logic-table th { padding: 3px 4px; font-size: 9px; }
  .logic-table td { width: 30px; min-width: 30px; }
  .logic-table .row-label { min-width: 76px; padding: 3px 6px; font-size: 10px; }
  .logic-table .cat-header { font-size: 8px; padding: 2px 4px; letter-spacing: .03em; }
  .cell-btn { height: 26px; font-size: 15px; }

  /* Vasemman reunan pystykategorialabel kapeammaksi */
  .row-cat-label { width: 16px; min-width: 16px; max-width: 16px; padding: 1px 2px; }
  .row-cat-text  { font-size: 8px; letter-spacing: .04em; }
}

/* =====================
   Nonogrammi — pelinäkymä
   ===================== */
.nono-section {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1.5rem;
}

.nono-wrap { overflow-x: auto; }

.nono-table { border-collapse: collapse; margin: 0 auto; }

.nono-table th {
  background: var(--paper2);
  border: 1px solid var(--border);
  padding: 2px 4px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  transition: background .15s, color .15s, opacity .15s;
}

.nono-clue-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;   /* numerot ruudukon reunaan päin, ei ylös */
  line-height: 1.2;
  width: 26px;
  max-width: 26px;
  overflow: hidden;            /* estää vihjenumeroa venyttämästä saraketta leveämmäksi */
  height: 100%;
  box-sizing: border-box;
}

.nono-clue-row { text-align: right; padding-right: 8px; }

/* Kun rivin/sarakkeen vihje on täysin ratkaistu, sen numerot yliviivataan */
.nono-clue-done {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  color: var(--green) !important;
  opacity: .65;
}

/* Himmeä erotinviiva peräkkäisten vihjenumeroiden väliin — erottaa esim.
   "1 1" numerosta "11" myös silloin kun teksti on tiiviisti pakattu. */
.nono-clue-num { display: inline-block; padding: 0 3px; }
.nono-clue-row .nono-clue-num:not(:first-child),
.nono-editor-clue-row .nono-clue-num:not(:first-child) {
  border-left: 1px solid var(--border);
  margin-left: 1px;
}
.nono-clue-col .nono-clue-num:not(:first-child),
.nono-editor-clue-col .nono-clue-num:not(:first-child) {
  border-top: 1px solid var(--border);
  margin-top: 1px;
  padding-top: 1px;
}

.nono-cell {
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--paper);
  cursor: pointer;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  user-select: none;
  touch-action: none;  /* estää sivun vierityksen sormella vedettäessä */
  transition: background .1s;
}

.nono-cell:hover { background: var(--paper2); }

.nono-cell.filled { background: var(--ink); }

.nono-help-link {
  font-family: 'Inter', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.nono-help-link:hover { border-color: var(--gold); }

/* Pienennetty nonogrammi — vain otsikkorivi ja avausnappi */
.nono-section.nono-collapsed {
  padding: .9rem 1.5rem;
}

.nono-collapsed-solved {
  font-family: 'Inter', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  color: var(--green);
  margin-left: .4rem;
  vertical-align: middle;
}

/* =====================
   Salaviesti
   ===================== */
.cipher-section-box {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 1.5rem;
}

.cipher-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 1rem;
}

.cipher-word-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cipher-shift-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 7px;
  flex: none;
}

.cipher-word-letters {
  display: flex;
  flex-wrap: wrap;      /* pitkät sanat kääntyvät siististi, eivät mene ruudun ulkopuolelle */
  gap: 5px;
}

.cipher-letter-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.cipher-encoded-letter {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--gold);
  letter-spacing: .02em;
}

.cipher-input {
  width: 34px;
  height: 38px;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 17px;      /* pidetään aina yli 16px, ettei iPhonen Safari zoomaa kosketettaessa */
  font-weight: 600;
  color: var(--ink);
  background: var(--paper2);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-transform: lowercase;
}

.cipher-input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--paper);
}

.cipher-input:disabled {
  background: var(--paper2);
  opacity: .8;
}

/* Puhelimella siirtomerkki nousee sanan yläpuolelle omalle rivilleen,
   jotta kirjaimille jää koko leveys käytettäväksi eivätkä ne ahtaudu
   yhteen pieneen tilaan */
@media (max-width: 480px) {
  .cipher-word-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  .cipher-row { gap: 18px; }
}

/* Apuviivat kymmenen ruudun välein — hieman tummempi reuna helpottaa
   laskemista isommissa ruudukoissa */
.nono-cell.nono-guide-right,
.nono-editor-cell.nono-guide-right { border-right: 2px solid var(--muted); }

.nono-cell.nono-guide-bottom,
.nono-editor-cell.nono-guide-bottom { border-bottom: 2px solid var(--muted); }

/* Himmeämpi apuviiva joka viidennen ruudun kohdalla (10:n monikerrat saavat
   jo tummemman viivan yllä, joten näitä ei tarvita niissä kohdissa) */
.nono-cell.nono-guide-right-mid,
.nono-editor-cell.nono-guide-right-mid { border-right: 1px solid rgba(26,18,9,.28); }

.nono-cell.nono-guide-bottom-mid,
.nono-editor-cell.nono-guide-bottom-mid { border-bottom: 1px solid rgba(26,18,9,.28); }

th.nono-guide-right { border-right: 2px solid var(--muted); }
th.nono-guide-right-mid { border-right: 1px solid rgba(26,18,9,.28); }
.nono-clue-row.nono-guide-bottom,
.nono-editor-clue-row.nono-guide-bottom { border-bottom: 2px solid var(--muted); }
.nono-clue-row.nono-guide-bottom-mid,
.nono-editor-clue-row.nono-guide-bottom-mid { border-bottom: 1px solid rgba(26,18,9,.28); }

/* =====================
   Nonogrammi — editorin esikatselu (admin.html)
   ===================== */
.nono-editor-table { border-collapse: collapse; }

.nono-editor-table th {
  background: var(--paper2);
  border: 1px solid var(--border);
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.nono-editor-clue-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 24px;
  max-width: 24px;
  overflow: hidden;
  line-height: 1.2;
  height: 100%;
  box-sizing: border-box;
}

.nono-editor-cell {
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--paper);
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}

.nono-editor-cell:hover { background: var(--paper2); }

.nono-editor-cell.filled { background: var(--ink); }

@media (max-width: 480px) {
  .nono-cell { width: 22px; height: 22px; font-size: 12px; }
  .nono-table th { font-size: 10px; padding: 1px 3px; }
}
