:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent: #4facfe;
  --accent-secondary: #00f2fe;
  --danger: #ef4444;
  --danger-hover: #dc2626;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.container {
  width: 100%;
  max-width: 400px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.cycle-counter {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.visualization {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#breathCanvas {
  display: block;
}

.phase-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.phase-name, .phase-timer {
  position: relative;
}

.phase-timer-wrapper {
  font-size: 3rem;
  font-weight: 300;
  margin-top: 0.25rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.phase-names-wrapper {
  position: relative;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase-name {
  position: absolute;
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.phase-name.inhale { color: #4facfe; }
.phase-name.inhale-hold { color: #00f2fe; }
.phase-name.exhale { color: #667eea; }
.phase-name.exhale-hold { color: #764ba2; }

.phase-timer {
  font-size: 3rem;
  font-weight: 300;
  margin-top: 0.25rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.instruction {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 280px;
}

.start-hint {
  text-align: center;
  color: var(--text-secondary);
}

.start-hint p:first-child {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.start-hint p:last-child {
  font-size: 0.875rem;
}

.colors-indicator {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.color-dot:first-child {
  transform: scale(1.2);
}

/* Technique selector */
.technique-selector {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.technique-selector select {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

@media (prefers-color-scheme: dark) {
  .technique-selector select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}

.add-technique-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.add-technique-btn:hover {
  background: var(--accent-hover);
}

.delete-technique-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.delete-technique-btn:hover {
  background: var(--danger-hover);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.modal {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.modal h2 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-group input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.phases-preview {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  min-height: 80px;
}

.phase-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

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

.phase-duration {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.phase-placeholder {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-align: center;
  padding: 0.5rem;
}

.phases-list {
  display: block;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  flex: 1;
  padding: 0.875rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}

:root {
  --border: rgba(255,255,255,0.1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --accent: #4facfe;
    --accent-hover: #3b82f6;
    --border: rgba(0,0,0,0.1);
  }
}