:root {
  --bg-base: #0a0a0c;
  --bg-elevated: #121216;
  --bg-surface: rgba(24, 24, 30, 0.72);
  --bg-surface-hover: rgba(34, 34, 42, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);
  --text-primary: #f4f4f6;
  --text-secondary: #8e8e9e;
  --accent: #ff4757;
  --accent-soft: rgba(255, 71, 87, 0.14);
  --accent-secondary: #5352ed;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="obsidian"] {
  --bg-base: #09090b;
  --bg-elevated: #121215;
  --bg-surface: rgba(22, 22, 26, 0.75);
  --accent: #f43f5e;
  --accent-soft: rgba(244, 63, 94, 0.14);
  --accent-secondary: #6366f1;
}

[data-theme="emerald"] {
  --bg-base: #060d0b;
  --bg-elevated: #0d1915;
  --bg-surface: rgba(16, 30, 25, 0.75);
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --accent-secondary: #06b6d4;
}

[data-theme="amber"] {
  --bg-base: #0c0907;
  --bg-elevated: #17120e;
  --bg-surface: rgba(28, 22, 18, 0.78);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --accent-secondary: #ec4899;
}

[data-theme="nordic"] {
  --bg-base: #080c14;
  --bg-elevated: #101726;
  --bg-surface: rgba(19, 28, 46, 0.76);
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --accent-secondary: #818cf8;
}

[data-theme="mono"] {
  --bg-base: #080808;
  --bg-elevated: #111111;
  --bg-surface: rgba(24, 24, 24, 0.8);
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --accent-secondary: #a1a1aa;
}

/* Central White Mode (combinable with all accent themes) */
body[data-color-mode="light"] {
  --bg-base: #f4f5f8;
  --bg-elevated: #ffffff;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --bg-surface-hover: rgba(255, 255, 255, 0.98);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-highlight: rgba(15, 23, 42, 0.22);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
}

body[data-color-mode="light"][data-theme="obsidian"] {
  --bg-base: #f7f4f6;
  --accent: #e11d48;
  --accent-soft: rgba(225, 29, 72, 0.15);
  --accent-secondary: #4f46e5;
}

body[data-color-mode="light"][data-theme="emerald"] {
  --bg-base: #f2f7f5;
  --accent: #059669;
  --accent-soft: rgba(5, 150, 105, 0.15);
  --accent-secondary: #0891b2;
}

body[data-color-mode="light"][data-theme="amber"] {
  --bg-base: #f8f5f0;
  --accent: #d97706;
  --accent-soft: rgba(217, 119, 6, 0.15);
  --accent-secondary: #db2777;
}

body[data-color-mode="light"][data-theme="nordic"] {
  --bg-base: #f1f5f9;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.15);
  --accent-secondary: #4f46e5;
}

body[data-color-mode="light"][data-theme="mono"] {
  --bg-base: #f4f4f5;
  --accent: #18181b;
  --accent-soft: rgba(24, 24, 27, 0.12);
  --accent-secondary: #52525b;
}

body[data-color-mode="light"] .bg-grid-pattern {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
}

body[data-color-mode="light"] .surface-card {
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.08), inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
}

body[data-color-mode="light"] .pill-button {
  background: rgba(15, 23, 42, 0.045);
  border-color: rgba(15, 23, 42, 0.11);
  color: #0f172a;
}

body[data-color-mode="light"] .pill-button:hover {
  background: rgba(15, 23, 42, 0.09);
  border-color: rgba(15, 23, 42, 0.22);
}

body[data-color-mode="light"] .btn-primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 24px -6px var(--accent-soft);
}

body[data-color-mode="light"] .text-white {
  color: #0f172a !important;
}

body[data-color-mode="light"] .btn-primary,
body[data-color-mode="light"] .btn-primary span,
body[data-color-mode="light"] .btn-primary i,
body[data-color-mode="light"] .btn-accent,
body[data-color-mode="light"] .btn-accent span,
body[data-color-mode="light"] .btn-accent i {
  color: #ffffff !important;
}

body[data-color-mode="light"] .text-zinc-200,
body[data-color-mode="light"] .text-zinc-300 {
  color: #334155 !important;
}

body[data-color-mode="light"] .text-zinc-400,
body[data-color-mode="light"] .text-zinc-500 {
  color: #64748b !important;
}

body[data-color-mode="light"] .bg-black\/20,
body[data-color-mode="light"] .bg-black\/25,
body[data-color-mode="light"] .bg-black\/30,
body[data-color-mode="light"] .bg-black\/35,
body[data-color-mode="light"] .bg-black\/40,
body[data-color-mode="light"] .bg-black\/45,
body[data-color-mode="light"] .bg-black\/50 {
  background-color: rgba(15, 23, 42, 0.045) !important;
}

body[data-color-mode="light"] .bg-white\/5,
body[data-color-mode="light"] .bg-white\/\[0\.08\],
body[data-color-mode="light"] .bg-white\/10,
body[data-color-mode="light"] .bg-white\/15 {
  background-color: rgba(15, 23, 42, 0.06) !important;
}

body[data-color-mode="light"] .bg-white.text-black {
  background-color: var(--accent) !important;
  color: #ffffff !important;
}

body[data-color-mode="light"] .border-white\/5,
body[data-color-mode="light"] .border-white\/10,
body[data-color-mode="light"] .border-white\/15,
body[data-color-mode="light"] .border-white\/20,
body[data-color-mode="light"] .border-white\/25,
body[data-color-mode="light"] .border-white\/30,
body[data-color-mode="light"] .border-white\/35 {
  border-color: rgba(15, 23, 42, 0.13) !important;
}

body[data-color-mode="light"] input.estimate-slider {
  background: rgba(15, 23, 42, 0.14);
}

/* Ladehinweis aus index.html ausblenden, sobald diese Datei geladen ist */
#loadErrorNotice {
  display: none !important;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  height: 100dvh;
  max-height: 100dvh;
  transition: background-color 0.6s var(--ease-out-expo), color 0.4s ease;
  letter-spacing: -0.015em;
}

.font-display {
  font-family: 'Syne', sans-serif;
  letter-spacing: -0.03em;
}

.font-mono-num {
  font-family: 'JetBrains Mono', monospace;
}

/* Subtle architectural grid background */
.bg-grid-pattern {
  background-size: 48px 48px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, black 30%, transparent 100%);
}

/* Clean Surface Cards */
.surface-card {
  background: var(--bg-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), inset 0 1px 0 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.45s var(--ease-spring), border-color 0.35s ease, background-color 0.35s ease, box-shadow 0.45s var(--ease-spring);
}

@media (hover: hover) {
  .surface-interactive:hover {
    border-color: var(--border-highlight);
    transform: translateY(-4px);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.65), inset 0 1px 0 0 rgba(255, 255, 255, 0.14);
  }
}

.surface-interactive:active {
  transform: translateY(-1px) scale(0.99);
}

.pill-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s var(--ease-spring);
}

@media (hover: hover) {
  .pill-button:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: var(--border-highlight);
    transform: translateY(-1px);
  }
}

.pill-button:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg-base);
  font-weight: 700;
  transition: all 0.35s var(--ease-spring);
  box-shadow: 0 12px 28px -8px rgba(255, 255, 255, 0.25);
}

@media (hover: hover) {
  .btn-primary:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 18px 36px -8px rgba(255, 255, 255, 0.35);
  }
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  transition: all 0.35s var(--ease-spring);
  box-shadow: 0 12px 30px -6px var(--accent-soft);
}

[data-theme="mono"] .btn-accent {
  color: #09090b;
}

@media (hover: hover) {
  .btn-accent:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
  }
}

.btn-accent:active {
  transform: translateY(0) scale(0.98);
}

/* 3D Role Card Flip */
.perspective-stage {
  perspective: 1600px;
}

.card-3d-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.19, 1, 0.22, 1);
}

.card-3d-wrapper.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 2rem;
  overflow: hidden;
}

.card-face-back {
  transform: rotateY(180deg);
}

/* Smooth View Transitions */
@keyframes viewReveal {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
  }
}

.view-enter {
  animation: viewReveal 0.55s var(--ease-out-expo) forwards;
}

@keyframes menuPop {
  0% {
    opacity: 0;
    transform: translateY(-12px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes menuPopOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

.menu-enter {
  animation: menuPop 0.35s var(--ease-spring) forwards;
}

.menu-exit {
  animation: menuPopOut 0.22s ease-in forwards;
}

@keyframes modalCardIn {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.94);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes modalCardOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    filter: blur(4px);
  }
}

@keyframes backdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes backdropFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-backdrop-animate-in {
  animation: backdropFadeIn 0.25s ease-out forwards;
}

.modal-backdrop-animate-out {
  animation: backdropFadeOut 0.22s ease-in forwards;
}

.modal-card-animate-in {
  animation: modalCardIn 0.42s var(--ease-spring) forwards;
}

.modal-card-animate-out {
  animation: modalCardOut 0.22s ease-in forwards;
}

@keyframes pulseSuccessPop {
  0% { transform: scale(0.94); opacity: 0.5; }
  50% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.item-added-pop {
  animation: pulseSuccessPop 0.4s var(--ease-spring) forwards;
}

/* Adaptive Word Display so long words never overflow */
.adaptive-word-fit {
  max-width: 100%;
  width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.15;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

@keyframes pulseRing {
  0% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.06); opacity: 0.2; }
  100% { transform: scale(0.95); opacity: 0.6; }
}

.pulse-slow {
  animation: pulseRing 3.5s ease-in-out infinite;
}

/* Custom Range Slider for Timer Modal */
input[type="range"].estimate-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

input[type="range"].estimate-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 4px solid var(--accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s ease;
}

/* Interactive Timeline / Ruler Slider (Zeitstrahl) */
.timeline-slider-viewport {
  position: relative;
  width: 100%;
  height: 86px;
  border-radius: 1.15rem;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 3px 12px rgba(0, 0, 0, 0.45);
}

.timeline-slider-viewport:active {
  cursor: grabbing;
  border-color: var(--border-highlight);
}

body[data-color-mode="light"] .timeline-slider-viewport {
  background: rgba(15, 23, 42, 0.055);
  box-shadow: inset 0 2px 8px rgba(15, 23, 42, 0.08);
}

.timeline-edge-fade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    to right,
    rgba(10, 10, 12, 0.88) 0%,
    rgba(10, 10, 12, 0) 22%,
    rgba(10, 10, 12, 0) 78%,
    rgba(10, 10, 12, 0.88) 100%
  );
}

body[data-color-mode="light"] .timeline-edge-fade {
  background: linear-gradient(
    to right,
    rgba(241, 245, 249, 0.92) 0%,
    rgba(241, 245, 249, 0) 22%,
    rgba(241, 245, 249, 0) 78%,
    rgba(241, 245, 249, 0.92) 100%
  );
}

/* Fixed Center Indicator Line (Strich in der Mitte) */
.timeline-center-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline-center-triangle-top {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--accent);
}

.timeline-center-line {
  width: 2.5px;
  height: 36px;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 0 12px var(--accent);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

/* =====================================================================
   MOBILE-FIRST FIT-TO-SCREEN LAYER
   Alles passt auf eine Seite (kein Seiten-Scroll), nichts wird abgeschnitten.
   ===================================================================== */
html {
  height: 100%;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overscroll-behavior: none;
}

/* Eingabefelder müssen trotz globalem user-select:none tippbar bleiben (iOS) */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

input[type="text"], input[type="password"], textarea {
  font-size: max(16px, 1rem);
}

/* App-Shell mit Safe-Area (Notch / Home-Indicator) */
.app-shell {
  padding: max(0.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(0.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

@media (min-width: 640px) {
  .app-shell {
    padding: max(1.25rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
  }
}

#toastContainer {
  top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
  width: calc(100vw - 2rem);
  max-width: 28rem;
}

#toastContainer > div {
  max-width: 100%;
  line-height: 1.25;
}

/* Dropdown-Menü immer komplett im Bild */
#logoDropdownMenu {
  max-height: calc(100dvh - 5.5rem);
  overflow-y: auto;
}

/* Alle Pop-ups: nie höher als der Bildschirm */
.modal-sheet {
  max-height: calc(100dvh - 1.5rem);
}

/* Textfelder in Modals dürfen den Rand nie sprengen */
.modal-sheet input,
.modal-sheet textarea,
.modal-sheet button {
  max-width: 100%;
}

/* ---------- Handy (schmal) ---------- */
@media (max-width: 639px) {
  .card-face {
    padding: 1rem !important;
    border-radius: 1.5rem;
  }

  .modal-sheet {
    padding: 1rem !important;
    border-radius: 1.5rem;
    overflow-y: auto;
  }

  .modal-sheet.space-y-5 > :not([hidden]) ~ :not([hidden]),
  .modal-sheet.space-y-4 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.75rem !important;
  }

  .modal-sheet .space-y-3\.5 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.5rem !important;
  }

  .modal-sheet .p-4 {
    padding: 0.75rem;
  }

  #logoDropdownMenu {
    width: min(20rem, calc(100vw - 2rem));
  }

  .timeline-slider-viewport {
    height: 80px;
  }
}

/* ---------- Niedrige Bildschirme (kleine Handys, Browserleisten) ---------- */
@media (max-height: 740px) {
  .disc-sub {
    display: none !important;
  }

  #cardBackFace .space-y-5 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.75rem;
  }

  #cardBackFace .space-y-3\.5 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0.5rem;
  }
}

@media (max-height: 680px) {
  .home-desc {
    display: none !important;
  }
}


/* Willkommensseite: darf auf dem Handy scrollen, damit alle drei Spiele vollständig lesbar sind */
#view-welcome {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

/* Bessere Lesbarkeit im hellen Modus: helle Grün-/Rot-/Gelbtöne werden dunkler */
body[data-color-mode="light"] .text-emerald-200,
body[data-color-mode="light"] .text-emerald-300,
body[data-color-mode="light"] .text-emerald-400 {
  color: #047857 !important;
}

body[data-color-mode="light"] .text-rose-300,
body[data-color-mode="light"] .text-rose-300\/90,
body[data-color-mode="light"] .text-rose-400 {
  color: #be123c !important;
}

body[data-color-mode="light"] .text-amber-200,
body[data-color-mode="light"] .text-amber-300 {
  color: #b45309 !important;
}

/* Quiz-Rückblick: Chips mit kräftigem Hintergrund und weißer Schrift – in beiden Modi gut lesbar */
.chip-ok,
.chip-bad {
  color: #ffffff !important;
  border: 1px solid transparent;
}

.chip-ok {
  background: #059669;
}

.chip-bad {
  background: #e11d48;
}

/* Diskussion auf kleinen Handys noch etwas kompakter */
@media (max-width: 1023px) and (max-height: 700px) {
  #discussionHeadline {
    font-size: 1rem;
    line-height: 1.3;
  }

  #view-discussion .disc-card {
    padding: 0.625rem;
  }

  #view-discussion .disc-vote h3 {
    font-size: 0.9375rem;
  }

  #timerDisplay {
    font-size: 1.375rem;
    line-height: 1.6rem;
  }
}

@media (max-height: 700px) {
  .quiz-res-icon {
    display: none !important;
  }
}

@media (max-height: 650px) {
  .pass-hint-text {
    display: none !important;
  }

  .timeline-slider-viewport {
    height: 80px;
  }
}

/* ---------- Quiz ---------- */
.quiz-ans {
  transition: background-color 0.25s ease, border-color 0.25s ease, opacity 0.25s ease, transform 0.3s var(--ease-spring);
}

.quiz-ans[data-state="right"] {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: rgba(16, 185, 129, 0.65) !important;
}

.quiz-ans[data-state="wrong"] {
  background: rgba(244, 63, 94, 0.22) !important;
  border-color: rgba(244, 63, 94, 0.65) !important;
}

.quiz-ans[data-state="picked"] {
  background: rgba(255, 255, 255, 0.14) !important;
  border-color: var(--border-highlight) !important;
}

.quiz-ans[data-state="dim"] {
  opacity: 0.45;
}

#quizTimeBar {
  transition: width 0.1s linear, background-color 0.3s ease;
}

/* ---------- Diskussion beim Fragen-Imposter: Frage oben, Antworten darunter, Timer kompakt unten ---------- */
#view-discussion[data-mode="question"] .disc-head {
  order: 1;
}

#view-discussion[data-mode="question"] #collectedAnswersBoard {
  order: 2;
}

#view-discussion[data-mode="question"] #timerContainerBlock {
  order: 3;
  margin-top: 0;
  margin-bottom: 0;
}

/* Inhalte der Diskussionskarten als Gruppe mittig zentrieren statt oben kleben + große Lücke */
#view-discussion .disc-card {
  justify-content: center;
}

/* Gut lesbare Frage (klare Schrift statt breiter Display-Schrift) */
.question-readable {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: -0.01em !important;
  font-weight: 700;
}

@media (min-width: 640px) {
  #view-discussion[data-mode="question"] #timerContainerBlock {
    padding: 0.75rem 1rem;
  }

  #view-discussion[data-mode="question"] #timerDisplay {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}

/* ---------- Diskussions-Ansicht: Handy & Tablet hochkant ---------- */
@media (max-width: 1023px) {
  #view-discussion .disc-col {
    flex: 1 1 auto;
    min-height: 0;
  }

  #view-discussion .disc-vote,
  #view-discussion .disc-board {
    flex: 0 1 auto;
    min-height: 0;
  }

  #view-discussion .disc-list {
    flex: 0 1 auto;
    min-height: 2.5rem;
    overflow-y: auto;
  }

  #view-discussion .disc-card {
    overflow-y: auto;
  }

  /* Nach der Auflösung: Platz für das Ergebnis schaffen */
  #view-discussion[data-revealed="true"] .disc-head,
  #view-discussion[data-revealed="true"] #timerContainerBlock,
  #view-discussion[data-revealed="true"] .disc-vote,
  #view-discussion[data-revealed="true"] #majorityQuestionBanner {
    display: none !important;
  }

  #view-discussion[data-revealed="true"][data-mode="word"] .disc-col-left {
    display: none !important;
  }

  #view-discussion[data-revealed="true"] .disc-col-left {
    flex: 0 1 auto;
    max-height: 32%;
  }

  #view-discussion[data-revealed="true"] .disc-col-right {
    flex: 3 1 auto;
  }

  #view-discussion[data-revealed="true"] .disc-result {
    flex: 0 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 0;
    padding-top: 0;
  }

  #view-discussion[data-revealed="true"] #resolutionBox {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
}


/* =====================================================================
   SPIELKACHELN: bunte, illustrierte Karten auf Start- und Willkommensseite
   (feste Farben pro Spiel, unabhängig vom Farbschema und Hell/Dunkel)
   ===================================================================== */
.home-greeting {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  padding: 0 0.25rem;
}

.home-greeting-emoji {
  display: inline-block;
  animation: greetingWiggle 2.8s ease-in-out infinite;
  transform-origin: 70% 80%;
}

@keyframes greetingWiggle {
  0%, 70%, 100% { transform: rotate(0deg); }
  76% { transform: rotate(-14deg); }
  84% { transform: rotate(12deg); }
  92% { transform: rotate(-6deg); }
}

.game-tile {
  --tile-a: #ff4d6d;
  --tile-b: #ff8a3d;
  --tile-shadow: rgba(244, 63, 94, 0.45);
  --tile-ink: #be123c;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 1.75rem;
  cursor: pointer;
  color: #ffffff;
  min-height: 0;
  background:
    radial-gradient(rgba(255, 255, 255, 0.14) 1.4px, transparent 1.6px) 0 0 / 18px 18px,
    linear-gradient(140deg, var(--tile-a) 0%, var(--tile-b) 100%);
  box-shadow: 0 18px 40px -18px var(--tile-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.45s var(--ease-spring), box-shadow 0.45s var(--ease-spring);
  -webkit-user-select: none;
  user-select: none;
}

.game-tile-question {
  --tile-a: #8b5cf6;
  --tile-b: #ec4899;
  --tile-shadow: rgba(139, 92, 246, 0.45);
  --tile-ink: #7c3aed;
}

.game-tile-quiz {
  --tile-a: #14b8a6;
  --tile-b: #0891b2;
  --tile-shadow: rgba(13, 148, 136, 0.45);
  --tile-ink: #0f766e;
}

@media (hover: hover) {
  .game-tile:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 26px 50px -18px var(--tile-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }

  .game-tile:hover .game-tile-art {
    transform: translateY(-50%) rotate(-2deg) scale(1.05);
  }
}

.game-tile:active {
  transform: scale(0.98);
}

/* weicher Lichtfleck oben rechts */
.game-tile-glow {
  position: absolute;
  z-index: -1;
  width: 70%;
  aspect-ratio: 1;
  right: -18%;
  top: -35%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

/* Handy: Illustration rechts, Text links */
.game-tile-art {
  position: absolute;
  z-index: 0;
  right: -3%;
  top: 50%;
  height: 92%;
  max-height: 12.5rem;
  max-width: 45%;
  object-fit: contain;
  transform: translateY(-50%) rotate(-4deg);
  transition: transform 0.5s var(--ease-spring);
  pointer-events: none;
  animation: tileFloat 6s ease-in-out infinite;
}

.game-tile-quiz .game-tile-art { animation-delay: -2s; }
.game-tile-question .game-tile-art { animation-delay: -4s; }

@keyframes tileFloat {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -6px; }
}

.game-tile-body {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 57%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1rem 1.15rem;
}

.game-tile-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.66rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.game-tile-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-size: min(1.5rem, 5.9vw);
  color: #ffffff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

.game-tile-desc {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.92);
}

.game-tile-cta {
  margin-top: 0.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  background: #ffffff;
  color: var(--tile-ink);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  transition: transform 0.3s var(--ease-spring);
}

.game-tile-cta i {
  color: var(--tile-ink);
}

button.game-tile-cta:active {
  transform: scale(0.96);
}

/* Willkommensseite: Kacheln mit natürlicher Höhe (Seite darf scrollen) */
#view-welcome .game-tile {
  min-height: 11.5rem;
}

#view-welcome .game-tile-body {
  padding: 1.1rem 1.2rem;
}

/* Breite Bildschirme: Illustration oben, Text unten */
@media (max-width: 639px) {
  .home-greeting {
    font-size: min(1.05rem, 4.6vw);
  }
}

@media (min-width: 640px) and (min-aspect-ratio: 4/5) {
  .game-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .game-tile-art {
    position: relative;
    right: auto;
    top: auto;
    height: auto;
    max-height: 46%;
    max-width: 82%;
    width: 82%;
    margin: 1.25rem auto 0;
    transform: rotate(-3deg);
    flex-shrink: 1;
    min-height: 0;
  }

  .game-tile-body {
    max-width: none;
    height: auto;
    flex: 0 1 auto;
    justify-content: flex-start;
    padding: 1rem 1.35rem 1.35rem;
  }

  .game-tile-title {
    font-size: 1.5rem;
  }

  .game-tile-desc {
    font-size: 0.85rem;
  }

  @media (hover: hover) {
    .game-tile:hover .game-tile-art {
      transform: rotate(-1deg) scale(1.05);
    }
  }

  #view-welcome .game-tile {
    min-height: 0;
  }
}

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

/* Sehr kleine/kurze Handys: Beschreibung weglassen, Kachel bleibt übersichtlich */
@media (max-width: 639px) and (max-height: 700px) {
  #view-home .game-tile-body {
    gap: 0.3rem;
    padding: 0.8rem 1rem;
  }

  .home-greeting {
    font-size: 1rem;
  }
}

/* Bewegung reduzieren, wenn das Gerät es wünscht */
@media (prefers-reduced-motion: reduce) {
  .game-tile-art,
  .home-greeting-emoji {
    animation: none !important;
  }
}

/* Setup: farbiges Abzeichen je nach Spiel */
#setupModeBadge[data-mode] {
  color: #ffffff !important;
  border-color: transparent !important;
  font-weight: 700;
}

#setupModeBadge[data-mode="word"] { background: linear-gradient(140deg, #ff4d6d, #ff8a3d) !important; }
#setupModeBadge[data-mode="question"] { background: linear-gradient(140deg, #8b5cf6, #ec4899) !important; }
#setupModeBadge[data-mode="quiz"] { background: linear-gradient(140deg, #14b8a6, #0891b2) !important; }


/* =====================================================================
   Automatische Anpassung an jedes Gerät (Handy, Tablet, Laptop, TV)
   Die Grundschrift wächst mit dem Bildschirm – alle Abstände, Schriften und
   Karten (in rem) wachsen mit. So bleibt das Verhältnis gleich, nichts wird
   verzerrt, und auf großen Bildschirmen bleibt kein leerer Rand übrig.
   ===================================================================== */
html {
  font-size: 16px;
  font-size: clamp(16px, min(2.45vw, 2.08vh), 22px);
  font-size: clamp(16px, min(2.45vw, 2.08dvh), 22px);
}

/* Feste Pixel-Größen auf mitwachsende Größen umstellen */
html .text-\[8px\] { font-size: 0.5rem; }
html .text-\[9px\] { font-size: 0.5625rem; }
html .text-\[10px\] { font-size: 0.625rem; }
html .text-\[11px\] { font-size: 0.6875rem; }
html .max-w-\[230px\] { max-width: 14.375rem; }
html .max-w-\[240px\] { max-width: 15rem; }
html .max-w-\[250px\] { max-width: 15.625rem; }
html .min-w-\[64px\] { min-width: 4rem; }
html .min-w-\[76px\] { min-width: 4.75rem; }

@media (min-width: 640px) {
  html .sm\:text-\[11px\] { font-size: 0.6875rem; }
  html .sm\:max-w-\[210px\] { max-width: 13.125rem; }
  html .sm\:min-h-\[260px\] { min-height: 16.25rem; }
}

/* Hohe Bildschirme (Tablet hochkant): Karten nicht in die Länge ziehen,
   sondern in einem angenehmen Format mittig anzeigen */
@media (min-width: 600px) and (min-height: 900px) {
  #view-pass,
  #view-quiz-pass,
  #view-quiz-play {
    max-width: 34rem;
    max-height: 48rem;
  }

  #view-setup {
    max-width: 40rem;
    max-height: 46rem;
  }

  #view-quiz-result {
    max-width: 40rem;
    max-height: 50rem;
  }

  #view-discussion {
    max-height: 56rem;
  }
}

/* Tablet hochkant: Spiele-Kacheln untereinander (wie am Handy, nur größer) */
@media (min-width: 640px) and (max-aspect-ratio: 4/5) {
  .home-tiles {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
    max-height: 52rem;
    align-self: center;
  }

  .welcome-tiles {
    grid-template-columns: minmax(0, 1fr) !important;
    flex: 0 0 auto !important;
  }

  .game-tile-art {
    max-height: 88%;
    max-width: 42%;
    right: 2%;
  }

  .game-tile-body {
    max-width: 58%;
    padding: 1.25rem 1.6rem;
    gap: 0.55rem;
  }

  .game-tile-title {
    font-size: 1.75rem;
  }

  .game-tile-desc {
    font-size: 0.9rem;
  }
}

/* ===== Quiz: Wahr/Falsch & Schätzen ===== */
.quiz-claim {
  background: var(--accent-soft);
  border: 1px solid var(--border-highlight);
}

.quiz-claim-label {
  color: var(--accent);
  font-weight: 700;
}

.quiz-tf-btn {
  border-width: 2px;
}

.quiz-tf-true .quiz-tf-icon {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.quiz-tf-false .quiz-tf-icon {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
}

.quiz-estimate-solution {
  color: #34d399;
}

body[data-color-mode="light"] .quiz-estimate-solution,
body[data-color-mode="light"] .quiz-tf-true .quiz-tf-icon {
  color: #047857;
}

body[data-color-mode="light"] .quiz-tf-false .quiz-tf-icon {
  color: #be123c;
}

#quizEstimateInput:disabled {
  opacity: 0.75;
}

/* Teilen: QR-Code */
.share-qr {
  width: min(15rem, 62vw);
  aspect-ratio: 1;
}

.share-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-height: 640px) {
  .share-qr {
    width: min(10rem, 40vh);
  }
}

/* Breite Bildschirme (Tablet quer, Laptop): Platz an den Seiten nutzen */
@media (min-width: 1024px) {
  html .app-shell,
  html #view-home,
  html #view-welcome {
    max-width: 70rem;
  }
}

/* Handy quer (sehr niedrig): Frage links, Antworten rechts – nichts überlappt */
@media (orientation: landscape) and (max-height: 560px) {
  #view-quiz-play {
    max-width: 48rem;
  }

  #view-quiz-play > .surface-card.rounded-3xl {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  #view-quiz-play > .surface-card.rounded-3xl > :nth-child(1),
  #view-quiz-play > .surface-card.rounded-3xl > :nth-child(2),
  #view-quiz-play > .surface-card.rounded-3xl > :nth-child(5) {
    grid-column: 1 / -1;
  }

  #quizQuestionBox {
    grid-column: 1;
    grid-row: 3;
  }

  #quizAnswers {
    grid-column: 2;
    grid-row: 3;
    min-height: 0;
  }

  .quiz-answers-estimate > label {
    display: none;
  }

  #quizEstimateInput {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-size: 1.35rem;
  }

  #view-quiz-play > .surface-card.rounded-3xl > :nth-child(5) {
    height: 2.5rem;
  }
}

/* Handy quer: Bildschirm ist zu niedrig für ein Spiel ohne Scrollen.
   Jede Ansicht bekommt die Höhe eines kleinen Handys im Hochformat,
   die Seite scrollt – so bleibt alles lesbar und nichts wird gequetscht. */
@media (orientation: landscape) and (max-height: 500px) {
  .app-shell {
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  #mainContent {
    flex: 1 0 auto !important;
    overflow: visible !important;
  }

  #mainContent > .view-section {
    flex: 0 0 auto !important;
    height: 34rem !important;
    max-height: none !important;
  }

  #mainContent > #view-home {
    height: 26rem !important;
  }

  #mainContent > #view-welcome {
    height: auto !important;
    overflow: visible;
  }
}
