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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: #2d3748;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: background 0.3s ease;
}

body.dark-mode {
  background: #1a202c;
}

body.dark-mode .main-content,
body.dark-mode .sidebar-info {
  background: #2d3748;
  color: #e2e8f0;
}

body.dark-mode h1 {
  color: #90cdf4;
}

body.dark-mode label,
body.dark-mode .segment-label {
  color: #cbd5e0;
}

body.dark-mode input,
body.dark-mode select {
  background: #4a5568;
  color: #e2e8f0;
  border-color: #4a5568;
}

body.dark-mode .progress-container {
  background: #4a5568;
}

.curis-container {
  display: flex;
  gap: 30px;
  max-width: 1400px;
  width: 100%;
}

.main-content {
  flex: 1;
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transition: background 0.3s ease, color 0.3s ease;
}

.sidebar-info {
  width: 300px !important;
  min-width: 300px !important;
  background: white;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transition: background 0.3s ease;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: static !important;
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.header-left {
  flex: 1;
}

.header-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s;
  color: #667eea;
  position: relative;
}

body.dark-mode .icon-btn {
  background: #2d3748;
  border-color: #4a5568;
  color: #90cdf4;
}

.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
  border-color: #667eea;
  background: #f8f9ff;
}

body.dark-mode .icon-btn:hover {
  background: #374151;
  border-color: #90cdf4;
  box-shadow: 0 6px 16px rgba(144, 205, 244, 0.2);
}

.icon-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

body.dark-mode .icon-btn.active {
  background: #90cdf4;
  color: #1a202c;
  border-color: #90cdf4;
}

.icon-btn.active:hover {
  background: #5568d3;
  border-color: #5568d3;
}

body.dark-mode .icon-btn.active:hover {
  background: #7ec4e0;
  border-color: #7ec4e0;
}

.icon-btn[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
}

body.dark-mode .icon-btn[title]:hover::after {
  background: rgba(255, 255, 255, 0.95);
  color: #1a202c;
}

h1 {
  text-align: center;
  color: #667eea;
  margin-bottom: 5px;
  font-size: 28px;
}

.version {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-bottom: 10px;
}

.intro-text {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 25px;
  padding: 20px;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
  border-radius: 12px;
  border-left: 4px solid #667eea;
}

body.dark-mode .intro-text {
  background: linear-gradient(135deg, #374151 0%, #2d3748 100%);
  border-left-color: #90cdf4;
}

.intro-text h2 {
  font-size: 18px;
  color: #667eea;
  margin-bottom: 10px;
  font-weight: 600;
}

body.dark-mode .intro-text h2 {
  color: #90cdf4;
}

.intro-text p {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
  margin: 0;
}

body.dark-mode .intro-text p {
  color: #cbd5e0;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-box {
  background: #f8f9fa;
  padding: 10px 20px;
  border-radius: 8px;
  text-align: center;
}

body.dark-mode .stat-box {
  background: #4a5568;
}

.stat-label {
  font-size: 11px;
  color: #999;
  text-transform: uppercase;
}

.stat-value {
  font-size: 18px;
  font-weight: bold;
  color: #667eea;
}

body.dark-mode .stat-value {
  color: #90cdf4;
}

.copyright {
  text-align: center;
  font-size: 11px;
  color: #999;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.preset-group {
  margin-bottom: 20px;
  text-align: center;
}

.preset-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.timer-goal-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.timer-goal-group label {
  font-weight: 600;
  color: #333;
}

.timer-goal-group input {
  width: 70px;
}

select {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  cursor: pointer;
  transition: border-color 0.3s;
  min-width: 250px;
}

select:focus {
  outline: none;
  border-color: #667eea;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

input[type="number"] {
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  width: 70px;
  text-align: center;
}

input[type="number"]:focus {
  outline: none;
  border-color: #667eea;
}

.breathing-section {
  display: flex;
  gap: 30px;
  align-items: center;
  justify-content: center;
  margin-bottom: 30px;
}

.breathing-circle {
  width: min(300px, 40vw);
  height: min(300px, 40vw);
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  position: relative;
}

.breathing-circle::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.1); }
}

.breathing-circle.inhale {
  animation: grow 1s ease-in-out;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.breathing-circle.hold {
  transform: scale(1);
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  box-shadow: 0 10px 30px rgba(156, 163, 175, 0.3);
}

.breathing-circle.relaxed {
  transform: scale(1);
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  box-shadow: 0 10px 30px rgba(156, 163, 175, 0.3);
}

.breathing-circle.exhale {
  animation: shrink 1s ease-in-out;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

@keyframes grow {
  from { transform: scale(1); }
  to { transform: scale(1.3); }
}

@keyframes shrink {
  from { transform: scale(1.3); }
  to { transform: scale(1); }
}

.phase-text {
  color: white;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: bold;
  text-align: center;
}

.guidance-text {
  max-width: 250px;
  text-align: left;
}

.guidance-text h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 20px;
}

body.dark-mode .guidance-text h3 {
  color: #90cdf4;
}

.guidance-text p {
  color: #666;
  font-size: 16px;
  line-height: 1.6;
}

body.dark-mode .guidance-text p {
  color: #cbd5e0;
}

.timer-display {
  text-align: center;
  font-size: clamp(18px, 4vw, 24px);
  color: #666;
  margin-bottom: 20px;
}

body.dark-mode .timer-display {
  color: #cbd5e0;
}

.goal-alert {
  background: #10b981;
  color: white;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  font-weight: bold;
  margin-bottom: 20px;
  display: none;
  animation: slideIn 0.5s ease;
}

@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.progress-container {
  width: 100%;
  max-width: 600px;
  height: 80px;
  margin: 0 auto 20px;
  background: #f5f5f5;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
}

.breath-segment {
  height: 100%;
  position: relative;
  border-right: 1px solid rgba(255,255,255,0.3);
  transition: all 0.3s ease;
}

.breath-segment:last-child {
  border-right: none;
}

.breath-segment.inhale {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.breath-segment.hold {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

.breath-segment.exhale {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.breath-segment.relaxed {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
}

.breath-segment svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.breath-segment svg path {
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress-marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: rgba(255, 59, 48, 0.8);
  box-shadow: 0 0 8px rgba(255, 59, 48, 0.6);
  transition: none;
  z-index: 10;
}

.progress-marker::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 59, 48, 0.9);
  border-radius: 50%;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.8);
}

.progress-marker::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: rgba(255, 59, 48, 0.9);
  border-radius: 50%;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.8);
}

.segment-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 0.5px;
}

.button-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

button {
  padding: 15px 40px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 120px;
}

.start-btn {
  background: #10b981;
  color: white;
}

.start-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.pause-btn {
  background: #f59e0b;
  color: white;
}

.pause-btn:hover {
  background: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.stop-btn {
  background: #dc3545;
  color: white;
}

.stop-btn:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.share-btn {
  background: #667eea;
  color: white;
  padding: 12px 24px;
  font-size: 15px;
  min-width: auto;
}

.share-btn:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.info-card {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  text-align: center;
  color: #6c757d;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.3s ease;
}

body.dark-mode .info-card {
  background: #4a5568;
  border-color: #4a5568;
  color: #cbd5e0;
}

/* Clickable card link styles */
.info-card.card-link {
  text-decoration: none;
  cursor: pointer;
  border-style: solid;
  border-color: #e0e0e0;
}

.info-card.card-link:hover {
  background: #667eea;
  border-color: #667eea;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

body.dark-mode .info-card.card-link:hover {
  background: #90cdf4;
  border-color: #90cdf4;
  color: #1a202c;
  box-shadow: 0 4px 12px rgba(144, 205, 244, 0.3);
}

.card-text {
  width: 100%;
}

.card-text strong {
  display: block;
  font-size: 18px;
  margin-bottom: 12px;
  color: inherit;
  font-weight: 700;
  line-height: 1.3;
}

.card-text small {
  display: block;
  font-size: 14px;
  line-height: 1.6;
  color: inherit;
  opacity: 0.85;
  margin-bottom: 12px;
}

.info-card.card-link:hover .card-text strong,
.info-card.card-link:hover .card-text small {
  color: white;
  opacity: 1;
}

body.dark-mode .info-card.card-link:hover .card-text strong,
body.dark-mode .info-card.card-link:hover .card-text small {
  color: #1a202c;
}

.info-header {
  font-size: 14px;
  color: #999;
  margin-bottom: 15px;
  text-align: center;
}

.fullscreen-hint {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 15px 20px;
  border-radius: 10px;
  display: none;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.keyboard-shortcuts {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  font-size: 12px;
}

body.dark-mode .keyboard-shortcuts {
  background: #4a5568;
}

.keyboard-shortcuts h4 {
  margin-bottom: 10px;
  color: #667eea;
}

body.dark-mode .keyboard-shortcuts h4 {
  color: #90cdf4;
}

.keyboard-shortcuts ul {
  list-style: none;
  padding: 0;
}

.keyboard-shortcuts li {
  margin-bottom: 5px;
  color: #666;
}

body.dark-mode .keyboard-shortcuts li {
  color: #cbd5e0;
}

.keyboard-shortcuts kbd {
  background: #e0e0e0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
}

body.dark-mode .keyboard-shortcuts kbd {
  background: #2d3748;
  color: #90cdf4;
}

@media (max-width: 968px) {
  .curis-container {
    flex-direction: column;
  }
  
  .sidebar-info {
    width: 100%;
  }
  
  .breathing-section {
    flex-direction: column;
  }
  
  .breathing-circle {
    width: min(300px, 70vw);
    height: min(300px, 70vw);
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }
  
  .main-content {
    padding: 20px;
  }
  
  .header-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-left {
    text-align: center;
    margin-bottom: 10px;
  }
  
  .header-right {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .icon-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .controls {
    gap: 10px;
  }
  
  .control-group {
    min-width: 70px;
  }
  
  h1 {
    font-size: 22px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  button {
    width: 100%;
  }
  
  select {
    width: 100%;
    min-width: unset;
  }
  
  .guidance-text {
    max-width: 100%;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .main-content {
    padding: 15px;
  }
  
  h1 {
    font-size: 20px;
    margin-bottom: 15px;
  }
  
  .breathing-circle {
    width: min(250px, 85vw);
    height: min(250px, 85vw);
  }
}

/* Dark Mode Styles */
body.dark-mode {
  background: #1a1a2e;
  color: #eee;
}

body.dark-mode .curis-container {
  background: #16213e;
}

body.dark-mode .main-content {
  background: #0f3460;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode label {
  color: #eee;
}

body.dark-mode .intro-text {
  background: #1a1a2e;
  color: #ccc;
}

body.dark-mode .stat-box {
  background: #1a1a2e;
  border: 2px solid #667eea;
}

body.dark-mode .stat-label {
  color: #aaa;
}

body.dark-mode .breathing-circle {
  background: linear-gradient(145deg, #1a1a2e, #0f3460);
  border: 4px solid #667eea;
}

body.dark-mode .guidance-text {
  background: #1a1a2e;
  color: #ccc;
}

body.dark-mode input,
body.dark-mode select {
  background: #1a1a2e;
  border: 2px solid #444;
  color: #eee;
}

body.dark-mode .timer-display {
  background: #1a1a2e;
  color: #eee;
}

body.dark-mode .keyboard-shortcuts {
  background: #1a1a2e;
  border: 2px solid #444;
}

body.dark-mode kbd {
  background: #0f3460;
  border: 1px solid #667eea;
  color: #eee;
}
