  :root {
    --bg: #f4efe6;
    --ink: #2b2622;
    --muted: #7a6f64;
    --line: #ddd3c4;
    --card: #fffdf8;
    --note: #ffe66d;
    --note-dark: #f2cf2c;
    --accent: #e4572e;
    --accent-dark: #c2401b;
    --yes: #2e9e5b;
    --no: #d64545;
    --maybe: #8a7f72;
    --radius: 14px;
    --shadow: 0 1px 0 rgba(0,0,0,.04), 0 6px 18px -8px rgba(60,40,20,.25);
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg);
    background-image: radial-gradient(rgba(0,0,0,.045) 1px, transparent 1px);
    background-size: 18px 18px;
    color: var(--ink);
    min-height: 100vh;
  }
  .wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
  h1, h2, h3 { margin: 0; line-height: 1.15; }
  .logo {
    font-family: "Segoe Print", "Comic Sans MS", "Chalkboard SE", cursive;
    font-size: clamp(40px, 8vw, 68px);
    letter-spacing: -1px;
    transform: rotate(-2deg);
    display: inline-block;
  }
  .logo span { color: var(--accent); }
  .hand { font-family: "Segoe Print", "Comic Sans MS", "Chalkboard SE", cursive; }

  .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
  }
  label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
  input, textarea, select {
    width: 100%; font: inherit; font-size: 17px;
    padding: 12px 14px; border-radius: 10px;
    border: 2px solid var(--line); background: #fff; color: var(--ink);
    outline: none; transition: border-color .15s;
  }
  input:focus, textarea:focus, select:focus { border-color: var(--accent); }
  textarea { resize: vertical; min-height: 110px; font-size: 15px; }
  button {
    font: inherit; font-weight: 700; font-size: 16px;
    border: 0; border-radius: 10px; padding: 12px 18px; cursor: pointer;
    background: var(--accent); color: #fff;
    box-shadow: 0 3px 0 var(--accent-dark);
    transition: transform .06s, box-shadow .06s, filter .15s;
  }
  button:hover { filter: brightness(1.05); }
  button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dark); }
  button:disabled { opacity: .45; cursor: not-allowed; }
  button.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
  button.ghost:hover { border-color: var(--ink); }
  button.yes { background: var(--yes); box-shadow: 0 3px 0 #217444; }
  button.no { background: var(--no); box-shadow: 0 3px 0 #a52f2f; }
  button.maybe { background: var(--maybe); box-shadow: 0 3px 0 #635a50; }
  button.picked { outline: 3px solid var(--ink); outline-offset: 2px; }
  .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .row > input { flex: 1; min-width: 160px; }
  .stack > * + * { margin-top: 14px; }
  .muted { color: var(--muted); }
  .small { font-size: 14px; }
  .hidden { display: none !important; }
  .error {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
    background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
    box-shadow: var(--shadow); z-index: 10; font-weight: 600;
  }

  /* Startseite */
  .home { display: grid; place-items: center; min-height: 80vh; text-align: center; }
  .home .panel { width: min(440px, 100%); text-align: left; margin-top: 26px; }
  .divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0; }
  .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  #joinCode { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; text-align: center; max-width: 140px; }

  /* Kopfzeile */
  .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
  .top .logo { font-size: 34px; }
  .codebox { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
  .codebox b { letter-spacing: .25em; font-size: 20px; }
  .codebox button { padding: 6px 12px; font-size: 14px; border-radius: 999px; }

  /* Spielerkarten (Post-its) */
  .players { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
  .pcard { position: relative; text-align: center; padding-top: 6px; }
  .note {
    background: var(--note);
    min-height: 92px; padding: 14px 10px 12px;
    display: grid; place-items: center;
    font-family: "Segoe Print", "Comic Sans MS", "Chalkboard SE", cursive;
    font-size: 19px; font-weight: 700; line-height: 1.2;
    box-shadow: 0 10px 14px -10px rgba(0,0,0,.45);
    transform: rotate(var(--rot, -2deg));
    position: relative; word-break: break-word;
  }
  .note::before {
    content: ""; position: absolute; top: -9px; left: 50%; width: 64px; height: 18px;
    transform: translateX(-50%) rotate(-3deg);
    background: rgba(255,255,255,.55); border: 1px solid rgba(0,0,0,.05);
  }
  .note.mine { background: repeating-linear-gradient(45deg, #ece4d6, #ece4d6 8px, #e4dbca 8px, #e4dbca 16px); color: var(--muted); font-size: 34px; }
  .note.solved { background: #b8eccb; }
  .note.gaveup { background: #f3c7c7; }
  .pname { margin-top: 12px; font-weight: 700; font-size: 16px; display: flex; gap: 6px; justify-content: center; align-items: center; }
  .dot { width: 8px; height: 8px; border-radius: 50%; background: #c9bfb2; flex: none; }
  .dot.on { background: var(--yes); }
  .pmeta { font-size: 13px; color: var(--muted); margin-top: 2px; }
  .pcard.turn .note { outline: 4px solid var(--accent); outline-offset: 4px; }
  .badge { position: absolute; top: -6px; right: -4px; z-index: 2; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
  .badge.turn { background: var(--accent); }

  /* Spielbereich */
  .game { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
  @media (max-width: 860px) { .game { grid-template-columns: 1fr; } }
  .stage h2 { font-size: 24px; }
  .side .stack > .panel { padding: 16px; }
  .log { list-style: none; padding: 0; margin: 0; max-height: 260px; overflow: auto; font-size: 14px; }
  .log li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
  .log li:last-child { border: 0; }
  .mode { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode label { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); font-weight: 600; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; margin: 0; }
  .mode input { width: auto; margin-right: 6px; }
  .mode label:has(input:checked) { border-color: var(--accent); background: #fff4ef; }
  .mode small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
  .ranking { list-style: none; padding: 0; margin: 0; }
  .ranking li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 17px; }
  .center { text-align: center; }
  .pcard .remove {
    position: absolute; top: -8px; left: -6px; z-index: 3;
    width: 28px; height: 28px; padding: 0; border-radius: 50%;
    font-size: 14px; line-height: 28px; background: var(--ink); box-shadow: none;
  }
  .assign-row { border: 2px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
  .assign-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
  .assign-char { font-size: 18px; font-weight: 700; background: var(--note); padding: 1px 8px; border-radius: 4px; }
  .order { list-style: none; padding: 0; margin: 0; border: 2px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
  .order li { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); }
  .order li:last-child { border-bottom: 0; }
  .order-n { color: var(--muted); font-weight: 700; width: 24px; }
  .order-name { flex: 1; font-weight: 600; }
  .order-btn { padding: 4px 10px; font-size: 14px; }
  .glink { color: inherit; text-decoration: none; border-bottom: 2px dotted rgba(0,0,0,.25); }
  .glink:hover { border-bottom-color: var(--accent); }
  .glink-icon { font-size: .6em; margin-left: .3em; opacity: .55; vertical-align: middle; }
  .glink:hover .glink-icon { opacity: 1; }
