/* ===========================================================
   The Thirty-Five — A Private Reckoning
   Editorial-dossier aesthetic. Restraint over flourish.
   =========================================================== */

@property --num {
  syntax: "<integer>";
  initial-value: 0;
  inherits: false;
}

:root {
  /* Surface — tinted warm, never pure black */
  --bg:        oklch(0.135 0.006 60);
  --bg-2:      oklch(0.165 0.008 60);
  --surface:   oklch(0.195 0.010 60);
  --surface-2: oklch(0.235 0.011 60);
  --line:      oklch(0.275 0.010 60);
  --line-2:    oklch(0.325 0.012 60);

  /* Type — warm cream */
  --text:    oklch(0.94 0.016 78);
  --muted:   oklch(0.62 0.013 70);
  --dim:     oklch(0.46 0.010 70);
  --faint:   oklch(0.35 0.009 70);

  /* Accents — used sparingly, single drops */
  --oxblood: oklch(0.52 0.155 22);   /* behind pace, urgency */
  --brass:   oklch(0.78 0.115 78);   /* on pace */
  --moss:    oklch(0.70 0.110 145);  /* ahead */

  /* Type stacks */
  --serif:  "Bodoni Moda", "Times New Roman", Times, Georgia, serif;
  --sans:   "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono:   "Fragment Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Motion */
  --ease-out-q: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out-q: cubic-bezier(0.65, 0, 0.35, 1);

  /* Space scale (4pt-based, semantic) */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  40px;
  --sp-2xl: 64px;
  --sp-3xl: 96px;
}

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

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
*::selection { background: var(--text); color: var(--bg); }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 400;
  font-feature-settings: "ss01", "cv11";
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  line-height: 1.5;
  letter-spacing: 0;
  /* gentle warmth seeping in from top — not a "tech glow" */
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -10%, oklch(0.20 0.012 60), transparent 70%),
    radial-gradient(ellipse 70% 50% at 100% 110%, oklch(0.17 0.020 30 / 0.45), transparent 60%);
  background-attachment: fixed;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; background: none; border: 0; outline: none; }

/* ============= TIME RULE ================ */
.time-rule {
  position: sticky;
  top: 0;
  height: 2px;
  background: var(--line);
  z-index: 50;
}
.time-rule-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  background: var(--text);
  transition: width 2s var(--ease-out-q);
}
.time-rule-ticks {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(35, 1fr);
  pointer-events: none;
}
.time-tick {
  border-left: 1px solid var(--bg);
}
.time-tick:first-child { border-left: 0; }

/* ============= TOP BAR ================== */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  animation: fadeDown 1.2s var(--ease-out-q) both;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--serif);
}
.brand-mark {
  font-size: 22px;
  color: var(--muted);
  transform: translateY(2px);
}
.brand-name {
  font-size: 17px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.005em;
}

.top-right {
  display: flex;
  align-items: center;
  gap: var(--sp-lg);
}

.day-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.day-pill .day-num { color: var(--text); font-size: 13px; }
.day-pill .day-total { color: var(--text); font-size: 13px; }

.ghost {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px;
  transition: color 0.4s var(--ease-out-q);
}
.ghost:hover { color: var(--text); }

/* ================ HERO ================== */
.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  align-items: end;
  gap: clamp(32px, 6vw, 96px);
  padding: clamp(56px, 9vw, 128px) clamp(20px, 4vw, 56px) clamp(40px, 6vw, 88px);
  animation: fadeUp 1.4s 0.15s var(--ease-out-q) both;
}

.overline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero-figure {
  display: flex;
  align-items: baseline;
  gap: 14px;
  position: relative;
}

.hero-number {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(112px, 22vw, 296px);
  line-height: 0.78;
  letter-spacing: -0.05em;
  font-variant-numeric: lining-nums tabular-nums;
  display: inline-block;
  position: relative;
}

.hero-suffix {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(20px, 2.4vw, 40px);
  color: var(--muted);
  letter-spacing: -0.01em;
}

.hero-date {
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-bottom: 8px;
}

.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
  margin-top: 10px;
  display: flex;
  align-items: baseline;
}
.stat-pct {
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  color: var(--muted);
  margin-left: 4px;
}

.stat-bar {
  margin-top: 14px;
  height: 1px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.stat-bar-fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: var(--text);
  transition: right 1.4s 0.3s var(--ease-out-q);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.stat-mini-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 8px;
  line-height: 1;
}
.muted-slash {
  color: var(--dim);
  font-weight: 400;
  font-size: 22px;
  font-style: normal;
  font-family: var(--sans);
  font-weight: 200;
  margin-left: 2px;
}

/* ============ SECTION HEAD ============== */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: clamp(40px, 6vw, 88px) clamp(20px, 4vw, 56px) clamp(20px, 3vw, 32px);
}
.section-head-tight {
  padding-top: clamp(48px, 5vw, 72px);
}
.section-head h2 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.section-head .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* =============== GOALS ================== */
.goals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 clamp(20px, 4vw, 56px);
}
@media (min-width: 760px) {
  .goals { grid-template-columns: 1fr 1fr; }
  .goals .goal:last-child { grid-column: 1 / -1; }
}

.goal {
  background: var(--bg);
  padding: clamp(28px, 3.5vw, 44px) clamp(28px, 3.5vw, 44px) clamp(24px, 3vw, 36px);
  cursor: pointer;
  position: relative;
  transition: background 0.7s var(--ease-out-q);
  display: flex;
  flex-direction: column;
  gap: 28px;
  animation: goalReveal 0.9s var(--ease-out-q) both;
  animation-delay: calc(var(--i, 0) * 60ms + 250ms);
}
.goal:hover {
  background: var(--bg-2);
}

.goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.goal-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1;
  letter-spacing: -0.012em;
}
.goal-numeral {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--dim);
  text-transform: uppercase;
  font-variant: small-caps;
  white-space: nowrap;
  padding-top: 4px;
}

.goal-figure {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.goal-current {
  font-family: var(--serif);
  font-size: clamp(64px, 7vw, 96px);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: -0.035em;
  display: inline-block;
  font-variant-numeric: lining-nums tabular-nums;
}
.goal-target {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 15px;
  color: var(--muted);
  letter-spacing: -0.005em;
}
.goal-target em {
  font-family: var(--mono);
  font-style: normal;
  color: var(--text);
  font-size: 13px;
  font-feature-settings: "tnum";
}

.goal-bar {
  position: relative;
  height: 1px;
  background: var(--line-2);
  overflow: visible;
}
.goal-bar-fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: var(--text);
  transition: right 1.4s var(--ease-out-q);
}
.goal-bar-mark {
  /* The "required-pace" indicator — where you should be by today */
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--brass);
  left: 0;
  transition: left 1.2s var(--ease-out-q);
  opacity: 0.55;
}

.goal-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.goal-pct {
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.goal-pct .pct-num {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-style: normal;
  text-transform: none;
}
.goal-pct .pct-sym {
  color: var(--muted);
  font-size: 11px;
}

.goal-pace {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.goal-pace::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  transform: translateY(-1px);
}
.goal-pace.behind { color: var(--oxblood); }
.goal-pace.behind::before { animation: pulse 1.6s var(--ease-in-out-q) infinite; }
.goal-pace.on      { color: var(--brass); }
.goal-pace.ahead   { color: var(--moss); }
.goal-pace.done    { color: var(--moss); }

.goal-daily {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* completed treatment */
.goal.done .goal-current { color: var(--moss); }
.goal.done .goal-bar-fill { background: var(--moss); }

/* =============== LEDGER ================= */
.ledger {
  margin: 0 clamp(20px, 4vw, 56px);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.ledger-empty {
  padding: 48px 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--dim);
  font-size: 16px;
  text-align: left;
}
.ledger-entry {
  display: grid;
  grid-template-columns: 80px 1.4fr 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  animation: entryEnter 0.7s var(--ease-out-q) both;
}
.ledger-entry:last-child { border-bottom: 0; }

.ledger-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.ledger-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.ledger-amt {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.ledger-amt .ledger-unit {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: -0.005em;
}
.ledger-undo {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-q);
}
.ledger-entry:hover .ledger-undo { opacity: 1; }
.ledger-undo:hover { color: var(--oxblood); }

/* ================ FOOTER ================ */
.foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(48px, 6vw, 96px) clamp(20px, 4vw, 56px) clamp(48px, 6vw, 80px);
  margin-top: clamp(48px, 6vw, 96px);
  border-top: 1px solid var(--line);
}
.foot-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--muted);
}
.foot-left em { font-style: italic; color: var(--text); }
.foot-mark { color: var(--dim); }
.foot-right {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ================ DIALOG ================ */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.08 0.005 60 / 0.78);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-out-q);
  display: grid;
  place-items: center;
  padding: 24px;
}
.dialog-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.dialog {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  width: min(560px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 40px 40px 32px;
  position: relative;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: transform 0.6s var(--ease-out-q), opacity 0.5s var(--ease-out-q);
}
.dialog-backdrop.open .dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: color 0.3s var(--ease-out-q);
}
.dialog-close:hover { color: var(--text); }

.dialog-overline {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.dialog-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 36px;
  letter-spacing: -0.015em;
  margin-bottom: 28px;
  line-height: 1;
}

.dialog-current {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.dialog-stat-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.dialog-stat-value {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  line-height: 1;
}
.dialog-quota { color: var(--brass); }
.dialog-unit {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 300;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: -0.005em;
}

.dialog-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.dialog-quick button {
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: all 0.3s var(--ease-out-q);
}
.dialog-quick button:hover {
  color: var(--text);
  border-color: var(--text);
}

.dialog-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
}
.dialog-form input {
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  font-family: var(--mono);
  font-size: 16px;
  color: var(--text);
  letter-spacing: 0.02em;
  transition: border-color 0.3s var(--ease-out-q);
}
.dialog-form input:focus { border-color: var(--text); }
.dialog-form input::placeholder { color: var(--dim); }

.dialog-submit {
  padding: 14px 22px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  transition: opacity 0.3s var(--ease-out-q);
}
.dialog-submit:hover { opacity: 0.86; }

.dialog-correct {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 0.3s var(--ease-out-q);
}
.dialog-correct:hover { color: var(--muted); }

.dialog-history {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: 0.04em;
  max-height: 120px;
  overflow-y: auto;
}
.dialog-history-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
}
.dialog-history-row span:first-child { color: var(--faint); }

.start .dialog-title { font-size: 28px; line-height: 1.1; }
.start-body {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
  max-width: 56ch;
}

/* ============ ANIMATIONS ================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes goalReveal {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes entryEnter {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: translateY(-1px) scale(1); }
  50%      { opacity: 0.4; transform: translateY(-1px) scale(1.6); }
}
@keyframes countUp {
  from { transform: translateY(0.6em); opacity: 0; filter: blur(4px); }
  to   { transform: translateY(0); opacity: 1; filter: blur(0); }
}
.count-pop {
  animation: countUp 0.7s var(--ease-out-q);
}

/* ============ RESPONSIVE ================ */
@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 56px;
    padding-top: 56px;
  }
  .hero-right { padding-bottom: 0; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .stat-mini-value { font-size: 22px; }
  .stat-value { font-size: 44px; }
  .ledger-entry {
    grid-template-columns: 70px 1fr auto;
  }
  .ledger-entry .ledger-name { grid-column: 2 / 3; }
  .ledger-entry .ledger-amt { grid-column: 3 / 4; }
  .ledger-undo { display: none; }
  .dialog-current { grid-template-columns: 1fr 1fr; }
  .dialog-current > div:nth-child(3) { grid-column: 1 / 3; }
  .dialog { padding: 32px 24px 24px; }
  .dialog-title { font-size: 28px; }
}

@media (max-width: 460px) {
  .top { padding: 16px 20px; }
  .day-pill { font-size: 10px; padding: 6px 12px; }
  .brand-name { font-size: 15px; }
  .ghost { padding: 6px 4px; }
  .top-right { gap: 12px; }
  .goal-current { font-size: 56px; }
  .ledger-entry { grid-template-columns: 60px 1fr auto; gap: 16px; }
  .ledger-name { font-size: 16px; }
  .ledger-amt { font-size: 18px; }
}

/* ============================================================
   SETUP WIZARD
   ============================================================ */
.setup-backdrop .dialog.setup {
  width: min(680px, 100%);
  padding: 44px 44px 36px;
}
.setup-intro {
  font-family: var(--serif);
  font-size: 16px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 32px;
  max-width: 58ch;
}
.setup-form {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.setup-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setup-section-row {
  flex-direction: row;
  gap: 24px;
  flex-wrap: wrap;
}
.setup-section-row .setup-cell {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setup-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.setup-label-major {
  font-size: 11px;
  color: var(--text);
}
.setup-help {
  font-family: var(--serif);
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 6px;
  max-width: 60ch;
}
.setup-help strong { font-style: normal; color: var(--text); font-weight: 500; }

.setup-input-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.setup-form input[type="number"],
.setup-form input[type="text"],
.setup-form input[type="date"],
.setup-form select {
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  padding: 11px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.3s var(--ease-out-q);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.setup-form input:focus,
.setup-form select:focus { border-color: var(--text); }
.setup-form input::placeholder { color: var(--dim); }
.setup-form select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.setup-suffix {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.setup-fronts {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.setup-front {
  background: var(--bg);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  align-items: center;
}
.setup-front-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--dim);
  letter-spacing: -0.01em;
  text-align: left;
  padding-top: 4px;
}
.setup-front-fields {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 0.9fr 0.7fr;
  gap: 10px;
  align-items: end;
}
.setup-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.setup-field > span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}
.setup-field input,
.setup-field select {
  font-size: 13px;
  padding: 9px 10px;
}

/* Passkey button */
.passkey-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.4s var(--ease-out-q);
  align-self: flex-start;
  position: relative;
}
.passkey-btn:hover:not(:disabled) {
  border-color: var(--text);
  background: var(--bg-2);
}
.passkey-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.passkey-btn.is-registered {
  border-color: var(--moss);
  color: var(--moss);
}
.passkey-btn.shake {
  animation: shake 0.4s var(--ease-out-q);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.passkey-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  transform: translateY(-1px);
}
.setup-passkey-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}
.setup-section-pass {
  padding: 24px 0 8px;
  border-top: 1px solid var(--line);
}

.setup-error {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--oxblood);
  min-height: 1em;
}
.setup-submit {
  margin-top: 8px;
  justify-self: stretch;
  width: 100%;
  padding: 16px 22px;
}

/* ============================================================
   RESTART DIALOG
   ============================================================ */
.dialog.restart {
  width: min(520px, 100%);
}
.restart-blocked-msg {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 12px;
}
.restart-blocked-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oxblood);
}
.restart-verify-hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
  max-width: 50ch;
}
.restart-verify-btn { padding: 14px 20px; }

/* When cycle is ready to restart, hint at it via the top-bar button */
.ghost.is-ready {
  color: var(--brass);
  position: relative;
}
.ghost.is-ready::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -2px;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 8px var(--brass);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.4; transform: translateY(-50%) scale(1.6); }
}

/* ============================================================
   RESPONSIVE — setup form
   ============================================================ */
@media (max-width: 720px) {
  .setup-backdrop .dialog.setup {
    padding: 32px 24px 28px;
  }
  .setup-front {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .setup-front-num {
    font-size: 22px;
  }
  .setup-front-fields {
    grid-template-columns: 1fr 1fr;
  }
  .setup-field-name { grid-column: 1 / -1; }
  .setup-field-dec { grid-column: 2; }
  .setup-section-row { flex-direction: column; gap: 16px; }
}

/* ============================================================
   ACCOUNT BUTTON + MENU (top-right, fixed across all designs)
   ============================================================ */
.account-btn {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 18, 14, 0.85);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  color: rgba(255,255,255,0.78);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  transition: all 0.5s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 10px 28px rgba(0,0,0,0.45), 0 1px 0 rgba(255,255,255,0.05) inset;
}
.account-btn:hover {
  color: rgba(255,255,255,0.98);
  border-color: rgba(255,255,255,0.22);
  background: rgba(34, 30, 24, 0.92);
  transform: scale(1.04);
}
.account-btn.is-open {
  color: rgba(255,255,255,0.98);
  background: rgba(34, 30, 24, 0.95);
  border-color: rgba(255,255,255,0.28);
}
.account-mark {
  display: inline-block;
  transform: translateY(-1px);
  font-style: normal;
  letter-spacing: 0.04em;
}

.account-menu {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 199;
  min-width: 280px;
  background: rgba(18, 16, 13, 0.94);
  border: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.04) inset;
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.4s cubic-bezier(.22,1,.36,1), transform 0.4s cubic-bezier(.22,1,.36,1);
}
.account-menu.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.account-menu-head {
  padding: 12px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 6px;
}
.account-menu-name {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  color: rgba(255,255,255,0.95);
  letter-spacing: -0.005em;
}
.account-menu-sub {
  font-family: "Fragment Mono", "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
}
.account-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.82);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.3s cubic-bezier(.22,1,.36,1), color 0.3s cubic-bezier(.22,1,.36,1);
}
.account-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.98);
}
.account-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.55);
}
.account-item:hover .account-item-icon { color: rgba(255,255,255,0.85); }
.account-item-label { font-weight: 400; }
.account-item-meta {
  font-family: "Fragment Mono", "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
}
.account-item-meta.is-ready {
  color: oklch(0.78 0.115 78);
  position: relative;
  padding-right: 14px;
}
.account-item-meta.is-ready::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: oklch(0.78 0.115 78);
  box-shadow: 0 0 8px oklch(0.78 0.115 78);
  animation: accountPulse 2s infinite;
}
@keyframes accountPulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50% { opacity: 0.4; transform: translateY(-50%) scale(1.5); }
}
.account-menu-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 6px 8px;
}
.account-item-danger { color: oklch(0.62 0.16 25); }
.account-item-danger .account-item-icon { color: oklch(0.62 0.16 25); }
.account-item-danger:hover {
  background: oklch(0.32 0.10 25 / 0.30);
  color: oklch(0.78 0.18 25);
}

/* Hide the old top-right Restart button if it still exists somewhere */
.top-right .ghost { display: none; }
/* Adjust top-right to make room for fixed avatar */
.top-right { padding-right: 56px; }

/* ============================================================
   ARCHIVES PANEL
   ============================================================ */
.dialog.archives {
  width: min(820px, 100%);
  padding: 36px 40px 32px;
  max-height: 88vh;
  overflow-y: auto;
}
.archives-intro {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
  max-width: 56ch;
}
.archives-empty {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  color: var(--dim);
  font-size: 16px;
  padding: 24px 0;
}
.archives-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.archive-card {
  background: var(--bg);
  padding: 22px 24px;
}
.archive-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 8px;
}
.archive-num {
  font-family: "Fragment Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.archive-dates {
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--dim);
  text-transform: uppercase;
}
.archive-overall {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
}
.archive-overall small {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  margin-left: 2px;
}
.archive-summary {
  display: flex;
  gap: 24px;
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.archive-stat em {
  font-style: normal;
  color: var(--text);
}
.archive-fronts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.archive-front {
  display: grid;
  grid-template-columns: 24px 1fr 1fr 60px;
  gap: 14px;
  align-items: baseline;
  padding: 4px 0;
}
.archive-front-num {
  font-family: "Bodoni Moda", "Fraunces", serif;
  font-style: italic;
  font-size: 13px;
  color: var(--dim);
}
.archive-front-name {
  font-family: "Bodoni Moda", "Fraunces", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.archive-front-val {
  font-family: "Bodoni Moda", "Fraunces", serif;
  font-size: 15px;
  letter-spacing: -0.005em;
  font-feature-settings: "tnum";
}
.archive-front-val em {
  font-family: "Fragment Mono", monospace;
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0.06em;
}
.archive-front-pct {
  font-family: "Fragment Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: right;
  color: var(--muted);
}
.archive-front-pct.is-done { color: oklch(0.7 0.110 145); }

/* ============================================================
   FORGET EVERYTHING DIALOG
   ============================================================ */
.dialog.forget {
  width: min(480px, 100%);
  padding: 36px 36px 28px;
  border-color: oklch(0.32 0.10 25 / 0.55);
}
.forget-overline { color: oklch(0.62 0.16 25); }
.forget-body {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 24px;
}
.forget-body strong {
  font-style: normal;
  color: oklch(0.78 0.18 25);
  font-weight: 500;
}
.forget-label {
  display: block;
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.forget-label strong {
  font-style: normal;
  color: oklch(0.78 0.18 25);
  font-weight: 600;
  letter-spacing: 0.18em;
}
#forgetInput {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid oklch(0.32 0.10 25 / 0.45);
  font-family: "Fragment Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: oklch(0.78 0.18 25);
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.3s ease;
}
#forgetInput:focus { border-color: oklch(0.62 0.16 25); }
.forget-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}
.forget-cancel {
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 16px;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.3s ease;
}
.forget-cancel:hover { color: var(--text); }
.forget-confirm {
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.95);
  background: oklch(0.42 0.16 25);
  border: 1px solid oklch(0.52 0.18 25);
  padding: 12px 22px;
  cursor: pointer;
  transition: background 0.3s ease, opacity 0.3s ease;
  font-weight: 500;
}
.forget-confirm:hover:not(:disabled) {
  background: oklch(0.52 0.18 25);
}
.forget-confirm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Mobile tweaks for the account UI */
@media (max-width: 600px) {
  .account-btn { top: 14px; right: 14px; width: 36px; height: 36px; font-size: 17px; }
  .account-menu { top: 60px; right: 12px; left: 12px; min-width: 0; }
  .dialog.archives { padding: 28px 22px 24px; }
  .archive-head { grid-template-columns: 1fr auto; }
  .archive-overall { grid-column: 2; grid-row: 1; }
  .archive-dates { grid-column: 1 / -1; grid-row: 2; }
  .archive-front { grid-template-columns: 18px 1fr auto; }
  .archive-front-val { grid-column: 2 / 3; }
  .archive-front-pct { grid-column: 3; }
}

/* ============================================================
   LOCK SCREEN
   ============================================================ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: oklch(0.10 0.005 60);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 30%, oklch(0.16 0.012 60), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 110%, oklch(0.14 0.020 25 / 0.45), transparent 70%);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s cubic-bezier(.22,1,.36,1);
}
.lock-screen.is-shown {
  opacity: 1;
  pointer-events: auto;
}
body.is-locked > *:not(#tt-universal-ui):not(#design-switcher) { visibility: hidden; }
body.is-locked .account-btn { display: none !important; }
body.is-locked #design-switcher { display: none !important; }

.lock-screen { cursor: pointer; }
.lock-inner {
  text-align: center;
  padding: 40px;
  max-width: 480px;
  animation: lockFadeUp 1.2s cubic-bezier(.22,1,.36,1) both;
}
@keyframes lockFadeUp {
  from { opacity: 0; transform: translateY(20px); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.lock-mark {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-size: 56px;
  color: oklch(0.55 0.013 70);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
  animation: lockMarkBreathe 4s ease-in-out infinite;
}
@keyframes lockMarkBreathe {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}
.lock-eyebrow {
  font-family: "Fragment Mono", "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: oklch(0.55 0.013 70);
  margin-bottom: 16px;
}
.lock-title {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(36px, 5vw, 52px);
  letter-spacing: -0.02em;
  color: oklch(0.94 0.016 78);
  line-height: 1.0;
  margin-bottom: 20px;
}
.lock-sub {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: oklch(0.62 0.013 70);
  line-height: 1.55;
  margin-bottom: 36px;
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
}
.lock-btn {
  padding: 16px 28px;
  font-size: 13px;
  letter-spacing: 0.2em;
}
.lock-error {
  margin-top: 18px;
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: oklch(0.62 0.16 25);
  min-height: 1em;
}
.lock-foot {
  margin-top: 56px;
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 13px;
  color: oklch(0.42 0.010 70);
}
.lock-foot em { color: oklch(0.62 0.013 70); font-style: italic; }

/* ============================================================
   CREDENTIAL ID VIEWER
   ============================================================ */
.dialog.credid {
  width: min(560px, 100%);
  padding: 36px 36px 28px;
}
.credid-help {
  font-family: "Bodoni Moda", "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 18px;
  max-width: 54ch;
}
.credid-help code {
  font-family: "Fragment Mono", "JetBrains Mono", monospace;
  font-style: normal;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  padding: 2px 6px;
  border: 1px solid var(--line);
  letter-spacing: -0.005em;
}
#credIdField {
  width: 100%;
  min-height: 90px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  font-family: "Fragment Mono", "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.01em;
  outline: none;
  resize: vertical;
  word-break: break-all;
}
#credIdField:focus { border-color: var(--text); }
#credIdField[data-empty="1"] { color: var(--dim); font-style: italic; }
.credid-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.credid-copy {
  padding: 10px 18px;
  background: var(--text);
  color: var(--bg);
  border: 0;
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.3s ease;
}
.credid-copy:hover { opacity: 0.84; }
.credid-copied {
  font-family: "Fragment Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: oklch(0.7 0.110 145);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.credid-copied.is-visible { opacity: 1; }
.credid-snippet {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: "Fragment Mono", monospace;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
}
.credid-snippet code {
  display: block;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 11px;
  letter-spacing: -0.005em;
  white-space: pre-line;
}
