:root {
  color-scheme: light;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #37352f;
  --muted: #787774;
  --line: #e6e4df;
  --soft-line: #f0efeb;
  --teal: #37352f;
  --teal-dark: #37352f;
  --blue: #6b6b6b;
  --coral: #9b4d3d;
  --olive: #6b705c;
  --sand: #ebe9e4;
  --shadow: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  touch-action: manipulation;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.home-header {
  padding: 14px 2px 18px;
}

.brand-row,
.section-title-row,
.safety-heading,
.session-bar,
.control-bar {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 9px;
  margin-bottom: 12px;
}

.brand-mark,
.section-dot,
.warning-icon,
.done-mark {
  display: inline-block;
  flex: 0 0 auto;
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background:
    linear-gradient(180deg, transparent 0 34%, rgba(55, 53, 47, 0.16) 35% 42%, transparent 43% 100%),
    #eee9df;
  border: 1px solid #ddd8cf;
}

.brand-kicker,
.segment-meta,
.timer-label,
.stat-label,
.program-meta,
.detail-block h3 {
  font-weight: 800;
}

.brand-kicker {
  color: var(--muted);
  font-size: 14px;
}

.home-link {
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0;
}

.lead {
  max-width: 34rem;
  margin-top: 10px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0 24px;
}

.stat-panel,
.program-card,
.record-panel,
.safety-panel,
.detail-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-panel {
  padding: 15px;
}

.stat-value {
  display: block;
  font-size: 27px;
  line-height: 1;
  font-weight: 900;
}

.stat-label {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.section-title-row {
  gap: 8px;
  margin-bottom: 12px;
}

.section-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
}

.section-title-row h2,
.safety-heading h2 {
  font-size: 18px;
}

.program-cards {
  display: grid;
  gap: 12px;
}

.program-card {
  width: 100%;
  padding: 18px;
  text-align: left;
  color: inherit;
  box-shadow: var(--shadow);
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.program-card:active {
  transform: scale(0.99);
}

.program-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.program-title {
  flex: 1;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 900;
}

.duration-badge {
  flex: 0 0 auto;
  color: var(--ink);
  background: #f1f1ef;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.program-description {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.program-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.record-panel {
  margin-top: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.record-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--line);
}

.record-summary-value {
  display: block;
  min-height: 23px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 900;
}

.record-summary-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.record-list {
  display: grid;
  gap: 0;
}

.record-item {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.record-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.record-item-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.record-item-title {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
}

.record-item-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.record-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.record-metric {
  color: var(--muted);
  background: #f4f3ef;
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12px;
  line-height: 1;
}

.record-empty {
  margin-top: 13px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.safety-panel {
  margin-top: 18px;
  padding: 16px;
  border-color: #eadfd7;
  background: #fbf3ef;
}

.safety-heading {
  gap: 9px;
  margin-bottom: 8px;
}

.warning-icon {
  width: 19px;
  height: 17px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: #a35d4f;
}

.safety-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.session-bar {
  gap: 12px;
  margin-bottom: 18px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.progress-track {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e4df;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 180ms ease;
}

.progress-count {
  min-width: 48px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.exercise-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 184px;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.segment-meta {
  color: var(--blue);
  font-size: 14px;
}

.side-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
  margin-top: 10px;
}

.side-mode-track {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f6f3;
}

.side-chip {
  min-width: 52px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.side-chip-active {
  color: #ffffff;
  background: var(--ink);
}

.side-mode-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.exercise-copy h2 {
  margin-top: 8px;
  font-size: 31px;
  line-height: 1.12;
  letter-spacing: 0;
}

.exercise-purpose {
  margin-top: 7px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.pose-visual {
  min-height: 162px;
  border-radius: 8px;
  background: #fbfbfa;
  border: 1px solid var(--soft-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: hidden;
}

.pose-image {
  width: 100%;
  height: 100%;
  max-height: 150px;
  object-fit: contain;
  display: block;
  mix-blend-mode: multiply;
}

.pose-visual .mat {
  fill: none;
  stroke: #c8c4bb;
  stroke-width: 7;
  stroke-linecap: round;
}

.pose-visual .head {
  fill: var(--ink);
  stroke: var(--ink);
  stroke-width: 2;
}

.pose-visual .body,
.pose-visual .accent-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pose-visual .accent-line {
  stroke: #b8b3aa;
  stroke-width: 5;
}

.pose-visual .silhouette,
.pose-visual .silhouette-head {
  fill: var(--ink);
  stroke: none;
}

.pose-visual .guide,
.pose-visual .prop {
  fill: none;
  stroke: #b8b3aa;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pose-visual .prop {
  stroke: #cbc7bf;
}

.timer-panel {
  margin-bottom: 16px;
  padding: 22px 20px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  text-align: center;
}

.timer-label {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.timer-value {
  display: block;
  margin-top: 2px;
  font-size: 58px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
}

.timer-subtitle {
  display: block;
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.detail-sheet {
  padding: 16px;
  margin-bottom: 92px;
}

.cue-text {
  font-size: 18px;
  line-height: 1.45;
  font-weight: 900;
}

.side-note {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #f7f6f3;
  font-size: 15px;
  line-height: 1.5;
}

.detail-block {
  margin-top: 16px;
}

.detail-block h3 {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 13px;
}

.detail-block p,
.detail-block li {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.detail-block ol {
  padding-left: 1.25rem;
  margin: 0;
}

.detail-block li + li {
  margin-top: 4px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.caution-strip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #eadfd7;
  border-radius: 8px;
  background: #fbf3ef;
}

.caution-strip p {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

.control-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 680px);
  transform: translateX(-50%);
  gap: 12px;
  padding: 14px 18px max(16px, env(safe-area-inset-bottom));
  background: rgba(247, 246, 243, 0.92);
  border-top: 1px solid rgba(230, 228, 223, 0.9);
  backdrop-filter: blur(18px);
}

.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 8px;
  padding: 0 18px;
  font-size: 17px;
  font-weight: 900;
}

.primary-button {
  flex: 1;
  color: white;
  background: var(--ink);
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.compact-button {
  flex: 0 0 auto;
  min-width: 86px;
  padding-inline: 14px;
}

.done-view {
  min-height: calc(100svh - 42px);
  text-align: center;
  align-content: center;
  padding: 20px 4px;
}

.done-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, transparent 38%, white 39% 47%, transparent 48%) 18px 20px / 28px 21px no-repeat,
    var(--olive);
}

.done-view h2 {
  font-size: 30px;
  line-height: 1.18;
}

.done-view p {
  max-width: 32rem;
  margin: 12px auto 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.wide-button {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 460px) {
  .app-shell {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 38px;
  }

  .exercise-hero {
    grid-template-columns: 1fr;
  }

  .pose-visual {
    min-height: 158px;
  }

  .timer-value {
    font-size: 54px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

.sync-toggle {
  display: block;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.feeling-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 18px;
}

.feeling-label {
  width: 100%;
  color: var(--muted);
  font-size: 14px;
}

.feeling-chip {
  min-width: 64px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.feeling-chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}
