/* Wer war’s? – Aussehen nach dem Vorbild von Razzia:
   Rubik, Orange #ff9900 auf dunklem Braun #1a140b, weiße Karten, Klassenzimmer-Hintergrund im Spiel. */

@font-face {
  font-family: 'Rubik Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/fonts/rubik-latin-ext-wght-normal.woff2') format('woff2-variations'), url('/fonts/rubik-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

@font-face {
  font-family: 'Rubik Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('/fonts/rubik-latin-wght-normal.woff2') format('woff2-variations'), url('/fonts/rubik-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --primary: #ff9900;
  --secondary: #1a140b;
  --answer-1: #e69f00;
  --answer-2: #56b4e9;
  --answer-3: #3dbfa0;
  --answer-4: #cc79a7;
  --correct: #22c55e;
  --wrong: #ef4444;
  --fg: #364153;
  --muted: #f3f4f6;
  --muted-fg: #6a7282;
  --accent: #d1d5dc;
  --dark: #1e2939;
  --font: 'Rubik Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --text-shadow: drop-shadow(0 4px 4px rgb(0 0 0 / 0.15));
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--secondary);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
  font-family: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* ---------- Hintergründe ---------- */

.game-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--secondary) url('/bg.jpg') center / cover no-repeat;
}

body.game .game-bg {
  display: block;
}

/* Anmelde-/Einrichtungs-Bildschirme: dunkel, mit schrägen Flächen und Wortmarke */

.brand {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 4rem;
  overflow: hidden;
}

.shapes {
  position: absolute;
  inset: 0;
  max-height: 100svh;
  overflow: hidden;
  pointer-events: none;
}

.shape {
  position: absolute;
  background: rgb(255 153 0 / 0.15);
  border-radius: 2rem;
  transform: rotate(20deg);
}

.shape.a {
  top: -70vmin;
  left: -50vmin;
  width: 120vmin;
  height: 120vmin;
}

.shape.b {
  right: -10vmin;
  bottom: -45vmin;
  width: 75vmin;
  height: 75vmin;
}

.brand > :not(.shapes) {
  position: relative;
  z-index: 1;
}

.wordmark {
  margin-bottom: 2.5rem;
  color: var(--primary);
  font-size: clamp(2.75rem, 13vw, 4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.01em;
  word-spacing: 0.12em;
  text-align: center;
}

.brand-foot {
  position: absolute !important;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: rgb(255 255 255 / 0.5);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Spiel-Bildschirme: Klassenzimmer, weißer Text mit Schatten */

.game {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.game-top {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
}

/* Beim Host bleiben Zähler und Aktionsknopf beim Scrollen stehen */
.game-top.stick {
  position: sticky;
  top: 0;
  pointer-events: none;
}

.game-top.stick > * {
  pointer-events: auto;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.3);
}

.game-top .right {
  margin-left: auto;
}

.game-main {
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.game-bottom {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom));
  background: #fff;
}

.game-bottom .name {
  color: var(--dark);
  font-size: 1.125rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.game-bottom.host {
  flex-wrap: wrap;
  padding: 1rem calc(1rem + env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom));
  background: none;
}

.badge {
  flex: none;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--dark);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  white-space: nowrap;
}

.counter {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  background: #fff;
  color: #000;
  font-size: 1.125rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.4);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

.pill .dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--wrong);
}

.pill .dot.on {
  background: var(--correct);
}

.pill .dot.wait {
  background: var(--primary);
}

.title {
  color: #fff;
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  filter: var(--text-shadow);
  overflow-wrap: anywhere;
}

.subtitle {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  filter: var(--text-shadow);
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .title {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .title {
    font-size: 3rem;
  }
}

.loader {
  width: 7.5rem;
  height: 7.5rem;
}

.fine {
  max-width: 28rem;
  color: rgb(255 255 255 / 0.9);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  filter: var(--text-shadow);
}

.spaced {
  margin-top: 0.75rem;
}

.leave {
  padding: 0.5rem;
  border: 0;
  background: none;
  color: rgb(255 255 255 / 0.8);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  filter: var(--text-shadow);
}

.leave:hover {
  color: #fff;
}

.status {
  position: fixed;
  top: 0.75rem;
  left: 50%;
  z-index: 60;
  max-width: calc(100vw - 2rem);
  transform: translateX(-50%);
  margin: 0;
  padding: 0.375rem 0.875rem;
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.75);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
}

.notice {
  max-width: 100%;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  background: #fff;
  color: #b91c1c;
  font-weight: 600;
  text-align: center;
}

.warn {
  max-width: 100%;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.4);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

/* ---------- Karten und Formulare ---------- */

.card {
  width: 100%;
  max-width: 28rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.card.narrow {
  max-width: 20rem;
}

.card.wide {
  max-width: 36rem;
}

.card h1,
.card h2 {
  margin-bottom: 0.5rem;
  color: #000;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.card p + p {
  margin-top: 0.5rem;
}

.card .lead {
  margin-bottom: 1rem;
  color: var(--muted-fg);
  font-weight: 500;
}

.card .note,
.hint-text {
  color: var(--muted-fg);
  font-size: 0.875rem;
  font-weight: 500;
}

.card .center {
  text-align: center;
}

.error {
  margin-bottom: 0.75rem;
  color: #dc2626;
  font-weight: 600;
}

.error:empty {
  display: none;
}

.ok-line {
  color: #15803d;
  font-weight: 600;
}

.warn-line {
  color: #b45309;
  font-weight: 600;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field .q {
  display: block;
  margin-bottom: 0.5rem;
  color: #000;
  font-size: 1rem;
  font-weight: 600;
}

.field .hint-text {
  display: block;
  margin-top: 0.25rem;
}

.link-btn {
  display: block;
  margin: -0.5rem 0 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: underline;
}

.link-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input[type='text'],
input[type='password'],
input[inputmode],
input:not([type]),
textarea {
  width: 100%;
  padding: 0.5rem;
  border: 2px solid var(--accent);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--fg);
  font-size: 1.125rem;
  font-weight: 600;
}

textarea {
  display: block;
  min-height: 3.5rem;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #99a1af;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgb(255 153 0 / 0.25);
}

.center-input {
  text-align: center;
}

.pin {
  display: flex;
  gap: 0.5rem;
}

.pin input {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  padding: 0.5rem 0;
  text-align: center;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--fg);
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0.125rem 0 0;
  border-radius: 999px;
  background: var(--accent);
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}

.switch:checked {
  background: var(--primary);
}

.switch:checked::after {
  transform: translateX(1.25rem);
}

.switch:focus-visible {
  outline: 3px solid rgb(255 153 0 / 0.45);
  outline-offset: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  display: block;
  width: 100%;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--primary);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.75rem;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn:active:not(:disabled) {
  filter: brightness(0.95);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn:focus-visible {
  outline: 3px solid rgb(255 153 0 / 0.45);
  outline-offset: 2px;
}

.btn.light {
  background: #fff;
  color: #000;
}

.btn.light:hover:not(:disabled) {
  background: var(--accent);
  filter: none;
}

.btn.light:focus-visible {
  outline-color: #fff;
}

.btn.fit {
  display: inline-block;
  width: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.btn.lg {
  padding: 0.75rem 1.25rem;
  font-size: 1.25rem;
}

.btn.sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
}

.sticky-action {
  position: sticky;
  bottom: 0.75rem;
  z-index: 4;
  width: 100%;
  max-width: 36rem;
}

.sticky-action .btn {
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
}

/* ---------- Chips ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.game .chips {
  justify-content: center;
  gap: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--primary);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}

.chip.wait {
  background: rgb(255 153 0 / 0.5);
  color: rgb(255 255 255 / 0.6);
}

.card .chip.wait {
  background: var(--muted);
  color: var(--muted-fg);
}

.chip small {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.85;
}

.chip button {
  display: inline-flex;
  padding: 0.125rem;
  margin: 0 -0.25rem 0 0;
  border: 0;
  border-radius: 0.375rem;
  background: rgb(0 0 0 / 0.15);
  color: inherit;
}

.chip button:hover {
  background: rgb(0 0 0 / 0.3);
}

.chip .ico,
.counter .ico,
.pill .ico {
  flex: none;
}

/* ---------- Hinweise ---------- */

.hints {
  display: grid;
  gap: 0.625rem;
  width: 100%;
  max-width: 36rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hint {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 0.75rem;
  row-gap: 0.125rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.hint .num {
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: var(--dark);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

.hint.new .num {
  background: var(--primary);
}

.hint .q {
  color: var(--muted-fg);
  font-size: 0.875rem;
  font-weight: 600;
}

.hint .a {
  color: #000;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.hint.pop {
  animation: show 0.5s ease-out;
}

/* ---------- Auswahl (Raten) ---------- */

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  max-width: 36rem;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 4.5rem;
  padding: 1rem;
  border: 0;
  border-radius: 1rem;
  background: var(--answer-1);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
}

.choice:nth-child(4n + 2) {
  background: var(--answer-2);
}

.choice:nth-child(4n + 3) {
  background: var(--answer-3);
}

.choice:nth-child(4n + 4) {
  background: var(--answer-4);
}

.choice .label {
  overflow-wrap: anywhere;
  filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.2));
}

.choice .box {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.375rem;
  background: rgb(255 255 255 / 0.2);
  color: var(--fg);
}

.choice.selected {
  outline: 4px solid #fff;
  outline-offset: -2px;
}

.choice.selected .box {
  background: #fff;
}

.choice:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 2px;
}

/* ---------- Ergebnis ---------- */

.verdict {
  width: clamp(9rem, 55vw, 14rem);
  height: auto;
  animation: show 0.5s ease-out;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  max-width: 36rem;
}

.stat {
  padding: 1rem 0.5rem;
  border-radius: 1rem;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 2px rgb(0 0 0 / 0.2);
}

.stat strong {
  display: block;
  font-size: 3.75rem;
  font-weight: 800;
  line-height: 1;
}

.stat span {
  font-size: 1rem;
  font-weight: 700;
}

.stat.good {
  background: var(--correct);
}

.stat.bad {
  background: var(--wrong);
}

.rounds {
  display: grid;
  gap: 0.5rem;
  width: 100%;
  max-width: 36rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rounds li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem;
  background: #fff;
}

.rounds .mark {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--correct);
  color: #fff;
}

.rounds .no .mark {
  background: var(--wrong);
}

.rounds .who {
  color: #000;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.rounds .tip {
  margin-left: auto;
  color: var(--muted-fg);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
}

/* ---------- Host: Codes ---------- */

.join {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  background: #fff;
  color: #000;
}

.join .sep {
  flex: none;
  height: 2px;
  background: var(--accent);
}

.join h2 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
}

.join .qr {
  display: block;
  width: 11rem;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.join .direct {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted-fg);
  font-size: 0.8rem;
  font-weight: 600;
  word-break: break-all;
}

.pin-code {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .join {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
  }

  .join .sep {
    align-self: stretch;
    width: 2px;
    height: auto;
  }

  .join .qr {
    width: 10rem;
    margin: 0;
  }
}

.game-main.wide {
  max-width: 48rem;
}

@media (min-width: 1024px) {
  .game-main.wide {
    max-width: 70rem;
  }
}

/* ---------- Animationen ---------- */

@keyframes show {
  0% {
    transform: scale(0);
  }
  30% {
    transform: scale(0.9);
  }
  60% {
    transform: scale(0.8);
  }
  80% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint.pop,
  .verdict {
    animation: none;
  }
}
