@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDelayed {
  0% {opacity: 0;}
  100% {opacity: 1;}
}

@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes bodyFadeIn {
  from {opacity: 0;}
  to {opacity: 1;}
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulseButton {
  0%, 100% {
    filter: brightness(1);
    transform: scale(1);
  }
  50% {
    filter: brightness(1.15);
    transform: scale(1.05);
  }
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseLoading {
  0%, 100% {opacity: 1;}
  50% {opacity: 0.5;}
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #2c3e50, #3498db);
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  animation: bodyFadeIn 1.2s ease forwards;
}

header {
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  animation: slideInLeft 1s ease forwards;
}

header h1 {
  margin: 0;
  font-size: 1.8em;
}

header h1::before {
  content: '';
  margin-right: 0;
  display: none;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo {
  height: 40px;
  width: 40px;
  animation: pulse 2s infinite;
  background-color: #3498db;
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  width: 100%;
  max-width: 900px;
  padding-top: 100px;
}

.description {
  font-size: 1.2em;
  margin-bottom: 30px;
  max-width: 600px;
  opacity: 0;
  animation: fadeInDelayed 1.5s ease forwards;
  animation-delay: 0.5s;
}

.btn, .login-card button, header button {
  background: #3498db;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  display: inline-block;
  text-align: center;
}

.btn:hover, .login-card button:hover, header button:hover {
  background: #2980b9;
  transform: scale(1.1);
  box-shadow: 0 0 12px #2980b9;
}

header button {
  animation: pulseButton 3s infinite;
}

header button:hover {
  animation-play-state: paused;
}

.btn-primary {
  background: #3498db;
  animation: fadeInScale 1s ease forwards;
}

.btn-secondary {
  background: #e94560;
  animation: fadeInScale 1s ease forwards;
  animation-delay: 0.2s;
}

.btn-success {
  background: #27ae60;
}

.btn-danger {
  background: #e74c3c;
}

.btn-google {
  background: #db4437;
}

.btn-group, header .buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

header .buttons {
  margin-top: 0;
}

.btn-container {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}

.main-content .login-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  padding: 32px 28px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  animation: fadeInUp 0.8s ease forwards;
}

.main-content .login-card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.4em;
}

.main-content .login-card h2::before {
  content: '✨';
  margin-right: 8px;
}

.main-content .login-card input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  margin-bottom: 12px;
  font-size: 1.1em;
  background: rgba(255,255,255,0.13);
  color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background 0.3s;
  box-sizing: border-box;
}

/* Neue, verbesserte Stile fÃ¼r alle Texteingabefelder */
input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-size: 1.1em;
  background: rgba(255,255,255,0.13);
  color: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background 0.3s;
  box-sizing: border-box;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
input[type="email"]::placeholder {
  color: rgba(255,255,255,0.7);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus {
  background: rgba(52,152,219,0.13);
  outline: 2px solid #3498db;
}
/* Ende der neuen Stile */

.error-message, .info-message, .success-message {
  padding: 15px;
  text-align: center;
  font-weight: bold;
  border-radius: 8px;
  min-height: 20px;
  margin-top: 20px;
  width: 100%;
}

.error-message {
  background: rgba(231, 76, 60, 0.2);
  border: 1px solid #e74c3c;
  color: #e74c3c;
}

.error-message::before {
  content: '😟';
  margin-right: 8px;
}

.info-message {
  background: rgba(52, 152, 219, 0.2);
  border: 1px solid #3498db;
  color: #3498db;
}

.info-message::before {
  content: '💡';
  margin-right: 8px;
}

.success-message {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid #2ecc71;
  color: #2ecc71;
}

.success-message::before {
  content: '🎉';
  margin-right: 8px;
}

.loading {
  text-align: center;
  margin-top: 50px;
  font-size: 1.5em;
  animation: pulseLoading 2s infinite;
}

.loading.show {
  display: block;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: none;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.show {
  display: block;
  opacity: 1;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #34495e;
  padding: 20px;
  border-radius: 10px;
  display: none;
  z-index: 1000;
  text-align: center;
  width: 300px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.show {
  display: block;
  animation: fadeInDelayed 0.3s ease forwards;
  opacity: 1;
}

.main-content .intro-section {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
}

#blocklyDiv {
  height: 500px;
  width: 100%;
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  margin-bottom: 20px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: background-color 0.4s;
  border-radius: 34px;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: #4caf50;
  box-shadow: 0 0 8px #4caf50aa;
}

input:checked + .slider:before {
  transform: translateX(26px);
  box-shadow: 0 2px 8px #3b8e40;
}

.container {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  animation: fadeInUp 0.7s ease forwards;
}

.level-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

main#levelsContainer .level-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeUp 0.8s ease forwards;
  animation-delay: var(--delay);
  flex: 1 1 280px;
}

main#levelsContainer .level-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 8px 20px rgba(255,255,255,0.3);
}

main#levelsContainer .level-card h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.4em;
}
main#levelsContainer .level-card p {
  flex-grow: 1;
  font-size: 1em;
  line-height: 1.3;
  margin-bottom: 15px;
  min-height: 60px;
}
main#levelsContainer .level-card button {
  align-self: flex-start;
  padding: 10px 15px;
  border: none;
  background: #27ae60;
  color: white;
  font-weight: bold;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
main#levelsContainer .level-card button:hover {
  background: #1e8449;
  transform: scale(1.1);
  box-shadow: 0 0 15px #1e8449;
}

.level-content {
  display: flex;
  gap: 20px;
  padding: 20px;
  height: calc(100vh - 100px);
}

.workspace-area {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#blocklyDiv {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.output-area {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.output-area h2 {
  margin: 0 0 15px 0;
  font-size: 1.4em;
}

#output {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 15px;
  font-family: monospace;
  font-size: 1.1em;
  white-space: pre-wrap;
}

.controls {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

@media (max-width: 600px) {
  .login-card { min-width: 90vw; padding: 16px 4vw;}
  header h1 { font-size: 1.2em;}
}

main#levelsContainer {
  flex: 1;
  padding: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 25px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}