:root {
  color-scheme: light;
  --bg: #f8efe5;
  --surface: rgba(255, 251, 246, 0.9);
  --card: #ffffff;
  --card-soft: #fff7ef;
  --ink: #2a1f19;
  --muted: #86756a;
  --line: rgba(95, 57, 42, 0.13);
  --teal: #a86a51;
  --mint: #f4e4d2;
  --aqua: #ead0c3;
  --coral: #d08c7a;
  --rose: #f6ded5;
  --gold: #b88449;
  --cream: #fff3e4;
  --shadow: 0 18px 48px rgba(95, 57, 42, 0.14);
  --shadow-soft: 0 10px 28px rgba(95, 57, 42, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(246, 222, 213, 0.78), transparent 340px),
    radial-gradient(circle at 16% 8%, rgba(208, 140, 122, 0.18), transparent 26%),
    var(--bg);
  color: var(--ink);
}

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

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.18rem;
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.ios-app {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom));
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 50px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 8px 0 14px;
  background: linear-gradient(180deg, rgba(248, 239, 229, 0.96), rgba(248, 239, 229, 0.76));
  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.72rem;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 850;
  letter-spacing: 0;
}

.round-button,
.icon-only {
  min-width: 46px;
  min-height: 46px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--teal);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.round-button svg,
.icon-only svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.screen {
  display: none;
  gap: 14px;
  animation: screenIn 220ms ease;
}

.screen.active {
  display: grid;
}

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

.score-hero {
  min-height: 216px;
  border-radius: 34px;
  padding: 22px;
  color: white;
  background:
    linear-gradient(142deg, rgba(168, 106, 81, 0.98), rgba(208, 140, 122, 0.82) 54%, rgba(255, 243, 228, 0.95)),
    #a86a51;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 14px;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.hero-copy .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.hero-copy strong {
  font-size: 5.4rem;
  line-height: 0.82;
  letter-spacing: 0;
}

.hero-copy span,
.score-orbit small {
  color: rgba(255, 255, 255, 0.82);
  font-weight: 750;
  line-height: 1.25;
}

.score-orbit {
  width: 110px;
  height: 110px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
  display: grid;
  place-items: center;
  align-content: center;
  position: relative;
  z-index: 1;
}

.score-orbit span {
  font-weight: 900;
  font-size: 1.1rem;
}

.panel-section,
.daily-card,
.glow-metrics article,
.mini-insight,
.metric-deck article,
.status-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.panel-section,
.daily-card,
.premium-teaser {
  border-radius: 28px;
  padding: 16px;
}

.daily-card,
.premium-teaser {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.daily-card h2 {
  font-size: 1.08rem;
}

.premium-teaser {
  border: 1px solid rgba(22, 124, 116, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(217, 243, 235, 0.82)),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.premium-teaser h2 {
  max-width: 260px;
  font-size: 1rem;
}

.premium-teaser span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.streak-box {
  height: 74px;
  border-radius: 24px;
  background: var(--cream);
  color: #7a501a;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
}

.streak-box svg {
  width: 17px;
  height: 17px;
  color: var(--gold);
}

.streak-box strong {
  font-size: 1.28rem;
  line-height: 1;
}

.streak-box span,
.metric-label,
.glow-metrics small,
.mini-insight span,
.mini-copy {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.glow-metrics,
.score-grid,
.metrics-strip,
.micro-grid,
.button-row,
.compare-grid,
.compare-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.glow-metrics article,
.mini-insight {
  border-radius: 24px;
  padding: 14px;
}

.glow-metrics span,
.metric-value,
.mini-insight strong {
  display: block;
  color: var(--teal);
  font-size: 1.55rem;
  line-height: 1;
  font-weight: 900;
}

.insight-stack {
  display: grid;
  gap: 10px;
}

.mini-insight {
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
}

.mini-insight svg {
  width: 24px;
  height: 24px;
  color: var(--teal);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title.spread {
  justify-content: space-between;
}

.section-title svg,
.routine-title svg,
.ios-button svg,
.empty-state svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.25;
}

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

.tag {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.tag.accent {
  color: var(--teal);
  background: var(--mint);
}

.tag.warn {
  color: #8e3a32;
  background: var(--rose);
}

.tag.gold {
  color: #755018;
  background: var(--cream);
}

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

.score-card,
.routine-card,
.module-result,
.share-card,
.cabinet-list {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card-soft);
}

.score-card {
  padding: 13px;
}

.score-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.score-head strong {
  color: var(--ink);
}

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

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--coral));
  transition: width 280ms ease;
}

.routine-grid {
  display: grid;
  gap: 10px;
}

.routine-card {
  padding: 15px;
}

.routine-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--teal);
}

ol {
  margin: 0;
  padding-left: 22px;
}

li {
  margin: 0 0 10px;
  line-height: 1.34;
}

li:last-child {
  margin-bottom: 0;
}

li span,
.notes,
.module-result,
.share-card,
.cabinet-list {
  color: var(--muted);
}

.notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.note {
  border-left: 3px solid var(--teal);
  padding: 9px 11px;
  background: #f2faf7;
  border-radius: 0 16px 16px 0;
}

.note.warning {
  border-left-color: var(--coral);
  background: #fff1ef;
}

.module-section,
.result-section,
.scan-panel,
.metric-report,
.history-card,
.compact {
  display: grid;
  gap: 12px;
}

[data-premium] {
  position: relative;
  overflow: hidden;
}

[data-premium].premium-locked > :not(.premium-overlay) {
  filter: blur(1px);
  opacity: 0.34;
  pointer-events: none;
}

.premium-overlay {
  position: absolute;
  inset: 10px;
  z-index: 4;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--teal);
  border: 1px solid rgba(22, 124, 116, 0.18);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  font-weight: 900;
  cursor: pointer;
}

.premium-overlay svg {
  width: 24px;
  height: 24px;
}

.ios-button {
  min-height: 48px;
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  cursor: pointer;
}

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

.ios-button[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.scan-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.status-pill {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill svg {
  width: 17px;
  height: 17px;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  min-height: 438px;
  aspect-ratio: 3 / 4;
  background:
    linear-gradient(145deg, rgba(18, 29, 26, 0.94), rgba(22, 124, 116, 0.78)),
    #111a18;
  box-shadow: var(--shadow);
}

#video,
#imagePreview,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video,
#imagePreview {
  object-fit: contain;
}

#video,
#imagePreview {
  display: none;
}

#overlay {
  pointer-events: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 850;
}

.empty-state svg {
  width: 44px;
  height: 44px;
}

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

#photoInput,
#beforeInput,
#afterInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.metrics-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metrics-strip > div {
  min-height: 78px;
  padding: 14px;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.metric-label {
  display: block;
  margin-top: 7px;
}

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

.metric-deck article {
  min-height: 88px;
  border-radius: 22px;
  padding: 12px;
}

.metric-deck strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.88rem;
}

.metric-deck span {
  color: var(--teal);
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 900;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.checkbox-row {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

select,
input[type="text"],
textarea,
.chat-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

select {
  min-height: 48px;
}

textarea {
  resize: vertical;
}

select:focus,
input[type="text"]:focus,
textarea:focus,
.chat-row input:focus {
  border-color: rgba(22, 124, 116, 0.5);
  box-shadow: 0 0 0 4px rgba(22, 124, 116, 0.1);
}

.range-field input {
  width: 100%;
  accent-color: var(--teal);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.35;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  flex: 0 0 auto;
}

.module-result,
.share-card,
.cabinet-list {
  padding: 13px;
  font-size: 0.9rem;
  line-height: 1.42;
}

.module-result strong,
.share-card strong,
.cabinet-list strong {
  color: var(--ink);
}

.module-result ul,
.cabinet-list ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.cabinet-item {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.cabinet-item:last-child {
  border-bottom: 0;
}

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

.chat-log {
  min-height: 54vh;
  max-height: 62vh;
  overflow: auto;
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.chat-bubble {
  width: fit-content;
  max-width: 90%;
  padding: 11px 13px;
  border-radius: 18px;
  line-height: 1.38;
  font-size: 0.92rem;
}

.chat-bubble.assistant {
  background: var(--mint);
  color: #0e5f58;
}

.chat-bubble.user {
  justify-self: end;
  background: var(--cream);
  color: #755018;
}

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

.history-bars {
  height: 116px;
  display: grid;
  grid-template-columns: repeat(7, minmax(18px, 1fr));
  align-items: end;
  gap: 8px;
  padding: 6px 0 22px;
}

.history-bar {
  min-height: 12px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(180deg, var(--teal), var(--gold));
  position: relative;
}

.history-bar.empty {
  height: 12px !important;
  background: #e6ede8;
}

.history-bar span {
  position: absolute;
  bottom: -21px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
}

.mini-button {
  min-height: 36px;
  border-radius: 14px;
  padding: 0 10px;
  background: var(--card);
  color: var(--teal);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 850;
  cursor: pointer;
}

.mini-button svg {
  width: 16px;
  height: 16px;
}

.milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.milestone {
  border-radius: 999px;
  padding: 8px 10px;
  background: var(--cream);
  color: #755018;
  font-size: 0.78rem;
  font-weight: 850;
}

.upload-tile {
  min-height: 86px;
  border: 1px dashed rgba(22, 124, 116, 0.42);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  font-weight: 900;
  cursor: pointer;
}

.upload-tile svg {
  width: 24px;
  height: 24px;
}

.compare-preview canvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #e8eee9;
  object-fit: cover;
}

.share-card {
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(217, 243, 235, 0.88), rgba(255, 246, 232, 0.92)),
    var(--card);
  font-weight: 800;
}

.paywall-hero {
  border-radius: 34px;
  padding: 22px;
  color: white;
  background:
    linear-gradient(142deg, rgba(22, 124, 116, 0.98), rgba(33, 155, 142, 0.82) 55%, rgba(231, 111, 97, 0.9)),
    var(--teal);
  box-shadow: var(--shadow);
}

.paywall-hero .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.paywall-hero h2 {
  margin-bottom: 14px;
  font-size: 1.35rem;
}

.paywall-hero ul {
  margin: 0;
  padding-left: 19px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.38;
  font-weight: 750;
}

.pricing-grid {
  display: grid;
  gap: 12px;
}

.price-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.price-card.featured {
  border-color: rgba(22, 124, 116, 0.38);
  background:
    linear-gradient(135deg, rgba(217, 243, 235, 0.95), rgba(255, 255, 255, 0.9)),
    var(--surface);
}

.price-card.selected-plan {
  outline: 3px solid rgba(22, 124, 116, 0.18);
}

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

.price-card strong {
  font-size: 2.35rem;
  line-height: 1;
  color: var(--ink);
}

.price-card > span {
  color: var(--muted);
  font-weight: 800;
}

.plan-badge {
  order: 2;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.plan-badge.muted {
  background: #e7ede8;
  color: var(--muted);
}

code {
  color: var(--teal);
  font-weight: 850;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  width: min(calc(100% - 18px), 452px);
  min-height: 74px;
  padding: 8px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 52px rgba(22, 37, 32, 0.18);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}

.tabbar button {
  min-width: 0;
  border-radius: 21px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 850;
}

.tabbar button.active {
  background: var(--teal);
  color: white;
}

.tabbar svg {
  width: 19px;
  height: 19px;
}

@media (min-width: 780px) {
  body {
    display: grid;
    place-items: start center;
    padding: 22px 0;
  }

  .ios-app {
    min-height: calc(100vh - 44px);
    border-radius: 42px;
    border: 1px solid rgba(18, 33, 28, 0.08);
    box-shadow: 0 28px 80px rgba(22, 37, 32, 0.18);
    background: rgba(244, 246, 241, 0.86);
    overflow: hidden;
  }

}

@media (max-width: 380px) {
  .ios-app {
    padding-left: 10px;
    padding-right: 10px;
  }

  .score-hero {
    grid-template-columns: 1fr;
  }

  .hero-copy strong {
    font-size: 4.6rem;
  }

  .toolbar,
  .metrics-strip,
  .metric-deck {
    grid-template-columns: 1fr;
  }

  .premium-teaser,
  .daily-card {
    grid-template-columns: 1fr;
  }
}
