/* Mal & Rate – alle Klassen mit Präfix .mg-paint- */
.mg-paint {
  --ink: var(--c-outline, #1b1b2f);
  --btn: 30px;
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  padding: var(--safe-top, 0px) var(--safe-right, 0px) var(--safe-bottom, 0px) var(--safe-left, 0px);
  background: radial-gradient(ellipse at 50% 30%, #2ec4b6 0%, #168a87 55%, #0b4f5c 100%);
  color: #fff; font-family: system-ui, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; overflow: hidden;
}
.mg-paint.mg-paint-tablet { --btn: 46px; }
:where(.mg-paint) button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Kopfzeile */
/* rechts Platz für den Pause-Knopf, Mitte frei für den Emote-Knopf des Hosts */
.mg-paint-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 64px 4px 8px; min-width: 0; }
.mg-paint-center { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; gap: 2px; }
.mg-paint-title {
  font-weight: 900; font-size: 13px; padding: 4px 8px; border-radius: 10px; white-space: nowrap;
  background: var(--c-gold, #ffd23f); color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
}
.mg-paint-turn { opacity: .7; margin-left: 4px; }
.mg-paint-word { flex: 1; min-width: 0; text-align: center; font-weight: 900; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-paint-word small { font-size: 12px; font-weight: 700; opacity: .85; }
.mg-paint-mask { letter-spacing: .3em; font-family: ui-monospace, monospace; }
.mg-paint-secret { color: var(--c-gold, #ffd23f); text-transform: uppercase; letter-spacing: .05em; }
.mg-paint-time { display: flex; align-items: center; gap: 6px; }
.mg-paint-time b { min-width: 2ch; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.mg-paint-timebar { width: 70px; height: 12px; border-radius: 6px; background: rgba(0,0,0,.35); border: 2px solid var(--ink); overflow: hidden; }
.mg-paint-timebar i { display: block; height: 100%; background: #06d6a0; transform-origin: left; }
.mg-paint-hurry .mg-paint-timebar i { background: #e63946; }
.mg-paint-hurry .mg-paint-time b { color: #ffd23f; }
.mg-paint-tablet .mg-paint-word { font-size: 26px; }
.mg-paint-tablet .mg-paint-title { font-size: 16px; }
.mg-paint-tablet .mg-paint-timebar { width: 120px; height: 16px; }

/* Hauptbereich: Werkzeuge | Zeichenfläche | Punkte + Chat */
.mg-paint-main { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(150px, 30%); gap: 6px; padding: 0 6px 6px; min-height: 0; }
.mg-paint-tools {
  display: grid; grid-template-columns: repeat(2, var(--btn)); grid-auto-rows: var(--btn); gap: 4px; align-content: center;
  visibility: hidden;
}
.mg-paint.is-painter .mg-paint-tools { visibility: visible; }
.mg-paint-tools button {
  border: 2px solid var(--ink); border-radius: 8px; background: rgba(255,255,255,.9); padding: 0;
  display: grid; place-items: center; font-size: calc(var(--btn) * .5); color: var(--ink);
}
.mg-paint-tools button.on { outline: 3px solid var(--c-gold, #ffd23f); outline-offset: 1px; }
.mg-paint-col { background: var(--c) !important; }
.mg-paint-size i { display: block; width: var(--s); height: var(--s); border-radius: 50%; background: var(--ink); }
.mg-paint-stage { position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; }
.mg-paint-canvas {
  display: block; background: #fff; border: 3px solid var(--ink); border-radius: 8px; box-shadow: 4px 4px 0 var(--ink);
  touch-action: none; -webkit-touch-callout: none;
}
.mg-paint.is-painter .mg-paint-canvas { cursor: crosshair; }
.mg-paint-ov { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.mg-paint-ov[hidden] { display: none; }
.mg-paint-card {
  background: rgba(27,27,47,.92); border: 3px solid var(--ink); border-radius: 14px; padding: 12px 18px; text-align: center;
  max-width: 90%; animation: mg-paint-pop .25s ease-out; display: grid; gap: 6px;
}
.mg-paint-big { font-size: 28px; font-weight: 900; color: var(--c-gold, #ffd23f); text-transform: uppercase; }
.mg-paint-next { opacity: .85; font-size: 13px; }
.mg-paint-rank { font-weight: 700; }
.mg-paint-rank.win { color: var(--c-gold, #ffd23f); font-size: 1.15em; }
@keyframes mg-paint-pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.mg-paint-side { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 4px; min-height: 0; }
.mg-paint-scores { display: flex; flex-wrap: wrap; gap: 3px; max-height: 30vh; overflow-y: auto; align-content: flex-start; }
.mg-paint-sc {
  display: flex; gap: 6px; justify-content: space-between; flex: 1 1 45%; min-width: 0;
  background: rgba(0,0,0,.3); border-radius: 6px; padding: 2px 6px; font-size: 12px;
}
.mg-paint-sc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mg-paint-sc.me { background: rgba(58,134,255,.6); }
.mg-paint-sc.off { opacity: .45; }
.mg-paint-chat {
  background: rgba(0,0,0,.3); border-radius: 8px; padding: 4px 6px; overflow-y: auto; font-size: 12px;
  touch-action: pan-y; user-select: text; -webkit-user-select: text;
}
.mg-paint-msg { padding: 1px 0; overflow-wrap: anywhere; }
.mg-paint-msg.ok { color: #06d6a0; font-weight: 700; }
.mg-paint-msg.sys { color: #ffd23f; }
.mg-paint-msg.me b { color: #9cc3ff; }
.mg-paint-form { display: flex; gap: 4px; }
.mg-paint-input {
  flex: 1; min-width: 0; font-size: 16px; /* 16px: iOS zoomt sonst beim Fokus */
  padding: 6px 8px; border-radius: 8px; border: 2px solid var(--ink); touch-action: manipulation; user-select: text; -webkit-user-select: text;
}
.mg-paint-send { width: 40px; border-radius: 8px; border: 2px solid var(--ink); background: var(--c-gold, #ffd23f); color: var(--ink) !important; font-weight: 900; }
.mg-paint-input:disabled, .mg-paint-send:disabled { opacity: .5; }
.mg-paint-tablet .mg-paint-chat, .mg-paint-tablet .mg-paint-sc { font-size: 15px; }
.mg-paint-tablet .mg-paint-scores { margin-right: 56px; } /* Pause-Knopf oben rechts */
