:root {
  color-scheme: dark;
  --bg: #070812;
  --panel: #0e1020;
  --panel-2: #14162a;
  --line: #7c2cff;
  --cyan: #00d5ff;
  --orange: #ff7a00;
  --text: #f5f3ff;
  --muted: #a5a2bf;
  --ok: #35d07f;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

img,
svg,
canvas,
video {
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(124, 44, 255, 0.34), transparent 36rem),
    radial-gradient(circle at top right, rgba(139, 44, 255, 0.2), transparent 30rem),
    radial-gradient(circle at bottom center, rgba(255, 122, 0, 0.055), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  width: min(960px, 100%);
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0 auto;
  padding: 20px 14px 96px;
}

.hero,
.card,
.metric {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(124, 44, 255, 0.72);
  background: linear-gradient(180deg, rgba(20, 22, 42, 0.94), rgba(9, 10, 22, 0.96));
  box-shadow: 0 0 28px rgba(124, 44, 255, 0.16);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  border-radius: 28px;
  padding: 22px;
  margin-bottom: 16px;
}

.kicker {
  color: var(--orange);
  letter-spacing: 0.16em;
  font-weight: 800;
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 8vw, 56px);
  line-height: 0.96;
  margin: 8px 0;
  text-shadow: 0 0 22px rgba(255, 122, 0, 0.32);
}

h2 {
  font-size: 20px;
}

p,
small,
em,
input {
  color: var(--muted);
}

.hero-orb {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 38px;
  text-shadow: 0 0 18px var(--cyan);
}

main {
  display: grid;
  gap: 14px;
}

.tabbar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px;
  border: 1px solid rgba(124, 44, 255, 0.55);
  border-radius: 999px;
  background: rgba(7, 8, 18, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: 0 0 26px rgba(124, 44, 255, 0.18);
}

.tabbar button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 11px 10px;
  cursor: pointer;
}

.tabbar button.active {
  background: linear-gradient(135deg, rgba(124, 44, 255, 0.42), rgba(255, 122, 0, 0.12));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(190, 93, 255, 0.42);
}

.screen {
  display: none;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.screen.active {
  display: grid;
}

.card {
  border-radius: 24px;
  padding: 18px;
}

.recipe-banner,
.academy-cover {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(124, 44, 255, 0.72);
  border-radius: 24px;
  background: #050610;
  box-shadow: 0 0 34px rgba(124, 44, 255, 0.18);
}

.recipe-banner img,
.academy-cover img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.card-head,
.section-title,
.ring-row,
.metric-grid {
  display: flex;
  align-items: center;
}

.card-head,
.section-title {
  min-width: 0;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head > *,
.section-title > * {
  min-width: 0;
}

.card-head span,
.section-title span {
  color: var(--muted);
}

.ring-row {
  gap: 18px;
}

.ring {
  --progress: 0%;
  width: 116px;
  height: 116px;
  flex: 0 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, var(--panel) 56%, transparent 57%),
    conic-gradient(var(--orange) var(--progress), rgba(255, 255, 255, 0.08) 0);
}

.ring span {
  font-size: 24px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border-radius: 22px;
  padding: 16px;
  min-height: 128px;
}

.metric span {
  display: block;
  font-size: 28px;
  margin-bottom: 10px;
}

.metric small,
.metric em {
  display: block;
}

.metric strong {
  display: block;
  margin: 5px 0;
}

.mini-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.mini-stat {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(124, 44, 255, 0.42);
  border-radius: 14px;
  background: rgba(7, 8, 18, 0.54);
  box-shadow: inset 0 0 18px rgba(124, 44, 255, 0.08);
}

.mini-stat small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mini-stat strong {
  margin: 4px 0 2px;
}

.mini-stat em {
  font-size: 12px;
  line-height: 1.25;
}

.water-glass {
  --water-level: 0%;
  position: relative;
  overflow: hidden;
  width: 54px;
  height: 74px;
  margin: 4px 0 12px;
  border: 2px solid rgba(0, 213, 255, 0.55);
  border-top: 0;
  border-radius: 8px 8px 18px 18px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.08), transparent 24%, transparent 76%, rgba(255,255,255,0.05)),
    rgba(0, 213, 255, 0.04);
  box-shadow:
    inset 0 0 14px rgba(0, 213, 255, 0.12),
    inset 10px 0 18px rgba(255, 255, 255, 0.035),
    0 0 18px rgba(0, 213, 255, 0.08);
}

.water-glass::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 0;
  height: 2px;
  background: rgba(0, 213, 255, 0.55);
}

.water-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--water-level);
  background: linear-gradient(180deg, rgba(0, 213, 255, 0.88), rgba(0, 105, 255, 0.46));
  transition: height 0.35s ease;
}

.water-fill::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -20px;
  width: 96px;
  height: 16px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 25% 45%, rgba(255,255,255,0.55), transparent 10px),
    rgba(127, 232, 255, 0.86);
  animation: waterWave 2.8s ease-in-out infinite;
}

.water-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 24px 24px, rgba(255,255,255,0.23), transparent 4px),
    radial-gradient(circle at 36px 46px, rgba(255,255,255,0.16), transparent 3px),
    radial-gradient(circle at 18px 58px, rgba(255,255,255,0.14), transparent 3px);
  opacity: 0.75;
}

.water-shine {
  position: absolute;
  inset: 8px auto 12px 10px;
  width: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.water-bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.water-bubbles i {
  position: absolute;
  bottom: 8px;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 999px;
  opacity: 0;
  animation: bubbleRise 3.2s ease-in infinite;
}

.water-bubbles i:nth-child(1) {
  left: 15px;
  animation-delay: 0.2s;
}

.water-bubbles i:nth-child(2) {
  left: 30px;
  animation-delay: 1.1s;
}

.water-bubbles i:nth-child(3) {
  left: 39px;
  animation-delay: 2s;
}

@keyframes waterWave {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  50% {
    transform: translateX(9px) rotate(-2deg);
  }
}

@keyframes bubbleRise {
  0% {
    transform: translateY(0) scale(0.65);
    opacity: 0;
  }
  18% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-46px) scale(1.1);
    opacity: 0;
  }
}

input {
  width: min(260px, 48vw);
  border: 1px solid rgba(0, 213, 255, 0.4);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  padding: 10px 13px;
  outline: none;
}

select {
  width: min(260px, 48vw);
  border: 1px solid rgba(0, 213, 255, 0.4);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  padding: 10px 13px;
  outline: none;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 213, 255, 0.12);
}

select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 213, 255, 0.12);
}

button {
  font: inherit;
  min-width: 0;
}

.action {
  border: 1px solid rgba(255, 122, 0, 0.75);
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.16);
  color: #ffd8b5;
  padding: 9px 13px;
  cursor: pointer;
  white-space: normal;
}

.action:hover {
  border-color: var(--orange);
  box-shadow: 0 0 14px rgba(255, 122, 0, 0.18);
}

.action.ghost {
  border-color: rgba(0, 213, 255, 0.5);
  background: rgba(0, 213, 255, 0.1);
  color: #bff4ff;
}

.action.danger {
  border-color: rgba(255, 91, 91, 0.65);
  background: rgba(255, 91, 91, 0.12);
  color: #ffd1d1;
}

.action.full {
  width: 100%;
  margin-top: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.inline-form input,
.inline-form select,
.inline-form button {
  min-width: 0;
}

.inline-form input {
  width: 100%;
}

.inline-form select {
  width: 100%;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.chips button {
  border: 1px solid rgba(124, 44, 255, 0.6);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 9px 13px;
  white-space: nowrap;
}

.chips button.active {
  border-color: var(--orange);
  background: rgba(255, 122, 0, 0.16);
  color: #ffd8b5;
}

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

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  padding: 13px;
}

.row div {
  min-width: 0;
}

.row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row small {
  display: block;
  margin-top: 4px;
}

.row em {
  flex: 0 0 auto;
  color: #ffd8b5;
  font-style: normal;
}

.row-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  width: 100%;
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.grams-input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  text-align: center;
}

.meal-select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
}

.mini-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.mini-actions .action {
  width: 100%;
  min-width: 0;
  padding-inline: 10px;
}

.meal-plan-panel {
  display: grid;
  gap: 10px;
}

.meal-plan-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(255, 122, 0, 0.45);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 0, 0.14), transparent 18rem),
    rgba(255, 255, 255, 0.035);
  padding: 16px;
}

.meal-plan-entry {
  display: grid;
  min-width: 0;
  gap: 8px;
  border: 1px solid rgba(124, 44, 255, 0.32);
  border-radius: 16px;
  padding: 12px;
  background: rgba(7, 8, 18, 0.42);
}

.meal-plan-entry strong,
.meal-plan-entry small {
  display: block;
}

.empty {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  color: var(--muted);
}

.recipe-page,
.academy-note {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  overflow-wrap: break-word;
  border: 1px solid rgba(255, 122, 0, 0.62);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 236, 196, 0.075), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 122, 0, 0.14), transparent 22rem),
    linear-gradient(180deg, rgba(20, 16, 22, 0.98), rgba(8, 8, 16, 0.98));
  box-shadow: 0 0 30px rgba(255, 122, 0, 0.14);
  padding: 22px;
}

.recipe-page::before,
.academy-note::before {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
}

.recipe-page h2,
.academy-note h2 {
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 122, 0, 0.24);
}

.recipe-stamps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.recipe-stamps span {
  min-width: 0;
  border: 1px solid rgba(255, 122, 0, 0.55);
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.1);
  color: #ffd8b5;
  padding: 10px 8px;
  text-align: center;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.check-list {
  list-style: none;
  padding-left: 0 !important;
}

.check-list li::before {
  content: "□";
  color: var(--orange);
  margin-right: 8px;
}

.academy-intro {
  display: grid;
  gap: 12px;
}

.academy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.academy-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(124, 44, 255, 0.72);
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(124, 44, 255, 0.22), transparent 14rem),
    linear-gradient(180deg, rgba(20, 18, 42, 0.96), rgba(9, 8, 22, 0.98));
  box-shadow: 0 0 26px rgba(124, 44, 255, 0.14);
  cursor: pointer;
  padding: 16px;
}

.academy-tile img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top center;
  opacity: 0.92;
}

.academy-tile .tile-body {
  padding: 0;
}

.academy-tile h3 {
  margin: 0 0 6px;
  color: var(--text);
}

.academy-tile p {
  color: var(--muted);
}

.tile-orb {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 213, 255, 0.45);
  border-radius: 14px;
  background: rgba(0, 213, 255, 0.08);
  color: var(--cyan);
  font-size: 20px;
  text-shadow: 0 0 18px var(--cyan);
}

.academy-note {
  border-color: rgba(124, 44, 255, 0.72);
  background:
    radial-gradient(circle at top left, rgba(124, 44, 255, 0.24), transparent 22rem),
    radial-gradient(circle at top right, rgba(255, 122, 0, 0.09), transparent 24rem),
    linear-gradient(180deg, rgba(13, 16, 34, 0.98), rgba(7, 8, 18, 0.98));
}

.lesson-block {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(124, 44, 255, 0.28);
  border-radius: 18px;
  background: rgba(124, 44, 255, 0.065);
}

.lesson-block h3 {
  margin: 0 0 8px;
  color: #d7b7ff;
}

.lesson-block p {
  line-height: 1.55;
  color: var(--text);
}

.academy-footer {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.16em;
  font-size: 12px;
}

.academy-footer b {
  color: var(--orange);
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.progress-panel {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(124, 44, 255, 0.42);
  border-radius: 20px;
  background: rgba(124, 44, 255, 0.065);
  padding: 16px;
}

.progress-panel strong {
  display: block;
  margin: 8px 0;
  color: var(--text);
  font-size: 24px;
}

.photo-grid,
.photo-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.photo-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(124, 44, 255, 0.42);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.photo-card img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 14px;
}

.photo-collage-card {
  grid-column: 1 / -1;
}

.photo-collage-card img {
  max-height: none;
  object-fit: contain;
  background: #050610;
}

.photo-card small {
  display: block;
  margin-top: 8px;
}

.measurements-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.chart-card {
  min-width: 0;
  max-width: 100%;
  border: 1px solid rgba(124, 44, 255, 0.42);
  border-radius: 20px;
  background: rgba(124, 44, 255, 0.055);
  padding: 16px;
}

.chart-card h3 {
  margin: 0 0 10px;
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-box {
  min-height: 220px;
}

.chart-box svg {
  display: block;
  width: 100%;
  height: auto;
}

.chips.small {
  margin: 0 0 10px;
}

.chips.small button {
  padding: 7px 10px;
  font-size: 13px;
}

.measurements-form input {
  width: 100%;
}

.recipe-details h3 {
  margin: 18px 0 8px;
}

.recipe-details ul,
.recipe-details ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text);
}

.recipe-details li {
  margin: 6px 0;
}

.muted {
  color: var(--muted);
}

.macro-line {
  margin-top: 12px;
  color: #ffd8b5;
  font-weight: 800;
}

.note {
  margin-top: 16px;
  padding: 14px;
  border-left: 3px solid var(--cyan);
  border-radius: 12px;
  background: rgba(0, 213, 255, 0.08);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 28px));
  border: 1px solid rgba(0, 213, 255, 0.55);
  border-radius: 18px;
  background: rgba(7, 8, 18, 0.94);
  color: var(--text);
  padding: 14px 16px;
  text-align: center;
  box-shadow: 0 0 28px rgba(0, 213, 255, 0.18);
  z-index: 10;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 4, 10, 0.72);
  backdrop-filter: blur(10px);
}

.confirm-card {
  width: min(460px, 100%);
  border: 1px solid rgba(124, 44, 255, 0.75);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 122, 0, 0.16), transparent 18rem),
    linear-gradient(180deg, rgba(20, 22, 42, 0.98), rgba(7, 8, 18, 0.98));
  box-shadow: 0 0 42px rgba(124, 44, 255, 0.28);
  padding: 22px;
}

.confirm-card h2 {
  margin: 8px 0;
}

.scroll-top {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 9;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(124, 44, 255, 0.75);
  border-radius: 999px;
  background: rgba(20, 22, 42, 0.92);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(124, 44, 255, 0.22);
}

.scroll-top:hover {
  border-color: var(--orange);
  color: #ffd8b5;
}

@media (max-width: 820px) {
  .app {
    width: 100%;
    padding: 10px max(12px, env(safe-area-inset-left)) 96px max(12px, env(safe-area-inset-right));
  }

  .hero {
    border-radius: 22px;
    padding: 16px;
  }

  .hero-orb {
    width: 46px;
    height: 46px;
    font-size: 28px;
  }

  .tabbar {
    position: sticky;
    top: max(8px, env(safe-area-inset-top));
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-radius: 22px;
    padding: 8px;
  }

  .tabbar::-webkit-scrollbar {
    display: none;
  }

  .tabbar button {
    flex: 0 0 auto;
    min-width: 112px;
    padding-inline: 14px;
  }

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

  .ring-row {
    align-items: flex-start;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title input,
  .section-title select,
  .section-title .action {
    width: 100%;
  }

  input {
    width: 100%;
    max-width: 100%;
  }

  select {
    width: 100%;
    max-width: 100%;
  }

  .inline-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .chips {
    margin-left: -4px;
    margin-right: -4px;
    padding-inline: 4px;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar {
    display: none;
  }

  .row {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
  }

  .row strong {
    white-space: normal;
  }

  .row em {
    align-self: flex-start;
  }

  .row-actions {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .row-actions .action {
    width: 100%;
    padding-inline: 10px;
  }

  .grams-input,
  .meal-select {
    width: 100%;
    min-width: 0;
  }

  .recipe-banner img,
  .academy-cover img {
    max-height: 260px;
  }

  .recipe-page,
  .academy-note {
    border-radius: 22px;
    padding: 16px;
  }

  .recipe-page {
    background:
      linear-gradient(180deg, rgba(255, 236, 196, 0.075), transparent 28%),
      radial-gradient(circle at top right, rgba(255, 122, 0, 0.14), transparent 22rem),
      linear-gradient(180deg, rgba(20, 16, 22, 0.98), rgba(8, 8, 16, 0.98));
  }

  .recipe-page .section-title {
    gap: 10px;
  }

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

  .recipe-stamps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-grid,
  .measurements-form,
  .chart-grid,
  .photo-grid,
  .photo-compare {
    grid-template-columns: 1fr;
  }

  .mini-actions {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .mini-actions .action {
    width: 100%;
  }

  .progress-panel,
  .chart-card,
  .metric,
  .card {
    overflow: hidden;
  }

  .macro-line,
  .note,
  .row small,
  .lesson-block p,
  .recipe-details li {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 38px;
  }

  h2 {
    font-size: 18px;
  }

  .kicker {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  .card,
  .metric,
  .progress-panel,
  .chart-card {
    border-radius: 20px;
    padding: 14px;
  }

  .tabbar button {
    min-width: 108px;
    padding: 10px 12px;
  }

  .recipe-stamps {
    grid-template-columns: 1fr 1fr;
  }

  .scroll-top {
    right: 12px;
    bottom: 72px;
    width: 44px;
    height: 44px;
  }
}

@media (min-width: 681px) and (max-width: 1024px) {
  .app {
    width: min(900px, 100%);
    padding-left: 18px;
    padding-right: 18px;
  }

  .tabbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-radius: 28px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-grid .metric:last-child {
    grid-column: 1 / -1;
  }

  .measurements-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
