:root {
  --font-body: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-title: "Russo One", "Orbitron", Impact, sans-serif;
  --accent: #7ef0d4;                          
  --glass-bg: rgba(15, 23, 42, 0.4);          
  --glass-blur: blur(16px);
  --glass-border: 1px solid rgba(255, 255, 255, 0.14);
  --header-h: 120px;                          
}

* { box-sizing: border-box; font-family: var(--font-body); }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, .nav-link { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #0b0f19;                        
  color: #e8ecf5;
  overflow-x: hidden;
  overflow-x: clip;
}


.bg-video {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: cover;
  z-index: -1;
  opacity: 0;
  transition: opacity .8s ease;
  pointer-events: none;
}
.bg-video.active { opacity: 1; }


body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 40%, transparent 30%, rgba(5, 8, 16, .55));
  pointer-events: none;
}


.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .35);
}


header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

nav {
  width: 100%;
  max-width: 1100px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}

.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.nav-link .short { display: none; }

.nav-link {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(232, 236, 245, .78);
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link.active {
  color: #0b1020;
  background: linear-gradient(135deg, #8ff5dc, #a9c7ff);
  box-shadow: 0 4px 16px rgba(126, 240, 212, .25);
}

/* Ad slots: dashed placeholder until a real ad is inserted.
   Paste ad code inside the slot (or fill AD_CONFIG in script.js) and the dashed box disappears. */
.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px dashed rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: rgba(15, 23, 42, .25);
  color: rgba(232, 236, 245, .5);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.ad-slot ins, .ad-slot iframe, .ad-slot img { max-width: 100%; }
.ad-slot.has-ad,
.ad-slot:has(> :not(.ad-label)) {
  border-color: transparent;
  background: transparent;
  letter-spacing: normal;
}
.ad-slot.has-ad .ad-label,
.ad-slot:has(> :not(.ad-label)) .ad-label { display: none; }


main {
  flex: 1;
  position: relative;
  display: flex;                               
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 24px) 20px 40px;
  overflow-x: hidden;                          
  overflow-x: clip;
}


.page {
  position: absolute;
  top: calc(var(--header-h) + 24px);
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .45s ease, transform .45s ease, visibility 0s linear .45s;
}
.page.active {
  position: relative;
  top: auto; left: auto; right: auto;
  width: 100%;
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  animation: pageIn .45s ease both;
  transition: none;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

h1, h2, h3 { font-family: var(--font-title); font-weight: 400; margin: 0; }


.hero { text-align: center; padding: clamp(32px, 7vw, 64px) clamp(24px, 6vw, 64px); max-width: 720px; }
.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.15;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .5), 0 0 28px color-mix(in srgb, var(--accent) 55%, transparent);
}
.hero p {
  margin: 18px 0 30px;
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .03em;
  color: rgba(232, 236, 245, .85);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .7);
}


.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .05em;
  color: #0b1d2e;
  padding: 14px 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8ff5dc 0%, #a9c7ff 55%, #d9b8ff 100%);
  box-shadow: 0 8px 22px rgba(126, 200, 240, .25);
  transition: transform .12s, filter .2s, box-shadow .2s;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 10px 28px rgba(126, 200, 240, .38); }
.btn:active { transform: scale(.98); }


.panel { width: 100%; max-width: 780px; padding: clamp(24px, 4vw, 40px); }
.panel h2 {
  font-size: clamp(24px, 4vw, 32px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  margin-bottom: 14px;
}
.panel p, .panel li {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: .02em;
  color: rgba(232, 236, 245, .88);
}
.panel ul { padding-left: 20px; margin: 10px 0 0; }
.panel p { margin: 0 0 14px; }
.panel h3 { font-size: clamp(17px, 2.6vw, 21px); letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin: 22px 0 8px; }
.panel strong { color: #fff; font-weight: 600; }
.panel em { color: rgba(232, 236, 245, .78); }

.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 20px; }
.module { padding: 16px 18px; border-radius: 16px; background: rgba(15, 23, 42, .4); border: var(--glass-border); }
.module h4 { font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.module p { margin: 0; font-size: 14.5px; line-height: 1.55; }

.credits-layout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.credits-layout .panel { flex: 1 1 380px; max-width: 600px; min-width: 0; }


.love-wrap {
  --s: .9;                                      
  position: relative;
  flex: none;
  width: calc(550px * var(--s));
  height: calc(540px * var(--s));
  pointer-events: none;
}
.love-stage {
  position: absolute;
  left: 0;
  top: calc(80px * var(--s));
  width: 450px;
  height: 450px;
  transform: scale(var(--s));
  transform-origin: 0 0;
}
.love-stage .love { position: absolute; top: 0; left: 0; --i: 1; }
.love-stage .love_word {
  color: #ea80b0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 2px;
  white-space: nowrap;
  text-shadow: 0 0 10px #fff;
  transform: translateY(-100%) rotate(-30deg);
}
.love-stage .love_horizontal {
  animation: love-h 10s infinite alternate ease-in-out;
  animation-delay: calc(var(--i) * -300ms);
}
.love-stage .love_vertical {
  animation: love-v 20s infinite linear;
  animation-delay: calc(var(--i) * -300ms);
}

.page:not(.active) .love-stage .love_horizontal,
.page:not(.active) .love-stage .love_vertical { animation-play-state: paused; }

@keyframes love-h { from { transform: translateX(0); } to { transform: translateX(450px); } }
@keyframes love-v {
  0%    { transform: translateY(180px); }
  10%   { transform: translateY(45px); }
  15%   { transform: translateY(4.5px); }
  18%   { transform: translateY(0); }
  20%   { transform: translateY(4.5px); }
  22%   { transform: translateY(34.61538px); }
  24%   { transform: translateY(64.28571px); }
  25%   { transform: translateY(112.5px); }
  26%   { transform: translateY(64.28571px); }
  28%   { transform: translateY(34.61538px); }
  30%   { transform: translateY(4.5px); }
  32%   { transform: translateY(0); }
  35%   { transform: translateY(4.5px); }
  40%   { transform: translateY(45px); }
  50%   { transform: translateY(180px); }
  71%   { transform: translateY(428.57143px); }
  72.5% { transform: translateY(441.17647px); }
  75%   { transform: translateY(450px); }
  77.5% { transform: translateY(441.17647px); }
  79%   { transform: translateY(428.57143px); }
  100%  { transform: translateY(180px); }
}

.credit-note {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: rgba(255, 255, 255, .04);
  font-family: var(--font-title);
  font-size: 17px;
  letter-spacing: 1px;
  color: var(--accent);
  text-align: center;
}


.bmi-layout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(40px, 7vw, 110px);
}

.character { flex: 0 1 460px; min-width: 0; }

.stage {
  --img-w: 133;                                
  --img-top: -0.7;                             
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.95;
  container-type: inline-size;
}
.stage::before {                               
  content: "";
  position: absolute;
  left: 50%; top: 0;
  width: 90%; height: 85%;
  transform: translateX(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%);
  transition: background .5s;
  pointer-events: none;
}


.crop {
  position: absolute;
  inset: 0;
  clip-path: inset(-20% -40% 22% -40%);
  -webkit-mask-image: linear-gradient(to bottom, #000 68%, transparent 78%);
          mask-image: linear-gradient(to bottom, #000 68%, transparent 78%);
}
.aria-img {
  position: absolute;
  left: 50%;
  top: calc(var(--img-top) * 1cqw);
  width: calc(var(--img-w) * 1cqw);
  max-width: none;
  height: auto;
  object-fit: cover;
  object-position: top center;
  transform: translateX(-50%);
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .5));
  user-select: none;
  -webkit-user-drag: none;
}
.aria-img.pop { animation: pop .5s ease-out; }
@keyframes pop {
  0%   { opacity: 0; transform: translateX(-50%) translateY(14px) scale(.97); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}


.dialogue {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; bottom: 0;
  min-height: 30%;
  padding: 24px 22px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
          backdrop-filter: var(--glass-blur);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 18px;
  box-shadow: 0 -6px 28px color-mix(in srgb, var(--accent) 24%, transparent), 0 12px 30px rgba(0, 0, 0, .45);
  transition: border-color .4s, box-shadow .4s;
}
.speaker {
  position: absolute;
  top: -14px; left: 20px;
  padding: 4px 16px;
  font-family: var(--font-title);
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #0b0f19;
  background: var(--accent);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
  transition: background .4s;
}
.dialogue-text {
  margin: 0;
  font-size: clamp(13px, 3.5cqw, 15.5px);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .03em;
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .9), 0 0 10px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color .4s;
}


.calc { flex: 0 1 420px; min-width: 0; padding: 34px 30px 26px; }
.calc h2 {
  text-align: center;
  font-size: 28px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 18px color-mix(in srgb, var(--accent) 50%, transparent);
}
.sub { margin: 6px 0 22px; text-align: center; font-size: 15px; color: rgba(232, 236, 245, .7); }

.input-group { margin-bottom: 14px; }
.input-group label small { font-weight: 400; opacity: .6; }


.unit-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.unit-tab {
  appearance: none; border: none; cursor: pointer;
  padding: 10px 8px; border-radius: 999px;
  font-family: var(--font-title); font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: rgba(232, 236, 245, .75); background: transparent;
  transition: background .2s, color .2s;
}
.unit-tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.unit-tab.active { color: #0b1d2e; background: linear-gradient(135deg, #8ff5dc, #a9c7ff); }
.unit-tab:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.unit-pane[hidden] { display: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair .num-field { margin-top: 7px; }


.gender { border: 0; padding: 0; min-width: 0; margin-left: 0; margin-right: 0; margin-top: 0; }
.gender legend { padding: 0; margin-bottom: 7px; font-size: 15px; font-weight: 500; letter-spacing: .03em; color: rgba(232, 236, 245, .88); }
.pills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pill { position: relative; display: block; cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 8px; border-radius: 12px;
  font-size: 14.5px; font-weight: 600; letter-spacing: .03em;
  color: rgba(232, 236, 245, .8);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .18);
  transition: background .2s, color .2s, border-color .2s;
}
.pill:hover span { background: rgba(255, 255, 255, .12); }
.pill input:checked + span { color: #0b1d2e; border-color: transparent; background: linear-gradient(135deg, #8ff5dc, #a9c7ff); }
.pill input:focus-visible + span { outline: 2px solid #a78bfa; outline-offset: 2px; }

.age-note { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: rgba(232, 236, 245, .7); }
label { font-size: 15px; font-weight: 500; letter-spacing: .03em; color: rgba(232, 236, 245, .88); }

input[type="number"] {
  width: 100%;
  padding: 12px 52px 12px 14px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  color-scheme: dark;
  transition: border-color .2s, background .2s;
}
input[type="number"]::placeholder { color: rgba(232, 236, 245, .4); }
input[type="number"]:focus { outline: none; border-color: var(--accent); background: rgba(255, 255, 255, .1); }


input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; appearance: none; display: none; margin: 0; }

.num-field { position: relative; margin-top: 7px; }
.stepper {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.step {
  appearance: none;
  position: relative;
  width: 30px;
  height: 20px;
  padding: 0;
  cursor: pointer;
  color: #c4b5fd;
  background: rgba(139, 92, 246, .2);
  border: 1px solid rgba(167, 139, 250, .4);
  border-radius: 7px;
  transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.step::before {                                  /* arrow triangle */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}
.step.up::before   { border-bottom: 6px solid currentColor; }
.step.down::before { border-top: 6px solid currentColor; }
.step:hover  { color: #fff; background: rgba(139, 92, 246, .5); border-color: #a78bfa; box-shadow: 0 0 10px rgba(139, 92, 246, .45); }
.step:active { color: #fff; background: #7c3aed; border-color: #8b5cf6; transform: scale(.93); }
.step:focus-visible { outline: 2px solid #a78bfa; outline-offset: 1px; }

.calc .btn { width: 100%; margin-top: 6px; }

.error { margin: 0 0 8px; font-size: 14px; color: #ff8a8a; }
.preview { display: none; margin-top: 14px; font-size: 14px; text-align: center; color: rgba(232, 236, 245, .75); }

.result-box {
  display: none;
  margin-top: 16px;
  padding: 14px;
  text-align: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--accent);
  transition: border-color .4s;
}
.bmi-line { font-size: 16px; font-weight: 500; color: rgba(232, 236, 245, .88); }
.bmi-value {
  font-family: var(--font-title);
  font-size: 34px;
  color: var(--accent);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: color .4s;
}
.status { margin-top: 4px; font-weight: 600; letter-spacing: .04em; color: var(--accent); transition: color .4s; }
.note { margin: 16px 0 0; font-size: 12px; text-align: center; color: rgba(232, 236, 245, .5); }


footer {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
footer small { font-size: 12px; color: rgba(232, 236, 245, .5); letter-spacing: .05em; }


@media (min-width: 1600px) {
  nav, main { max-width: 1240px; }
  .character { flex-basis: 520px; }
  .calc { flex-basis: 460px; }
}


@media (max-width: 1000px) {
  .credits-layout { flex-direction: column; gap: 10px; }
  .credits-layout .panel { flex: none; width: 100%; max-width: 620px; }
}


@media (max-width: 900px) {
  .bmi-layout { flex-direction: column; gap: 34px; }
  .character { flex: none; width: min(440px, 100%); }
  .calc { flex: none; width: min(460px, 100%); }
}


@media (max-width: 640px) {
  :root { --glass-blur: blur(12px); }

  header { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); gap: 6px; }

  nav { flex-wrap: nowrap; justify-content: center; padding: 6px; border-radius: 999px; }
  .nav-links { width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: 2px; }
  .nav-link { flex: 1; min-height: 44px; padding: 8px 4px; font-size: 12px; letter-spacing: .6px; white-space: nowrap; }
  .nav-link .long { display: none; }
  .nav-link .short { display: inline; }

  .ad-slot { min-height: 34px; font-size: 11px; letter-spacing: 1.5px; border-radius: 10px; }

  main { padding: calc(var(--header-h) + 14px) 14px 28px; }
  .page { top: calc(var(--header-h) + 14px); left: 14px; right: 14px; }

  .glass { border-radius: 18px; }
  .hero { padding: 30px 20px; }
  .panel { padding: 22px 18px; }
  .panel p, .panel li { font-size: 15px; line-height: 1.6; }
  .modules { grid-template-columns: 1fr 1fr; gap: 10px; }
  .module { padding: 12px 14px; }
  .credit-note { font-size: 15px; padding: 14px; }

  .bmi-layout { gap: 28px; }
  .calc { padding: 26px 20px 22px; }
  .calc h2 { font-size: 24px; }
  .btn { min-height: 48px; padding: 13px 26px; }
  input { min-height: 48px; }
  .step { width: 32px; height: 22px; }

  footer { padding: 0 12px calc(18px + env(safe-area-inset-bottom)); }
  footer small { text-align: center; line-height: 1.5; }
}

@media (max-width: 640px) { .love-wrap { --s: .62; } }


@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; gap: 0; } }

@media (max-width: 380px) {
  .love-wrap { --s: .52; }
  .nav-link { font-size: 11px; letter-spacing: .3px; }
  .modules { grid-template-columns: 1fr; }
  .dialogue { padding: 24px 16px 12px; }
  .speaker { left: 14px; font-size: 12px; }
}


@media (max-height: 520px) and (orientation: landscape) {
  header { gap: 4px; padding-top: 6px; }
  .ad-slot { min-height: 26px; }
  .hero { padding: 22px 28px; }
  .hero h1 { font-size: 30px; }
  .hero p { margin: 10px 0 18px; font-size: 15px; }
  .bmi-layout { flex-direction: row; gap: 24px; }
  .character { flex: 0 1 300px; }
  .calc { flex: 0 1 340px; padding: 20px 20px 16px; }
  .calc .sub, .calc .note { display: none; }
  .input-group { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .love-stage .love_horizontal, .love-stage .love_vertical { animation-play-state: paused; }
  .page, .page.active, .bg-video { transition: none; animation: none; }
}
