/* ===== Strafen-Orakel – Shell Styles ===== */
:root {
  --bg: #0f1020;
  --bg2: #16182e;
  --panel: #1c1e3a;
  --panel2: #262950;
  --fg: #f4f4ff;
  --muted: #9b9ec6;
  --accent: #ff5c8a;
  --accent2: #ffb347;
  --ok: #38d39f;
  --danger: #ff4d4d;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --header-h: 72px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(1200px 800px at 20% -10%, #2a1f5a 0%, transparent 60%),
              radial-gradient(1000px 700px at 110% 110%, #3a1d3f 0%, transparent 60%),
              var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button { font-family: inherit; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #ff7a59);
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,92,138,.35);
  transition: transform .08s ease, filter .15s ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.ghost {
  background: rgba(255,255,255,.08);
  color: var(--fg);
  box-shadow: none;
}
.btn.ghost:hover { background: rgba(255,255,255,.14); }
.btn.big { font-size: 20px; padding: 16px 32px; }
.btn.ok { background: linear-gradient(135deg, var(--ok), #2bb6c6); box-shadow: 0 4px 14px rgba(56,211,159,.35); }
.btn.danger { background: linear-gradient(135deg, var(--danger), #ff7a59); }

/* ---- Header ---- */
#topbar {
  position: relative;
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 16px;
  background: rgba(10,10,25,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  z-index: 20;
  flex: 0 0 auto;
}
#topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#topbar .spacer { flex: 1; }
.offender {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.offender input {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  width: 170px;
  outline: none;
}
.offender input:focus { border-color: var(--accent); }

/* ---- Hub ---- */
#hub {
  flex: 1;
  overflow: auto;
  padding: 28px clamp(16px, 4vw, 56px) 48px;
}
#hub .intro {
  max-width: 900px;
  margin: 0 auto 24px;
  text-align: center;
}
#hub .intro h2 {
  font-size: clamp(28px, 4.5vw, 44px);
  margin: 0 0 8px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#hub .intro p { color: var(--muted); margin: 0 0 14px; font-size: 17px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  max-width: 1300px;
  margin: 0 auto;
}
.card {
  background: linear-gradient(160deg, var(--panel), var(--bg2));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 190px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
  text-align: left;
  color: var(--fg);
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-4px) scale(1.01); border-color: var(--accent); box-shadow: var(--shadow); }
.card .emoji { font-size: 46px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
.card h3 { margin: 6px 0 0; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; flex: 1; }
.card .num {
  position: absolute; top: 12px; right: 14px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: rgba(255,255,255,.06); border-radius: 999px; padding: 3px 9px;
}
.card.random { border-style: dashed; justify-content: center; align-items: center; text-align: center; }

/* ---- Stage ---- */
#stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
}
#stage-root {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#stage-root canvas { display: block; }
#stage-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.45); color: var(--fg); padding: 8px 16px; border-radius: 999px;
  font-size: 14px; pointer-events: none; z-index: 5; width: max-content; max-width: 90vw; text-align: center;
  transition: opacity .3s;
}
#stage-hint.hidden { opacity: 0; }

/* ---- Verdict overlay ---- */
#verdict {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,5,20,.72);
  backdrop-filter: blur(6px);
  animation: fadeIn .25s ease;
}
#verdict .box {
  background: linear-gradient(160deg, #2a2260, #171a3a);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 36px 40px 30px;
  max-width: min(760px, 92vw);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: popIn .45s cubic-bezier(.2,1.4,.4,1);
}
#verdict .kicker { color: var(--accent2); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }
#verdict .who { font-size: clamp(20px, 3vw, 28px); margin: 10px 0 4px; color: var(--muted); }
#verdict .who b { color: var(--fg); }
#verdict .result {
  font-size: clamp(26px, 4.6vw, 46px);
  font-weight: 900;
  line-height: 1.15;
  margin: 14px 0 8px;
  background: linear-gradient(90deg, #fff, var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#verdict .sub { color: var(--muted); font-size: 16px; margin-bottom: 22px; min-height: 1.2em; }
#verdict .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }

/* ---- Dialogs ---- */
dialog {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  background: var(--panel);
  color: var(--fg);
  padding: 0;
  width: min(680px, 94vw);
  max-height: 90vh;
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
dialog .dlg-head { padding: 18px 22px 8px; font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; }
dialog .dlg-body { padding: 8px 22px 14px; overflow: auto; max-height: 60vh; }
dialog .dlg-foot { padding: 12px 22px 18px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid rgba(255,255,255,.08); }
dialog textarea {
  width: 100%; min-height: 320px; resize: vertical;
  background: rgba(0,0,0,.35); color: var(--fg);
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; line-height: 1.5; font-family: inherit;
  outline: none;
}
dialog textarea:focus { border-color: var(--accent); }
dialog .hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
table.log { width: 100%; border-collapse: collapse; font-size: 14px; }
table.log th, table.log td { text-align: left; padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.08); vertical-align: top; }
table.log th { color: var(--muted); font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* ---- Utilities generators may use ---- */
.p-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.p-title { font-size: clamp(22px, 3.5vw, 36px); font-weight: 900; margin: 0; text-align: center; }
.p-sub { color: var(--muted); text-align: center; margin: 0; font-size: 16px; }
.p-panel { background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 16px 20px; }
.p-legend { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,.5); border-radius: 12px; padding: 10px 14px; font-size: 13px; max-width: 300px; z-index: 4; line-height: 1.5; }
.p-legend b { color: var(--accent2); }

@media (max-width: 700px) {
  #topbar { gap: 6px 8px; padding: 6px 10px; }
  #topbar .spacer { display: none; }
  .offender { flex: 1 1 100%; order: 10; }
  .offender input { flex: 1; width: auto; }
  #topbar h1 { font-size: 16px; }
  .offender span { display: none; }
  .offender input { width: 110px; }
  .btn { padding: 8px 12px; font-size: 13px; }
  #verdict .box { padding: 26px 18px 20px; }
}

/* ===== Erweiterungen: Porträts, harte Strafen, Freispruch, Easter Egg ===== */
#topbar .lbl { display: inline; }
@media (max-width: 1000px) { #topbar .lbl { display: none; } }

.card .badge {
  align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--ok);
  background: rgba(56,211,159,.12); border: 1px solid rgba(56,211,159,.3); border-radius: 999px; padding: 3px 9px; margin-top: 4px;
}



/* Rundes Porträt (DOM) */
.p-portrait {
  border-radius: 50%; background-size: cover; background-position: center; background-repeat: no-repeat;
  border: 0; box-shadow: 0 6px 18px rgba(0,0,0,.45);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; overflow: hidden;
  box-sizing: border-box; line-height: 1;
}

/* Porträt-Dialog */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.pcell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; background: rgba(0,0,0,.25); border-radius: 14px; padding: 12px 8px 10px; }
.pcell input { width: 100%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--fg); border-radius: 8px; padding: 6px 8px; font-size: 13px; text-align: center; outline: none; }
.pcell input:focus { border-color: var(--accent); }
.pcell .pdel { position: absolute; top: 6px; right: 6px; border: 0; background: rgba(255,77,77,.85); color: #fff; border-radius: 50%; width: 22px; height: 22px; font-size: 12px; cursor: pointer; line-height: 22px; padding: 0; }
dialog.drop { outline: 3px dashed var(--ok); outline-offset: -8px; }
.crop-body { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#crop-canvas { border-radius: 12px; cursor: grab; touch-action: none; background: #111; }
#crop-canvas:active { cursor: grabbing; }
.crop-row { display: flex; align-items: center; gap: 10px; width: 300px; font-size: 14px; color: var(--muted); }
.crop-row input[type=range] { flex: 1; accent-color: var(--accent); }
.crop-row input[type=text] { flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); color: var(--fg); border-radius: 8px; padding: 8px 10px; font-size: 15px; outline: none; }

/* Urteil: Porträt, harte Strafe, Freispruch */
#verdict .portrait { display: flex; justify-content: center; margin: 14px 0 4px; }
#verdict .box.hard {
  background: linear-gradient(160deg, #4a1020, #1a0a12);
  border-color: rgba(255,90,60,.5);
  animation: popIn .45s cubic-bezier(.2,1.4,.4,1), hardPulse 1.1s ease-in-out infinite .45s;
}
#verdict .box.hard .kicker { color: #ff6a4d; }
#verdict .box.hard .result { background: linear-gradient(90deg, #fff1c4, #ff7a1a 60%, #ff2e2e); -webkit-background-clip: text; background-clip: text; }
#verdict .box.hard::before {
  content: '🔥🔥🔥🔥🔥'; position: absolute; left: 0; right: 0; top: -22px; text-align: center; font-size: 30px; letter-spacing: 14px;
  animation: flicker .5s ease-in-out infinite alternate; pointer-events: none;
}
#verdict .box { position: relative; }
#verdict .box.escaped { background: linear-gradient(160deg, #0f3d34, #101b2e); border-color: rgba(56,211,159,.5); }
#verdict .box.escaped .kicker { color: var(--ok); }
#verdict .box.escaped .result { background: linear-gradient(90deg, #fff, #38d39f); -webkit-background-clip: text; background-clip: text; }
@keyframes hardPulse {
  0%, 100% { box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 0 rgba(255,60,40,.0); }
  50% { box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 60px 10px rgba(255,60,40,.45); }
}
@keyframes flicker {
  from { transform: translateY(0) scaleY(1); opacity: .85; filter: hue-rotate(0deg); }
  to { transform: translateY(-4px) scaleY(1.12); opacity: 1; filter: hue-rotate(-12deg); }
}

/* Harte Strafe – wiederverwendbarer DOM-Effekt für Generatoren */
.p-hard {
  position: relative;
  border-color: #ff5a3c !important;
  animation: hardGlow .9s ease-in-out infinite;
}
.p-hard::after {
  content: '🔥🔥🔥'; position: absolute; left: 50%; top: -0.9em; transform: translateX(-50%);
  font-size: 1.25em; letter-spacing: .25em; line-height: 1; pointer-events: none;
  animation: flicker .45s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px rgba(255,120,0,.8));
}
.p-hard.p-hard-small::after { font-size: .9em; letter-spacing: .1em; }
.p-hard-text {
  background: linear-gradient(90deg, #fff1c4, #ff7a1a 60%, #ff2e2e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: hardText .8s ease-in-out infinite alternate;
}
@keyframes hardGlow {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(255,80,40,.35), inset 0 0 12px rgba(255,80,40,.15); }
  50% { box-shadow: 0 0 26px 6px rgba(255,80,40,.75), inset 0 0 22px rgba(255,120,40,.35); }
}
@keyframes hardText { from { filter: brightness(1) drop-shadow(0 0 2px rgba(255,80,0,.6)); } to { filter: brightness(1.25) drop-shadow(0 0 10px rgba(255,80,0,.95)); } }

/* ===== Logo, Ordner „Weitere Spiele“, Freisteller-Porträts ===== */
/* Logo immer in der Mitte der Kopfzeile, größer */
.logo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; background: #fff; border-radius: 12px; padding: 6px 14px;
  height: 56px; cursor: pointer; text-decoration: none; z-index: 2;
}
.logo img { height: 100%; width: auto; display: block; }
#topbar h1 { font-size: 20px; max-width: 30vw; }
@media (max-width: 900px) { .logo { height: 42px; padding: 4px 9px; border-radius: 9px; } #topbar h1 { max-width: 24vw; } }
/* Schmal: Logo bekommt eine eigene, zentrierte Zeile, damit es nichts überlappt */
@media (max-width: 640px) {
  .logo { position: static; transform: none; height: 36px; padding: 3px 8px; flex: 0 0 100%; order: -1; margin: 0 auto; justify-content: center; }
  #topbar h1 { display: none; }
  #topbar { justify-content: center; }
}

.folder-bar { max-width: 1300px; margin: 0 auto 18px; display: flex; align-items: center; gap: 14px; }
.folder-bar h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); }
.card.folder { border-style: dashed; }
.card.folder .emoji { font-size: 40px; }
.card.folder .mini { font-size: 22px; letter-spacing: 4px; line-height: 1.3; word-break: break-all; }

/* Freisteller: kein Kreis, weiße Sticker-Kontur */
.p-portrait.cutout {
  border: 0 !important; border-radius: 0; background-color: transparent !important; background-size: contain !important; box-shadow: none;
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 6px 10px rgba(0,0,0,.45));
}
.crop-check { color: var(--fg); cursor: pointer; }
.crop-check input { accent-color: var(--ok); width: 18px; height: 18px; }

/* Kopfzeile bleibt bis 1280 px einzeilig */
@media (max-width: 1400px) {
  .offender span { display: none; }
  .offender input { width: 150px; }
  #topbar h1 { font-size: 18px; }
}

/* ===== Namens-Modal, Schummel-Szenarien, Porträts ohne Rand ===== */
.linky { background: none; border: 0; color: var(--accent2); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; opacity: .55; }
.linky:hover { opacity: 1; }

.cheat-corner { position: fixed; right: 22px; bottom: 6px; z-index: 15; display: flex; gap: 8px; }
.cheat-num {
  background: none; border: 0; color: rgba(255,255,255,.14); font-size: 12px; line-height: 1;
  cursor: default; padding: 4px 3px; user-select: none;
}
.cheat-num:hover { color: rgba(255,255,255,.3); }

.name-body { display: flex; flex-direction: column; gap: 12px; }
.name-game { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; }
.name-game .em { font-size: 30px; }
#name-input {
  background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.16); color: var(--fg);
  border-radius: 12px; padding: 14px 16px; font-size: 22px; font-family: inherit; outline: none; width: 100%;
}
#name-input:focus { border-color: var(--accent); }
.name-faces { display: flex; flex-wrap: wrap; gap: 8px; }
.name-faces button {
  display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  color: var(--fg); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; font-size: 14px;
}
.name-faces button:hover { background: rgba(255,255,255,.15); border-color: var(--accent); }
.name-faces button.on { border-color: var(--ok); background: rgba(56,211,159,.15); }

.cheat-rows { display: flex; flex-direction: column; gap: 10px; }
.cheat-row { display: flex; align-items: center; gap: 12px; }
.cheat-row span {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.08);
  display: grid; place-items: center; font-weight: 800; color: var(--accent2);
}
.cheat-row input {
  flex: 1; background: rgba(0,0,0,.35); border: 1px solid rgba(255,255,255,.14); color: var(--fg);
  border-radius: 10px; padding: 10px 12px; font-size: 16px; font-family: inherit; outline: none;
}
.cheat-row input:focus { border-color: var(--accent); }

/* Gesichter ohne weißen Rand; transparente PNGs „contain“ */
.p-portrait.ringed { border-style: solid; border-width: 3px; }
.p-portrait.alpha { background-size: contain; background-color: transparent !important; border-radius: 0; box-shadow: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
