:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #17231f;
  --muted: #66736d;
  --line: #ded8cc;
  --accent: #2f6157;
  --accent-2: #a65f3f;
  --gold: #c49a45;
  --shadow: 0 18px 50px rgba(48, 57, 51, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-shell,
.training-screen {
  min-height: 100svh;
  padding: 20px;
}

.auth-shell {
  display: grid;
  place-items: center;
}

.auth-card,
.panel,
.training-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 420px);
  padding: 24px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 7vw, 52px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #a43c32;
  font-size: 14px;
}

.primary-button,
.secondary-button,
.logout-button,
.account-chip,
.wordmark,
.icon-button {
  border: 0;
  border-radius: 8px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button {
  background: #e9e2d6;
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 62px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 234, 0.94);
  backdrop-filter: blur(12px);
}

.wordmark {
  min-width: 0;
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  max-width: 260px;
  min-width: 0;
}

.account-chip,
.logout-button {
  min-height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.account-chip {
  overflow: hidden;
  background: white;
  color: var(--ink);
  text-overflow: ellipsis;
}

.logout-button {
  background: transparent;
  color: var(--muted);
}

.app-shell {
  display: grid;
  gap: 16px;
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 18px 14px 32px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 156px;
  gap: 18px;
  align-items: center;
  min-height: 250px;
}

.hero-art,
.breath-card,
.pose-card {
  display: grid;
  place-items: center;
  min-height: 156px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 97, 87, 0.14), rgba(196, 154, 69, 0.2)),
    var(--surface);
  border: 1px solid var(--line);
}

.hero-art {
  position: relative;
  border-radius: 50%;
  aspect-ratio: 1;
}

.hero-art span {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  font-weight: 900;
}

.breath-orbit,
.breath-circle {
  position: absolute;
  width: 112px;
  height: 112px;
  border: 2px solid rgba(47, 97, 87, 0.35);
  border-radius: 50%;
}

.panel {
  padding: 18px;
}

.current-step p:last-child {
  margin-bottom: 0;
}

.progress-meter {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.progress-meter div {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e3ddd3;
}

.progress-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.exercise-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.exercise-chip {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.exercise-chip span,
.badge-title span {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #efe7da;
  color: var(--accent);
  font-weight: 900;
}

.exercise-chip div {
  min-width: 0;
}

.exercise-chip strong,
.exercise-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exercise-chip small,
.badge-title small {
  color: var(--muted);
}

.training-screen {
  position: relative;
  display: grid;
  place-items: center;
  background: #eee6d9;
}

.training-card {
  display: grid;
  gap: 16px;
  width: min(100%, 560px);
  padding: 22px;
  text-align: center;
}

.training-card h1 {
  font-size: clamp(32px, 9vw, 58px);
}

.round-timer {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 3;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 3px solid rgba(47, 97, 87, 0.28);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-size: 24px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.exit-button {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  z-index: 3;
  width: 44px;
  height: 44px;
  background: var(--surface);
  color: var(--ink);
  font-size: 28px;
}

.next-button {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
}

.pose-card {
  min-height: min(48vh, 320px);
  overflow: hidden;
}

.pose-figure {
  width: 120px;
  height: 220px;
  border-radius: 999px 999px 24px 24px;
  background:
    radial-gradient(circle at 50% 18%, var(--accent) 0 28px, transparent 29px),
    linear-gradient(var(--accent), var(--accent)) 50% 80px / 36px 96px no-repeat,
    linear-gradient(130deg, transparent 48%, var(--accent-2) 49% 55%, transparent 56%) 5px 78px / 110px 80px no-repeat,
    linear-gradient(55deg, transparent 48%, var(--accent-2) 49% 55%, transparent 56%) 8px 154px / 110px 74px no-repeat;
  opacity: 0.9;
}

.training-cue {
  min-height: 54px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.section-heading {
  padding: 10px 0;
}

.badge-map {
  display: grid;
  gap: 8px;
}

.badge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.badge-row.locked {
  opacity: 0.48;
}

.badge-row.active {
  border-color: rgba(47, 97, 87, 0.45);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(47, 97, 87, 0.1);
}

.badge-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  min-width: 0;
}

.badge-title span {
  grid-row: span 2;
}

.badge-title strong,
.badge-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seals {
  display: flex;
  gap: 8px;
}

.seals i {
  width: 28px;
  height: 28px;
  border: 2px solid #c9bfae;
  border-radius: 50%;
  background: transparent;
}

.seals i.filled {
  border-color: var(--gold);
  background:
    radial-gradient(circle at 50% 50%, var(--gold) 0 42%, transparent 43%),
    var(--surface);
}

.admin-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.admin-list span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.full-width {
  width: 100%;
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
  }

  .account {
    max-width: 210px;
  }

  .hero,
  .action-grid,
  .admin-panel {
    grid-template-columns: 1fr;
  }

  .hero-art {
    width: 150px;
    justify-self: center;
  }

  .badge-row {
    grid-template-columns: 1fr;
  }

  .seals {
    padding-left: 42px;
  }
}

@media (max-width: 360px) {
  .account {
    grid-template-columns: 1fr;
    gap: 4px;
    max-width: 150px;
  }

  .account-chip,
  .logout-button {
    min-height: 34px;
  }
}
