/* crabucate — Gruppen-Zufallsgenerator im Browser.
 * Eingebunden von guides/zufallsgruppen-generator.html und
 * en/guides/random-group-generator.html, nach base.css und dem Inline-Style
 * der Seite. Farben kommen aus den Tokens, die Gruppenfarben aus --c.
 */

.gg {
  /* bricht aus der 720px-Artikelspalte auf bis zu 960px aus */
  margin: 0 calc(50% - min(480px, 50vw - 1.25rem)) 3.5rem;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: clamp(1.25rem, 3.5vw, 2.25rem);
  box-shadow: 0 2px 10px rgba(176,77,28,0.06), 0 24px 60px -20px rgba(36,31,26,0.18);
  position: relative;
  overflow: hidden;
}
.gg::before {
  content: '';
  position: absolute; inset: -40% -20% auto auto;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--tz) 22%, transparent), transparent 65%);
  pointer-events: none;
}
.gg > * { position: relative; }

.gg-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(1.25rem, 3vw, 2.25rem); align-items: start; }

.gg-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.6rem;
}
.gg-count {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0; text-transform: none;
  background: color-mix(in srgb, var(--tz) 16%, transparent); color: var(--tz-text);
  border-radius: 100px; padding: 0.1rem 0.55rem; min-width: 1.6rem; text-align: center;
}

.gg textarea {
  width: 100%; min-height: 15rem; resize: vertical;
  font: inherit; font-size: 0.95rem; line-height: 1.6;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 0.9rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.gg textarea::placeholder { color: var(--muted); opacity: 0.8; }
.gg textarea:focus { outline: none; border-color: var(--tz); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tz) 18%, transparent); }

.gg-link {
  margin-top: 0.6rem; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--tz-text);
}
.gg-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.gg-controls { display: flex; flex-direction: column; gap: 1.1rem; }

.gg-seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 4px;
}
.gg-seg button {
  font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-radius: 10px; padding: 0.6rem 0.4rem; cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.gg-seg button[aria-checked="true"] { background: var(--card-bg); color: var(--fg); box-shadow: 0 1px 3px rgba(36,31,26,0.12); }

.gg-stepper {
  display: grid; grid-template-columns: 3.25rem 1fr 3.25rem; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 0.4rem;
}
.gg-stepper button {
  height: 3.25rem; border: 0; border-radius: 13px; cursor: pointer;
  font: inherit; font-size: 1.5rem; font-weight: 500; line-height: 1;
  background: var(--card-bg); color: var(--fg); box-shadow: 0 1px 3px rgba(36,31,26,0.1);
  transition: transform 0.12s;
}
.gg-stepper button:active { transform: scale(0.94); }
.gg-stepper button:disabled { opacity: 0.35; cursor: default; }
.gg-stepper output {
  text-align: center; font-size: 2.6rem; font-weight: 800; letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.gg-stepper-note { text-align: center; font-size: 0.78rem; color: var(--muted); margin-top: -0.4rem; min-height: 1.2em; }

.gg-go {
  font: inherit; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em;
  color: #fff; border: 0; border-radius: 16px; padding: 1.05rem 1.25rem; cursor: pointer;
  background: linear-gradient(180deg, #F7944F, #E8622C);
  box-shadow: 0 10px 24px -8px rgba(232,98,44,0.6), inset 0 1px 0 rgba(255,255,255,0.25);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.gg-go:hover { transform: translateY(-1px); box-shadow: 0 14px 30px -8px rgba(232,98,44,0.7), inset 0 1px 0 rgba(255,255,255,0.25); }
.gg-go:active { transform: translateY(1px) scale(0.99); }
.gg-go svg { width: 18px; height: 18px; }
.gg-go.is-rolling svg { animation: gg-spin 0.6s linear infinite; }
@keyframes gg-spin { to { transform: rotate(360deg); } }

.gg-error { font-size: 0.82rem; color: #C2410C; min-height: 1.2em; margin-top: -0.4rem; }

/* ── Ergebnis ── */
.gg-result { margin-top: clamp(1.75rem, 4vw, 2.5rem); padding-top: clamp(1.5rem, 3.5vw, 2rem); border-top: 1px solid var(--line); }
.gg-result[hidden] { display: none; }
.gg-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1.25rem; }
.gg-summary { font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.gg-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gg-actions button {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 100px;
  padding: 0.5rem 0.9rem; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.gg-actions button:hover { border-color: var(--tz); }
.gg-actions svg { width: 15px; height: 15px; }
.gg-actions [hidden] { display: none; }

.gg-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.9rem; }

.gg-card {
  --c: #3B82F6;
  border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 7%, var(--card-bg));
  border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.gg-card:nth-child(10n+2) { --c: #EF4444; }
.gg-card:nth-child(10n+3) { --c: #22A355; }
.gg-card:nth-child(10n+4) { --c: #F59E0B; }
.gg-card:nth-child(10n+5) { --c: #A855F7; }
.gg-card:nth-child(10n+6) { --c: #14B8A6; }
.gg-card:nth-child(10n+7) { --c: #EC4899; }
.gg-card:nth-child(10n+8) { --c: #6366F1; }
.gg-card:nth-child(10n+9) { --c: #65A30D; }
.gg-card:nth-child(10n+10) { --c: #F97316; }

.gg-card h3 {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0; padding: 0.6rem 0.9rem;
  font-size: 0.85rem; font-weight: 700; color: #fff; background: var(--c);
}
.gg-card h3 span { font-size: 0.75rem; font-weight: 600; opacity: 0.85; }
.gg-card ul { list-style: none; margin: 0; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.gg-card li {
  margin: 0; padding: 0.45rem 0.75rem; border-radius: 10px;
  font-size: 0.9rem; font-weight: 550; line-height: 1.35; color: var(--fg);
  background: var(--card-bg); border: 1px solid color-mix(in srgb, var(--c) 20%, transparent);
  overflow-wrap: anywhere;
}
.gg-card.is-rolling li { color: var(--muted); }
.gg-card.is-in { animation: gg-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes gg-pop { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: none; } }

.gg-nudge {
  display: flex; align-items: center; gap: 0.9rem;
  margin-top: 1.25rem; padding: 0.9rem 1rem; border-radius: 16px;
  background: color-mix(in srgb, var(--tz) 10%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--tz) 24%, transparent);
  font-size: 0.86rem; line-height: 1.5; color: var(--prose);
}
.gg-nudge img { width: 44px; height: 44px; flex-shrink: 0; }
.gg-nudge a { font-weight: 650; }

.gg-privacy {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 1.5rem 0 0; font-size: 0.78rem; color: var(--muted);
}
.gg-privacy svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Beamer: Ergebnis im Vollbild ── */
.gg-result:fullscreen { background: #17120E; color: #F3ECE3; padding: 4vh 4vw; margin: 0; border: 0; overflow: auto; }
.gg-result:-webkit-full-screen { background: #17120E; color: #F3ECE3; padding: 4vh 4vw; margin: 0; border: 0; overflow: auto; }
.gg-result:fullscreen .gg-actions, .gg-result:fullscreen .gg-nudge { display: none; }
.gg-result:-webkit-full-screen .gg-actions, .gg-result:-webkit-full-screen .gg-nudge { display: none; }
.gg-result:fullscreen .gg-summary { font-size: 1.4rem; color: #A3998B; }
.gg-result:fullscreen .gg-groups { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5vw; }
.gg-result:fullscreen .gg-card { background: color-mix(in srgb, var(--c) 16%, #211A15); }
.gg-result:fullscreen .gg-card h3 { font-size: 1.5rem; padding: 0.9rem 1.2rem; }
.gg-result:fullscreen .gg-card li { font-size: clamp(1.2rem, 2.2vw, 2rem); background: #211A15; color: #F3ECE3; padding: 0.6rem 1rem; }

@media (max-width: 720px) {
  .gg-grid { grid-template-columns: 1fr; }
  .gg textarea { min-height: 11rem; }
  .gg-groups { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .gg-card.is-in, .gg-go.is-rolling svg { animation: none; }
}
