:root {
  --bg: #14172b; --bg2: #1e2340; --karte: #232a4d; --rand: #343d6b;
  --text: #eef0fb; --leise: #a9b0d6; --akzent: #ffcc4d; --gruen: #3ddc97; --rot: #ff6b6b;
  --x2: #2f5d9e; --x3: #8a3d7a; --stein: #f6e7c1; --steintext: #1b1f3a;
  --brett: min(calc(100vw - 20px), 600px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1000px 500px at 20% -10%, #2b3270 0%, transparent 60%), var(--bg);
}
main { max-width: 640px; margin: 0 auto; padding: 10px 10px 40px; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.marke { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo { width: 42px; height: 42px; }
h1 { margin: 0; font-size: 24px; }
h2, h3 { margin: 0 0 10px; }
.unter { margin: 0; color: var(--leise); font-size: 14px; }
.zurueck { color: var(--leise); font-size: 14px; text-decoration: none; white-space: nowrap; }
.karte { background: linear-gradient(160deg, var(--karte), var(--bg2)); border: 1px solid var(--rand); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.leise { color: var(--leise); }
.klein { font-size: 14px; }
.mitte { justify-content: center; }
label { display: block; font-size: 14px; color: var(--leise); margin-bottom: 4px; }
input { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--rand); background: #0f1226; color: var(--text); font: inherit; }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 0; padding: 11px 14px; font-weight: 700; }
button:disabled { opacity: .4; cursor: default; }
.haupt { background: var(--akzent); color: #1b1f3a; }
.neben { background: #ffffff18; color: var(--text); }
.leicht { background: none; color: var(--leise); text-decoration: underline; font-weight: 500; padding: 6px; }
#raumNeu { width: 100%; margin-top: 10px; }
.reihe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reihe input { flex: 1 1 140px; width: auto; }
.beitreten { margin-top: 10px; }
.beitreten input { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.regeln { margin: 0; padding-left: 20px; }
.regeln li { margin-bottom: 6px; }
.raumkopf { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.code { font-size: 24px; font-weight: 800; letter-spacing: 4px; color: var(--akzent); }
.spielerliste { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.spielerliste li { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: #ffffff0a; border-radius: 10px; }
.spielerliste button { padding: 4px 9px; font-size: 13px; }
.punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.punkte { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sp { flex: 1 1 90px; padding: 6px 9px; border-radius: 10px; background: var(--bg2); border: 2px solid transparent; font-size: 14px; min-width: 0; }
.sp.dran { border-color: var(--akzent); }
.sp .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp .p { font-size: 20px; font-weight: 800; }
.sp.weg { opacity: .55; }
.status { text-align: center; margin: 4px 0 8px; font-weight: 600; min-height: 1.4em; }
.status.du { color: var(--akzent); }

.brettrahmen { display: flex; justify-content: center; }
.brett {
  width: var(--brett); height: var(--brett); display: grid; grid-template-columns: repeat(15, 1fr); gap: 2px;
  background: #0d1022; padding: 3px; border-radius: 10px; touch-action: manipulation; user-select: none;
}
.feld {
  position: relative; background: #262d52; border-radius: 3px; display: grid; place-items: center;
  font-size: calc(var(--brett) / 15 * .30); color: #ffffffa0; font-weight: 700; cursor: pointer;
}
.feld.x2 { background: var(--x2); }
.feld.x3 { background: var(--x3); }
.feld.mitte::after { content: "★"; font-size: calc(var(--brett) / 15 * .45); color: #ffffffb0; }
.feld.mitte.x2 { }
.stein {
  position: absolute; inset: 0; border-radius: 4px; background: var(--stein); color: var(--steintext);
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--brett) / 15 * .52);
  box-shadow: inset 0 -2px 0 #0003; border-bottom: 3px solid var(--sf, transparent);
}
.stein.joker { background: #ffe18a; }
.stein.joker::after { content: "✱"; position: absolute; top: 0; right: 2px; font-size: 40%; }
.stein.neu { background: #9be7c4; outline: 2px solid var(--gruen); }
.stein.zuletzt { box-shadow: 0 0 0 2px var(--akzent); }
.brett.waehlen .feld:not(:has(.stein)) { outline: 1px dashed #ffffff30; }

.vorschau { text-align: center; min-height: 1.5em; margin: 8px 0 4px; font-weight: 600; font-size: 15px; }
.vorschau.gut { color: var(--gruen); }
.vorschau.schlecht { color: var(--rot); }
.bank { display: flex; justify-content: center; gap: 12px; margin: 6px 0 12px; min-height: 64px; }
.bstein {
  width: 58px; height: 64px; border-radius: 10px; background: var(--stein); color: var(--steintext);
  font-size: 30px; font-weight: 800; display: grid; place-items: center; cursor: pointer; position: relative;
  box-shadow: inset 0 -4px 0 #0003; border: 3px solid transparent; padding: 0;
}
.bstein.joker { background: #ffe18a; font-size: 26px; }
.bstein.gewaehlt { border-color: var(--akzent); transform: translateY(-6px); }
.bstein.tausch { border-color: var(--rot); transform: translateY(-6px); }
.bstein.weg { opacity: .2; }
.knoepfe { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; }
.knoepfe button { flex: 1 1 120px; }
.verlauf { margin-top: 12px; }
.verlauf summary { cursor: pointer; font-weight: 700; }
.verlauf ol { margin: 8px 0 0; padding-left: 20px; font-size: 14px; color: var(--leise); }

.dialog { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog .karte { max-width: 420px; width: 100%; }
.zahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.zahlen button { background: var(--stein); color: var(--steintext); font-size: 22px; }
.zahlen button.passt { box-shadow: 0 0 0 3px var(--gruen); }
.endliste { padding-left: 22px; font-size: 18px; }
.endliste li { margin-bottom: 4px; }
.meldung { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #2a2f55; border: 1px solid var(--rand); padding: 10px 16px; border-radius: 12px; z-index: 20; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px #0008; }
