/* ============================================================
   Components — Tilt Check-Up (Studio Premium)
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-xs);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  border: none;
  transition: opacity var(--dur-base) ease, background var(--dur-base) ease;
}
.btn:active { opacity: 0.75; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-2);
}
.btn-ghost:hover { border-color: var(--text-3); color: var(--text); }

.btn-ghost-brick {
  background: transparent;
  border: 1px solid var(--brick-bord);
  color: var(--brick);
}

.btn-sage {
  background: var(--sage);
  color: var(--sage-ink);
}

.btn-skip {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: var(--fs-body);
  justify-content: center;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  font-family: var(--font-sans);
}
.btn-skip:hover { color: var(--text-2); }

/* Aliases */
.btn-green { background: var(--sage); color: var(--sage-ink); }
.btn-red   { background: var(--brick); color: #fff; }
.btn-dim   { background: var(--bg3); color: var(--text-2); }

.btn-glyph {
  font-family: var(--font-mono);
  font-size: 14px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
}

/* ---------- App shell ---------- */
.screen-header {
  padding: 10px 24px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-brand {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.005em;
}

.header-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  color: var(--text-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Step progress bar */
.step-progress {
  display: flex;
  gap: 6px;
  padding: 0 24px 14px;
  background: var(--bg2);
}
.step-seg {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  transition: background var(--dur-base) ease;
}
.step-seg.active { background: var(--accent); }
.step-seg.done   { background: var(--sage); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 12px 0 20px;
  z-index: 100;
}
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--dur-base) ease;
  text-decoration: none;
}
.nav-tab:hover { color: var(--text-2); }
.nav-tab.active { color: var(--accent); }

.nav-glyph {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
}
.nav-label {
  font-family: var(--font-mono);
  font-size: var(--fs-bnav);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* ---------- State list (replaces grid) ---------- */
.s-list {
  display: flex;
  flex-direction: column;
}
.s-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 14px 0;
  cursor: pointer;
  transition: background var(--dur-base) ease;
}
.s-item:last-child { border-bottom: 1px solid var(--border); }
.s-item:hover { background: var(--bg3); margin: 0 -24px; padding: 14px 24px; }
.s-item.selected { background: var(--bg3); margin: 0 -24px; padding: 14px 24px; }

.s-num {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--text-3);
}
.s-name {
  font-size: var(--fs-body-l);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.s-glyph {
  font-family: var(--font-mono);
  font-size: 16px;
}

/* State colors */
.s-item--calm    .s-name, .s-item--calm    .s-glyph { color: var(--sage); }
.s-item--fomo    .s-name, .s-item--fomo    .s-glyph { color: var(--butter); }
.s-item--anger   .s-name, .s-item--anger   .s-glyph { color: var(--brick); }
.s-item--fear    .s-name, .s-item--fear    .s-glyph { color: var(--clay); }
.s-item--euphoria .s-name, .s-item--euphoria .s-glyph { color: var(--butter); }
.s-item--tired   .s-name, .s-item--tired   .s-glyph { color: var(--text-2); }

/* Keep old state-grid/btn for onboarding compat */
.state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.state-btn {
  padding: 14px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--dur-base) ease;
}
.state-btn:hover { border-color: var(--border2); }
.state-btn.selected {
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* ---------- Checklist ---------- */
.c-list {
  display: flex;
  flex-direction: column;
}
.c-item {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 14px 0;
  cursor: pointer;
  transition: background var(--dur-base) ease;
  gap: 8px;
}
.c-item:last-child { border-bottom: 1px solid var(--border); }

.c-num {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  color: var(--text-3);
}
.c-label {
  font-size: var(--fs-body);
  color: var(--text-2);
  line-height: 1.4;
}
.c-item.checked .c-label { color: var(--text); }

.c-box {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: transparent;
  transition: all var(--dur-base) ease;
}
.c-item.checked .c-box {
  background: var(--sage);
  border-color: var(--sage);
  color: var(--sage-ink);
}

/* Score block */
.score-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 16px 0;
}
.score-num {
  font-family: var(--font-mono);
  font-size: var(--fs-score);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
}
.score-label {
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  color: var(--text-3);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Segmented control ---------- */
.seg-control {
  display: flex;
  background: var(--bg3);
  border-radius: var(--radius-xs);
  padding: 3px;
  gap: 2px;
}
.seg-control .seg-btn {
  flex: 1;
  padding: 8px 0;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--dur-base) ease;
}
.seg-control .seg-btn.active {
  background: var(--text);
  color: var(--bg);
}

/* ---------- Warning pill ---------- */
.warning-pill {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--butter-soft);
  border: 1px solid var(--butter-bord);
  border-radius: var(--radius-xs);
  font-size: var(--fs-meta);
  color: var(--text-2);
}

.warn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--brick-soft);
  border: 1px solid var(--brick-bord);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  color: var(--brick);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* ---------- Decision card ---------- */
.decision-card {
  padding: 28px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg3);
  animation: decisionIn var(--dur-slow) ease forwards;
}

@keyframes decisionIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.decision-bar {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: 16px;
}
.decision-tag {
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.decision-title {
  font-family: var(--font-serif);
  font-size: var(--fs-decision);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
.decision-sub {
  font-size: var(--fs-sub);
  color: var(--text-2);
  margin-bottom: 24px;
  line-height: 1.5;
}
.d-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Decision variants */
.decision-card.green {
  border-color: var(--sage-bord);
  box-shadow: var(--glow-sage);
}
.decision-card.green .decision-bar,
.decision-card.green .decision-tag { color: var(--sage); background: var(--sage); }
.decision-card.green .decision-title { color: var(--text); }

.decision-card.yellow {
  border-color: var(--butter-bord);
  box-shadow: var(--glow-butter);
}
.decision-card.yellow .decision-bar,
.decision-card.yellow .decision-tag { color: var(--butter); background: var(--butter); }

.decision-card.orange {
  border-color: var(--clay-bord);
  box-shadow: var(--glow-clay);
}
.decision-card.orange .decision-bar,
.decision-card.orange .decision-tag { color: var(--clay); background: var(--clay); }

.decision-card.red {
  border-color: var(--brick-bord);
  box-shadow: var(--glow-brick);
}
.decision-card.red .decision-bar,
.decision-card.red .decision-tag { color: var(--brick); background: var(--brick); }

/* ---------- Timer card (RED loop) ---------- */
.timer-card {
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: var(--radius-sm);
  padding: 24px 20px;
  text-align: center;
}
.timer-meta {
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  color: var(--brick);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.timer-title {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.1;
  margin-bottom: 20px;
}

/* Breath ring */
.breath-ring {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-bord);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  transition: transform var(--dur-breath) ease-in-out;
}
.breath-ring.is-expanded { transform: scale(1.18); }
.breath-inner {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(246, 194, 107, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.breath-phase {
  font-weight: 600;
  font-size: var(--fs-meta);
  color: var(--accent);
}
.breath-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

/* ---------- Insight cards (Patterns) ---------- */
.icard {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
}
.icard-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.icard-stripe {
  width: 16px;
  height: 2px;
  border-radius: 1px;
}
.icard-type {
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}
.icard-hd {
  font-size: var(--fs-body);
  font-weight: 500;
  margin-bottom: 6px;
  line-height: 1.3;
}
.icard-bd {
  font-size: var(--fs-meta);
  color: var(--text-2);
  line-height: 1.5;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 1px;
  transition: width 350ms ease;
  background: var(--accent);
}

/* ---------- Strategy tag ---------- */
.strategy-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--butter-bord);
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: var(--fs-cap-s, 10px);
  color: var(--butter);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Page ---------- */
.page {
  padding: var(--space-md);
  padding-bottom: calc(var(--nav-height) + var(--space-md) + 20px);
  min-height: 100vh;
}
