:root {
  --bg: #050509;
  --bg-elevated: #11111a;
  --bg-elevated-soft: #151525;
  --text-main: #f7f7ff;
  --text-muted: #9b9bb5;
  --danger: #ff4b81;
  --accent-gradient: linear-gradient(90deg, #5170ff, #ff66c4);
  --border-soft: rgba(255, 255, 255, 0.08);
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.6);
}

/* Global */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #121227 0, #050509 45%, #000 100%);
  color: var(--text-main);
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header / Logo */

.app-header {
  padding: 12px 16px 4px;
  display: flex;
  justify-content: center;
}

.logo-wrapper {
  text-align: center;
}

.logo {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 32px;
  background-image: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 2px;
}

.logo-sub {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* Views */

.view {
  flex: 1;
  display: none;
  padding: 10px 16px 80px;
  display: none;
}

.view.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.view > section,
.view > .game-layout {
  width: 100%;
  max-width: 820px;
}

/* Panels (Age, Setup, Summary) */

.card-panel {
  margin: 0 auto;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(24, 24, 40, 0.9));
  border-radius: var(--radius-xl);
  padding: 20px 18px 24px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
}

.headline {
  margin-top: 0;
  margin-bottom: 10px;
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 26px;
  text-align: center;
}

.card-panel p {
  margin: 4px 0;
  color: var(--text-muted);
}

/* Buttons */

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  border: none;
  cursor: pointer;
}

.btn-primary {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  color: #fff;
  background-image: var(--accent-gradient);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.75);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
}

.btn-ghost {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 500;
  color: var(--text-main);
  background: transparent;
  border: 1px solid var(--border-soft);
  opacity: 0.9;
}

.btn-ghost:hover {
  opacity: 1;
}

.btn-large {
  width: 100%;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 16px;
}

.btn-link-small {
  margin-top: 6px;
  font-size: 12px;
  background: transparent;
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  padding: 4px 0;
}

.btn-link-small:hover {
  color: var(--text-main);
}

/* Age note */

.age-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Player form */

.player-form {
  margin-top: 16px;
}

#player-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.player-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-input-row span {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 22px;
}

.player-input-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(10, 10, 22, 0.9);
  color: var(--text-main);
  font-size: 14px;
}

/* Game layout */

.game-layout {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

/* Reihenfolge der Bereiche im Spiellayout */
.roulette-container { order: 1; }
.current-player     { order: 2; }
.card-wrapper       { order: 3; }
.controls           { order: 4; }
.stats-panel        { order: 5; }

/* Roulette */

.roulette-container {
  width: 100%;
  max-width: 480px;
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at top left, rgba(81, 112, 255, 0.15), rgba(10, 10, 24, 0.95));
  border: 1px solid var(--border-soft);
}

.roulette-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: left;
}

.roulette-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.roulette-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20e36a, #ffea00, #ff3355); /* Grün → Gelb → Rot */
  transition: width 0.3s ease-out;
}

/* Aktueller Spieler */

.current-player {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
}

.current-player .label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.player-name-gradient {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 20px;
  background-image: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Karte (Flip) */

.card-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
}

.flip-card {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 3 / 4;
  perspective: 1000px;
  -webkit-perspective: 1000px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

.flip-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  border-radius: 26px;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* Kartenrückseite: NSFW + Ziehen */

.flip-card-front {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.06), rgba(10, 10, 22, 0.98));
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.card-back-logo {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 40px;
  background-image: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 3px;
}

.card-back-sub {
  margin-top: 6px;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* Kartenvorderseite */

.flip-card-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at top left, rgba(255, 102, 196, 0.35), transparent 55%),
    radial-gradient(circle at bottom right, rgba(81, 112, 255, 0.45), transparent 60%),
    linear-gradient(145deg, #050515, #15152b);
}

.card-face-inner {
  height: 100%;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Icon, Titel, Text, Footer */

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  margin: 0 auto 10px;
  background: rgba(5, 5, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #ffffff;
}

.card-title {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 18px;
  margin-bottom: 8px;
}

.card-text {
  font-size: 14px;
  color: #f4f4ff;
  line-height: 1.4;
  white-space: pre-wrap;
}

/* z.B. "Gewinner verteilt 2", "Verlierer trinkt 3" */

.card-footer {
  margin-top: 10px;
  font-size: 13px;
  color: #ffd6f4;
  font-weight: 500;
}

/* Stats-Panel unter der Karte */

.stats-panel {
  width: 100%;
  max-width: 480px;
  margin-top: 10px;
  padding: 10px 12px 12px;
  border-radius: var(--radius-lg);
  background: rgba(10, 10, 22, 0.9);
  border: 1px solid var(--border-soft);
}

.stats-headline {
  margin: 0 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: left;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-muted);
}

.stats-row-name {
  font-weight: 500;
}

.stats-row-value {
  font-variant-numeric: tabular-nums;
}

/* Controls */

.controls {
  margin-top: 14px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Podium (Siegerehrung) */

.podium {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: flex-end;
}

.podium-slot {
  padding: 10px 8px;
  border-radius: 18px 18px 4px 4px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.02), rgba(16, 16, 30, 0.95));
  border: 1px solid var(--border-soft);
  text-align: center;
}

.podium-slot.place-1 {
  height: 140px;
}

.podium-slot.place-2 {
  height: 110px;
}

.podium-slot.place-3 {
  height: 100px;
}

.podium-rank {
  font-size: 13px;
  color: var(--text-muted);
}

.podium-name {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 18px;
  margin: 4px 0;
}

.podium-stats {
  font-size: 12px;
  color: var(--text-muted);
}

.summary-note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.summary-bonus {
  margin-top: 16px;
  font-size: 13px;
}

/* Modal */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.hidden {
  display: none;
}

.modal:not(.hidden) {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-soft);
}

.modal-scrollable {
  max-height: 80vh;
  overflow-y: auto;
}

.modal-title {
  margin: 0 0 8px;
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 20px;
}

.modal-body {
  font-size: 14px;
  color: var(--text-main);
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* Footer */

.app-footer {
  padding: 8px 16px 10px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 8px;
}

.link-button {
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: underline;
  text-decoration-style: dotted;
  padding: 0;
}

.link-button:hover {
  color: var(--text-main);
}

/* Legal body */

.legal-body p {
  font-size: 13px;
  color: var(--text-main);
}

.legal-body h3 {
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 15px;
}

/* Coin Flip */

.coin-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.coin-label {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.coin-instruction {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.coin {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 40%),
              radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.4), transparent 55%),
              radial-gradient(circle, #1b1b29, #070710);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
  cursor: pointer;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.3s ease-out;
}

.coin:active {
  transform: scale(0.98);
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 10px;
  text-align: center;
}

/* Vorderseite: NSFW Logo */

.coin-face-front {
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.15), transparent 40%),
              radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.5), transparent 60%),
              linear-gradient(145deg, #050509, #18182a);
  border-radius: 50%;
}

.coin-front-logo {
  font-family: "Permanent Marker", system-ui, sans-serif;
  font-size: 26px;
  background-image: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 2px;
}

.coin-front-sub {
  margin-top: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--text-muted);
}

/* Rückseite: Ergebnis-Text */

.coin-face-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.12), transparent 45%),
              radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.6), transparent 55%),
              linear-gradient(145deg, #15152b, #050509);
}

.coin-result-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-main);
}

/* Spin-Animation – wird per JS über Klasse coin-spinning getriggert */

@keyframes coin-flip-spin {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(1080deg); /* 3 volle Umdrehungen */
  }
}

.coin-spinning {
  animation: coin-flip-spin 1.2s cubic-bezier(0.3, 0.1, 0.3, 1);
}

/* Wenn das Ergebnis angezeigt wird, leicht "poppen" */

@keyframes coin-pop {
  0% {
    transform: scale(0.9) rotateY(180deg);
  }
  100% {
    transform: scale(1) rotateY(180deg);
  }
}

.coin-result-ready {
  transform: rotateY(180deg);
  animation: coin-pop 0.18s ease-out;
}

/* Responsive */

@media (min-width: 768px) {
  .view {
    padding-inline: 24px;
  }
}
