:root {
  --reset-page: #f7f6f1;
  --reset-card: rgba(255, 255, 255, 0.88);
  --reset-card-solid: #ffffff;
  --reset-ink: #202022;
  --reset-muted: #68686f;
  --reset-line: rgba(38, 37, 55, 0.11);
  --reset-brand: #5b5bd6;
  --reset-brand-deep: #4141a8;
  --reset-brand-soft: #ececff;
  --reset-warm: #f5e6d8;
  --reset-danger: #a64160;
  --reset-shadow: 0 24px 70px rgba(46, 43, 91, 0.12);
}

[data-theme="dark"] {
  --reset-page: #0d0d16;
  --reset-card: rgba(24, 24, 38, 0.92);
  --reset-card-solid: #181826;
  --reset-ink: #f0f0f4;
  --reset-muted: #ababba;
  --reset-line: rgba(255, 255, 255, 0.11);
  --reset-brand: #a5a5ee;
  --reset-brand-deep: #c2c2f6;
  --reset-brand-soft: #252540;
  --reset-warm: #392d29;
  --reset-danger: #ff9db9;
  --reset-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

body.sera-reset-active {
  display: block;
  min-height: 100svh;
  height: auto;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 5%, rgba(142, 142, 218, 0.16), transparent 34rem),
    radial-gradient(circle at 90% 92%, rgba(226, 181, 146, 0.12), transparent 32rem),
    var(--reset-page);
  color: var(--reset-ink);
}

body.sera-reset-active header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-color: var(--reset-line);
  background: color-mix(in srgb, var(--reset-page) 88%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

body.sera-reset-active header .wrap {
  max-width: 1120px;
}

#resetApp {
  min-height: calc(100svh - 52px);
  padding: clamp(20px, 4vw, 52px) 18px calc(32px + env(safe-area-inset-bottom));
}

.reset-shell {
  width: min(100%, 1040px);
  margin: 0 auto;
}

.reset-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}

.reset-stage {
  min-width: 0;
}

.reset-card {
  border: 1px solid var(--reset-line);
  border-radius: 28px;
  background: var(--reset-card);
  box-shadow: var(--reset-shadow);
  padding: clamp(22px, 4.5vw, 44px);
}

.reset-eyebrow {
  margin: 0 0 8px;
  color: var(--reset-brand-deep);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.reset-card h1,
.reset-card h2 {
  margin: 0;
  font-family: var(--font-serif, Georgia, serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.035em;
}

.reset-card h1 {
  max-width: 17ch;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.04;
}

.reset-card h2 {
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  line-height: 1.12;
}

.reset-lead {
  max-width: 58ch;
  margin: 14px 0 0;
  color: var(--reset-muted);
  font-size: 1rem;
}

.reset-status {
  min-height: 1.45em;
  margin: 12px 0 0;
  color: var(--reset-muted);
  font-size: 0.875rem;
}

.reset-status.error {
  color: var(--reset-danger);
}

.intent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 26px 0;
}

.intent-choice,
.choice-button,
.mode-button,
.quiet-button,
.record-cancel,
.panel-close,
.text-link {
  font: inherit;
}

.intent-choice {
  min-height: 56px;
  padding: 12px 15px;
  border: 1px solid var(--reset-line);
  border-radius: 16px;
  background: var(--reset-card-solid);
  color: var(--reset-ink);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.intent-choice:last-child {
  grid-column: 1 / -1;
}

.intent-choice:hover,
.intent-choice[aria-checked="true"] {
  border-color: var(--reset-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--reset-brand) 18%, transparent);
}

.intent-choice[aria-checked="true"]::after {
  content: "Selected";
  float: right;
  color: var(--reset-brand-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}

.mode-label {
  margin-right: auto;
  color: var(--reset-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.mode-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--reset-line);
  border-radius: 999px;
  background: transparent;
  color: var(--reset-muted);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mode-button[aria-pressed="true"] {
  border-color: var(--reset-brand);
  background: var(--reset-brand-soft);
  color: var(--reset-brand-deep);
}

.capture-zone {
  display: grid;
  justify-items: center;
  gap: 13px;
  margin: 22px 0 16px;
}

.talk-button {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(152px, 30vw, 190px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.46), transparent 35%),
    linear-gradient(145deg, #8181e8, var(--reset-brand-deep));
  box-shadow:
    0 20px 46px rgba(91, 91, 214, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  color: #fff;
  font: 800 1.02rem/1.2 var(--font-sans, sans-serif);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.talk-button::before {
  content: "";
  position: absolute;
  inset: -9px;
  border: 1px solid color-mix(in srgb, var(--reset-brand) 35%, transparent);
  border-radius: inherit;
}

.talk-button[aria-pressed="true"] {
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.45), transparent 35%),
    linear-gradient(145deg, #c25478, #943b5a);
  box-shadow:
    0 20px 50px rgba(166, 65, 96, 0.34),
    0 0 0 12px rgba(166, 65, 96, 0.1);
}

.talk-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.52;
}

.capture-hint {
  max-width: 40ch;
  color: var(--reset-muted);
  font-size: 0.84rem;
  text-align: center;
}

.capture-zone .memory-truth {
  margin: 0;
}

.record-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.record-timer {
  min-width: 4.3em;
  color: var(--reset-danger);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.record-cancel,
.quiet-button,
.panel-close,
.text-link {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--reset-line);
  border-radius: 999px;
  background: transparent;
  color: var(--reset-brand-deep);
  font-weight: 750;
  cursor: pointer;
}

.text-link {
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.typed-box,
.edit-box {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  resize: vertical;
  border: 1.5px solid var(--reset-line);
  border-radius: 17px;
  background: var(--reset-card-solid);
  color: var(--reset-ink);
  font: 1rem/1.5 var(--font-sans, sans-serif);
}

.typed-box:focus,
.edit-box:focus,
.intent-choice:focus-visible,
.choice-button:focus-visible,
.talk-button:focus-visible,
.mode-button:focus-visible,
.example-button:focus-visible,
.quiet-button:focus-visible,
.record-cancel:focus-visible,
.panel-close:focus-visible,
.text-link:focus-visible,
.compact-consent input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--reset-brand) 42%, transparent);
  outline-offset: 2px;
}

.form-actions,
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.choice-grid.vertical {
  flex-direction: column;
}

.choice-button {
  flex: 1 1 150px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--reset-brand);
  border-radius: 999px;
  background: transparent;
  color: var(--reset-brand-deep);
  font-weight: 750;
  cursor: pointer;
}

.choice-button.primary {
  background: var(--reset-brand);
  color: var(--brand-ink, #fff);
}

.choice-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.input-examples {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--reset-line);
}

.input-examples h2 {
  font: 800 0.79rem/1.3 var(--font-sans, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-examples ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 13px 0;
  padding: 0;
  list-style: none;
}

.input-examples li {
  min-width: 0;
}

.example-button {
  width: 100%;
  min-width: 44px;
  min-height: 44px;
  height: 100%;
  padding: 10px 13px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: color-mix(in srgb, var(--reset-brand-soft) 70%, transparent);
  color: var(--reset-muted);
  font: 0.9rem/1.5 var(--font-sans, sans-serif);
  text-align: left;
  cursor: pointer;
}

.example-button:hover {
  border-color: var(--reset-brand);
  color: var(--reset-ink);
}

.example-note,
.memory-truth {
  margin: 10px 0 0;
  color: var(--reset-muted);
  font-size: 0.84rem;
}

.memory-truth {
  text-align: center;
}

.compact-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  margin: 10px 0 0;
  color: var(--reset-muted);
  font-size: 0.74rem;
  line-height: 1.45;
  cursor: pointer;
}

.compact-consent input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--reset-brand);
  flex: none;
}

.compact-consent a {
  color: var(--reset-brand-deep);
  text-underline-offset: 2px;
}

.side-stack {
  display: grid;
  gap: 12px;
}

.side-card {
  padding: 16px;
  border: 1px solid var(--reset-line);
  border-radius: 18px;
  background: var(--reset-card);
}

.side-card .label {
  margin: 0 0 5px;
  color: var(--reset-brand-deep);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-card h2 {
  margin: 0;
  font-size: 0.98rem;
}

.side-card p {
  margin: 6px 0 10px;
  color: var(--reset-muted);
  font-size: 0.82rem;
}

.side-card button {
  width: 100%;
  margin: 0;
}

.account-tools {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.account-tools button {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--reset-muted);
  font: 700 0.82rem/1.25 var(--font-sans, sans-serif);
  text-align: left;
  cursor: pointer;
}

.account-tools button:hover {
  background: var(--reset-brand-soft);
  color: var(--reset-brand-deep);
}

.progress-line {
  height: 4px;
  margin: 0 0 24px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--reset-line);
}

.progress-line span {
  display: block;
  width: var(--reset-progress, 10%);
  height: 100%;
  border-radius: inherit;
  background: var(--reset-brand);
  transition: width 180ms ease;
}

.stage-quote,
.intervention-card,
.takeaway-card,
.memory-proposal {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--reset-line);
  border-radius: 18px;
  background: var(--reset-card-solid);
}

.stage-quote {
  border-left: 4px solid var(--reset-brand);
  font: 400 clamp(1.05rem, 2.6vw, 1.28rem)/1.5 var(--font-serif, Georgia, serif);
}

.stage-caption {
  margin: 20px 0 8px;
  color: var(--reset-muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.intervention-card {
  background: color-mix(in srgb, var(--reset-brand-soft) 66%, var(--reset-card-solid));
}

.intervention-card .version,
.memory-meta {
  margin: 0 0 8px;
  color: var(--reset-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.intervention-card p,
.takeaway-card p,
.memory-proposal p {
  margin: 0;
  white-space: pre-wrap;
}

.reset-countdown {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin: 18px auto 4px;
  border: 4px solid var(--reset-brand);
  border-radius: 50%;
  color: var(--reset-brand-deep);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.takeaway-card {
  border-color: color-mix(in srgb, var(--reset-brand) 36%, var(--reset-line));
}

.takeaway-card h3,
.memory-proposal h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-value {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--reset-line);
}

.post-value p {
  color: var(--reset-muted);
  font-size: 0.88rem;
}

.done-mark {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--reset-brand-soft);
  color: var(--reset-brand-deep);
  font-size: 1.8rem;
  font-weight: 800;
}

.reset-panel {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  padding: 22px 16px;
  background: color-mix(in srgb, var(--reset-page) 90%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.reset-panel-card {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--reset-line);
  border-radius: 24px;
  background: var(--reset-card-solid);
  box-shadow: var(--reset-shadow);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-head > div {
  flex: 1;
}

.panel-head h2 {
  margin: 0;
  font: italic 400 clamp(1.55rem, 4vw, 2.25rem)/1.1 var(--font-serif, Georgia, serif);
}

.panel-head p {
  margin: 7px 0 0;
  color: var(--reset-muted);
  font-size: 0.9rem;
}

.brain-section {
  margin: 18px 0;
}

.brain-section h3 {
  margin: 0 0 8px;
  font-size: 0.83rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brain-item,
.thread-item,
.review-item {
  margin: 8px 0;
  padding: 14px;
  border: 1px solid var(--reset-line);
  border-radius: 14px;
  background: var(--reset-card);
}

.brain-item p,
.thread-item p,
.review-item p {
  margin: 0;
}

.brain-item small,
.thread-item small,
.review-item small {
  display: block;
  margin-top: 6px;
  color: var(--reset-muted);
}

.item-sources {
  margin-top: 10px;
  color: var(--reset-muted);
  font-size: 0.78rem;
}

.item-sources summary {
  color: var(--reset-brand-deep);
  font-weight: 750;
  cursor: pointer;
}

.item-sources p {
  margin: 7px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--reset-line);
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.item-actions button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--reset-line);
  border-radius: 999px;
  background: transparent;
  color: var(--reset-brand-deep);
  font: 700 0.76rem/1 var(--font-sans, sans-serif);
  cursor: pointer;
}

.trial-timeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.trial-step {
  position: relative;
  min-width: 0;
  padding: 13px 10px;
  border-radius: 14px;
  background: var(--reset-brand-soft);
}

.trial-step b,
.trial-step span {
  display: block;
}

.trial-step b {
  font-size: 0.78rem;
}

.trial-step span {
  margin-top: 4px;
  color: var(--reset-muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.screen-reader-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 800px) {
  .reset-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-tools {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  #resetApp {
    padding: 14px 10px calc(24px + env(safe-area-inset-bottom));
  }

  .reset-card {
    padding: 22px 17px;
    border-radius: 22px;
  }

  .side-stack,
  .account-tools {
    grid-template-columns: 1fr;
  }

  .mode-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .mode-label {
    width: 100%;
  }

  .mode-button {
    flex: 1 1 auto;
  }

  .intent-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .intent-choice {
    min-height: 58px;
    padding: 8px 6px;
    font-size: 0.78rem;
    text-align: center;
  }

  .intent-choice:last-child {
    grid-column: auto;
  }

  .choice-grid {
    flex-direction: column;
  }

  .choice-button {
    flex-basis: auto;
    width: 100%;
  }

  .trial-timeline {
    grid-template-columns: 1fr;
  }

  .input-examples ul {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .input-examples {
    margin-top: 20px;
    padding-top: 17px;
  }

  .example-button {
    padding: 8px;
    font-size: 0.73rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .talk-button {
    width: 138px;
  }

  .capture-zone {
    margin-block: 17px 12px;
  }

}

@media (min-width: 801px) {
  .reset-layout {
    grid-template-columns: minmax(0, 800px) minmax(220px, 1fr);
  }

  .reset-card {
    padding: 36px;
  }

  .intent-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-block: 20px;
  }

  .intent-choice {
    min-height: 62px;
    text-align: center;
  }

  .intent-choice:last-child {
    grid-column: auto;
  }

  .intent-choice[aria-checked="true"]::after {
    display: block;
    float: none;
    margin-top: 4px;
  }

  .talk-button {
    width: 166px;
  }

  .capture-zone {
    margin-block: 17px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .intent-choice,
  .progress-line span {
    transition: none;
  }

  .talk-button,
  .talk-button[aria-pressed="true"] {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--reset-brand) 24%, transparent);
  }
}
