:root {
  --bg: #1b2430;
  --card-bg: #232f3f;
  --text: #eef1f5;
  --muted: #93a1b3;
  --red: #e0503a;
  --blue: #3a7ce0;
  --green: #3ba55d;
  --yellow: #e0b93a;
  --radius: 14px;
}

* { box-sizing: border-box; }

.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: #b5341f;
  color: white;
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  padding: 10px 12px;
  animation: pop-in 0.25s ease-out;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 24px;
}

.screen { display: none; width: 100%; }
.screen.active { display: flex; justify-content: center; }

.card {
  background: var(--card-bg);
  border-radius: 22px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  border-top: 6px solid var(--red);
  border-right: 6px solid var(--blue);
  border-bottom: 6px solid var(--green);
  border-left: 6px solid var(--yellow);
}

h1 {
  margin: 0 0 4px;
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.3px;
}

h2 {
  margin-top: 0;
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #354355;
  background: #1b2430;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 16px;
}

input:focus { outline: 2px solid var(--blue); }

button {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
  background: var(--blue);
  color: white;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(2px) scale(0.98); box-shadow: 0 1px 0 rgba(0,0,0,0.15); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }

#btn-show-join { background: #354355; }
#btn-start-game { background: var(--green); }

.button-row { display: flex; flex-direction: column; }

.hidden { display: none !important; }

.error {
  color: var(--red);
  font-size: 14px;
  margin-top: -8px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Startbildschirm ---------- */

.home-card {
  text-align: center;
  position: relative;
}

/* ---------- Uno-Logo (Wiedererkennung) ---------- */

.uno-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 18px;
}

.uno-logo-cards {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 54px;
  margin-bottom: -6px;
}

.uno-logo-cards .mini-card {
  width: 34px;
  height: 50px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
  font-size: 13px;
  color: white;
  margin: 0 -8px;
}

.mini-card-red { background: linear-gradient(160deg, #ff8a70, var(--red)); transform: rotate(-16deg) translateY(4px); z-index: 1; }
.mini-card-yellow { background: linear-gradient(160deg, #ffdd7f, var(--yellow)); transform: translateY(-6px); z-index: 3; }
.mini-card-green { background: linear-gradient(160deg, #7fd99b, var(--green)); transform: rotate(16deg) translateY(4px); z-index: 2; }

.uno-title {
  margin: 0;
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
  font-size: 42px;
  letter-spacing: 1px;
}

.uno-title span { text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }
.uno-title .l-red { color: var(--red); }
.uno-title .l-yellow { color: var(--yellow); }
.uno-title .l-green { color: var(--green); }
.uno-title .l-blue { color: var(--blue); }

.uno-title-sm {
  font-size: 22px;
  margin-bottom: 8px;
}

.name-input {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 34px;
  font-weight: 600;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid #354355;
  border-radius: 0;
  padding: 6px 4px 10px;
  margin-bottom: 22px;
}

.name-input:focus { outline: none; border-bottom-color: var(--blue); }

.skin-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 8px;
}

.skin-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1b2430;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
}

.skin-preview {
  width: 110px;
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.skin-preview img {
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.skin-standard-dot-lg {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #79b1ff, #1f56b5);
  margin-bottom: 20px;
}

.skin-preview-name {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 8px;
}

.my-stats {
  margin: 0 0 22px;
  font-size: 13px;
}

.home-actions {
  display: flex;
  gap: 14px;
  margin-bottom: 6px;
}

.home-action {
  flex: 1;
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 19px;
}

#btn-show-join.home-action { background: #354355; }

.lobby-browser {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #354355;
  text-align: left;
}

.lobby-browser h3 {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 500;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.leaderboard-header h3 { margin: 0; }

.sort-select-wrap {
  position: relative;
}

.sort-current-btn {
  width: auto;
  background: #1b2430;
  color: var(--blue);
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  margin: 0;
  border-radius: 8px;
  box-shadow: none;
}

.sort-options-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  background: #1b2430;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.sort-options-menu .mode-option-item {
  font-size: 13px;
  padding: 8px 10px;
}

.open-lobbies-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.open-lobbies-list li.hint { padding: 4px 0; }

.open-lobby-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1b2430;
  border-radius: 10px;
  padding: 10px 14px;
}

.open-lobby-info {
  font-size: 14px;
}

.open-lobby-code {
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
  letter-spacing: 2px;
}

.open-lobby-count {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}

.open-lobby-join {
  width: auto;
  padding: 8px 16px;
  margin: 0;
  font-size: 14px;
  background: var(--green);
}

/* ---------- Spielmodus-Umschalter in der Lobby ---------- */

.mode-switch {
  margin: 0 0 8px;
  text-align: center;
}

.mode-switch-title {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px;
}

.mode-select-wrap {
  position: relative;
  display: inline-block;
}

.mode-current-btn {
  width: auto;
  background: #1b2430;
  color: var(--blue);
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 18px;
  margin: 0;
  border-radius: 10px;
  box-shadow: none;
}

.mode-current-btn:disabled { cursor: default; opacity: 0.85; }

.mode-chevron {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.8;
}

.mode-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(8, 10, 14, 0.75);
}

.mode-options {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 151;
  background: #1b2430;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.mode-options-title {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  margin: 0 0 8px;
}

.mode-option-item {
  width: 100%;
  text-align: center;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  padding: 11px 10px;
  margin: 0;
  border-radius: 8px;
  box-shadow: none;
}

.mode-option-item:hover { background: #2c3a4c; color: var(--text); }
.mode-option-item.selected { color: var(--blue); font-weight: 600; }

.mode-option-locked {
  color: #5a6b80;
  opacity: 0.6;
}
.mode-option-locked:hover { color: #7a8ba0; background: #232f3f; }
.mode-option-locked.selected { color: var(--blue); opacity: 1; }

/* ---------- Farbwahl-Modal (Wild-Karten) ---------- */

.color-picker {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 151;
  background: #1b2430;
  border-radius: 14px;
  padding: 20px;
  min-width: 240px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  text-align: center;
}

.color-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1.4 / 1;
  border-radius: 12px;
  margin: 0;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
}

.color-swatch[data-color="red"] { background: linear-gradient(135deg, #ff8a70, var(--red)); }
.color-swatch[data-color="blue"] { background: linear-gradient(135deg, #79b1ff, var(--blue)); }
.color-swatch[data-color="green"] { background: linear-gradient(135deg, #7fd99b, var(--green)); }
.color-swatch[data-color="yellow"] { background: linear-gradient(135deg, #ffdd7f, var(--yellow)); }

/* ---------- Account-/Bestenliste-Modal ---------- */

.trophy-btn-pos { right: 14px; left: auto; }

.account-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 151;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 28px 26px;
  width: calc(100% - 40px);
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  text-align: center;
}

.account-modal-close-pos { top: 14px; right: 14px; left: auto; }

#account-profile-view h2, #account-login-view h2 {
  font-family: "Fredoka", "Inter", sans-serif;
  margin: 4px 0 4px;
}

#account-profile-view .my-stats { margin: 10px 0 18px; }
#account-profile-view button { max-width: 220px; margin: 0 auto 8px; }

#mode-hint { margin-top: 8px; margin-bottom: 0; }

/* ---------- Lehrer-Event-Banner im Spiel ---------- */

.teacher-event {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}

.teacher-event-img {
  width: 96px;
  height: 140px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  flex-shrink: 0;
}

.teacher-event-text {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  max-width: 90%;
  animation: pop-in 0.3s ease-out;
}

/* ---------- Emote-Radial-Menü ---------- */

.emote-wrap {
  position: relative;
  width: 48px;
  height: 48px;
}

.emote-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1b2430;
  font-size: 22px;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.emote-radial {
  position: absolute;
  inset: 0;
  z-index: 25;
}

.emote-btn {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1b2430;
  font-size: 20px;
  padding: 0;
  margin: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  animation: emote-pop-in 0.18s ease-out;
}

.emote-btn:active { transform: scale(0.9); }

.emote-pos-top { top: -62px; left: 2px; }
.emote-pos-right { top: 2px; left: 62px; }
.emote-pos-bottom { top: 62px; left: 2px; }
.emote-pos-left { top: 2px; left: -62px; }

@keyframes emote-pop-in {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.emote-popup {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  animation: emote-float 3s ease-out forwards;
}

.emote-popup .emote-emoji {
  font-size: 56px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}

.emote-popup .emote-name {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  background: rgba(0,0,0,0.55);
  padding: 3px 10px;
  border-radius: 8px;
  color: var(--text);
}

@keyframes emote-float {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  10% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  18% { transform: translate(-50%, 0) scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.9); }
}

.lobby-card { text-align: center; position: relative; padding-top: 22px; padding-bottom: 22px; }

.lobby-close-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1b2430;
  color: var(--muted);
  font-size: 15px;
  padding: 0;
  margin: 0;
  box-shadow: none;
  z-index: 5;
}

.lobby-title-label {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 6px;
}

.lobby-code {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 6px;
  text-align: center;
  background: #1b2430;
  border-radius: 14px;
  padding: 12px 0;
  margin-bottom: 14px;
  animation: pop-in 0.35s ease-out;
}

.lobby-qr {
  width: 128px;
  height: 128px;
  display: block;
  margin: 0 auto 6px;
  border-radius: 12px;
  background: white;
  padding: 8px;
  cursor: pointer;
}

.lobby-qr-hint {
  margin-bottom: 14px;
}

.qr-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 12, 16, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.qr-fullscreen img {
  width: min(80vw, 420px);
  height: min(80vw, 420px);
  background: white;
  border-radius: 20px;
  padding: 20px;
}

@keyframes pop-in {
  0% { transform: scale(0.9); opacity: 0; }
  70% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

.player-standees {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
}

.standee {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 96px;
}

.standee img {
  width: 76px;
  height: 114px;
  object-fit: contain;
  animation: pop-in 0.3s ease-out;
}

.standee-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin-top: 22px;
  margin-bottom: 22px;
  animation: pop-in 0.3s ease-out;
}

.standee-name {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.standee-accent {
  width: 28px;
  height: 4px;
  border-radius: 2px;
}

/* ---------- Spielbildschirm ---------- */

.game-wrap {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: relative;
}

.reset-turn-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1b2430;
  font-size: 18px;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.reset-menu-wrap {
  position: absolute;
  top: -6px;
  right: 4px;
  z-index: 20;
}

.reset-menu {
  position: absolute;
  top: 46px;
  right: 0;
  background: #1b2430;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 190px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.reset-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  font-size: 14px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 8px;
  box-shadow: none;
}

.reset-menu-item:hover { background: #2c3a4c; }

.turn-banner {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 18px;
  font-weight: 600;
  background: var(--card-bg);
  padding: 10px 20px;
  border-radius: 12px;
  text-align: center;
  width: 100%;
  max-width: 500px;
}

/* ---- Gegnerreihe ---- */

.opponents-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.opponent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--card-bg);
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 74px;
  position: relative;
  opacity: 0.6;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.opponent.active-turn {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--blue), 0 6px 16px rgba(0,0,0,0.4);
}

.opponent-avatar-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.opponent img {
  max-width: 34px;
  max-height: 44px;
  object-fit: contain;
}

.opponent-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #79b1ff, #1f56b5);
}

.opponent-name {
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
}

.opponent-count {
  font-size: 11px;
  color: var(--muted);
  background: #1b2430;
  padding: 1px 8px;
  border-radius: 8px;
}

.opponent-uno {
  position: absolute;
  top: -8px;
  right: -6px;
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 10px;
  font-weight: 600;
  background: var(--red);
  color: white;
  padding: 3px 6px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  cursor: pointer;
  animation: pulse 1s ease-in-out infinite;
  width: auto;
  margin: 0;
}

/* ---- Tisch: Ziehstapel + Ablage ---- */

.table-stage {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

.table-center {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 28px;
  padding: 10px 0;
}

.pile-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pile-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.discard-pile-wrap {
  position: relative;
}

.uno-card {
  width: 78px;
  height: 112px;
  border-radius: 10px;
  position: relative;
  box-shadow: 0 6px 16px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fredoka", "Inter", sans-serif;
  color: white;
  border: 3px solid rgba(255,255,255,0.85);
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.uno-card.card-back {
  background: radial-gradient(circle at 30% 30%, #3a4c66, #131a24);
  border-color: #354355;
  cursor: pointer;
}

.uno-card.card-back::after {
  content: "UNO";
  font-size: 15px;
  font-weight: 600;
  color: #5a7ba8;
  transform: rotate(-18deg);
}

.uno-card .card-oval {
  position: absolute;
  inset: 8px;
  background: rgba(255,255,255,0.92);
  border-radius: 50% / 38%;
}

.uno-card .card-symbol {
  position: relative;
  z-index: 2;
  font-size: 34px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.uno-card .card-corner {
  position: absolute;
  z-index: 2;
  font-size: 12px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

.uno-card .card-corner.top-left { top: 6px; left: 8px; }
.uno-card .card-corner.bottom-right { bottom: 6px; right: 8px; transform: rotate(180deg); }

.uno-card.color-red { background: linear-gradient(160deg, #ff8a70, var(--red)); }
.uno-card.color-blue { background: linear-gradient(160deg, #79b1ff, var(--blue)); }
.uno-card.color-green { background: linear-gradient(160deg, #7fd99b, var(--green)); }
.uno-card.color-yellow { background: linear-gradient(160deg, #ffdd7f, var(--yellow)); }
.uno-card.color-wild { background: conic-gradient(from 45deg, var(--red), var(--yellow), var(--green), var(--blue), var(--red)); }
.uno-card.color-wild .card-symbol { color: white; text-shadow: 0 2px 4px rgba(0,0,0,0.6); }

.stack-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: white;
  font-family: "Fredoka", "Inter", sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  white-space: nowrap;
}

.draw-pile-count {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #1b2430;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
}

/* ---- Aktionsreihe ---- */

.action-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  justify-content: center;
}

.action-row button {
  width: auto;
  flex: 1;
  max-width: 150px;
}

.uno-btn {
  background: var(--red);
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 18px;
  letter-spacing: 0.5px;
}

#btn-draw { background: #354355; }
.secondary { background: #354355; }

/* ---- Handbereich ---- */

.hand-wrap {
  width: 100%;
  max-width: 640px;
  overflow-x: auto;
  overflow-y: visible;
  padding: 14px 6px 8px;
}

.hand {
  display: flex;
  justify-content: center;
  min-width: min-content;
  padding: 0 20px;
}

.hand .uno-card {
  margin-left: -22px;
  cursor: default;
  filter: brightness(0.72) saturate(0.6);
}

.hand .uno-card:first-child { margin-left: 0; }

.hand .uno-card.playable {
  cursor: pointer;
  filter: none;
  animation: pulse 1.1s ease-in-out infinite;
}

.hand .uno-card.playable:hover {
  transform: translateY(-14px);
  z-index: 5;
}

@keyframes pulse {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.06) translateY(-4px); }
}

.winner-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 160;
  font-family: "Fredoka", "Inter", sans-serif;
  font-size: 22px;
  font-weight: 600;
  background: var(--green);
  color: #10241a;
  padding: 28px 30px;
  border-radius: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  min-width: 260px;
}

#winner-backdrop { z-index: 159; }

#winner-text { margin: 0; }

#btn-play-again {
  width: auto;
  background: #10241a;
  color: var(--text);
  font-size: 15px;
  padding: 10px 20px;
  margin: 0;
}

/* ---------- Konfetti ---------- */

.confetti-piece {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 16px;
  z-index: 100;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(600deg); opacity: 0.9; }
}

/* Ab Desktop-Breite: etwas mehr Luft, Gegnerreihe bleibt oben */
@media (min-width: 900px) {
  .game-wrap { max-width: 760px; }
  .uno-card { width: 88px; height: 126px; }
  .hand .uno-card { margin-left: -20px; }
}
