/* Keep off-canvas navigation drawers from expanding the document width. */
html { overflow-x: clip; }
@supports not (overflow-x: clip) {
  html { overflow-x: hidden; }
}

/* The consent UI is injected after the stylesheets; keep its outer box and
   its content inside the viewport even on pages with different box models. */
body .nepsis-consent-panel {
  box-sizing: border-box;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
}
@media (max-width: 520px) {
  html body .nepsis-consent-panel,
  body .nepsis-consent-panel {
    left: max(12px, env(safe-area-inset-left, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    transform: none;
  }
}

/* Diary / library / reset keep a single header row on phones.
   Back links hide on narrow widths (nav is in the menu); compact sizing
   lives in nav-polish.css so every page shares one ~56px bar. */

.nepsis-dialog {
  width: min(92vw, 28rem);
  max-width: 28rem;
  padding: 1.5rem;
  color: var(--np-text, #27221f);
  background: var(--np-surface-raised, #fff);
  border: 1px solid var(--np-border, rgba(53, 43, 37, .12));
  border-radius: 1rem;
  box-shadow: var(--np-modal-shadow, 0 24px 70px -20px rgba(30, 25, 22, .28));
}
.nepsis-dialog::backdrop { background: var(--np-scrim, rgba(30, 25, 22, .44)); }
.nepsis-dialog h2 { margin: 0 0 1rem; font-size: 1.2rem; letter-spacing: -.025em; }
.nepsis-dialog input { box-sizing: border-box; width: 100%; min-height: 2.8rem; padding: .65rem .8rem; border: 1px solid var(--np-border, rgba(53, 43, 37, .12)); border-radius: .6rem; background: var(--np-surface-muted, #f4f2ee); color: var(--np-text, #27221f); font: inherit; }
.nepsis-dialog-actions { display: flex; justify-content: flex-end; gap: .65rem; margin-top: 1.1rem; }
.nepsis-dialog-actions button { min-height: 2.6rem; padding: .5rem .9rem; font: inherit; cursor: pointer; }
@media (max-width: 390px) { .nepsis-dialog { padding: 1.1rem; } .nepsis-dialog-actions button { flex: 1; } }
.nepsis-menu-button { position: relative; z-index: 1003; min-width: 2.7rem; min-height: 2.7rem; border: 1px solid var(--np-border, rgba(53, 43, 37, .12)); border-radius: 12px; color: var(--np-text, #27221f); background: var(--np-surface, #fff); font: inherit; cursor: pointer; }
.nepsis-site-drawer { position: fixed; z-index: 1002; inset: 0 0 0 auto; display: flex; flex-direction: column; gap: .2rem; width: min(88vw, 22rem); padding: 1.1rem 1.2rem 1.2rem; overflow-y: auto; background: var(--np-surface-raised, #fff); border-left: 1px solid var(--np-border, rgba(53, 43, 37, .12)); box-shadow: -1rem 0 3rem rgba(40, 28, 20, .14); transform: translateX(105%); transition: transform .24s ease; }
.nepsis-site-drawer.open { transform: translateX(0); }
.nepsis-site-drawer .nepsis-drawer-close {
  align-self: flex-end;
  width: 44px;
  height: 44px;
  margin: 0 0 .4rem;
  border: 1px solid var(--np-border, rgba(53, 43, 37, .12));
  border-radius: 12px;
  background: var(--np-surface, #fff);
  color: var(--np-text, #27221f);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.nepsis-site-drawer a { display: block; padding: .75rem .9rem; border-radius: .65rem; color: var(--np-text, #27221f); text-decoration: none; font-weight: 650; }
.nepsis-site-drawer a:hover, .nepsis-site-drawer a:focus-visible { background: var(--np-surface-muted, #f4f2ee); outline-color: var(--np-focus, #a9491c); }
.nepsis-menu-scrim { position: fixed; z-index: 1001; inset: 0; border: 0; background: var(--np-scrim, rgba(30, 25, 22, .44)); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility .2s ease; }
.nepsis-menu-scrim.open { opacity: 1; visibility: visible; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .nepsis-site-drawer, .nepsis-menu-scrim { transition: none; } }

/* The sticky header paints over the drawer's Close control. Keep that
   control below the header so it can be seen and clicked, without
   covering the menu button. */
#drawer .close {
  position: relative;
  top: auto;
  right: auto;
  align-self: flex-end;
  margin-top: 64px;
  z-index: 1;
}
/* The 404 page lifts the drawer over the header. Put the header bar
   back above that drawer, but let clicks pass through to Close, and
   keep the menu button itself clickable so it can toggle. */
body.missing-page:has(#drawer.open) header.top {
  z-index: 85;
  pointer-events: none;
}
body.missing-page:has(#drawer.open) #menuBtn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

/* Closed scrims leave the render and hit trees. .open keeps the painted look. */
.scrim:not(.open),
.acc-scrim:not(.open),
.nepsis-menu-scrim:not(.open) {
  display: none ;
  pointer-events: none ;
}
/* Modal panels fade and scale in and out (macOS window style). A closed panel
   stays in layout but is hidden with visibility, so the close animation can finish
   and the panel still leaves the hit and accessibility trees. */
body .sub-modal,
body .acc-modal,
body .account {
  transition: opacity .2s ease, visibility .2s ease;
}
body .sub-modal:not(.open),
body .acc-modal:not(.open),
body .account:not(.open) {
  visibility: hidden;
  opacity: 0;
  pointer-events: none ;
}
body .sub-modal.open,
body .acc-modal.open,
body .account.open {
  visibility: visible;
  opacity: 1;
}
body .sub-card,
body .acc-card,
body .account-card {
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
}
body .sub-modal:not(.open) :is(.sub-card),
body .acc-modal:not(.open) :is(.acc-card),
body .account:not(.open) :is(.account-card) {
  opacity: 0;
  transform: scale(.94) translateY(8px);
}
body .sub-modal.open :is(.sub-card),
body .acc-modal.open :is(.acc-card),
body .account.open :is(.account-card) {
  opacity: 1;
  transform: none;
}
/* Native dialogs (text prompts) scale in when they open. */
.nepsis-dialog[open] {
  animation: nepsis-dialog-in .22s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes nepsis-dialog-in {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  body .sub-modal, body .acc-modal, body .account,
  body .sub-card, body .acc-card, body .account-card { transition: none !important; }
  .nepsis-dialog[open] { animation: none; }
}
.sub-modal:not(.open) *,
.acc-modal:not(.open) *,
.account:not(.open) * {
  pointer-events: none ;
}
@starting-style {
  .scrim.open,
  .acc-scrim.open,
  .sub-modal.open,
  .acc-modal.open,
  .account.open,
  .nepsis-menu-scrim.open {
    opacity: 0;
  }
}

/* Simple brand mark: a flat orange dot, with Nepsis as separate text. */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo .dot,
body.home-page .logo .dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-block;
  border-radius: 50%;
  background: none;
  background-image: url("../brand/nepsis-mark.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  box-shadow: none;
}
.logo span:not(.dot) {
  color: inherit;
}

.hero-copy {
  container-type: inline-size;
}
body.home-page .hero h1 {
  max-width: 100%;
  font-size: clamp(1.85rem, 8.4cqi, 4.2rem);
  letter-spacing: -0.03em;
  word-spacing: 0.06em;
}
body.home-page .hero h1 .hero-kicker,
body.home-page .hero h1 em {
  display: block;
  font-size: inherit;
  letter-spacing: inherit;
  word-spacing: inherit;
}
body.home-page .hero h1 .hero-kicker {
  white-space: nowrap;
}
.hero-copy .knowledge-note {
  margin-top: 18px;
  margin-bottom: 0;
  max-width: 36rem;
  padding: 14px 16px 16px;
  overflow: visible;
}
.hero-copy .knowledge-note .eyebrow {
  margin-bottom: 6px;
}
.hero-copy .knowledge-note p {
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.hero-copy .knowledge-note p:last-child {
  margin-bottom: 0;
}
.whop-upsell {
  margin-top: 12px;
  padding: 12px 0 2px;
  border-top: 1px solid rgba(58, 36, 24, 0.08);
}
.whop-upsell a {
  display: block;
  font-size: 0.82rem;
  line-height: 1.5;
  font-weight: 700;
  color: var(--muted, #7A5F50);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.whop-upsell a:hover,
.whop-upsell a:focus-visible {
  color: var(--orange, #F0702A);
  text-decoration: underline;
}
.whop-upsell a:focus-visible {
  outline: 3px solid #F0702A55;
  outline-offset: 3px;
  border-radius: 6px;
}
.hero-copy .knowledge-note .whop-upsell {
  margin-top: 10px;
  margin-bottom: 0;
  padding: 10px 0 0;
}
.hero-copy .knowledge-note .whop-upsell a {
  font-size: 0.8rem;
  line-height: 1.55;
}

/* Visible practice timer: larger centered time, orange ring, active and complete states. */
.practice-page .stage {
  container-type: inline-size;
  transition: border-color .4s ease, box-shadow .4s ease;
}
.practice-page .ring {
  width: min(100%, 240px);
  height: auto;
  aspect-ratio: 1;
  margin: 12px auto 8px;
}
.practice-page .ring svg {
  width: 100%;
  height: 100%;
}
.practice-page .ring .track {
  stroke: var(--np-accent-soft, rgba(184, 82, 34, .18));
}
.practice-page .ring .prog {
  stroke: var(--np-accent, #b85222);
  transition: stroke-dashoffset .25s linear, stroke .4s ease;
}
.practice-page .ring .time {
  font-size: clamp(2.5rem, 28cqi, 3.6rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
  color: var(--np-text, #27221f);
}
.practice-page .stage.is-running {
  border-color: var(--np-accent, #b85222);
  box-shadow: 0 0 0 1px var(--np-accent-border, rgba(184, 82, 34, .38)), var(--np-shadow, 0 4px 24px -2px rgba(0, 0, 0, .09));
}
.practice-page .stage.is-running .time {
  color: var(--np-accent, #b85222);
}
.practice-page .stage.is-running .dot2 {
  background: var(--np-accent, #b85222);
  box-shadow: 0 0 0 6px var(--np-accent-soft, rgba(184, 82, 34, .1));
}
.practice-page .stage.is-complete .msg,
.practice-page .stage.is-complete .after {
  animation: nepsis-complete-in .85s ease;
}
@keyframes nepsis-complete-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .practice-page .stage.is-complete .msg,
  .practice-page .stage.is-complete .after {
    animation: none;
  }
}

/* Homepage: one clear Start button, without a stage row on the first screen. */
body.home-page .hero-copy .btns {
  margin-bottom: 0;
}
body.home-page .hero-copy .btn-primary {
  background: var(--np-accent, #b85222);
  border-color: var(--np-accent, #b85222);
  color: var(--np-on-accent, #fff);
  box-shadow: 0 5px 14px -6px var(--np-accent-border, rgba(184, 82, 34, .38));
}
body.home-page .hero-copy .knowledge-note {
  margin-top: 14px;
}


/* Thought parking: a small in-stage field, only while a timer is running. */
.practice-page .thought-park {
  display: none;
  margin: 10px 0 4px;
  text-align: left;
}
.practice-page .stage.is-running .thought-park {
  display: block;
}
.practice-page .thought-park-label {
  margin: 0 0 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #3A2418;
}
/* Stage cards are narrow, so the field takes the full width and the button sits below it. */
.practice-page .thought-park-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.practice-page .thought-park-input {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 2.6rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid #EADCCB;
  border-radius: 0.65rem;
  background: #FFFBF6;
  color: #3A2418;
  font: inherit;
  font-size: 16px;
}
.practice-page .thought-park-input:focus {
  outline: 2px solid rgba(240, 138, 36, 0.45);
  outline-offset: 1px;
  border-color: #F08A24;
}
.practice-page .thought-park-save {
  flex: 0 0 auto;
  width: 100%;
  white-space: normal;
}
.practice-page .thought-park-privacy {
  margin: 6px 0 0;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #7A6558;
}
.practice-page .thought-park-ok {
  min-height: 1.2em;
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: #3A2418;
}
.practice-page .thought-park-return {
  position: static;
  display: block;
  min-height: 0;
  margin: 6px 0 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #FFF8EE;
  border: 1px solid rgba(240, 138, 36, 0.25);
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.35;
  color: #3A2418;
}
.practice-page .thought-park-return:empty {
  display: none;
}
/* Kept notes: shown under the card when no timer is running. */
.practice-page .thought-park-review {
  margin: 10px 0 4px;
  text-align: left;
  font-size: 0.9rem;
  color: #3A2418;
}
.practice-page .stage.is-running .thought-park-review {
  display: none;
}
.practice-page .thought-park-review summary {
  cursor: pointer;
  min-height: 2.2rem;
  display: list-item;
  padding: 0.3rem 0;
}
.practice-page .thought-park-review .thought-park-privacy {
  margin: 4px 0 6px;
}
.practice-page .thought-park-list {
  margin: 6px 0 8px;
  padding-left: 1.1rem;
  max-height: 12rem;
  overflow-y: auto;
  overflow-wrap: anywhere;
}
.practice-page .thought-park-list li {
  margin: 0 0 6px;
  line-height: 1.35;
}
.practice-page .thought-park-when {
  color: #7A6558;
  font-size: 0.8rem;
}
@media (prefers-reduced-motion: reduce) {
  .practice-page .thought-park-ok { transition: none; }
}

/* Return-to-reading question after a note is kept */
.practice-page .thought-park-next { margin: 8px 0 0; }
.practice-page .thought-park-next[hidden] { display: none; }
.practice-page .thought-park-next-q {
  display: block; margin: 0 0 8px; font-size: 0.9rem; line-height: 1.4; font-weight: 700; color: #3A2418;
}
.practice-page .thought-park-anchor {
  margin: 6px 0 0; font-size: 0.88rem; line-height: 1.4; color: #B4612A; font-weight: 700; overflow-wrap: anywhere;
}
.practice-page .thought-park-anchor:empty { display: none; }
.practice-page .thought-park-next-item { display: block; color: #B4612A; font-size: 0.82rem; }
@media (min-width: 700px) {
  .practice-page .thought-park-input { font-size: 0.9rem; padding: 0.5rem 0.6rem; }
}
/* Practice page: opt-in completion notification under the stages */
.notify-row { text-align: center; margin: 18px 0 0; }
.notify-btn { font-size: 14px; padding: 10px 16px; }
.notify-btn:disabled { opacity: .6; cursor: not-allowed; }
.notify-blocked { margin: 10px auto 0; max-width: 32rem; font-size: .9rem; color: var(--muted); }
.notify-blocked[hidden] { display: none; }

/* Google OAuth: calm loading state on the sign-in button */
.nepsis-oauth-spinner {
  display: none;
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(58, 36, 24, .18);
  border-top-color: var(--orange, #B9552A);
  box-sizing: border-box;
}
button.is-oauth-loading,
.btn.is-oauth-loading {
  cursor: wait;
  opacity: .92;
  pointer-events: none;
}
button.is-oauth-loading .nepsis-oauth-spinner,
.btn.is-oauth-loading .nepsis-oauth-spinner {
  display: inline-block;
  animation: nepsis-oauth-spin .7s linear infinite;
}
button.is-oauth-loading > svg,
.btn.is-oauth-loading > svg {
  opacity: .35;
}
@media (prefers-reduced-motion: reduce) {
  button.is-oauth-loading .nepsis-oauth-spinner,
  .btn.is-oauth-loading .nepsis-oauth-spinner {
    animation: none;
    border-top-color: rgba(58, 36, 24, .18);
    background: var(--orange, #B9552A);
  }
}
@keyframes nepsis-oauth-spin {
  to { transform: rotate(360deg); }
}
/* Ambient focus sounds: inline header control (never a fixed overlay). */
.nepsis-ambient {
  position: relative;
  z-index: 40;
  left: auto;
  right: auto;
  bottom: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 0;
  font-family: inherit;
  pointer-events: none;
}
.nepsis-ambient > * { pointer-events: auto; }
.nepsis-ambient-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--np-border, rgba(53, 43, 37, .12));
  background: var(--np-surface-raised, #fff);
  color: var(--np-text, #27221f);
  box-shadow: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .18s ease, border-color .18s ease, color .18s ease, background .18s ease;
}
.nepsis-ambient-toggle:hover,
.nepsis-ambient-toggle:focus-visible {
  transform: translateY(-2px);
  border-color: var(--np-accent-border, rgba(184, 82, 34, .38));
  color: var(--np-accent, #b85222);
}
.nepsis-ambient-icon { width: 22px; height: 22px; display: block; }
.nepsis-ambient-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(240, 112, 42, 0.35);
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
}
.nepsis-ambient-toggle > svg,
.nepsis-ambient-toggle > .visually-hidden {
  pointer-events: none;
}
.nepsis-ambient.is-playing .nepsis-ambient-toggle {
  border-color: var(--orange, #F0702A);
  color: var(--orange, #F0702A);
}
.nepsis-ambient.is-playing .nepsis-ambient-pulse {
  animation: nepsis-ambient-pulse 1.8s ease-out infinite;
}
.nepsis-ambient-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 60;
  width: min(18.5rem, calc(100vw - 28px));
  padding: 14px 14px 12px;
  border-radius: 18px;
  border: 1px solid var(--np-border, rgba(53, 43, 37, .12));
  background: var(--np-surface-raised, #fff);
  color: var(--np-text, #27221f);
  box-shadow: var(--np-modal-shadow, 0 24px 70px -20px rgba(30, 25, 22, .28));
}
.nepsis-ambient-panel[hidden] { display: none; }
.nepsis-ambient-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.nepsis-ambient-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.nepsis-ambient-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border, #EEDCC8);
  background: transparent;
  color: var(--muted, #7A5F50);
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.nepsis-ambient-close:hover,
.nepsis-ambient-close:focus-visible {
  border-color: var(--orange, #F0702A);
  color: var(--ember, #D8392B);
}
.nepsis-ambient-hint {
  margin: 6px 0 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--muted, #7A5F50);
}
.nepsis-ambient-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.nepsis-ambient-pick {
  min-height: 2.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 12px;
  border: 1.5px solid var(--border, #EEDCC8);
  background: var(--np-surface, #fff);
  color: var(--np-text, #27221f);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, color .15s ease;
}
.nepsis-ambient-pick:hover,
.nepsis-ambient-pick:focus-visible {
  transform: translateY(-1px);
  border-color: var(--orange, #F0702A);
}
.nepsis-ambient-pick.active {
  background: var(--np-accent-soft, rgba(184, 82, 34, .1));
  border-color: var(--np-accent-border, rgba(184, 82, 34, .38));
  color: var(--np-text, #27221f);
}
.nepsis-ambient-vol {
  display: grid;
  gap: 6px;
  margin: 12px 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--muted, #7A5F50);
}
.nepsis-ambient-vol input[type="range"] {
  width: 100%;
  accent-color: var(--orange, #F0702A);
}
.nepsis-ambient-stop {
  width: 100%;
  min-height: 2.4rem;
  border-radius: 999px;
  border: 1.5px solid var(--border, #EEDCC8);
  background: var(--np-surface, #fff);
  color: var(--np-text, #27221f);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}
.nepsis-ambient-stop:hover:not(:disabled),
.nepsis-ambient-stop:focus-visible:not(:disabled) {
  border-color: var(--orange, #F0702A);
  color: var(--ember, #D8392B);
}
.nepsis-ambient-stop:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.nepsis-ambient .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes nepsis-ambient-pulse {
  0% { opacity: 0.7; transform: scale(0.94); }
  100% { opacity: 0; transform: scale(1.18); }
}
@media (prefers-reduced-motion: reduce) {
  .nepsis-ambient-toggle,
  .nepsis-ambient-pick { transition: none; }
  .nepsis-ambient.is-playing .nepsis-ambient-pulse { animation: none; opacity: 0.55; transform: none; }
}
/* Keep the toggle reachable in zen mode; collapse the open panel chrome. */
body.zen-active .nepsis-ambient-panel { display: none; }
body.zen-active .nepsis-ambient { z-index: 120; }
@media (max-width: 420px) {
  .nepsis-ambient-toggle { width: 36px; height: 36px; }
  .nepsis-ambient-icon { width: 16px; height: 16px; }
}
