:root {
  color-scheme: light;
  --bg: #f6e9cd; --panel: #fffdf4; --ink: #20233a; --dim: #6f6a5c;
  --gold: #ffb52e; --red: #ff4b38; --green: #2e9e52;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; padding: 18px 16px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  /* Comic-Papier: warmer Grund mit Halbtonpunkten und Papierkorn (falls generiert) */
  background:
    url(/img/tex_paper.png),
    radial-gradient(circle, rgba(32, 35, 58, .07) 2px, transparent 2.6px) 0 0 / 22px 22px,
    linear-gradient(#f9efd9, var(--bg));
  background-blend-mode: multiply, normal, normal;
  color: var(--ink);
  font: 500 15px/1.5 "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
}
header { display: flex; align-items: baseline; gap: 14px; }
h1 {
  margin: 0; font: 34px/1 "Bangers", "Baloo 2", sans-serif; letter-spacing: .06em;
  color: var(--gold); -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
}
h2 { margin: 0 0 4px; font: 24px/1.1 "Bangers", "Baloo 2", sans-serif; letter-spacing: .04em; }
h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); }
.status { font-size: 12px; font-weight: 700; color: var(--dim); }
.status.on { color: var(--green); }
.status.off { color: var(--red); }
.hidden { display: none !important; }
.muted { color: var(--dim); font-size: 13px; }

.panel {
  width: min(760px, 100%); background: var(--panel);
  border: 3px solid var(--ink); border-radius: 18px; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 6px 6px 0 rgba(32, 35, 58, .85);
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--dim); }
input {
  background: #fff; border: 3px solid var(--ink); color: var(--ink);
  border-radius: 10px; padding: 8px 10px; font: inherit; font-weight: 700; min-width: 140px;
}
button {
  font: inherit; font-weight: 800; border-radius: 12px; padding: 9px 16px; cursor: pointer;
  border: 3px solid var(--ink); background: #fff; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .06s, box-shadow .06s;
}
button:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
button.primary { background: var(--gold); }
button.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--dim); }
button:disabled { opacity: .45; cursor: not-allowed; }

.players { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  border: 2.5px solid var(--ink); border-radius: 999px; background: #fff;
  font-size: 14px; font-weight: 700; box-shadow: 2px 2px 0 rgba(32, 35, 58, .6);
}
.dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); }

.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: 12px; }
.level {
  text-align: left; padding: 12px; border-radius: 13px; background: #fff;
  border: 3px solid var(--ink); display: flex; flex-direction: column; gap: 4px;
  box-shadow: 3px 3px 0 rgba(32, 35, 58, .55);
}
.level.sel { background: #fff3d1; box-shadow: 3px 3px 0 var(--gold), 0 0 0 2px var(--gold) inset; }
.level.locked { opacity: .45; cursor: not-allowed; box-shadow: none; }
.level b { font-size: 15px; }
.level small { color: var(--dim); font-size: 12px; line-height: 1.35; }
.level .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
       color: var(--ink); background: #ffe6a8; border: 1.5px solid var(--ink);
       border-radius: 6px; padding: 1px 6px; }

canvas {
  max-width: 100%; height: auto; border: 4px solid var(--ink); border-radius: 16px;
  box-shadow: 8px 8px 0 rgba(32, 35, 58, .8);
}
.keys { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 16px; font-size: 13px; color: var(--dim); }
kbd { background: #fff; border: 2px solid var(--ink); border-bottom-width: 3.5px; border-radius: 6px;
      padding: 1px 6px; font-size: 12px; font-weight: 800; color: var(--ink); }

.stars { font-size: 46px; letter-spacing: 6px; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); }
#result-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: #fff; border: 3px solid var(--ink); border-radius: 12px; padding: 10px;
        box-shadow: 3px 3px 0 rgba(32, 35, 58, .55); }
.stat b { display: block; font: 26px/1.1 "Bangers", "Baloo 2", sans-serif; color: var(--gold);
          -webkit-text-stroke: 1px var(--ink); }
.stat span { font-size: 12px; color: var(--dim); }
