#home-page .main-content > :not(.kouli-home-shell) {
  display: none !important;
}

/* Home is the default visible page in index.html. The legacy panda header
   (#app-header + mascot.png) is still in the DOM because main.js expects it,
   but it must not paint before kouli-home.js adds body.kouli-home-active.
   Match on the visible home page itself so the first frame is already dark. */
body:has(#home-page:not(.hidden)) #app-header {
  display: none;
}

html:has(#home-page:not(.hidden)),
body:has(#home-page:not(.hidden)) {
  background-color: #07070d;
}

html:has(body.kouli-home-active),
html:has(body.kouli-progress-active),
html:has(body.kouli-profile-active) {
  background-color: #07070d;
}

body.kouli-home-active {
  /* === TEAL BACKGROUND GLOW (original) — to revert, delete the grey/blue
     block below and uncomment this one. ===
  background:
    radial-gradient(circle at 50% 8%, rgba(0, 196, 160, 0.18), transparent 44%),
    radial-gradient(circle at 82% 36%, rgba(14, 165, 233, 0.10), transparent 34%),
    linear-gradient(180deg, #07070d 0%, #070d0c 44%, #040407 100%);
  */
  /* === GREY/BLUE BACKGROUND GLOW (trial) === */
  background:
    radial-gradient(circle at 50% 6%, rgba(122, 153, 171, 0.22), transparent 46%),
    radial-gradient(circle at 82% 34%, rgba(74, 93, 110, 0.16), transparent 36%),
    radial-gradient(circle at 14% 74%, rgba(74, 93, 110, 0.12), transparent 44%),
    linear-gradient(180deg, #07070d 0%, #08070f 50%, #040407 100%);
  background-color: #07070d;
  color: #fff;
  /* Clear fixed bottom nav + a little air under the last mode row. */
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
}

body.kouli-home-active #app-header {
  display: none;
}

body.kouli-home-active #home-page {
  padding: 0;
  min-height: 0;
  /* === TEAL CONTENT GLOW (original) — to revert, delete the grey/blue
     block below and uncomment this one. ===
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 14%),
    radial-gradient(circle at 50% 16%, rgba(0, 196, 160, 0.13), transparent 34%);
  */
  /* === GREY/BLUE CONTENT GLOW (trial) === */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 14%),
    radial-gradient(circle at 50% 16%, rgba(122, 153, 171, 0.16), transparent 34%);
}

body.kouli-home-active #home-page .main-content {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  /* Beat index.html `.main-content { padding: 1rem !important }` on mobile.
     Floor keeps KoLi + avatar clear of the status bar even if safe-area is 0. */
  padding:
    max(59px, calc(env(safe-area-inset-top, 0px) + 14px))
    18px
    24px !important;
}

.kouli-home-shell {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #fff;
}

.kouli-home-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 72%);
}

.kouli-home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.kouli-home-wordmark {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 0 22px rgba(0, 196, 160, 0.20);
  padding: 6px 0;
}

.kouli-home-avatar {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.kouli-home-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: none;
}

.kouli-home-avatar-img.is-visible {
  display: block;
}

.kouli-home-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.kouli-home-avatar.is-image {
  border-color: rgba(255, 255, 255, 0.32);
}

.kouli-home-avatar.is-image .kouli-home-avatar-initials {
  display: none;
}

.kouli-home-mist-button {
  position: relative;
  width: 100%;
  height: clamp(300px, 50vh, 440px);
  margin: 2px auto -6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  flex: 0 0 auto;
}

.kouli-home-mist-button:focus-visible {
  outline: 3px solid rgba(0, 196, 160, 0.85);
  outline-offset: 4px;
  border-radius: 20px;
}

.kouli-home-mist-button .kouli-home-mist-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: none;
  pointer-events: none;
}

/* Keep the idle aurora running. WebKit can leave columns frozen after the
   home page was display:none or restored from bfcache — JS restarts via
   .is-mist-restarting, and these rules re-assert play-state when home is live. */
body.kouli-home-active .kouli-home-mist-stage .kouli-mist-col {
  animation-name: kouli-mist-col-rise;
  animation-duration: 2.6s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-play-state: running;
}

body.kouli-home-active .kouli-home-mist-stage.is-mist-restarting .kouli-mist-col {
  animation: none !important;
}

.kouli-home-mist-button:hover .kouli-home-mist-stage {
  filter: saturate(1.14) brightness(1.04);
}

.kouli-home-mist-label {
  position: absolute;
  left: 50%;
  top: 51%;
  z-index: 2;
  transform: translate(-50%, -50%);
  padding: 12px 26px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(8, 8, 18, 0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  font-size: clamp(0.78rem, 3.2vw, 0.92rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.96);
  text-shadow:
    0 0 18px rgba(255, 255, 255, 0.45),
    0 0 42px rgba(0, 196, 160, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 6px 24px rgba(8, 8, 18, 0.32);
  pointer-events: none;
  white-space: nowrap;
}

.kouli-home-mist-button:hover .kouli-home-mist-label {
  background: rgba(8, 8, 18, 0.28);
  border-color: rgba(255, 255, 255, 0.85);
}

.kouli-home-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.kouli-home-copy {
  text-align: left;
}

.kouli-home-title {
  margin: 0;
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 1.04;
  letter-spacing: -0.06em;
  font-weight: 850;
  color: rgba(255, 255, 255, 0.96);
}

.kouli-home-subtitle {
  margin: 10px 0 0;
  max-width: 34rem;
  font-size: 1rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.68);
}

.kouli-home-primary {
  width: 100%;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: #00C4A0;
  box-shadow:
    0 10px 28px rgba(0, 122, 100, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.kouli-home-primary:hover {
  transform: translateY(-1px);
  background: #00D4AD;
  box-shadow:
    0 12px 32px rgba(0, 122, 100, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.kouli-home-primary:active {
  transform: scale(0.985);
}

.kouli-home-primary svg,
.kouli-home-card svg,
.kouli-home-focus-edit svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.kouli-home-primary svg {
  color: #fff;
}

.kouli-home-focus {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.kouli-home-focus-row {
  min-height: 44px;
  padding: 0 12px 0 14px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.kouli-home-focus-label {
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.47);
}

.kouli-home-focus-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
}

.kouli-home-focus-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
}

.kouli-home-focus-text.is-empty {
  color: rgba(255, 255, 255, 0.46);
}

.kouli-home-focus-edit {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.kouli-home-focus-edit:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.kouli-home-focus-form {
  display: none;
  gap: 10px;
  padding: 0 12px 12px;
}

.kouli-home-focus.is-editing .kouli-home-focus-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.kouli-home-focus-form input {
  min-height: 44px;
  border: 1px solid rgba(0, 196, 160, 0.34);
  border-radius: 14px;
  background: rgba(4, 4, 10, 0.7);
  color: #fff;
  padding: 0 13px;
  font: inherit;
  outline: none;
}

.kouli-home-focus-form input:focus {
  border-color: rgba(128, 245, 226, 0.82);
  box-shadow: 0 0 0 4px rgba(0, 122, 100, 0.18);
}

.kouli-home-focus-save {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 15px;
  background: rgba(0, 122, 100, 0.95);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.kouli-home-section-label {
  margin: 3px 0 -4px;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.46);
}

.kouli-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kouli-home-card {
  position: relative;
  min-height: 82px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(8, 8, 18, 0.76);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.2s ease, background 0.2s ease;
}

.kouli-home-card:hover {
  transform: translateY(-2px);
  border-color: rgba(184, 205, 216, 0.34);
  background:
    linear-gradient(180deg, rgba(122, 153, 171, 0.14), rgba(255, 255, 255, 0.025)),
    rgba(8, 8, 18, 0.82);
}

.kouli-home-card:active {
  transform: scale(0.98);
}

.kouli-home-card svg {
  color: rgba(255, 255, 255, 0.72);
}

.kouli-home-card span {
  font-size: 0.93rem;
  font-weight: 760;
  letter-spacing: -0.01em;
}

/* Sprint Pass marker. Designed to whisper, not shout — sits as a
   sibling of the FOCUS / PRACTICE labels on the home screen.
   No fill, no glow, no chroma; just a hairline border + soft slate. */
.kouli-home-pass-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: transparent;
  font-size: 0.58rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Dark mode-card surface: hairline white at low opacity. */
.kouli-home-card .kouli-home-pass-badge {
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.52);
}

/* Legacy marker on the Pitch card. Same whisper register as the
   Sprint Pass badge (top-right, hairline border, no fill).
   Selector is scoped `.kouli-home-card .kouli-home-legacy-badge`
   so it beats `.kouli-home-card span` (which would otherwise drag
   the title's 0.93rem/760 weight onto this <span>). */
.kouli-home-card .kouli-home-legacy-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  display: inline-block;
  padding: 1px 4px;
  border-radius: 999px;
  background: transparent;
  font-size: 8px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.42);
}

/* If the card is pass-locked AND the user has no active pass, the
   Sprint Pass badge is occupying the top-right slot — hide Legacy
   to avoid a stacked pill. When the user has an active pass, the
   Sprint Pass badge is suppressed (see rule above), so Legacy
   re-emerges in the slot it would have always owned. */
.kouli-home-card.is-pass-locked .kouli-home-legacy-badge {
  display: none;
}
.kouli-home-shell.has-active-pass .kouli-home-card.is-pass-locked .kouli-home-legacy-badge {
  display: inline-block;
}

/* Primary Interview CTA — flat teal; pass badge stays quiet. */
.kouli-home-primary {
  position: relative;
}
.kouli-home-primary .kouli-home-pass-badge {
  border: 1px solid rgba(255, 255, 255, 0.26);
  color: rgba(255, 255, 255, 0.7);
}

.kouli-home-shell.has-active-pass .kouli-home-pass-badge {
  display: none;
}

/* 2026-06-02: Hide Sprint Pass badges until /api/check-pass has
   resolved (or its localStorage cache was read at page load). The
   shell receives .has-checked-pass via main.js syncHomePassVisuals()
   the moment we know the answer. Without this, paid users saw badges
   flash for ~1-2s on every load because the .has-active-pass class
   was only flipped on a later /api/coach/memory response. */
.kouli-home-shell:not(.has-checked-pass) .kouli-home-pass-badge {
  display: none;
}

@media (min-width: 760px) {
  body.kouli-home-active #home-page .main-content {
    padding-top: max(32px, calc(env(safe-area-inset-top, 0px) + 16px)) !important;
  }

  .kouli-home-shell {
    justify-content: flex-start;
  }

  .kouli-home-mist-button {
    height: clamp(340px, 48vh, 460px);
  }
}

@media (max-width: 380px) {
  .kouli-home-shell {
    gap: 12px;
  }

  .kouli-home-mist-button {
    height: clamp(260px, 46vh, 340px);
  }

  .kouli-home-mist-label {
    padding: 10px 22px;
    letter-spacing: 0.18em;
  }

  .kouli-home-title {
    font-size: 1.8rem;
  }

  .kouli-home-grid {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kouli-home-mist-button .kouli-mist-col,
  body.kouli-home-active .kouli-home-mist-stage .kouli-mist-col {
    animation: none !important;
  }

  .kouli-home-primary,
  .kouli-home-card {
    transition: none !important;
  }
}

@media (min-width: 1024px) {
  body.kouli-home-active #home-page .main-content {
    max-width: 1180px;
    padding: max(52px, calc(env(safe-area-inset-top, 0px) + 16px)) 28px 40px !important;
  }

  .kouli-home-shell {
    display: grid;
    grid-template-columns: minmax(380px, 520px) minmax(420px, 1fr);
    grid-template-areas:
      "top top"
      "mist intro"
      "grid grid";
    gap: 22px 28px;
    align-items: center;
  }

  .kouli-home-topbar { grid-area: top; }
  .kouli-home-mist-button {
    grid-area: mist;
    width: min(100%, 520px);
    height: clamp(340px, 52vh, 500px);
    margin: 0;
  }
  .kouli-home-intro {
    grid-area: intro;
    align-self: center;
    max-width: 42rem;
    gap: 16px;
  }
  .kouli-home-grid {
    grid-area: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .kouli-home-title {
    font-size: clamp(2.2rem, 3.2vw, 3.3rem);
  }

  .kouli-home-subtitle {
    font-size: 1.04rem;
    max-width: 44rem;
  }

  .kouli-home-card {
    min-height: 94px;
    padding: 15px;
  }

  .kouli-home-mist-label {
    font-size: 0.88rem;
    padding: 13px 28px;
  }
}
