/* ─── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:       #F5F2EE;
  --surface:  #FFFFFF;
  --ink:      #1A1A18;
  --ink2:     #6B6B67;
  --accent:   #2ECC8A;
  --accent2:  #FF6B4A;
  --warn:     #F5A623;
  --border:   rgba(26,26,24,.08);
  --shadow:   0 2px 24px rgba(26,26,24,.07);
  --r:        20px;
  --r-sm:     12px;
  --font-h:   'Abril Fatface', serif;
  --font-b:   'DM Sans', sans-serif;
}

/* ─── RESET ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-b);
  background-color: var(--bg);
  background-image: url(back.svg);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ─── LAYOUT ─────────────────────────────────────────── */
.app { max-width: 480px; margin: 0 auto; padding: 0 0 100px; }

/* ─── HEADER ─────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 56px 24px 20px;
}
.logo {
  font-family: var(--font-h);
  font-size: 20px; font-weight: 800; letter-spacing: 0px;
}
.logo span { color: var(--accent); }
.header-sub { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.header-icon { border-radius: 10px; display: block; }

/* ─── HERO TAGLINE ───────────────────────────────────── */
.hero {
  padding: 0 24px 32px;
  animation: fadeUp .6s ease both;
}
.hero h1 {
  font-family: var(--font-h);
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 800; line-height: 1.1; letter-spacing: 0px;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p {
  margin-top: 10px; font-size: 14px; color: var(--ink2);
  line-height: 1.6; max-width: 320px;
}

/* ─── CARDS ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin: 0 16px 16px;
  padding: 24px;
  animation: fadeUp .5s ease both;
}
.card--accent { background: var(--ink); color: #fff; border-color: transparent; }
.card-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink2); margin-bottom: 16px;
}
.card--accent .card-label { color: rgba(255,255,255,.5); }

/* ─── GENDER TOGGLE ──────────────────────────────────── */
.gender-toggle {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 20px;
}
.gender-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 12px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-family: var(--font-b); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s ease;
  color: var(--ink2);
}
.gender-btn.active {
  border-color: var(--accent);
  background: rgba(46,204,138,.08);
  color: var(--ink);
}
.gender-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ─── UNIT TOGGLE ────────────────────────────────────── */
.unit-toggle {
  display: flex; gap: 0; margin-bottom: 20px;
  background: var(--bg); border-radius: 10px; padding: 3px;
  border: 1px solid var(--border);
}
.unit-btn {
  flex: 1; padding: 8px; text-align: center;
  border: none; background: transparent;
  font-family: var(--font-b); font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: 8px; transition: all .2s ease;
  color: var(--ink2);
}
.unit-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ─── INPUTS ─────────────────────────────────────────── */
.input-group { margin-bottom: 16px; }
.input-label {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--ink2); margin-bottom: 6px; letter-spacing: .02em;
}
.input-wrap {
  position: relative; display: flex; align-items: center;
}
.input-wrap svg {
  position: absolute; left: 14px; width: 18px; height: 18px;
  color: var(--ink2); pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 14px 48px 14px 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  font-family: var(--font-b); font-size: 16px; font-weight: 400;
  color: var(--ink); outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .2s;
}
.input-wrap input:focus { border-color: var(--accent); background: #fff; }
.input-unit {
  position: absolute; right: 14px;
  font-size: 12px; font-weight: 600; color: var(--ink2);
  pointer-events: none;
}

/* ─── CTA BUTTON ─────────────────────────────────────── */
.btn-calc {
  width: 100%; padding: 18px;
  border: none; border-radius: var(--r-sm);
  background: var(--ink);
  color: #fff; font-family: var(--font-b);
  font-size: 16px; font-weight: 500; letter-spacing: 0px;
  cursor: pointer; transition: all .2s ease;
  position: relative; overflow: hidden;
}
.btn-calc:active { transform: scale(.98); }
.btn-calc::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,.08) 100%);
}

/* ─── SCORE DISPLAY ──────────────────────────────────── */
#result-section { display: none; }
#result-section.visible { display: block; }

.score-card {
  background: var(--ink); color: #fff;
  border-radius: var(--r); margin: 0 16px 16px;
  padding: 32px 24px 24px;
  animation: scoreReveal .7s cubic-bezier(.34,1.56,.64,1) both;
  border: 1px solid transparent;
}
@keyframes scoreReveal {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: none; }
}

.score-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
}
.score-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .5; }
.ratio-badge {
  background: rgba(255,255,255,.1);
  border-radius: 8px; padding: 6px 12px;
  font-family: var(--font-h); font-size: 14px; font-weight: 700;
}

/* ─── GAUGE ──────────────────────────────────────────── */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.gauge-svg { width: 200px; height: 110px; overflow: visible; }
.gauge-track {
  fill: none; stroke: rgba(255,255,255,.1);
  stroke-width: 12; stroke-linecap: round;
}
.gauge-fill {
  fill: none; stroke: var(--accent);
  stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1.2s cubic-bezier(.34,1.2,.64,1),
              stroke .5s ease;
}
.gauge-score-num {
  font-family: var(--font-h);
  font-size: 56px; font-weight: 800; letter-spacing: 0px;
  fill: #fff; text-anchor: middle;
}
.gauge-score-label { fill: rgba(255,255,255,.45); font-size: 12px; text-anchor: middle; font-family: var(--font-b); }

/* ─── SCORE MESSAGE ──────────────────────────────────── */
.score-message {
  font-size: 14px; line-height: 1.6; opacity: .8;
  padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1);
}
.score-message strong { color: var(--accent); font-weight: 600; opacity: 1; }

/* ─── STATS ROW ──────────────────────────────────────── */
.stats-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin: 0 16px 16px;
}
.stat-card {
  background: var(--surface); border-radius: var(--r-sm);
  padding: 16px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: fadeUp .5s ease both;
}
.stat-card .value {
  font-family: var(--font-h); font-size: 24px; font-weight: 800;
  letter-spacing: 0px;
}
.stat-card .unit-txt { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.stat-card .stat-lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); margin-bottom: 6px; }

/* ─── SIMULATOR ──────────────────────────────────────── */
.sim-toggle-btn {
  width: calc(100% - 32px); margin: 0 16px 16px;
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface);
  font-family: var(--font-b); font-size: 14px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  color: var(--ink); transition: all .2s;
  box-shadow: var(--shadow);
}
.sim-toggle-btn:active { transform: scale(.99); }
.sim-toggle-btn svg { transition: transform .3s ease; }
.sim-toggle-btn.open svg { transform: rotate(180deg); }

.simulator {
  display: none; margin: 0 16px 16px; overflow: hidden;
}
.simulator.open { display: block; animation: fadeUp .4s ease both; }

.sim-card {
  background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 24px;
}

.slider-group { margin-bottom: 20px; }
.slider-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.slider-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.slider-val {
  font-family: var(--font-h); font-size: 18px; font-weight: 700;
  color: var(--accent);
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg); border-radius: 4px; outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: transform .15s ease;
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }

.sim-result {
  background: var(--bg); border-radius: var(--r-sm);
  padding: 16px; display: flex; align-items: center; gap: 16px;
}
.sim-score-num {
  font-family: var(--font-h); font-size: 40px; font-weight: 800; letter-spacing: 0px;
}
.sim-score-info { flex: 1; }
.sim-score-info .lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.sim-score-info .ratio-txt { font-size: 13px; color: var(--ink2); margin-top: 4px; }

/* ─── PROGRESS BAR (sim) ─────────────────────────────── */
.progress-bar-wrap { margin-top: 12px; }
.progress-bar-bg {
  height: 6px; background: var(--bg);
  border-radius: 4px; overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar-fill {
  height: 100%; border-radius: 4px;
  background: var(--accent);
  transition: width .4s cubic-bezier(.34,1.2,.64,1), background .4s ease;
}

/* ─── EDUCATION ──────────────────────────────────────── */
.edu-card {
  background: var(--surface); border-radius: var(--r);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  margin: 0 16px 16px; overflow: hidden;
}
.edu-header {
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; gap: 14px;
}
.edu-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  background: rgba(46,204,138,.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.edu-icon svg { color: var(--accent); }
.edu-title { font-family: var(--font-h); font-size: 16px; font-weight: 700; line-height: 1.2; }
.edu-body { padding: 16px 24px 20px; font-size: 13px; color: var(--ink2); line-height: 1.7; }
.edu-body strong { color: var(--ink); font-weight: 600; }
.edu-link {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; font-size: 13px; font-weight: 600;
  color: var(--accent); text-decoration: none;
}
.disclaimer {
  margin: 0 16px 16px; padding: 14px 16px;
  border-radius: var(--r-sm);
  background: rgba(245,166,35,.08);
  border: 1px solid rgba(245,166,35,.2);
  font-size: 12px; color: var(--ink2); line-height: 1.6;
}
.disclaimer strong { color: var(--warn); font-weight: 600; }

/* ─── BOTTOM NAV ─────────────────────────────────────── */
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(245,242,238,.9);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  padding: 12px 0 max(12px, env(safe-area-inset-bottom));
  display: flex; justify-content: space-around;
  max-width: 480px; margin: 0 auto;
}
@media (min-width: 480px) {
  .bottom-bar { left: 50%; right: auto; transform: translateX(-50%); width: 480px; }
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; color: var(--ink2);
  cursor: pointer; padding: 4px 16px; border-radius: 10px;
  transition: color .2s;
  background: none; border: none;
}
.nav-item.active { color: var(--ink); }
.nav-item svg { width: 22px; height: 22px; }
.nav-dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent); margin: 0 auto;
  opacity: 0; transition: opacity .2s;
}
.nav-item.active .nav-dot { opacity: 1; }

/* ─── HISTORY ────────────────────────────────────────── */
#history-section { display: none; padding-top: 16px; }
#history-section.visible { display: block; }
.history-item {
  background: var(--surface); border-radius: var(--r-sm);
  border: 1px solid var(--border); margin: 0 16px 10px;
  padding: 16px 20px; display: flex; align-items: center; gap: 16px;
  animation: fadeUp .3s ease both;
}
.history-score {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-h); font-size: 20px; font-weight: 800;
}
.history-info { flex: 1; }
.history-info .h-label { font-size: 13px; font-weight: 600; }
.history-info .h-date { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.history-ratio { font-family: var(--font-h); font-size: 16px; font-weight: 700; }

.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--ink2); font-size: 14px; line-height: 1.7;
}
.empty-state svg { width: 48px; height: 48px; opacity: .3; margin-bottom: 16px; }

/* ─── ANIMATIONS ─────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.card:nth-child(1) { animation-delay: .05s; }
.card:nth-child(2) { animation-delay: .1s; }
.card:nth-child(3) { animation-delay: .15s; }

@keyframes shake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)}
}

/* ─── PAGE VIEWS ─────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ─── ABOUT PAGE ─────────────────────────────────────── */
.about-hero {
  padding: 56px 24px 32px;
  background: var(--ink); color: #fff;
  margin-bottom: 24px;
}
.about-hero h2 {
  font-family: var(--font-h); font-size: 28px; font-weight: 800;
  letter-spacing: 1px; line-height: 1.15;
}
.about-hero p { font-size: 14px; opacity: .6; margin-top: 10px; line-height: 1.6; }
.about-section { margin: 0 16px 24px; }
.about-section h3 {
  font-family: var(--font-h); font-size: 18px; font-weight: 700;
  letter-spacing: 0.5px; margin-bottom: 10px;
}
.about-section p { font-size: 14px; color: var(--ink2); line-height: 1.7; }
.about-section p + p { margin-top: 10px; }
.ratio-table {
  width: 100%; border-collapse: collapse; margin-top: 12px;
  font-size: 13px;
}
.ratio-table th {
  text-align: left; padding: 10px 12px;
  background: var(--bg); font-weight: 600;
  border-radius: 8px 8px 0 0;
}
.ratio-table td { padding: 10px 12px; border-top: 1px solid var(--border); }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.pill-green { background: rgba(46,204,138,.15); color: var(--accent); }
.pill-yellow { background: rgba(245,166,35,.15); color: var(--warn); }
.pill-red { background: rgba(255,107,74,.15); color: var(--accent2); }
