/* Schriften liegen auf dem eigenen Server (nicht Google), damit keine Besucher-Daten an Dritte gehen. */
@font-face { font-family: "Pixelify Sans"; src: url(fonts/pixelify-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url(fonts/pixelify-sans-latin-700-normal.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Rubik"; src: url(fonts/rubik-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Rubik"; src: url(fonts/rubik-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }

/* Aufbau: Insel links, Holztafeln rechts; auf dem Handy untereinander. Eine feste Nacht-Meer-Optik. */
:root {
  --meer: #14283d; --meer2: #1d3a57; --brett: #3b2a1f; --brett2: #4b3628; --kante: #24180f;
  --text: #f7ecd6; --leise: #cdbb9b; --sonne: #ffd04d; --discord: #5865f2; --discord2: #4752c4;
  --ok: #7ed36a; --warn: #ffb347; --aus: #ff7a6b;
  --pixel: "Pixelify Sans", "Courier New", monospace;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--meer); color: var(--text); }
body { font: 15px/1.5 var(--body); padding-inline: 16px; padding-block: 20px 24px; min-height: 100vh;
  background: radial-gradient(ellipse at 30% 0%, var(--meer2), var(--meer) 60%); }
a { color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.marke { font: 700 clamp(26px, 4vw, 38px)/1 var(--pixel); margin: 0; letter-spacing: .5px; }
.marke span { color: var(--sonne); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.buehne { position: relative; min-width: 0; margin: 8px; background: #24507a;
  box-shadow: 0 0 0 4px var(--kante), 0 0 0 8px var(--brett2), 8px 8px 0 8px rgba(0,0,0,.35); }
canvas { display: block; width: 100%; height: auto; max-width: 100%; image-rendering: pixelated; cursor: crosshair; touch-action: manipulation; }
.tip { position: absolute; transform: translate(-50%, -120%); font: 14px var(--pixel); background: var(--brett); padding: 2px 8px; border: 2px solid var(--kante); pointer-events: none; white-space: nowrap; }
.toast { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font: 16px var(--pixel); background: var(--brett); border: 2px solid var(--sonne); padding: 6px 14px; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.zeiger { position: absolute; pointer-events: none; display: flex; align-items: flex-start; gap: 2px; transform: translate(-2px, -2px); }
.zeiger svg { width: 16px; height: 16px; filter: drop-shadow(1px 1px 0 rgba(0,0,0,.5)); }
.zeiger b { font: 600 11px var(--body); color: #10202f; padding: 1px 6px; margin-top: 12px; white-space: nowrap; }

.figname { position: absolute; transform: translate(-50%, -100%); pointer-events: none; font: 600 10px/1.3 var(--body); color: #10202f; padding: 0 5px; white-space: nowrap; box-shadow: 1px 1px 0 rgba(0,0,0,.4); }
.seite { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.brett { background: var(--brett); border: 3px solid var(--kante); box-shadow: inset 0 0 0 2px var(--brett2), 4px 4px 0 rgba(0,0,0,.35); padding: 14px 16px; }
.eyebrow { font: 12px var(--pixel); text-transform: uppercase; letter-spacing: 1.5px; color: var(--sonne); margin: 0 0 4px; display: flex; justify-content: space-between; gap: 8px; }
.brett h2 { font: 600 24px/1.15 var(--pixel); margin: 0 0 6px; text-wrap: balance; }
.brett p { margin: 0; color: var(--leise); }
.chip { display: inline-block; margin-top: 10px; font: 13px var(--pixel); padding: 2px 8px; background: var(--kante); color: var(--sonne); }

.status { text-transform: none; letter-spacing: 0; color: var(--warn); }
.status::before { content: "■ "; }
.status[data-s="online"] { color: var(--ok); }
.status[data-s="offline"] { color: var(--aus); }
.name { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 12px; }
.name label { font-size: 13px; color: var(--leise); }
.zeile { display: flex; gap: 6px; }
.zeile input { flex: 1; min-width: 0; font: 15px var(--body); color: var(--text); background: var(--kante); border: 2px solid var(--brett2); padding: 6px 8px; }
.zeile input::placeholder { color: var(--leise); opacity: .7; }
.knopf { font: 700 15px var(--pixel); color: var(--kante); background: var(--sonne); border: 0; padding: 6px 14px; cursor: pointer; box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
.knopf:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 rgba(0,0,0,.35); }

.zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.zahlen div { background: var(--kante); padding: 6px 4px; }
.zahlen strong { display: block; font: 22px var(--pixel); font-variant-numeric: tabular-nums; }
.zahlen span { font-size: 12px; color: var(--leise); }

.discord { display: flex; align-items: center; justify-content: center; gap: 10px; font: 700 20px var(--pixel); color: #fff; text-decoration: none;
  background: var(--discord); padding: 12px 16px; border: 3px solid var(--discord2); box-shadow: 4px 4px 0 rgba(0,0,0,.35); transition: transform .08s; }
.discord:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 rgba(0,0,0,.35); }
.discord:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(0,0,0,.35); }
:is(.discord, .knopf, input, .fuss a):focus-visible { outline: 3px solid var(--sonne); outline-offset: 3px; }

.bauplan { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; counter-reset: p; }
.bauplan li { counter-increment: p; display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; color: var(--leise); font-size: 14px; padding: 4px 6px; border: 2px solid transparent; }
.bauplan li::before { content: counter(p); font: 16px/24px var(--pixel); background: var(--kante); color: var(--text); text-align: center; }
.bauplan li.an { border-color: var(--sonne); color: var(--text); }
.hinweis { font-size: 12px; color: var(--leise); margin: 0; }

.fuss { display: flex; gap: 16px; justify-content: center; font-size: 13px; color: var(--leise); padding-top: 8px; }
@media (prefers-reduced-motion: reduce) { .discord { transition: none; } }

/* ---------- Ton-Knopf in der Kopfzeile (Paket B) ---------- */
.tonknopf { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; cursor: pointer; color: var(--sonne); background: var(--brett);
  border: 3px solid var(--kante); box-shadow: inset 0 0 0 2px var(--brett2), 3px 3px 0 rgba(0,0,0,.35); }
.tonknopf:hover { background: var(--brett2); }
.tonknopf:active { transform: translate(1px, 1px); box-shadow: inset 0 0 0 2px var(--brett2), 2px 2px 0 rgba(0,0,0,.35); }
.tonknopf:focus-visible { outline: 3px solid var(--sonne); outline-offset: 3px; }
.tonknopf .strich { display: none; }
.tonknopf[aria-pressed="false"] { color: var(--leise); }
.tonknopf[aria-pressed="false"] .wellen { display: none; }
.tonknopf[aria-pressed="false"] .strich { display: inline; color: var(--aus); }

/* ---------- Aktion-Knopf in der Infotafel ---------- */
.aktion { display: block; margin-top: 12px; width: 100%; padding: 8px 14px; font-size: 17px; }
.knopf:focus-visible, .wahl:focus-visible, .link:focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }


/* ---------- Chat & Emotes (Paket C) ---------- */
.spalte { min-width: 0; display: flex; flex-direction: column; gap: 4px; }

/* Sprechblase: Pixel-Optik mit Spitze. Sitzt in der Bühne, wird von chat.js positioniert (Text immer per textContent). */
.blase { position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none;
  max-width: 160px; width: max-content;   /* kein overflow:hidden, sonst wird die Spitze abgeschnitten */
  font: 600 13px/1.2 var(--body); color: #2b2233; background: #fff8e6; padding: 3px 7px 4px;
  border: 2px solid #2b2233; box-shadow: 2px 2px 0 rgba(0,0,0,.3);
  overflow-wrap: anywhere; word-break: break-word; text-align: left; unicode-bidi: isolate; --pf: 0px; }
.blase::before, .blase::after { content: ""; position: absolute; left: calc(50% + var(--pf)); width: 0; height: 0; border-style: solid; border-color: transparent; }
.blase::before { bottom: -9px; margin-left: -6px; border-width: 7px 6px 0; border-top-color: #2b2233; }          /* dunkle Spitze (Rand) */
.blase::after { bottom: -5px; margin-left: -4px; border-width: 5px 4px 0; border-top-color: #fff8e6; }          /* helle Spitze (Füllung) */

/* Chat-Feld unten in der Bühne; der Toast rutscht dann nach oben, damit nichts überlappt */
.chatzeile { position: absolute; z-index: 6; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; padding: 6px; background: var(--brett); border: 3px solid var(--kante); box-shadow: 3px 3px 0 rgba(0,0,0,.35); }
.chatzeile input { flex: 1; min-width: 0; font: 16px var(--body); color: var(--text); background: var(--kante); border: 2px solid var(--brett2); padding: 6px 8px; }   /* 16px: verhindert Zoom auf iPhones */
.chatzeile input::placeholder { color: var(--leise); opacity: .7; }
.buehne.chat-offen .toast { bottom: 64px; }
.chatzeile input:focus-visible { outline: 3px solid var(--sonne); outline-offset: 1px; }

/* Emote-Leiste unter der Bühne */
.leiste { display: flex; align-items: center; gap: 8px; margin: 4px 8px 0; flex-wrap: wrap; }
.slots { display: flex; gap: 6px; flex-wrap: wrap; }
.leistenknopf, .slot, .emo-wahl { font: 18px/1 var(--pixel); color: var(--text); background: var(--brett); border: 3px solid var(--kante); box-shadow: inset 0 0 0 2px var(--brett2), 2px 2px 0 rgba(0,0,0,.35); cursor: pointer; }
.leistenknopf { width: 44px; height: 44px; padding: 0; }
.slot { position: relative; width: 48px; height: 48px; padding: 0; display: grid; place-items: center; }
.slot kbd { position: absolute; right: 3px; bottom: 1px; font: 700 12px/1 var(--pixel); color: var(--sonne); }
.slot.an { border-color: var(--sonne); }
.emo-icon { width: 27px; height: 27px; image-rendering: pixelated; display: block; }
.leistenknopf:active, .slot:active, .emo-wahl:active { transform: translate(1px, 1px); }
:is(.leistenknopf, .slot, .emo-wahl, .funkname, .stummchip, .knopf.klein):focus-visible { outline: 3px solid var(--sonne); outline-offset: 2px; }

/* Auswahl der Emotes (✎) */
.emowahl { margin: 4px 8px 0; background: var(--brett); border: 3px solid var(--kante); box-shadow: inset 0 0 0 2px var(--brett2), 4px 4px 0 rgba(0,0,0,.35); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.emo-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: 600 18px var(--pixel); }
.emo-slots { display: flex; gap: 6px; flex-wrap: wrap; }
.emo-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.emo-wahl { position: relative; height: 48px; padding: 0; display: grid; place-items: center; }
.emo-wahl.gesperrt { filter: grayscale(1); opacity: .55; cursor: help; }
.emo-wahl .schloss { position: absolute; right: 1px; bottom: 0; font-size: 13px; line-height: 1; }
.emo-info { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--leise); }
.knopf.klein { font-size: 14px; padding: 4px 10px; }

/* Verlauf "Insel-Funk" */
.funk { list-style: none; margin: 6px 0 0; padding: 0; max-height: 190px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: 14px; overscroll-behavior: contain; }
.funk li { overflow-wrap: anywhere; color: var(--text); }
.funk li.leer { color: var(--leise); }
.funkname { font: 600 14px var(--body); color: var(--sonne); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
.funkname:disabled { color: var(--leise); cursor: default; text-decoration: none; }
.funkmenue { padding: 2px 0 4px; }
.funkstumm { margin-top: 10px; font-size: 13px; color: var(--leise); }
.funkstumm p { margin: 0 0 4px; }
.stummchip { cursor: pointer; border: 0; margin: 0 4px 4px 0; }

@media (max-width: 860px) { .blase { font-size: 12px; max-width: 140px; } }
@media (max-width: 420px) { .slot { width: 42px; height: 42px; } .leistenknopf { width: 40px; height: 40px; } .leiste { gap: 6px; } .slots { gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .leistenknopf:active, .slot:active, .emo-wahl:active { transform: none; } }
