/* Krawallstadt – Client-Kit: Controls, Emotes, Uno-Karten, Charaktereditor, Minispiel-Host.
   Präfixe: .kit-  .editor-  .mghost-   Layout-Profile: body.layout-phone / body.layout-tablet
   Variablen aus main.css (mit Fallbacks): --c-outline, --c-panel, --c-ink, --c-accent, --c-good, --c-bad, --c-gold */

:root {
  --kit-outline: var(--c-outline, #1b1b2f);
  --kit-font: "Press Start 2P", "Pixelify Sans", "Courier New", ui-monospace, monospace;
  --kit-panel: var(--c-panel, #fff6e0);
  --kit-ink: var(--c-ink, #1b1b2f);
  --kit-accent: var(--c-accent, #ff4d6d);
  --kit-good: var(--c-good, #2ec27e);
  --kit-bad: var(--c-bad, #ff4d4d);
  --kit-gold: var(--c-gold, #ffd23f);
  --kit-shadow: 0 5px 0 var(--kit-outline);
  --kit-uno-w: 72px;
}

/* ------------------------------------------------------------------ Grundbausteine */
.kit-canvas { image-rendering: auto; }

.kit-title {
  font-family: var(--kit-font);
  font-weight: bold;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow:
    3px 0 0 var(--kit-outline), -3px 0 0 var(--kit-outline), 0 3px 0 var(--kit-outline), 0 -3px 0 var(--kit-outline),
    3px 3px 0 var(--kit-outline), -3px 3px 0 var(--kit-outline), 3px -3px 0 var(--kit-outline), -3px -3px 0 var(--kit-outline),
    0 7px 0 rgba(0, 0, 0, 0.35);
  margin: 0;
}

.kit-btn {
  min-width: var(--btn-min, 48px);
  min-height: var(--btn-min, 48px);
  padding: 0 16px;
  border: 4px solid var(--kit-outline);
  border-radius: 14px;
  background: var(--kit-gold);
  color: var(--kit-ink);
  font-family: var(--kit-font);
  font-size: 13px;
  font-weight: bold;
  box-shadow: var(--kit-shadow);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.1s;
}
.kit-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--kit-outline); }
.kit-btn:disabled { filter: grayscale(0.7) brightness(0.9); cursor: default; }
.kit-btn--good { background: var(--kit-good); color: #fff; }
.kit-btn--bad { background: var(--kit-bad); color: #fff; }
.kit-btn--purple { background: #8338ec; color: #fff; }
.kit-btn--ghost { background: #fff; }
.kit-btn.is-pulsing { animation: kit-pulse 1.1s ease-in-out infinite; }

.kit-badge {
  display: inline-block;
  padding: 3px 6px;
  border: 3px solid var(--kit-outline);
  border-radius: 8px;
  background: var(--kit-accent);
  color: #fff;
  font-family: var(--kit-font);
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
}

.kit-progress {
  height: 14px;
  border: 3px solid var(--kit-outline);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.kit-progress__bar {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--kit-gold) 0 10px, #ffb703 10px 20px);
}

.kit-char { display: block; overflow: visible; }

@keyframes kit-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes kit-pop { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes kit-wobble { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

/* ------------------------------------------------------------------ Controls */
.kit-controls {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.kit-joy-zone { position: absolute; pointer-events: auto; touch-action: none; }
.kit-joy-base {
  position: absolute;
  box-sizing: border-box;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.12) 70%);
  border: 4px solid var(--kit-outline);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.35), 0 5px 0 rgba(0, 0, 0, 0.35);
  opacity: 0.75;
  transition: opacity 0.12s;
}
.kit-joy-base::before {
  /* Retro-Fadenkreuz */
  content: "";
  position: absolute;
  inset: 22%;
  border: 3px dashed rgba(27, 27, 47, 0.35);
  border-radius: 50%;
}
.kit-joy-base.is-active { opacity: 1; }
.kit-controls--floating .kit-joy-base:not(.is-active) { opacity: 0.32; }
.kit-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  box-sizing: border-box;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, #4cc9f0 13% 100%);
  border: 4px solid var(--kit-outline);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -50%);
}
.kit-fire, .kit-ctl-btn {
  position: absolute;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  pointer-events: auto;
  touch-action: none;
  border-radius: 50%;
  border: 4px solid var(--kit-outline);
  font-family: var(--kit-font);
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 0 var(--kit-outline);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: transform 0.05s, box-shadow 0.05s, filter 0.05s;
}
.kit-fire {
  background: radial-gradient(circle at 35% 30%, #ff9a9a 0 14%, #ff4d4d 15% 100%);
  box-shadow: 0 6px 0 #8f1d1d, 0 6px 0 4px var(--kit-outline);
  opacity: 0.92;
}
.kit-fire__label { pointer-events: none; }
.kit-fire.is-down {
  transform: translateY(5px) scale(0.96);
  box-shadow: 0 1px 0 #8f1d1d, 0 1px 0 4px var(--kit-outline);
  filter: brightness(1.2);
  opacity: 1;
}
.kit-ctl-btn {
  background: radial-gradient(circle at 35% 30%, #fff1a8 0 14%, #ffd23f 15% 100%);
  color: var(--kit-ink);
  text-shadow: none;
  box-shadow: 0 4px 0 #a07800, 0 4px 0 4px var(--kit-outline);
  opacity: 0.92;
}
.kit-ctl-btn.is-down { transform: translateY(4px) scale(0.95); box-shadow: 0 0 0 #a07800; filter: brightness(1.15); }

/* ------------------------------------------------------------------ Emotes */
.kit-emotebar {
  position: absolute;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}
.kit-emotebar--bottom-left {
  left: calc(10px + var(--safe-left, env(safe-area-inset-left, 0px)));
  bottom: calc(10px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
}
.kit-emotebar--bottom-right {
  right: calc(10px + var(--safe-right, env(safe-area-inset-right, 0px)));
  bottom: calc(10px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
  flex-direction: row-reverse;
}
.kit-emotebar--top-right {
  right: calc(10px + var(--safe-right, env(safe-area-inset-right, 0px)));
  top: calc(10px + var(--safe-top, env(safe-area-inset-top, 0px)));
  flex-direction: row-reverse;
  align-items: flex-start;
}
.kit-emotebar--top-left {
  left: calc(10px + var(--safe-left, env(safe-area-inset-left, 0px)));
  top: calc(8px + var(--safe-top, env(safe-area-inset-top, 0px)));
  bottom: auto;
  flex-direction: row;
  align-items: flex-start;
}
.kit-emotebar--top-center {
  left: 50%;
  top: calc(8px + var(--safe-top, env(safe-area-inset-top, 0px)));
  bottom: auto;
  transform: translateX(-50%);
  flex-direction: column;
  align-items: center;
}
.kit-emotebar__toggle {
  position: relative;
  width: 52px;
  height: 52px;
  border: 4px solid var(--kit-outline);
  border-radius: 50%;
  background: #fff;
  font-size: 24px;
  box-shadow: 0 4px 0 var(--kit-outline);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.kit-emotebar__toggle:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--kit-outline); }
.kit-emotebar--compact .kit-emotebar__toggle { width: 44px; height: 44px; font-size: 19px; opacity: 0.85; }
.kit-emotebar__cd {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
  width: 0;
  background: rgba(27, 27, 47, 0.45);
  pointer-events: none;
}
@keyframes kit-emote-cd { from { width: 100%; } to { width: 0; } }
.kit-emotebar__panel {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(420px, 70vw);
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
  border: 4px solid var(--kit-outline);
  border-radius: 16px;
  background: var(--kit-panel);
  box-shadow: 0 5px 0 var(--kit-outline);
  touch-action: pan-y;
}
.kit-emotebar.is-open .kit-emotebar__panel { display: flex; animation: kit-pop 0.18s ease-out; }
.kit-emotebar.is-cooling .kit-emote { filter: grayscale(0.8); opacity: 0.55; }
.kit-emote {
  min-width: 48px;
  min-height: 44px;
  padding: 4px 10px;
  border: 3px solid var(--kit-outline);
  border-radius: 12px;
  background: #fff;
  color: var(--kit-ink);
  font-family: var(--kit-font);
  font-size: 10px;
  box-shadow: 0 3px 0 var(--kit-outline);
  cursor: pointer;
  touch-action: manipulation;
}
.kit-emote--emoji { font-family: inherit; font-size: 24px; padding: 2px 6px; }
.kit-emote:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--kit-outline); }

.kit-emote-bubble {
  position: absolute;
  z-index: 70;
  padding: 6px 10px;
  border: 3px solid var(--kit-outline);
  border-radius: 14px;
  background: #fff;
  color: var(--kit-ink);
  font-family: var(--kit-font);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
  transform: translate(-50%, calc(-100% - 12px));
  animation: kit-bubble 2200ms ease-out forwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.kit-emote-bubble--emoji { font-size: 28px; font-family: inherit; padding: 2px 8px; }
.kit-emote-bubble__name { font-family: var(--kit-font); font-size: 8px; opacity: 0.7; }
.kit-emote-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  margin-left: -8px;
  border: 8px solid transparent;
  border-top: 9px solid var(--kit-outline);
}
@keyframes kit-bubble {
  0% { transform: translate(-50%, calc(-100% - 4px)) scale(0.2); opacity: 0; }
  12% { transform: translate(-50%, calc(-100% - 14px)) scale(1.15); opacity: 1; }
  20% { transform: translate(-50%, calc(-100% - 12px)) scale(1); }
  75% { transform: translate(-50%, calc(-100% - 22px)) scale(1); opacity: 1; }
  100% { transform: translate(-50%, calc(-100% - 70px)) scale(0.9); opacity: 0; }
}

/* ------------------------------------------------------------------ Uno-Karten */
.kit-uno {
  --uc: #e63946;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  box-sizing: border-box;
  width: var(--kit-uno-w);
  height: calc(var(--kit-uno-w) * 1.5);
  font-size: calc(var(--kit-uno-w) / 4);
  padding: calc(var(--kit-uno-w) * 0.06);
  border: max(2px, calc(var(--kit-uno-w) * 0.035)) solid var(--kit-outline);
  border-radius: calc(var(--kit-uno-w) * 0.12);
  background: #fff;
  box-shadow: 0 calc(var(--kit-uno-w) * 0.05) 0 rgba(0, 0, 0, 0.35);
  user-select: none;
  -webkit-user-select: none;
  font-family: "Arial Black", "Segoe UI Black", Impact, system-ui, sans-serif;
  font-weight: 900;
  line-height: 1;
  vertical-align: top;
  transition: transform 0.12s;
}
.kit-uno--small { --kit-uno-w: 44px; }
.kit-uno--red { --uc: #e63946; }
.kit-uno--yellow { --uc: #ffc300; }
.kit-uno--green { --uc: #2a9d4b; }
.kit-uno--blue { --uc: #1d6fd8; }
.kit-uno--wild { --uc: #1b1b2f; }
.kit-uno__inner {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--kit-uno-w) * 0.07);
  background: var(--uc);
  overflow: hidden;
}
.kit-uno__oval {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  height: 92%;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%) rotate(28deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 max(1px, calc(var(--kit-uno-w) * 0.02)) rgba(0, 0, 0, 0.15);
}
.kit-uno__sym {
  transform: rotate(-28deg);
  font-size: 2.15em;
  color: var(--uc);
  -webkit-text-stroke: max(1px, calc(var(--kit-uno-w) * 0.022)) var(--kit-outline);
  text-shadow: calc(var(--kit-uno-w) * 0.03) calc(var(--kit-uno-w) * 0.03) 0 var(--kit-outline);
}
.kit-uno--v-skip .kit-uno__sym, .kit-uno--v-reverse .kit-uno__sym { font-size: 2.3em; }
.kit-uno--v-draw2 .kit-uno__sym { font-size: 1.8em; }
.kit-uno__u { text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.08em; }
.kit-uno__corner {
  position: absolute;
  font-size: 0.85em;
  color: #fff;
  -webkit-text-stroke: max(0.6px, calc(var(--kit-uno-w) * 0.012)) var(--kit-outline);
  text-shadow: calc(var(--kit-uno-w) * 0.015) calc(var(--kit-uno-w) * 0.015) 0 var(--kit-outline);
  z-index: 1;
}
.kit-uno__corner--tl { left: 7%; top: 5%; }
.kit-uno__corner--br { right: 7%; bottom: 5%; transform: rotate(180deg); }
.kit-uno--small .kit-uno__corner { display: none; }
.kit-uno--small .kit-uno__sym { font-size: 2em; }
/* vierfarbiges Oval für Farbwahl / +4 */
.kit-uno__oval--quad,
.kit-uno__quad-mini {
  background: conic-gradient(#e63946 0 25%, #1d6fd8 0 50%, #ffc300 0 75%, #2a9d4b 0 100%);
}
.kit-uno__oval--quad { box-shadow: 0 0 0 max(2px, calc(var(--kit-uno-w) * 0.035)) #fff; }
.kit-uno__quad-mini {
  display: inline-block;
  width: 0.8em;
  height: 1.05em;
  border-radius: 50%;
  border: max(1px, calc(var(--kit-uno-w) * 0.015)) solid #fff;
  transform: rotate(28deg);
}
.kit-uno__sym--plus4 { color: #fff; font-size: 1.7em; }
/* gewählte Farbe einer Farbwahlkarte */
.kit-uno--chosen-red { box-shadow: 0 0 0 4px #e63946, 0 4px 0 4px var(--kit-outline); }
.kit-uno--chosen-yellow { box-shadow: 0 0 0 4px #ffc300, 0 4px 0 4px var(--kit-outline); }
.kit-uno--chosen-green { box-shadow: 0 0 0 4px #2a9d4b, 0 4px 0 4px var(--kit-outline); }
.kit-uno--chosen-blue { box-shadow: 0 0 0 4px #1d6fd8, 0 4px 0 4px var(--kit-outline); }
/* Rückseite */
.kit-uno--back .kit-uno__inner { background: #1b1b2f; }
.kit-uno--back .kit-uno__oval { background: #e63946; box-shadow: none; }
.kit-uno__logo {
  transform: rotate(-28deg);
  font-family: var(--kit-font);
  font-size: 0.5em;
  color: var(--kit-gold);
  text-shadow: calc(var(--kit-uno-w) * 0.02) calc(var(--kit-uno-w) * 0.02) 0 var(--kit-outline);
  letter-spacing: 0.02em;
}
.kit-uno--small .kit-uno__logo { font-size: 0.42em; }
/* Zustände */
.kit-uno.is-playable { transform: translateY(-8%); box-shadow: 0 0 0 3px var(--kit-gold), 0 6px 0 rgba(0, 0, 0, 0.35); cursor: pointer; }
.kit-uno.is-selected { transform: translateY(-16%) scale(1.04); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--kit-outline); }
.kit-uno.is-disabled { filter: brightness(0.6) saturate(0.6); }

/* ------------------------------------------------------------------ Charaktereditor */
.editor-root {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(8px + var(--safe-top, env(safe-area-inset-top, 0px))) calc(10px + var(--safe-right, env(safe-area-inset-right, 0px)))
           calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px))) calc(10px + var(--safe-left, env(safe-area-inset-left, 0px)));
  box-sizing: border-box;
  gap: 8px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.editor-head { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.editor-title { flex: 1 1 auto; font-size: clamp(14px, 3.2vh, 26px); text-align: center; }
.editor-head__actions { display: flex; gap: 8px; }
.editor-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 38%) 1fr;
  gap: 10px;
}
.editor-preview {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 4px solid var(--kit-outline);
  border-radius: 20px;
  background:
    radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.6), transparent 60%),
    repeating-linear-gradient(45deg, #ffe9a8 0 14px, #ffdd80 14px 28px);
  box-shadow: var(--kit-shadow);
  overflow: hidden;
}
.editor-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.editor-name {
  text-align: center;
  font-family: var(--kit-font);
  font-size: 12px;
  color: var(--kit-ink);
  padding: 4px 6px 8px;
}
.editor-msg { position: absolute; left: 8px; right: 8px; top: 8px; text-align: center; font-family: var(--kit-font); font-size: 10px; color: var(--kit-ink); }
.editor-msg.is-error { color: #fff; background: var(--kit-bad); border: 3px solid var(--kit-outline); border-radius: 10px; padding: 6px; }
.editor-options {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 4px 6px 24px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.editor-section {
  border: 4px solid var(--kit-outline);
  border-radius: 16px;
  background: var(--kit-panel);
  padding: 8px;
  box-shadow: 0 4px 0 var(--kit-outline);
}
.editor-section__title { margin: 0 0 6px; font-family: var(--kit-font); font-size: 11px; color: var(--kit-ink); }
.editor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.editor-grid--colors { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
.editor-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 84px;
  padding: 4px 2px;
  border: 3px solid var(--kit-outline);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 0 var(--kit-outline);
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.editor-tile__fig { width: 56px; height: 56px; pointer-events: none; }
.editor-tile__label { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-weight: 800; font-size: 12px; color: var(--kit-ink); text-align: center; line-height: 1.3; pointer-events: none; }
.editor-tile.is-selected, .editor-swatch.is-selected {
  background: var(--kit-gold);
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--kit-outline), 0 0 0 3px #fff inset;
}
.editor-swatch {
  height: 48px;
  border: 3px solid var(--kit-outline);
  border-radius: 12px;
  background: var(--sw);
  box-shadow: 0 3px 0 var(--kit-outline);
  cursor: pointer;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}
.editor-swatch.is-selected { background: var(--sw); box-shadow: 0 0 0 3px #fff inset, 0 0 0 5px var(--kit-outline) inset; }
.editor-swatch.is-selected::after { content: "✔"; color: #fff; font-size: 20px; text-shadow: 0 0 3px #000, 2px 2px 0 var(--kit-outline); }

body.layout-phone .editor-head .kit-btn { font-size: 12px; padding: 0 10px; }
body.layout-tablet .editor-main { grid-template-columns: minmax(260px, 30%) 1fr; gap: 16px; }
body.layout-tablet .editor-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row dense;
  align-content: start;
  overflow-y: auto;
}
body.layout-tablet .editor-section--body,
body.layout-tablet .editor-section--color { grid-column: span 1; }
body.layout-tablet .editor-section--eyes { grid-column: span 1; }
body.layout-tablet .editor-section--hat,
body.layout-tablet .editor-section--accessory { grid-column: span 1; }
body.layout-tablet .editor-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
body.layout-tablet .editor-title { font-size: 28px; }
body.layout-tablet .editor-name { font-size: 16px; }

/* ------------------------------------------------------------------ Minispiel-Host */
.mghost-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #2b2d42;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.mghost-game, .mghost-mod { position: absolute; inset: 0; }
.mghost-fx, .mghost-bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
.mghost-bubbles { z-index: 65; }
.mghost-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(10px + var(--safe-top, env(safe-area-inset-top, 0px))) calc(12px + var(--safe-right, env(safe-area-inset-right, 0px)))
           calc(10px + var(--safe-bottom, env(safe-area-inset-bottom, 0px))) calc(12px + var(--safe-left, env(safe-area-inset-left, 0px)));
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 210, 63, 0.25), transparent 60%),
    repeating-conic-gradient(from 0deg at 50% 50%, #3a2f6b 0 10deg, #2b2d42 10deg 20deg);
  transition: opacity 0.3s;
}
.mghost-screen[hidden] { display: none; }
.mghost-screen.is-dim { opacity: 0.55; }
.mghost-panel {
  width: min(100%, 920px);
  max-height: 100%;
  overflow-y: auto;
  touch-action: pan-y;
  box-sizing: border-box;
  padding: 12px 16px;
  border: 4px solid var(--kit-outline);
  border-radius: 22px;
  background: var(--kit-panel);
  box-shadow: 0 7px 0 var(--kit-outline);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: kit-pop 0.3s ease-out;
}
.mghost-wait, .mghost-missing { align-items: center; padding: 30px; width: auto; }
.mghost-missing { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); animation: none; }
.mghost-kind {
  align-self: center;
  padding: 4px 10px;
  border: 3px solid var(--kit-outline);
  border-radius: 10px;
  background: var(--kit-accent);
  color: #fff;
  font-family: var(--kit-font);
  font-size: 11px;
}
.mghost-title, .mghost-banner { text-align: center; font-size: clamp(16px, 5vh, 34px); }
.mghost-banner.is-win { color: var(--kit-gold); animation: kit-wobble 0.6s ease-in-out infinite; }
.mghost-intro__body { display: flex; gap: 14px; align-items: flex-start; min-height: 0; }
.mghost-intro__info { flex: 1 1 55%; min-width: 0; }
.mghost-text { margin: 0 0 8px; font-size: clamp(13px, 2.6vh, 18px); line-height: 1.35; color: var(--kit-ink); font-weight: 600; }
.mghost-controls { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.mghost-controls li {
  padding: 5px 8px 5px 30px;
  position: relative;
  border: 3px solid var(--kit-outline);
  border-radius: 10px;
  background: #fff;
  font-size: clamp(11px, 2.2vh, 15px);
  color: var(--kit-ink);
}
.mghost-controls li::before { content: "🎮"; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); font-size: 14px; }
.mghost-players { flex: 1 1 45%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: flex-start; }
.mghost-player {
  position: relative;
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px 6px;
  border: 3px solid var(--kit-outline);
  border-radius: 12px;
  background: #fff;
}
.mghost-player.is-me { background: #fff1b8; }
.mghost-player .kit-badge { position: absolute; top: -8px; right: -6px; }
.mghost-player__name, .mghost-res__name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 800;
  font-size: 13px; /* war 8 px Pixelschrift – auf dem Handy unlesbar */
  color: var(--kit-ink);
  margin-top: 2px;
}
.mghost-fig { display: flex; justify-content: center; }
.mghost-specnote { text-align: center; font-family: var(--kit-font); font-size: 11px; color: var(--kit-ink); padding: 6px; background: #d7f3ff; border: 3px solid var(--kit-outline); border-radius: 10px; }
.mghost-specnote--small { font-size: 9px; background: transparent; border: 0; padding: 0; }
.mghost-spec-tag {
  position: absolute;
  z-index: 55;
  top: calc(8px + var(--safe-top, env(safe-area-inset-top, 0px)));
  right: calc(10px + var(--safe-right, env(safe-area-inset-right, 0px)));
  padding: 5px 8px;
  border: 3px solid var(--kit-outline);
  border-radius: 10px;
  background: #d7f3ff;
  font-family: var(--kit-font);
  font-size: 9px;
  color: var(--kit-ink);
  pointer-events: none;
}
.mghost-spec-tag[hidden] { display: none; }

/* Countdown */
.mghost-count {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--kit-font);
  font-weight: bold;
  font-size: min(34vh, 220px);
  color: var(--kit-gold);
  opacity: 0;
  text-shadow:
    6px 0 0 var(--kit-outline), -6px 0 0 var(--kit-outline), 0 6px 0 var(--kit-outline), 0 -6px 0 var(--kit-outline),
    6px 6px 0 var(--kit-outline), -6px 6px 0 var(--kit-outline), 6px -6px 0 var(--kit-outline), -6px -6px 0 var(--kit-outline),
    0 14px 0 rgba(0, 0, 0, 0.4);
}
.mghost-count.is-on { animation: mghost-count 0.9s ease-out forwards; }
.mghost-count.is-go { color: #7CFF6B; font-size: min(26vh, 170px); animation: mghost-go 0.85s ease-out forwards; }
@keyframes mghost-count {
  0% { opacity: 0; transform: scale(2.2); }
  18% { opacity: 1; transform: scale(0.9); }
  30% { transform: scale(1.05); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.7); }
}
@keyframes mghost-go {
  0% { opacity: 0; transform: scale(0.4) rotate(-8deg); }
  25% { opacity: 1; transform: scale(1.2) rotate(3deg); }
  70% { opacity: 1; transform: scale(1) rotate(0); }
  100% { opacity: 0; transform: scale(1.6); }
}

/* Ergebnis */
.mghost-podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.mghost-res {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 4px;
  border-radius: 12px;
}
.mghost-res--podium { width: min(30%, 190px); }
.mghost-res--podium.is-me .mghost-res__step { box-shadow: 0 0 0 4px #fff inset; }
.mghost-res__medal { font-size: 26px; line-height: 1; font-family: var(--kit-font); color: var(--kit-ink); }
.mghost-res__score { font-family: system-ui, -apple-system, sans-serif; font-weight: 700; font-size: 12px; color: var(--kit-ink); margin-top: 2px; }
.mghost-res__step {
  width: 100%;
  margin-top: 4px;
  border: 4px solid var(--kit-outline);
  border-radius: 10px 10px 4px 4px;
  background: repeating-linear-gradient(90deg, #c0c6d0 0 12px, #aeb5c0 12px 24px);
  box-shadow: 0 4px 0 var(--kit-outline);
}
.mghost-res--p1 .mghost-res__step { height: 54px; background: repeating-linear-gradient(90deg, #ffd23f 0 12px, #ffc300 12px 24px); }
.mghost-res--p2 .mghost-res__step { height: 36px; }
.mghost-res--p3 .mghost-res__step { height: 22px; background: repeating-linear-gradient(90deg, #d9955a 0 12px, #c07f45 12px 24px); }
.mghost-res--p4 .mghost-res__step { height: 14px; }
.mghost-res--p1 .mghost-fig { animation: kit-wobble 0.7s ease-in-out infinite; }
.mghost-reward {
  margin: 3px 0 0;
  padding: 3px 6px;
  list-style: none;
  border: 3px solid var(--kit-outline);
  border-radius: 8px;
  background: #e9ffe9;
  font-size: 13px;
  font-weight: 700;
  color: #145c2a;
  text-align: center;
}
.mghost-reslist { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.mghost-reslist .mghost-res {
  flex-direction: row;
  gap: 6px;
  border: 3px solid var(--kit-outline);
  background: #fff;
  padding: 3px 8px;
}
.mghost-reslist .mghost-res.is-me { background: #fff1b8; }
.mghost-reslist .mghost-res__medal { font-size: 12px; }
.mghost-reslist .mghost-reward { margin: 0; }
.kit-progress--down .kit-progress__bar { width: 100%; }

body.layout-phone .mghost-panel { padding: 8px 10px; gap: 6px; border-radius: 16px; }
body.layout-phone .mghost-player { width: 64px; }
body.layout-phone .mghost-player .kit-char { width: 46px; height: 46px; }
body.layout-phone .mghost-res--podium .kit-char { width: 54px; height: 54px; }
body.layout-phone .mghost-res--p1 .mghost-res__step { height: 38px; }
body.layout-phone .mghost-res--p2 .mghost-res__step { height: 24px; }
body.layout-phone .mghost-res--p3 .mghost-res__step { height: 14px; }
body.layout-phone .mghost-reward { font-size: 12px; }
body.layout-tablet .mghost-panel { padding: 18px 24px; gap: 12px; }
body.layout-tablet .mghost-player { width: 96px; }
body.layout-tablet .mghost-player .kit-char { width: 76px; height: 76px; }
body.layout-tablet .mghost-player__name, body.layout-tablet .mghost-res__name { font-size: 15px; }
body.layout-tablet .mghost-res--podium .kit-char { width: 96px; height: 96px; }
body.layout-tablet .mghost-res__medal { font-size: 34px; }
body.layout-tablet .mghost-kind { font-size: 13px; }
body.layout-tablet .kit-uno { --kit-uno-w: 92px; }
body.layout-tablet .kit-uno--small { --kit-uno-w: 56px; }

@media (prefers-reduced-motion: reduce) {
  .mghost-banner.is-win, .mghost-res--p1 .mghost-fig, .kit-btn.is-pulsing { animation: none; }
}

/* Skip-Karte im Minispiel-Intro (Brett: Mystery Box / Flaschendrehen) */
.mghost-skip { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 6px 0; }
.mghost-skip:empty { display: none; }
.mghost-skip__btn { min-height: 48px; padding: 8px 16px; background: #ffd23f; color: #1b1b2f; font-weight: 700; animation: mghost-skip-pulse 0.8s ease-in-out infinite alternate; }
.mghost-skip__btn:disabled { opacity: 0.6; animation: none; }
.mghost-skip__note { padding: 4px 10px; border-radius: 10px; background: rgba(255, 210, 63, 0.25); font-size: 14px; text-align: center; }
@keyframes mghost-skip-pulse { from { transform: scale(1); } to { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .mghost-skip__btn { animation: none; } }

/* Minispiel-Pause (Host/Admin) */
.mghost-pausebtn { position: absolute; z-index: 60; top: calc(var(--safe-top, 0px) + 6px); right: calc(var(--safe-right, 0px) + 6px); width: 46px; height: 46px; border: 3px solid var(--kit-outline, #1b1b2f); border-radius: 12px; background: #fff6e0; font-size: 20px; box-shadow: 0 3px 0 var(--kit-outline, #1b1b2f); touch-action: manipulation; }
.mghost-pause { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgba(27, 27, 47, 0.62); pointer-events: auto; touch-action: none; }
.mghost-pause[hidden] { display: none; }
.mghost-pause__box { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 18px 24px; }
.mghost-pause__go { min-width: 160px; min-height: 52px; font-size: 18px; }
.mghost-pause__count { font-size: 56px; font-weight: 800; }