:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #20312f;
  --muted: #66736e;
  --line: #ded6c8;
  --primary: #2f5f58;
  --primary-soft: #d9e8df;
  --accent: #d68f5d;
  --accent-soft: #f4dfcc;
  --calm: #8caeb7;
  --danger: #9d4b45;
  --shadow: 0 18px 50px rgba(42, 50, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(166, 200, 183, 0.32), transparent 28%),
    linear-gradient(145deg, #f6f1e8 0%, #edf4ef 52%, #f7efe6 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background: rgba(255, 250, 242, 0.82);
  box-shadow: var(--shadow);
  position: relative;
}

.screen {
  min-height: 100vh;
  padding: 10px 12px 82px;
}

.login-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 28px rgba(32, 49, 47, 0.12);
}

.brand-mark::before {
  content: "";
  width: 34px;
  height: 44px;
  border-radius: 50% 50% 44% 44%;
  background: linear-gradient(180deg, var(--primary-soft), var(--primary));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.topbar-title {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 25px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.18;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.card,
.practice-card,
.panel {
  background: var(--surface-strong);
  border: 1px solid rgba(222, 214, 200, 0.9);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(60, 64, 58, 0.08);
}

.section {
  margin: 10px 0;
}

.lang-row,
.segmented {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.chip,
.icon-btn,
.tab-btn,
.secondary-btn,
.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 750;
}

.chip {
  padding: 9px 12px;
}

.chip.active,
.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.ghost-btn {
  width: 100%;
  padding: 12px 14px;
}

.primary-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.secondary-btn {
  background: var(--primary-soft);
  border-color: #b8d4c7;
  color: var(--primary);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 9px;
}

.favorite-btn {
  color: var(--accent);
}

.favorite-btn.active {
  background: var(--accent-soft);
  border-color: #e4bb98;
}

.ghost-btn {
  background: transparent;
}

.danger-btn {
  background: #fff5f3;
  border-color: #e0b8b4;
  color: var(--danger);
}

.icon-btn {
  width: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.form-stack {
  display: grid;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 95, 88, 0.12);
}

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

.pain-btn {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  color: var(--ink);
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 12px;
}

.pain-btn strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
  line-height: 1.15;
}

.pain-btn span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.28;
}

.pain-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pain-icon {
  width: 56px;
  height: 56px;
  display: block;
}

.pain-copy {
  min-width: 0;
}

.range-wrap {
  display: grid;
  gap: 5px;
  margin: 9px 0;
}

input[type="range"] {
  padding: 0;
  min-height: 28px;
  accent-color: var(--primary);
}

.range-value {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 750;
}

.practice-card {
  display: grid;
  gap: 12px;
}

.practice-visual {
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-soft), #fff6ec);
  border: 1px solid #d7e3da;
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}

.practice-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.visual-glyph {
  font-size: 54px;
  line-height: 1;
}

.tag-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.tag {
  border-radius: 999px;
  background: var(--accent-soft);
  color: #704323;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 750;
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.step-list {
  padding-left: 21px;
  margin: 8px 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.step-list li {
  margin-bottom: 8px;
}

.audio-box {
  display: grid;
  gap: 10px;
  background: #f7fbf8;
  border: 1px solid #d8e8df;
  border-radius: 8px;
  padding: 12px;
}

.audio-controls {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 11px;
  align-items: center;
}

.play-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
}

.progress-line {
  height: 10px;
  border-radius: 999px;
  background: #dce8e0;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 460px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  background: rgba(255, 250, 242, 0.96);
  border-top: 1px solid var(--line);
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  backdrop-filter: blur(14px);
}

.nav-btn {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 750;
}

.nav-btn .nav-icon {
  font-size: 17px;
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.list {
  display: grid;
  gap: 10px;
}

.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 22px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  padding: 24px 14px;
  text-align: center;
}

.notice {
  border-left: 4px solid var(--accent);
  background: #fff6ec;
  padding: 12px;
  border-radius: 8px;
  color: #614832;
  line-height: 1.45;
}

.course-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
}

.course-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.admin-grid {
  display: grid;
  gap: 14px;
}

.small {
  font-size: 12px;
  color: var(--muted);
}

.profile-head {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 13px;
}

.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--primary-soft);
  border: 2px solid #b8d4c7;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 28px;
  font-weight: 850;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 420px);
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 8;
}

.hidden {
  display: none !important;
}

@media (max-width: 370px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .pain-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 28px;
  }
}
