:root {
  --primary-color: #2dd4bf;
  /* vibrant teal 400 */
  --bg-top: #0f172a;
  /* slate 900 */
  --bg-bottom: #134e4a;
  /* teal 900 */
  --text-main: #f8fafc;
  /* slate 50 */
  --text-muted: #94a3b8;
  /* slate 400 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);

  --glass-bg: rgba(15, 23, 42, 0.4);
  --glass-card: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
}

body[data-theme="blue"] {
  --primary-color: #3b82f6;
  --bg-top: #0f172a;
  --bg-bottom: #1e3a8a;
}

body[data-theme="green"] {
  --primary-color: #4ade80;
  --bg-top: #064e3b;
  --bg-bottom: #14532d;
}

body[data-theme="orange"] {
  --primary-color: #fb923c;
  --bg-top: #431407;
  --bg-bottom: #7c2d12;
}

body[data-theme="purple"] {
  --primary-color: #c084fc;
  --bg-top: #2e1065;
  --bg-bottom: #4c1d95;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(to bottom, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  user-select: none;
  /* Mobile app feel */
}

#app-container {
  width: 100%;
  max-width: 480px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 24px;
}

.screen.active {
  display: flex;
  animation: fadeIn 0.3s ease;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  margin-bottom: 30px;
}

.logo-icon {
  font-size: 28px;
  color: var(--primary-color);
}

.settings-icon {
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
}

.header h2 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.header p {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* Home Grid */
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--glass-card);
  padding: 20px;
  border-radius: 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  border: 1px solid var(--glass-border);
}

.card:hover {
  transform: scale(1.02);
  background: rgba(30, 41, 59, 0.8);
  box-shadow: var(--shadow-md);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-color);
  margin-bottom: 16px;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
}

.card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.level-badge {
  background: linear-gradient(135deg, var(--primary-color), #3b82f6);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mt-2 {
  margin-top: 12px;
}

.xp-bar-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}

.xp-bar-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.card p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Duration Stepper */
.duration-selector {
  background: var(--glass-card);
  border-radius: 24px;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 100px;
  border: 1px solid var(--glass-border);
}

.duration-selector label {
  font-size: 16px;
  font-weight: 600;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stepper button {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.stepper button:hover {
  background: rgba(255, 255, 255, 0.2);
}

#dur-value {
  font-size: 16px;
  font-weight: 600;
  width: 30px;
  text-align: center;
}

/* Custom Inputs */
.custom-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--glass-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--glass-border);
}

.input-row label {
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}

.input-row input {
  width: 60px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  border: none;
  outline: none;
  background: transparent;
  color: var(--primary-color);
}

.input-row span {
  color: var(--text-muted);
  margin-left: 8px;
}

.settings-select {
  background: rgba(0, 0, 0, 0.3);
  color: var(--primary-color);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 8px;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  font-family: 'Outfit', sans-serif;
}

.settings-select option {
  background: var(--bg-top);
  color: var(--text-main);
}

/* Stats */
.stats-grid {
  display: grid;
  gap: 16px;
}

.stat-card {
  background: var(--glass-card);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--glass-border);
}

.stat-card h2 {
  font-size: 36px;
  color: var(--primary-color);
  margin-bottom: 8px;
}

/* Exercise Screen */
.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
}

#btn-back {
  font-size: 28px;
  cursor: pointer;
  padding: 8px;
}

.timer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.6);
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.exercise-stage {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.vertical-slider {
  width: 50px;
  height: 250px;
  background: rgba(30, 41, 59, 0.5);
  border-radius: 25px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding-bottom: 16px;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

.slider-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--primary-color);
  border-radius: 25px;
  transition: height 0.1s linear;
  opacity: 0.8;
}

.vertical-slider ion-icon {
  position: relative;
  z-index: 2;
  font-size: 22px;
  color: var(--text-main);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.breathing-circle-container {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breathing-circle {
  width: 200px;
  height: 200px;
  border-radius: 100px;
  background: radial-gradient(circle, var(--primary-color) 0%, rgba(45, 212, 191, 0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 40px rgba(45, 212, 191, 0.4);
  transition: transform 0.1s linear;
  transform: scale(1);
}

#countdown-text {
  font-size: 48px;
  font-weight: 300;
  color: var(--text-main);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.exercise-footer {
  text-align: center;
  padding-bottom: 90px;
}

#phase-label {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
  transition: opacity 0.3s;
}

.primary-btn {
  background: var(--primary-color);
  border: none;
  padding: 16px 40px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  color: #0f172a;
  width: 100%;
  max-width: 200px;
  transition: opacity 0.2s, transform 0.2s;
}

.primary-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* Tab Bar */
.tab-bar {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  height: 70px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: var(--shadow-lg);
  padding: 0 16px;
  border: 1px solid var(--glass-border);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  cursor: pointer;
  gap: 4px;
  padding: 10px;
}

.tab-item.active {
  color: var(--primary-color);
}

.tab-item ion-icon {
  font-size: 24px;
  pointer-events: none;
}

.tab-item span {
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}