:root {
  color-scheme: dark;
  --black: #070a09;
  --off-black: #0d1210;
  --card: #141b18;
  --card-2: #101613;
  --green: #006039;
  --green-dark: #003e2b;
  --green-light: #88b5a0;
  --ivory: #f4f0e8;
  --muted: #aab5af;
  --line: #26342e;
  --safe-t: max(14px, env(safe-area-inset-top));
  --safe-r: max(18px, env(safe-area-inset-right));
  --safe-b: max(14px, env(safe-area-inset-bottom));
  --safe-l: max(18px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--black);
  color: var(--ivory);
  font-family: Arial, "Helvetica Neue", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

#app {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 103% -4%, transparent 0 13%, rgba(0, 96, 57, .28) 13.2% 13.35%, transparent 13.55% 20%, rgba(0, 96, 57, .18) 20.2% 20.35%, transparent 20.55% 28%, rgba(0, 96, 57, .12) 28.2% 28.35%, transparent 28.55%),
    radial-gradient(circle at -7% 108%, #101613 0 24%, transparent 24.2%),
    var(--black);
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  overflow: hidden;
  animation: reveal .26s ease-out;
}

@keyframes reveal {
  from { opacity: 0; transform: scale(.992); }
  to { opacity: 1; transform: scale(1); }
}

.topbar {
  height: clamp(38px, 6.2vh, 62px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: 0 0 auto;
}

.brand-lock {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: default;
}

.brand-name {
  display: block;
  font-size: clamp(10px, 1.25vw, 16px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: .08em;
}

.brand-signature {
  display: block;
  margin-top: 7px;
  color: var(--green-light);
  font-size: clamp(5px, .62vw, 8px);
  letter-spacing: .06em;
}

.step {
  color: var(--muted);
  font-size: clamp(7px, .78vw, 10px);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, .95fr);
  align-items: center;
  gap: clamp(26px, 5vw, 76px);
  padding: 2vh 5vw 5vh;
}

.welcome-screen {
  isolation: isolate;
  background: #050505;
}

.welcome-screen::before,
.welcome-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.welcome-screen::before {
  z-index: -2;
  background: url("assets/welcome-khilkhal.png") center center / cover no-repeat;
}

.welcome-screen::after {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .94) 0%, rgba(0, 0, 0, .78) 34%, rgba(0, 0, 0, .14) 68%, rgba(0, 0, 0, .35) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .3) 0%, transparent 48%, rgba(0, 0, 0, .58) 100%);
}

.welcome-screen .hero {
  grid-template-columns: minmax(320px, .76fr) minmax(260px, 1.24fr);
}

.welcome-screen .hero-copy {
  max-width: 720px;
  padding: clamp(20px, 2.6vw, 38px);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 24px;
  background: rgba(5, 7, 6, .42);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.welcome-screen .hero-copy p:not(.eyebrow) {
  color: rgba(244, 240, 232, .82);
}

.hero-copy h1,
.section-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: -.025em;
}

.hero-copy h1 {
  max-width: 720px;
  font-size: clamp(38px, 6vw, 76px);
  line-height: .98;
}

.hero-copy p {
  max-width: 620px;
  margin: clamp(20px, 3vh, 34px) 0;
  color: var(--muted);
  font-size: clamp(12px, 1.35vw, 17px);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--green-light);
  font-size: clamp(8px, .9vw, 12px);
  font-weight: 800;
  letter-spacing: .13em;
}

.bottle-stage {
  position: relative;
  align-self: stretch;
  min-height: 0;
}

.bottle-card {
  position: absolute;
  width: 55%;
  height: 74%;
  bottom: 8%;
  border-radius: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}

.bottle-card:nth-child(1) { left: 0; opacity: .7; transform: scale(.82); }
.bottle-card:nth-child(2) { left: 22%; z-index: 2; }
.bottle-card:nth-child(3) { right: 0; opacity: .72; transform: scale(.88); }
.bottle-card img { width: 100%; height: 100%; object-fit: contain; background: #fff; }

.primary,
.secondary,
.language-btn {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 28px;
  border: 1px solid transparent;
  font-weight: 800;
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: .04em;
}

.primary,
.language-btn {
  background: var(--green);
  border-color: var(--green);
}

.primary:disabled {
  opacity: .34;
}

.secondary {
  background: var(--card);
  border-color: var(--line);
}

.language-screen {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.crest {
  width: clamp(66px, 9vh, 94px);
  height: clamp(66px, 9vh, 94px);
  display: grid;
  place-items: center;
  margin-bottom: clamp(24px, 4vh, 42px);
  border-radius: 50%;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: clamp(28px, 4vh, 42px);
  font-weight: 700;
}

.language-screen h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(36px, 5.5vw, 70px);
  line-height: 1;
}

.language-screen .byline {
  margin: 14px 0 5vh;
  color: var(--green-light);
  font-size: clamp(9px, 1vw, 13px);
  letter-spacing: .14em;
}

.language-actions {
  display: flex;
  gap: 22px;
}

.language-btn { width: clamp(190px, 23vw, 290px); }

.content-head {
  flex: 0 0 auto;
  padding: .5vh 2vw 1.5vh;
}

.section-title {
  font-size: clamp(28px, 4vw, 54px);
  line-height: 1.05;
}

.section-subtitle {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: clamp(9px, 1.1vw, 14px);
}

.ingredient-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: clamp(5px, .8vw, 11px);
  padding: 0 2vw;
}

.ingredient-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(58px, 42%) 1fr;
  align-items: center;
  min-height: 0;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(10px, 1.3vw, 16px);
  background: var(--card);
  text-align: left;
}

.ingredient-card.selected {
  border-color: var(--green-light);
  background: #10261d;
  box-shadow: inset 0 0 0 1px var(--green);
}

.ingredient-card img {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 10px;
  object-fit: cover;
}

.ingredient-label {
  min-width: 0;
  padding: 0 8px;
}

.ingredient-label strong {
  display: block;
  font-size: clamp(8px, .9vw, 12px);
  line-height: 1.15;
}

.ingredient-label small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: clamp(7px, .72vw, 10px);
}

.select-mark {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: clamp(18px, 2vw, 26px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.bottom-bar {
  flex: 0 0 auto;
  height: clamp(58px, 8.5vh, 82px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 1vh 2vw 0;
}

.selection-count {
  color: var(--green-light);
  font-size: clamp(8px, .9vw, 12px);
  font-weight: 800;
  letter-spacing: .08em;
}

.choice-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  align-items: stretch;
  gap: clamp(10px, 1.5vw, 20px);
  padding: 2.2vh 2vw 2vh;
}

.choice-grid.moments { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.choice-grid.intensities { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-inline: 7vw; }

.choice-card {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(16px, 2vw, 25px);
  background: var(--card);
  text-align: left;
  padding: 0;
}

.choice-card img {
  width: 100%;
  height: 58%;
  object-fit: cover;
}

.choice-copy { padding: clamp(12px, 1.6vw, 21px); }
.choice-copy strong { display: block; font-family: Georgia, serif; font-size: clamp(13px, 1.5vw, 21px); }
.choice-copy small { display: block; margin-top: 9px; color: var(--muted); font-size: clamp(8px, .85vw, 12px); line-height: 1.45; }

.level-visual {
  height: 60%;
  display: grid;
  place-items: center;
}

.level-ring {
  width: calc(70px + var(--level) * 34px);
  max-width: 55%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--green-light);
  background: rgba(0, 96, 57, .42);
  font-family: Georgia, serif;
  font-size: clamp(28px, 4vw, 56px);
}

.result-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1.8vw, 24px);
  padding: 1vh 2vw 1.5vh;
}

.product-card {
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(16px, 2vw, 24px);
  background: var(--card);
  color: inherit;
}

.product-open {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.product-image-wrap {
  min-height: 0;
  margin: clamp(8px, 1vw, 14px);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.product-image-wrap img { width: 100%; height: 100%; object-fit: contain; }
.product-info { padding: 0 clamp(14px, 1.6vw, 22px) clamp(14px, 1.6vw, 22px); }
.product-rank { color: var(--green-light); font-size: clamp(7px, .75vw, 10px); letter-spacing: .12em; }
.product-info h3 { margin: 7px 0 9px; font-family: Georgia, serif; font-size: clamp(15px, 1.8vw, 25px); line-height: 1; }
.note-pair { color: var(--green-light); font-size: clamp(7px, .76vw, 11px); font-weight: 800; line-height: 1.4; }
.note-pair-ar { margin-top: 4px; color: var(--muted); font-size: clamp(7px, .7vw, 10px); }

.cart-add,
.store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.cart-add {
  min-height: 40px;
  margin: 0 clamp(10px, 1vw, 14px) clamp(10px, 1vw, 14px);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--green);
  color: var(--ivory);
  font-size: clamp(8px, .85vw, 12px);
  font-weight: 800;
  letter-spacing: .04em;
}

.cart-add-form {
  margin: 0 clamp(10px, 1vw, 14px) clamp(10px, 1vw, 14px);
}

.cart-add-form .cart-add {
  width: 100%;
  margin: 0;
  border: 0;
}

.result-bottom {
  height: clamp(52px, 7.5vh, 74px);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2vw;
}

.detail-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, .88fr) minmax(360px, 1.12fr);
  gap: clamp(28px, 5vw, 76px);
  align-items: center;
  padding: 2vh 5vw 5vh;
}

.detail-image {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: #fff;
}

.detail-image img { width: 100%; height: 100%; object-fit: contain; }
.detail-copy h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(38px, 5vw, 70px); line-height: .95; }
.detail-copy > p:not(.eyebrow) { max-width: 720px; display: -webkit-box; overflow: hidden; color: var(--muted); font-size: clamp(11px, 1.18vw, 16px); line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 7; }
.detail-pairs { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0; }
.detail-pairs span { padding: 10px 14px; border-radius: 999px; background: var(--green-dark); color: var(--green-light); font-size: clamp(8px, .85vw, 12px); }
.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.detail-cart-form { margin: 0; }
.detail-cart { min-height: 46px; margin: 0; }

.rtl { direction: rtl; }
.rtl .brand-lock,
.rtl .ingredient-card,
.rtl .choice-card,
.rtl .product-card,
.rtl .product-open { text-align: right; }
.rtl .select-mark { right: auto; left: 7px; }
.rtl .hero-copy { text-align: right; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .78);
  backdrop-filter: blur(14px);
}

.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: min(92vw, 440px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--off-black);
  box-shadow: 0 30px 100px #000;
}

.modal-card h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; }
.modal-card input { width: 100%; height: 48px; margin: 24px 0 12px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--card); color: var(--ivory); }
.modal-card input:focus { border-color: var(--green-light); }
.modal-close { position: absolute; top: 13px; right: 15px; width: 36px; height: 36px; border: 0; background: transparent; font-size: 28px; color: var(--muted); }
.wide { width: 100%; margin-top: 10px; }
.muted { color: var(--muted); }
.error { color: #e8a0a5; font-size: 12px; }
.admin-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

@media (max-aspect-ratio: 4/3) {
  .hero { grid-template-columns: 1fr 44%; padding-inline: 2vw; }
  .welcome-screen .hero { grid-template-columns: 1fr 38%; }
  .hero-copy h1 { font-size: clamp(31px, 5vw, 58px); }
  .ingredient-card { grid-template-columns: 45% 1fr; }
  .choice-copy small { display: none; }
}

@media (orientation: portrait) {
  .hero { grid-template-columns: 1fr; grid-template-rows: auto 40%; text-align: center; padding: 1vh 5vw 3vh; }
  .welcome-screen::before { background-position: center center; }
  .welcome-screen::after {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .14) 42%, rgba(0, 0, 0, .88) 100%),
      linear-gradient(90deg, rgba(0, 0, 0, .28), transparent 58%, rgba(0, 0, 0, .24));
  }
  .welcome-screen .hero {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 2vh 4vw 4vh;
    text-align: center;
  }
  .welcome-screen .hero-copy {
    width: min(92vw, 680px);
    padding: clamp(16px, 3vw, 28px);
    background: rgba(5, 7, 6, .52);
  }
  .hero-copy p { margin-inline: auto; }
  .bottle-stage { width: min(80vw, 620px); justify-self: center; }
  .ingredient-grid { gap: 5px; padding-inline: 0; }
  .ingredient-card { grid-template-columns: 1fr; grid-template-rows: 58% 1fr; }
  .ingredient-label { padding: 3px 5px 0; }
  .ingredient-label small { display: none; }
  .choice-grid.moments { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); }
  .choice-grid.moments .choice-card:last-child { grid-column: 1 / -1; }
  .choice-card img { height: 48%; }
  .choice-grid.intensities { grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); padding-inline: 5vw; }
  .choice-grid.intensities .choice-card { display: grid; grid-template-columns: 38% 1fr; }
  .level-visual { height: 100%; }
  .level-ring { width: calc(45px + var(--level) * 20px); }
  .result-grid { grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); }
  .product-card { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr; }
  .product-open { grid-template-columns: 35% 1fr; grid-template-rows: 1fr; }
  .cart-add { min-width: clamp(90px, 18vw, 150px); align-self: center; margin: 10px; padding-inline: 12px; }
  .product-info { display: flex; flex-direction: column; justify-content: center; padding: 12px; }
  .detail-layout { grid-template-columns: 1fr; grid-template-rows: 48% 1fr; padding: 1vh 5vw 3vh; text-align: center; }
  .detail-image { width: min(74vw, 580px); justify-self: center; }
  .detail-pairs { justify-content: center; }
  .detail-actions { justify-content: center; }
  .detail-copy > p:not(.eyebrow) { margin-inline: auto; }
}

@media (max-height: 560px) {
  .content-head { padding-bottom: .8vh; }
  .section-title { font-size: clamp(23px, 3.4vw, 42px); }
  .section-subtitle { margin-top: 4px; }
  .bottom-bar { height: 52px; }
}
