:root {
  --bg: #0f1720;
  --card: #1a2531;
  --card2: #223244;
  --line: #2f4358;
  --text: #e8eef4;
  --muted: #93a4b5;
  --accent: #f2b84b;
  --good: #4ea36b;
  --bad: #d65a4f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#root { min-height: 100%; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }

.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: #0b1117; border-bottom: 1px solid var(--line); height: 48px; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.conn { font-size: 12px; color: var(--muted); }
.conn.on::before { content: "● "; color: var(--good); }
.conn.off::before { content: "● "; color: var(--bad); }

.center { display: flex; justify-content: center; padding: 24px 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: 100%; max-width: 640px; }
h1 { margin: 0 0 8px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--muted); }
.err-text { color: var(--bad); }
.label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.code-big { font-family: ui-monospace, monospace; letter-spacing: 4px; color: var(--accent); }

.input { background: #0f1923; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; color: var(--text); width: 100%; }
.input.code { text-transform: uppercase; letter-spacing: 4px; text-align: center; font-family: ui-monospace, monospace; max-width: 140px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.btn { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; transition: background .12s, transform .05s; }
.btn:hover:not(:disabled) { background: #2b4157; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #1b1405; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #f6c76b; }
.btn.warn { background: #3a2a22; border-color: #6b4a38; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.big { padding: 12px 18px; font-size: 17px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--card2); margin-bottom: 6px; }
.row.empty { opacity: .5; }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); vertical-align: -2px; flex: none; }

/* Spielansicht */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 12px; padding: 12px; height: calc(100vh - 48px); }
.board-pane { display: flex; flex-direction: column; min-height: 0; gap: 8px; }
.status { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 48px; }
.status.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.dice { display: flex; align-items: center; gap: 6px; flex: none; }
.die { font-size: 34px; line-height: 1; }
.dice-sum { font-weight: 700; font-size: 18px; margin-left: 4px; color: var(--accent); }
.board-wrap { flex: 1; min-height: 0; background: #0b1117; border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.board-svg { width: 100%; height: 100%; display: block; user-select: none; }
.board-svg text { font-family: system-ui, sans-serif; pointer-events: none; }
.hl-vertex { fill: rgba(255,255,255,.65); stroke: #fff; stroke-width: .05; cursor: pointer; animation: pulse 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.hl-vertex:hover { fill: var(--accent); }
.hl-edge { cursor: pointer; animation: blink 1.1s ease-in-out infinite; }
.hl-edge:hover { opacity: 1; }
.hl-hex { fill: rgba(255,255,255,.22); stroke: #fff; stroke-width: .05; cursor: pointer; }
.hl-hex:hover { fill: rgba(242,184,75,.55); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.side { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-right: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.player { display: grid; grid-template-columns: 18px 1fr; gap: 2px 8px; align-items: center; padding: 6px 4px; border-radius: 8px; }
.player.active { background: rgba(242,184,75,.14); outline: 1px solid rgba(242,184,75,.5); }
.pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstats { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.badge { background: var(--accent); color: #1b1405; border-radius: 6px; padding: 0 6px; font-weight: 700; }
.panel.offer { border-color: var(--accent); }
.res-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.res { background: var(--card2); border-radius: 8px; text-align: center; padding: 6px 2px; }
.res.zero { opacity: .45; }
.res-emoji { font-size: 20px; }
.res-n { font-size: 20px; font-weight: 700; }
.res-name { font-size: 11px; color: var(--muted); }
.dev-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.devcard { background: #2c2440; border: 1px solid #54448a; border-radius: 8px; padding: 5px 10px; cursor: default; font-size: 13px; }
.devcard.playable { cursor: pointer; border-color: var(--accent); background: #3a2f57; }
.devcard.playable:hover { background: #4a3d6e; }
.devcard.fresh { opacity: .55; }
.devcard:disabled { color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 8px; }
.bank { font-size: 12px; }

.tab-row { display: flex; gap: 6px; margin-bottom: 8px; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 4px 8px; color: var(--muted); cursor: pointer; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.log-list, .chat-list { height: 190px; overflow-y: auto; font-size: 13px; }
.log-line { padding: 2px 0; border-bottom: 1px dotted #25374a; }
.chat-line { padding: 2px 0; word-break: break-word; }
.chat-form { display: flex; gap: 6px; margin-top: 6px; }
.card .chat-list { height: 140px; background: #0f1923; border-radius: 8px; padding: 6px 8px; margin-top: 14px; }

/* Dialoge */
.overlay { position: fixed; inset: 0; background: rgba(5,10,15,.7); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: 100%; max-width: 460px; max-height: 92vh; overflow-y: auto; }
.counter { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.counter-label { flex: 1; }
.counter-n { min-width: 22px; text-align: center; font-weight: 700; }
.help p { margin: 6px 0; }

.toasts { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: #223244; border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.err { background: #4a2420; border-color: #7d3a33; }

@media (max-width: 960px) {
  .game { grid-template-columns: 1fr; height: auto; }
  .board-wrap { height: 78vw; max-height: 70vh; flex: none; }
  .side { overflow: visible; }
}

.btn-grid .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 8px; }
.btn .cost { font-size: 12px; opacity: .85; white-space: nowrap; }
