/* Behält die vorherigen Spielstile bei und überschreibt nur die body-Stile, um Konflikte zu vermeiden */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

/* Entfernt die expliziten Hintergrundfarben, da diese von default.css übernommen werden */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-color);
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Klicks gehen durch */
  z-index: -1;
  /* Hinter allem anderen platzieren */
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--card-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  padding: 30px 40px;
  border-radius: 20px;
  border: var(--card-border);
  text-align: left;
  /* Überschriften linksbündig wie im Timer */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  animation: fadeIn 0.3s ease-out;
  width: 95%;
  max-width: 450px;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 2em;
  color: var(--primary);
  font-weight: bold;
  text-align: center;
}

.modal-subtitle {
  color: #ccc;
  font-weight: bold;
  margin-bottom: 1rem;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 1px;
  text-align: left;
}

.modal-content p {
  font-size: 1.2em;
  margin-bottom: 25px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  position: relative;
  /* Notwendig für z-index */
  z-index: 10;
  /* Stellt sicher, dass das Spiel über dem Konfetti liegt */
}

canvas {
  border: 4px solid var(--text-color);
  background: rgba(0, 0, 0, 0.2);
  image-rendering: pixelated;
  border-radius: 8px;
  /* Hardware acceleration for smoother animations */
  will-change: contents;
  transform: translateZ(0);
}

#tetris {
  height: 85vh;
  width: auto;
  max-width: 70vw;
  /* Verhindert horizontales Überlaufen auf schmalen Screens */
  max-height: 800px;
  /* Optional: Maximale Größe für extrem hohe Bildschirme */
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 140px;
}

.controls {
  font-size: 14px;
  white-space: pre-line;
}

.rainbow {
  animation: rainbow 1s linear infinite;
}

@keyframes rainbow {
  0% {
    border-color: red;
  }

  16% {
    border-color: orange;
  }

  33% {
    border-color: yellow;
  }

  50% {
    border-color: green;
  }

  66% {
    border-color: blue;
  }

  83% {
    border-color: indigo;
  }

  100% {
    border-color: violet;
  }
}

@keyframes shake {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  20% {
    transform: translate(-2px, 2px) rotate(-1deg);
  }

  40% {
    transform: translate(2px, -2px) rotate(1deg);
  }

  60% {
    transform: translate(-2px, 2px) rotate(-1deg);
  }

  80% {
    transform: translate(2px, -2px) rotate(1deg);
  }

  100% {
    transform: translate(0, 0) rotate(0deg);
  }
}

.shake {
  animation: shake 0.3s;
}

#wowMessage {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 72px;
  font-weight: bold;
  color: #ff0d72;
  text-shadow: 0 0 5px #ff0d72, 0 0 10px #ff0d72, 0 0 20px #ff0d72, 0 0 40px #ff0d72;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: 1000;
}

.floating-points {
  position: fixed;
  transform: translate(-50%, 0);
  font-size: 32px;
  font-weight: bold;
  color: #FFE138;
  text-shadow: 0 0 5px #000, 0 0 10px #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  z-index: 1000;
}

.floating-combo {
  position: fixed;
  transform: translate(-50%, 0);
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-out, transform 1s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1001;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.button-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 15px;
  z-index: 1001;
}

.game-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 2px solid var(--text-color);
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: bold;
  padding: 0;
  position: relative;
}

/* Absolute Schnee-Eliminierung inklusive Pseudo-Elementen */
.snow-wrapper .snow-cap,
.snow-wrapper .snow-drip,
.snow-cap,
.snow-drip,
[class*="snow-cap"],
[class*="snow-drip"],
.snow-cap::before,
.snow-cap::after {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
  content: none !important;
}

.snow-wrapper {
  display: inline-block !important;
  transform: none !important;
  margin: 0 !important;
}

/* Entfernt den Standard-Shine der Buttons, falls er stört */
html[data-theme] .game-button::after,
html[data-theme] .rainbow-button::after,
html[data-theme] .btn::after {
  content: none !important;
  display: none !important;
}

.game-button:hover {
  opacity: 0.8;
  transform: scale(1.1);
  border-color: #ff0d72;
}

.game-button svg {
  stroke: var(--text-color);
  transition: all 0.3s ease;
}

.game-button:hover svg {
  stroke: #ff0d72;
}

#next,
#hold {
  width: 7rem;
  height: 7rem;
}

.score-stats {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 25px;
}

.score-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 15px 25px;
  flex: 1;
}

.score-stat-label {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #aaa;
  margin-bottom: 8px;
}

.score-stat-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--text-color);
}

.new-highscore-badge {
  background: var(--primary);
  color: white;
  text-align: center;
  border-radius: 20px;
  padding: 5px 15px;
  font-size: 0.8em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
  animation: fadeIn 0.5s ease;
}

.rainbow-button {
  background-image: linear-gradient(90deg, #ff0d72, #ff8e0d, #ffe138, #0dff72, #0dc2ff, #3877ff, #f538ff);
  background-size: 200% auto;
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 1.2em;
  cursor: pointer;
  transition: background-position 0.5s;
}

.rainbow-button:hover {
  background-position: right center;
}

.btn-primary {
  background-color: var(--primary) !important;
  border: none !important;
  font-weight: bold !important;
  padding: 12px !important;
  border-radius: 8px !important;
  transition: all 0.3s ease !important;
}

.btn-primary:hover {
  filter: brightness(1.2) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.settings-section {
  margin-bottom: 30px;
}

.settings-section h3 {
  margin-bottom: 15px;
  color: var(--text-color);
}

.style-selector {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  padding: 5px 0;
}

/* Premium Volume Slider Styles */
.slider-container {
  width: 100%;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  outline: none;
  border: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(255, 13, 114, 0.8);
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--primary);
  border: 3px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

/* Toggle Switch Styles (Blockdrop Specific to avoid global conflicts) */
.toggle-container-simple {
  width: 100%;
}

.toggle-label {
  margin: 0 !important;
  padding: 0 !important;
  line-height: normal !important;
  font-weight: normal;
}

.bd-switch {
  position: relative;
  display: flex;
  align-items: center;
  width: 50px;
  height: 24px;
  margin: 0 !important;
  flex-shrink: 0;
}

.bd-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.bd-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444;
  transition: .4s;
  border-radius: 34px;
}

.bd-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked+.bd-slider {
  background-color: var(--primary);
}

input:checked+.bd-slider:before {
  transform: translateX(26px);
}

.list-group-item {
  border-color: rgba(255, 255, 255, 0.1) !important;
  padding: 0.75rem 0 !important;
}

.settings-section h3,
.settings-section label {
  display: block;
  margin-bottom: 12px;
  color: #ccc;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 1px;
  text-align: left;
}

.style-option {
  cursor: pointer;
  border: 3px solid transparent;
  border-radius: 8px;
  padding: 5px;
  transition: border-color 0.3s;
}

.style-option.selected {
  border-color: #ff0d72;
}

.style-preview {
  display: grid;
  grid-template-columns: repeat(4, 15px);
  grid-template-rows: repeat(2, 15px);
  gap: 4px;
}

.preview-block {
  width: 15px;
  height: 15px;
  border-radius: 3px;
}

#star-canvas {
  border: none;
}

/* Mode Selection */
.mode-select-options {
  display: flex;
  gap: 16px;
}

.mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--text-color);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  font-family: inherit;
}

.mode-btn:hover {
  border-color: var(--primary);
  background: rgba(255, 13, 114, 0.1);
  transform: translateY(-3px);
}

.mode-btn-icon {
  font-size: 2.2em;
}

.mode-btn-name {
  font-size: 1.1em;
  font-weight: bold;
}

.mode-btn-desc {
  font-size: 0.78em;
  color: #aaa;
  text-align: center;
}

.mode-btn-hs {
  font-size: 0.82em;
  color: var(--primary);
  font-weight: bold;
  margin-top: 4px;
}

/* Mode badge in sidebar */
.mode-badge {
  font-size: 0.78em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  opacity: 0.85;
}

/* Leaderboard Modal */
.bd-close-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.2em;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: opacity 0.2s;
}

.bd-close-btn:hover {
  opacity: 1;
}

.bd-lb-tab {
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid transparent;
  border-radius: 20px;
  color: var(--text-color);
  padding: 6px 20px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  transition: border-color 0.2s, background 0.2s;
}

.bd-lb-tab.active {
  border-color: var(--primary);
  background: rgba(255, 13, 114, 0.12);
}

.bd-lb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.bd-lb-item:last-child {
  border-bottom: none;
}

.bd-lb-item.bd-lb-me {
  background: rgba(255, 13, 114, 0.08);
  border-radius: 8px;
}

.bd-lb-rank {
  width: 28px;
  text-align: right;
  font-size: 0.85em;
  color: #888;
  flex-shrink: 0;
}

.bd-lb-name {
  flex: 1;
  font-weight: bold;
  font-size: 0.95em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bd-lb-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.bd-lb-score {
  font-weight: bold;
  font-size: 1em;
  color: var(--primary);
}

.bd-lb-meta {
  font-size: 0.75em;
  color: #888;
}

@media (max-width: 600px) {
  .container {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
    height: 100dvh;
    padding: 6px 6px 70px 6px; /* 70px unten für Buttons */
    box-sizing: border-box;
    justify-content: space-between;
  }

  #tetris {
    order: 2;
    height: auto;
    width: auto;
    max-height: calc(100dvh - 160px);
    max-width: 95vw;
    margin-top: auto;
  }

  .button-container {
    flex-direction: row;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    gap: 12px;
  }

  .game-button {
    width: 46px;
    height: 46px;
  }

  .sidebar {
    order: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    min-width: unset;
    width: 100%;
    flex-shrink: 0;
    padding: 0 8px;
    box-sizing: border-box;
    gap: 0;
  }

  #next {
    order: 1;
  }

  .score-group {
    order: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    text-align: center;
    white-space: nowrap;
  }

  #hold {
    order: 3;
  }

  .controls {
    display: none;
  }

  #next,
  #hold {
    width: 5rem;
    height: 5rem;
  }
}