:root {
  --primary: #FF6B35;
  --secondary: #2ECC71;
  --accent: #3498DB;
  --warning: #F39C12;
  --success: #27AE60;
  --error: #E74C3C;
  --text-dark: #2C3E50;
  --text-light: #ECF0F1;
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --shadow: 0 8px 32px rgba(0,0,0,0.1);
  --glass-bg: rgba(255,255,255,0.15);
  --glass-border: rgba(255,255,255,0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

header {
  text-align: center;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 0;
  text-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: pulse 3s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 2rem;
  width: 100%;
  max-width: 900px;
  box-shadow: var(--shadow);
  position: relative;
}

.level-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: levelPop 0.5s ease-out;
}

@keyframes levelPop {
  0% { transform: scale(0.5); opacity: 0; }
  80% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.task-info {
  text-align: center;
  margin-bottom: 1.5rem;
}

.task-info h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.highlight {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.3em;
  text-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.score {
  display: flex;
  justify-content: center;
  gap: 1rem;
  font-size: 1.4rem;
  font-weight: 600;
  flex-wrap: wrap;
  color: var(--warning);
}

.highscore {
  font-size: 1rem;
  color: var(--warning);
  font-weight: bold;
  margin-top: 0.5rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.circles-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  gap: 1rem;
}

.circle-wrapper {
  text-align: center;
  flex: 1;
}

.circle-wrapper h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
  color: var(--text-light);
}

.circle {
  width: clamp(200px, 28vw, 280px);
  height: clamp(200px, 28vw, 280px);
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 5px solid var(--primary);
  position: relative;
  margin: 0 auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
}

.circle:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.circle.drag-over {
  border-color: var(--success);
  background: rgba(46, 204, 113, 0.15);
  transform: scale(1.08);
  box-shadow: 0 16px 40px rgba(46, 204, 113, 0.4);
}

.circle-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
  color: var(--text-dark);
  font-size: 1.5rem;
  z-index: 10;
  background: rgba(255,255,255,0.9);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  pointer-events: none;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.slice {
  position: absolute;
  width: 90%;
  height: 90%;
  left: 5%;
  top: 5%;
  border-radius: 50%;
  transform-origin: center;
  cursor: grab;
  transition: transform 0.3s cubic-bezier(.68,-0.55,.27,1.55), box-shadow 0.3s, opacity 0.3s;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: slicePop 0.5s ease-out;
}

@keyframes slicePop {
  0% { 
    transform: scale(0.3) rotate(-10deg); 
    opacity: 0; 
  }
  60% { 
    transform: scale(1.1) rotate(5deg); 
    opacity: 1; 
  }
  100% { 
    transform: scale(1) rotate(0deg); 
    opacity: 1; 
  }
}

.slice:active {
  cursor: grabbing;
}

.slice:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.slice.dragging {
  opacity: 0.8;
  transform: scale(1.15) rotate(-5deg);
  z-index: 1000;
  box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.slice.half {
  background: conic-gradient(from 0deg, var(--primary) 0deg 180deg, transparent 180deg 360deg);
}

.slice.quarter {
  background: conic-gradient(from 0deg, var(--primary) 0deg 90deg, transparent 90deg 360deg);
}

.slice.third {
  background: conic-gradient(from 0deg, var(--primary) 0deg 120deg, transparent 120deg 360deg);
}

.slice.sixth {
  background: conic-gradient(from 0deg, var(--primary) 0deg 60deg, transparent 60deg 360deg);
}

.slice.eighth {
  background: conic-gradient(from 0deg, var(--primary) 0deg 45deg, transparent 45deg 360deg);
}

/* Farben für verschiedene Bruchteile */
.slice.color-1 { 
  filter: hue-rotate(0deg);
}
.slice.color-2 { 
  filter: hue-rotate(60deg);
}
.slice.color-3 { 
  filter: hue-rotate(120deg);
}
.slice.color-4 { 
  filter: hue-rotate(180deg);
}
.slice.color-5 { 
  filter: hue-rotate(240deg);
}
.slice.color-6 { 
  filter: hue-rotate(300deg);
}

.arrow {
  font-size: 3rem;
  color: var(--primary);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

.feedback-container {
  text-align: center;
  margin: 2rem 0;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback {
  font-size: 2rem;
  font-weight: bold;
  padding: 1.5rem 2.5rem;
  border-radius: 30px;
  transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.feedback.success {
  background: var(--success);
  color: white;
  animation: celebration 0.8s ease-out;
  transform: scale(1.05);
}

.feedback.error {
  background: var(--error);
  color: white;
  animation: errorShake 0.5s ease-out;
}

.feedback.hint {
  background: var(--warning);
  color: white;
  animation: hintPulse 0.6s ease-out;
}

@keyframes celebration {
  0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
  30% { transform: scale(1.2) rotate(2deg); opacity: 1; }
  100% { transform: scale(1.05) rotate(0deg); opacity: 1; }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes hintPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.btn {
  padding: 0;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.68,-0.55,.27,1.55);
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none;
}

.btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  background: var(--success);
}

.btn:active {
  transform: translateY(-1px) scale(1.05);
}

.btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -3rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
  z-index: 1000;
  animation: tooltipFade 0.2s ease-out;
}

@keyframes tooltipFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Punkte-Animation */
.points-animate {
  animation: popPoints 0.6s;
}

@keyframes popPoints {
  0% { transform: scale(1); color: var(--text-light); }
  40% { transform: scale(1.4); color: var(--warning); }
  100% { transform: scale(1); color: var(--text-light); }
}

/* Pizza-Stücke Animation */
.pizza-fly {
  position: absolute;
  top: 60%;
  font-size: 2.2rem;
  animation: pizzaFly 1.5s ease-out forwards;
  pointer-events: none;
}

@keyframes pizzaFly {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(-80px) scale(1.3) rotate(-20deg);}
  100% { opacity: 0; transform: translateY(-120px) scale(0.8) rotate(30deg);}
}

footer {
  text-align: center;
  margin-top: 2rem;
  opacity: 0.8;
}

.info p {
  margin: 0.5rem 0;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .circles-container {
    flex-direction: column;
    gap: 2rem;
  }
  
  .arrow {
    transform: rotate(90deg);
    font-size: 2rem;
  }
  
  .score {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .controls {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 200px;
  }
}

@media (max-width: 500px) {
  .game-container {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  .circle {
    width: 150px;
    height: 150px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .circle {
    border-width: 6px;
  }
  
  .slice {
    border-width: 3px;
  }
}

/* Success animation for completed tasks */
.task-complete {
  animation: taskSuccess 1s ease-out;
}

@keyframes taskSuccess {
  0% { transform: scale(1); }
  25% { transform: scale(1.05) rotate(2deg); }
  50% { transform: scale(1.1) rotate(-2deg); }
  75% { transform: scale(1.05) rotate(1deg); }
  100% { transform: scale(1); }
}

/* Belohnungssystem */
.reward-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
}

.star {
  position: absolute;
  font-size: 2rem;
  animation: starFall 2s ease-out forwards;
  pointer-events: none;
}

@keyframes starFall {
  0% {
    transform: translateY(-100px) rotate(0deg);
    opacity: 1;
    scale: 0;
  }
  30% {
    scale: 1.2;
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
    scale: 0.5;
  }
}

/* Verbesserte Hover-Effekte für Buttons */
.btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* Kindgerechte Cursor für interaktive Elemente */
.slice {
  cursor: grab;
}

.slice:active {
  cursor: grabbing;
}

.btn {
  cursor: pointer;
}

/* Animierte Emojis im Feedback */
.feedback.success {
  position: relative;
  overflow: visible;
}

.feedback.success::after {
  content: '🎉';
  position: absolute;
  top: -20px;
  right: -20px;
  font-size: 2rem;
  animation: bounce 1s infinite;
}
