/* =========================================================
   Boulimiracle — design tokens
   ========================================================= */
:root {
  --cream:        #F7F3EC;
  --cream-deep:    #EFE9DC;
  --sage:          #7A8A6E;
  --sage-dark:     #4A5A42;
  --sage-pale:     #DCE3D5;
  --terracotta:    #C97C5D;
  --terracotta-dk: #A85F42;
  --ink:           #2B2A28;
  --ink-soft:      #6B6862;

  --font-display: 'Lora', Georgia, serif;
  --font-body: 'Poppins', -apple-system, sans-serif;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;

  --shadow-card: 0 8px 24px rgba(43, 42, 40, 0.10);
  --shadow-card-lg: 0 16px 40px rgba(43, 42, 40, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a { color: inherit; }

em {
  font-family: var(--font-display);
  font-style: italic;
}

::selection { background: var(--sage-pale); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================
   App shell
   ========================================================= */
#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  padding: 18px 24px 10px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.topbar__logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: block;
}
.topbar__mark {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--sage-dark);
  text-transform: uppercase;
}

#views {
  flex: 1;
  padding: 8px 20px 150px;
}

.view { animation: fadeIn 0.35s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Home
   ========================================================= */
.home-hero {
  padding: 28px 4px 30px;
  text-align: center;
}
.home-hero__eyebrow {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.home-hero__title {
  margin: 2px 0 14px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 34px;
  color: var(--sage-dark);
}
.home-hero__sub {
  margin: 0 auto;
  max-width: 320px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.home-card {
  border-radius: var(--radius-l);
  padding: 22px 18px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-align: left;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.home-card:active { transform: scale(0.97); }

.home-card__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 4px;
}
.home-card__hint {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.4;
}

.home-card--oracle {
  background: linear-gradient(155deg, var(--sage-dark), var(--sage));
  color: var(--cream);
  grid-column: span 2;
  min-height: 130px;
}
.home-card--oracle::after {
  content: "✦";
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 22px;
  opacity: 0.5;
}
.home-card--qa {
  background: var(--cream-deep);
  color: var(--ink);
  border: 1px solid rgba(74,90,66,0.12);
}
.home-card--test {
  background: var(--terracotta);
  color: var(--cream);
}
.home-card--kit {
  border: 1.5px solid rgba(74,90,66,0.18);
  background: var(--cream-deep);
  color: var(--ink);
}
.home-card--sumher {
  border: 1.5px solid rgba(74,90,66,0.18);
  background: var(--cream-deep);
  color: var(--ink);
}

/* =========================================================
   View header (shared)
   ========================================================= */
.view-header {
  padding: 18px 2px 16px;
}
.view-header__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 23px;
  color: var(--sage-dark);
}
.view-header__sub {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--sage-dark);
  color: var(--cream);
  font-size: 15px;
  font-weight: 500;
  padding: 14px 28px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease;
  width: 100%;
}
.btn-primary:active { transform: scale(0.97); }

/* =========================================================
   Oracle — tabs
   ========================================================= */
.oracle-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.oracle-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--cream-deep);
  transition: background 0.2s ease, color 0.2s ease;
}
.oracle-tab.is-active {
  background: var(--sage-dark);
  color: var(--cream);
}

.oracle-order-link {
  display: block;
  text-align: center;
  margin: 0 0 22px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1.5px dashed rgba(74,90,66,0.35);
  color: var(--sage-dark);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s ease;
}
.oracle-order-link:active { background: var(--cream-deep); }

/* Draw mode */
.draw-stage {
  display: flex;
  justify-content: center;
  padding: 20px 0 26px;
  perspective: 1200px;
}

.draw-card {
  width: 190px;
  height: 286px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.15, 0.2, 1);
}
.draw-card.is-flipped { transform: rotateY(180deg); }
.draw-card.is-shaking { animation: shake 0.5s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-3deg); }
  40% { transform: rotate(3deg); }
  60% { transform: rotate(-2deg); }
  80% { transform: rotate(2deg); }
}

.draw-card__back, .draw-card__front {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-m);
  backface-visibility: hidden;
  box-shadow: var(--shadow-card-lg);
  overflow: hidden;
}

.draw-card__back {
  background: linear-gradient(160deg, var(--sage-dark) 0%, #34412E 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.draw-card__back-ring {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 1.5px solid rgba(247,243,236,0.4);
  margin-bottom: 14px;
  position: relative;
}
.draw-card__back-ring::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px solid rgba(247,243,236,0.25);
}
.draw-card__back-label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: rgba(247,243,236,0.75);
  text-transform: uppercase;
}

.draw-card__front {
  transform: rotateY(180deg);
  background: var(--cream-deep);
}
.draw-card__front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-detail {
  margin-top: 22px;
  animation: fadeIn 0.4s ease;
}
.card-detail__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 21px;
  color: var(--sage-dark);
  margin: 0 0 14px;
  text-align: center;
}
.card-detail__section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terracotta-dk);
  font-weight: 600;
  margin: 18px 0 6px;
}
.card-detail__text {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-line;
}
.card-detail__text:first-of-type { margin-top: 0; }

/* Browse mode */
.oracle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.oracle-grid__item {
  border-radius: var(--radius-s);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  aspect-ratio: 422 / 634;
  position: relative;
  transition: transform 0.15s ease;
}
.oracle-grid__item:active { transform: scale(0.95); }
.oracle-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.oracle-grid__item span {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 6px 6px 5px;
  font-size: 9.5px;
  line-height: 1.25;
  color: var(--cream);
  background: linear-gradient(to top, rgba(43,42,40,0.75), transparent);
}

/* =========================================================
   Q&A
   ========================================================= */
.qa-search {
  margin-bottom: 16px;
}
.qa-search input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 999px;
  border: 1px solid rgba(74,90,66,0.18);
  background: var(--cream-deep);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.qa-search input:focus {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
}
.qa-search input::placeholder { color: var(--ink-soft); }

.qa-list { display: flex; flex-direction: column; gap: 8px; }

.qa-item {
  background: var(--cream-deep);
  border-radius: var(--radius-m);
  overflow: hidden;
}
.qa-item__q {
  width: 100%;
  text-align: left;
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.qa-item__q-mark {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--terracotta);
  transition: transform 0.25s ease;
}
.qa-item.is-open .qa-item__q-mark { transform: rotate(45deg); }

.qa-item__a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 18px;
}
.qa-item.is-open .qa-item__a {
  max-height: 600px;
  padding: 0 18px 18px;
}
.qa-item__a p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.qa-item__listen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--terracotta-dk);
  text-decoration: none;
}

.qa-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

/* =========================================================
   Test / Kit
   ========================================================= */
.test-card {
  background: var(--cream-deep);
  border-radius: var(--radius-l);
  padding: 26px 22px;
  text-align: center;
}
.test-card__text {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 22px;
}

/* Sum Her Body */
.sumher-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sumher-item {
  background: var(--cream-deep);
  border-radius: var(--radius-m);
  padding: 16px 18px;
}
.sumher-item__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  color: var(--sage-dark);
  margin: 0 0 10px;
}
.sumher-item audio {
  width: 100%;
  height: 36px;
}
.sumher-item__pending {
  margin: 0;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
}
.sumher-item__summary {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre-line;
}
.sumher-item__summary strong.subhead {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--sage-dark);
  margin: 12px 0 4px;
  font-size: 13.5px;
}
.kit-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.kit-tabs::-webkit-scrollbar { display: none; }
.kit-tab {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--cream-deep);
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.kit-tab.is-active {
  background: var(--sage-dark);
  color: var(--cream);
}

.kit-intro {
  background: var(--cream-deep);
  border-radius: var(--radius-l);
  padding: 22px 20px;
  margin-bottom: 18px;
}
.kit-intro__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 19px;
  color: var(--sage-dark);
  margin: 0 0 10px;
}

.kit-section {
  margin-bottom: 22px;
}
.kit-section__heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--terracotta-dk);
  margin: 0 0 8px;
}
.kit-video {
  position: relative;
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-s);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.kit-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.kit-section__body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-line;
}
.kit-section__body strong.subhead {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--sage-dark);
  margin: 14px 0 4px;
  font-size: 14.5px;
}

/* =========================================================
   Bottom bar (CTA + nav)
   ========================================================= */
.bottombar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  z-index: 50;
  background: rgba(247, 243, 236, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(74,90,66,0.12);
}
.accompany-cta {
  display: block;
  text-align: center;
  margin: 10px 16px 0;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--terracotta);
  color: var(--cream);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.accompany-cta:active { transform: scale(0.98); }

.bottomnav {
  display: flex;
  justify-content: space-around;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.bottomnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  color: var(--ink-soft);
  transition: color 0.2s ease;
  flex: 1;
}
.bottomnav__item.is-active { color: var(--sage-dark); }
.bottomnav__icon { font-size: 17px; line-height: 1; }
.bottomnav__label { font-size: 10px; font-weight: 500; }

/* =========================================================
   Responsive
   ========================================================= */
@media (min-width: 420px) {
  .oracle-grid { grid-template-columns: repeat(4, 1fr); }
}
