/* ===========================================================
   NIMM – Streichholzspiel (index.php?seite=nimm)
   Alle Regeln sind auf .nimm beschränkt, damit das übrige
   Seitenlayout unverändert bleibt. Farben kommen aus den
   Variablen in style.css (--color-teal usw.).
   =========================================================== */

.nimm {
  --n-teal: var(--color-teal, #2e6c6b);
  --n-teal-dark: var(--color-teal-dark, #1f4d4c);
  --n-teal-light: var(--color-teal-light, #e8f1f1);
  --n-text: var(--color-text, #222);
  --n-soft: var(--color-text-soft, #555);
  --n-bg: var(--color-bg, #fff);
  --n-line: rgba(46, 108, 107, .15);
  --n-line-strong: rgba(46, 108, 107, .35);
  --n-cpu: #c8860d;            /* wie das NEU-Abzeichen auf der Gaming-Seite */
  --n-good: #2f7d4a;
  --n-bad: #b23a2a;
}

.nimm-head { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 24px; align-items: center; margin-bottom: 18px; }
.nimm-head img { width: 100%; height: auto; }
.nimm-badge {
  display: inline-block; background: var(--n-teal); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; padding: 2px 10px; border-radius: 999px; margin-bottom: 8px;
}
@media (max-width: 640px) {
  .nimm-head { grid-template-columns: minmax(0, 1fr); }
  .nimm-head img { display: none; }
}

.nimm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 26px; align-items: start; }
@media (max-width: 900px) { .nimm-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Statuszeile ---------- */
.nimm-status {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--n-line); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 14px; min-height: 52px; background: var(--n-bg);
}
.nimm-pill {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 10px; border-radius: 999px; border: 1.5px solid currentColor; white-space: nowrap;
}
.nimm-pill.you { color: var(--n-teal); }
.nimm-pill.cpu { color: var(--n-cpu); }
.nimm-pill.won { color: var(--n-good); }
.nimm-pill.lost { color: var(--n-bad); }
.nimm-msg { flex: 1 1 240px; min-width: 0; color: var(--n-soft); }

/* ---------- Spieltisch ---------- */
.nimm-board {
  display: flex; flex-direction: column;
  background: var(--n-teal-light); border: 1px solid var(--n-line);
  border-radius: 16px; padding: 4px 18px;
}
.nimm-row {
  display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--n-line-strong);
}
.nimm-row:last-child { border-bottom: 0; }
.nimm-row-label { font-size: 13px; color: var(--n-soft); line-height: 1.2; }
.nimm-row-label b { display: block; font-size: 22px; color: var(--n-teal-dark); font-variant-numeric: tabular-nums; margin-top: 2px; }
.nimm-row.empty .nimm-row-label { opacity: .45; }
.nimm-row.empty .nimm-matches { min-height: 0; padding-top: 0; }
.nimm-matches { display: flex; flex-wrap: wrap; gap: 10px; min-height: 92px; align-items: flex-end; padding-top: 12px; }

.nimm-match {
  position: relative; width: 18px; height: 84px; padding: 0; border: 0; background: none; cursor: pointer;
  transition: transform .18s ease, opacity .5s ease;
  transform: rotate(var(--tilt, 0deg)); border-radius: 6px;
  --stroke: var(--n-teal); --headc: var(--n-teal-dark); --fillc: var(--n-bg);
}
.nimm-match::before {
  content: ""; position: absolute; left: 3px; right: 3px; top: 14px; bottom: 0;
  background: var(--fillc); border: 3px solid var(--stroke); border-radius: 4px;
}
.nimm-match::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 19px;
  background: var(--headc); border-radius: 50% 50% 45% 45%;
}
.nimm-match:hover:not(:disabled) { transform: translateY(-4px) rotate(var(--tilt, 0deg)); }
.nimm-match:focus-visible { outline: 3px solid var(--n-teal); outline-offset: 4px; }
.nimm-match[aria-checked="true"] { transform: translateY(-12px) rotate(var(--tilt, 0deg)); --fillc: var(--n-teal); }
.nimm-match.cpu-pick { transform: translateY(-12px); --stroke: var(--n-cpu); --headc: var(--n-cpu); --fillc: var(--n-cpu); }
.nimm-match.gone { opacity: 0; transform: translateY(-36px) rotate(20deg); }
.nimm-match:disabled { cursor: default; }

@media (max-width: 520px) {
  .nimm-board { padding: 4px 12px; }
  .nimm-row { grid-template-columns: 50px minmax(0, 1fr); gap: 8px; }
  .nimm-match { width: 15px; height: 68px; }
  .nimm-match::after { height: 16px; }
  .nimm-match::before { top: 11px; left: 2.5px; right: 2.5px; border-width: 2.5px; }
  .nimm-matches { gap: 8px; min-height: 76px; }
}

.nimm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.nimm-btn {
  font: 600 14px/1 var(--font-main, sans-serif); padding: 11px 18px; border-radius: 8px;
  border: 1.5px solid var(--n-teal); background: var(--n-teal); color: #fff; cursor: pointer;
  transition: background .2s ease;
}
.nimm-btn:hover:not(:disabled) { background: var(--n-teal-dark); border-color: var(--n-teal-dark); }
.nimm-btn.ghost { background: var(--n-teal-light); color: var(--n-teal-dark); border-color: var(--n-line-strong); }
.nimm-btn.ghost:hover:not(:disabled) { background: #d8ece9; }
.nimm-btn:disabled { opacity: .4; cursor: not-allowed; }
.nimm-btn:focus-visible { outline: 3px solid var(--n-teal); outline-offset: 2px; }
.nimm-hint { color: var(--n-soft); font-size: 13px; }

/* ---------- Seitenspalte ---------- */
.nimm-aside { display: flex; flex-direction: column; gap: 18px; }
.nimm-mat {
  width: 100%; max-width: 240px; aspect-ratio: 1; margin: 0 auto; border-radius: 50%;
  background: var(--n-teal-light); border: 4px solid var(--n-teal);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 26px;
}
.nimm-mat h3 { font-size: 16px; color: var(--n-teal-dark); margin: 0 0 8px; }
.nimm-tally-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; width: 100%; }
.nimm-who { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--n-soft); }
.nimm-tally { min-height: 40px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; align-content: flex-start; }
.nimm-tally svg { width: 26px; height: 22px; }
.nimm-tally svg line { stroke: var(--n-teal); stroke-width: 3; stroke-linecap: round; }
.nimm-tally .num { font-size: 13px; color: var(--n-soft); width: 100%; font-variant-numeric: tabular-nums; }

.nimm-panel { background: var(--n-bg); border: 1px solid var(--n-line); border-radius: 12px; padding: 14px 16px; }
.site-content .nimm-panel h3 { font-size: 16px; color: var(--n-teal-dark); margin: 0 0 10px; }
.nimm-field { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin-bottom: 12px; }
.nimm-field > label, .nimm-field > span { font-weight: 500; font-size: 14px; }
.nimm-field output { font-weight: 700; color: var(--n-teal-dark); font-variant-numeric: tabular-nums; }
.nimm-field input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--n-teal); }
.nimm-seg { display: flex; border: 1.5px solid var(--n-line-strong); border-radius: 8px; overflow: hidden; grid-column: 1 / -1; background: var(--n-teal-light); }
.nimm-seg input { position: absolute; opacity: 0; pointer-events: none; }
.nimm-seg label { flex: 1; text-align: center; padding: 6px 4px; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--n-teal-dark); }
.nimm-seg input:checked + label { background: var(--n-teal); color: #fff; }
.nimm-seg input:focus-visible + label { outline: 3px solid var(--n-teal); outline-offset: -3px; }
.site-content .nimm-small { font-size: 12.5px; color: var(--n-soft); margin: 4px 0 0; grid-column: 1 / -1; line-height: 1.45; }

.nimm-log { list-style: none; margin: 0; padding: 0; font-size: 13.5px; max-height: 200px; overflow-y: auto; }
.nimm-log li { padding: 3px 0; border-bottom: 1px solid var(--n-line); display: flex; gap: 8px; }
.nimm-log .n { color: var(--n-soft); width: 2.2em; flex: none; font-variant-numeric: tabular-nums; }
.nimm-log .you { color: var(--n-teal); font-weight: 600; }
.nimm-log .cpu { color: var(--n-cpu); font-weight: 600; }

/* ---------- Geschichte ---------- */
.nimm-story { max-width: 68ch; margin: 44px 0 0; padding-top: 26px; border-top: 1px solid var(--n-line-strong); }
.site-content .nimm-story h2 { margin-top: 0; }
.nimm-story .kicker { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--n-teal); margin: 0 0 4px; }
.site-content .nimm-story p { line-height: 1.7; }
.nimm-story .aside-note {
  margin: 26px 0 0; padding: 12px 16px; border-left: 4px solid var(--n-teal);
  background: var(--n-teal-light); border-radius: 0 8px 8px 0; font-size: 14px;
}
.nimm-scroll-hint { font-size: 13px; color: var(--n-soft); margin-top: 14px; }

@media (prefers-reduced-motion: reduce) { .nimm-match { transition: none; } }
