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

:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --surface-hover: #f0f0eb;
  --border: #e0e0d8;
  --text: #1a1a1a;
  --text-muted: #777;
  --accent: #2d7a4f;
  --accent-dim: rgba(45, 122, 79, 0.1);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.screen {
  display: none;
  padding: 20px;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  overflow-y: auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ---- Typography ---- */

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}

#objective-description {
  margin-bottom: 24px;
}

/* ---- Cards ---- */

.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
  font-size: 16px;
  width: 100%;
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.card-image {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  margin-bottom: 12px;
  border-radius: 8px;
}

.card .card-title {
  font-weight: 600;
  margin-bottom: 4px;
}

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

/* ---- Back button ---- */

.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  margin-bottom: 12px;
  align-self: flex-start;
  font-family: var(--font);
}

.back-btn:hover {
  color: var(--text);
}

/* ---- Timer screen ---- */

.timer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.timer-header .back-btn {
  margin-bottom: 0;
}

.timer-block-title {
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.progress {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.timer-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 12px;
  overflow: hidden;
}

/* ---- Top section: image + info side by side ---- */

.timer-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-shrink: 0;
}

.exercise-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}

.exercise-info .subtitle {
  margin-bottom: 0;
}

/* ---- Exercise image ---- */

.exercise-image {
  width: 120px;
  height: 120px;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.exercise-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.exercise-image.flip img {
  transform: scaleX(-1);
}

.placeholder-icon {
  font-size: 48px;
  opacity: 0.3;
}

/* ---- Countdown overlay ---- */

.countdown-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.countdown-overlay.visible {
  opacity: 1;
}

.countdown-text {
  font-size: 48px;
  font-weight: 700;
  color: var(--text-muted);
}

/* ---- Side label ---- */

.side-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  min-height: 20px;
}

/* ---- Exercise details ---- */

.exercise-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.detail-tips,
.detail-why,
.detail-warning {
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
}

.detail-tips {
  color: var(--text-muted);
}

.detail-why {
  color: var(--text-muted);
  font-style: italic;
}

.detail-warning {
  color: #b45309;
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid rgba(245, 166, 35, 0.25);
}

/* ---- Bottom section: timer + controls ---- */

.timer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-bottom: 8px;
}

/* ---- Timer circle ---- */

.timer-circle {
  position: relative;
  width: 120px;
  height: 120px;
}

.timer-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.timer-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s linear;
}

.timer-ring-rest {
  stroke: var(--text-muted);
}

#timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

/* ---- Controls ---- */

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

.control-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.control-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.control-btn-main {
  width: 52px;
  height: 52px;
  font-size: 20px;
  background: var(--accent-dim);
  border-color: var(--accent);
}

/* ---- Done screen ---- */

.done-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  text-align: center;
}

.done-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.done-content .card {
  margin-top: 16px;
  text-align: center;
  max-width: 200px;
}

/* ---- Home divider ---- */

.section-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ---- Meditation ---- */

.med-settings {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin: 32px 0;
}

.med-setting label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.med-adjuster {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: center;
}

.med-adjuster span {
  font-size: 28px;
  font-weight: 700;
  min-width: 100px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.med-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}

.med-btn:hover {
  border-color: var(--accent);
}

.med-start {
  text-align: center;
  font-weight: 600;
  font-size: 18px;
}

.med-timer-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 32px;
}

.timer-circle-large {
  width: 200px;
  height: 200px;
}

.med-timer-text-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

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