* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.3);
  --bg-card: rgba(255, 255, 255, 0.06);
  --text-light: #ffffff;
  --text-muted: #888;
  --success: #22c55e;
}

html { background: #0f0f1a; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
  min-height: 100vh;
  color: var(--text-light);
  overscroll-behavior: none;
}

.app {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 20px;
  padding-top: calc(env(safe-area-inset-top, 20px) + 40px);
  padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 60px);
  min-height: 100vh;
}

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 28px;
}

.back-btn {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  -webkit-tap-highlight-color: transparent;
}

.back-btn:active { background: rgba(255, 255, 255, 0.15); }

header h1 {
  font-size: 1.3rem;
  font-weight: 600;
}

/* Form */
.form-group { margin-bottom: 22px; }

.form-group label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

select, input[type="time"] {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  font-size: 1rem;
  background: var(--bg-card);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  -webkit-appearance: none;
  appearance: none;
}

select:focus, input[type="time"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Schlafdauer */
.sleep-row { display: flex; flex-direction: column; gap: 8px; }
.sleep-hint {
  font-size: 0.9rem;
  color: rgba(139, 92, 246, 0.9);
  text-align: center;
}
.hint-text {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Result */
.result-container {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 20px;
}

.result-header {
  padding: 14px 18px;
  background: rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 600;
  font-size: 0.95rem;
}

pre {
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
  padding: 18px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #e0e0e0;
  margin: 0;
}

/* Active Times */
.active-times {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

.times-row { display: flex; gap: 12px; }

.time-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.time-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.time-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

/* Confirm Button */
.confirm-btn {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.3);
}

.confirm-btn:active { transform: scale(0.98); }

.confirm-btn.success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
}

.confirm-icon { font-size: 1.3rem; }

/* Success Message */
.success-message {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--success);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.success-message.show {
  opacity: 1;
  transform: translateY(0);
}