:root {
  color-scheme: light;
  --brand-burgundy: #571823;
  --brand-burgundy-strong: #3f1018;
  --brand-rose: #c17973;
  --brand-blue: #9da4b7;
  --brand-cream: #f3e5d8;
  --brand-paper: #fffaf5;
  --brand-ink: #32191d;
  --brand-muted: #6e595c;
  --brand-line: #dcc8bd;
  --surface: rgba(255, 250, 245, .88);
  --shadow: 0 18px 48px rgba(87, 24, 35, .12);
  --radius-card: 24px;
  --radius-control: 14px;
  --safe-top: max(24px, env(safe-area-inset-top));
  --safe-bottom: max(24px, env(safe-area-inset-bottom));
  --font-display: Cinzel, Georgia, "Times New Roman", serif;
  --font-interface: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--brand-cream); }
body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  color: var(--brand-ink);
  font-family: var(--font-interface);
  background:
    radial-gradient(circle at 16% 4%, rgba(193, 121, 115, .14), transparent 32rem),
    linear-gradient(155deg, var(--brand-paper), var(--brand-cream));
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: .38;
  background-image:
    linear-gradient(90deg, transparent 49.8%, rgba(87, 24, 35, .08) 50%, transparent 50.2%),
    linear-gradient(transparent 49.8%, rgba(87, 24, 35, .06) 50%, transparent 50.2%);
  background-size: 180px 180px;
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
a { color: inherit; }
button, input, select { font: inherit; }
.app-shell {
  width: min(100%, 720px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--safe-top) 20px var(--safe-bottom);
}
.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 28px;
  border-bottom: 1px solid rgba(87, 24, 35, .18);
}
.brand-header > p {
  margin: 0;
  color: var(--brand-burgundy);
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 4vw, 1.35rem);
  letter-spacing: .02em;
}
.institute-lockup { display: grid; color: var(--brand-burgundy); line-height: 1; }
.institute-lockup span { font-size: .58rem; letter-spacing: .23em; text-transform: uppercase; }
.institute-lockup strong { margin-top: 5px; font-family: var(--font-display); font-size: 1.02rem; font-weight: 500; letter-spacing: .04em; }
.home-intro { padding: clamp(42px, 9vh, 76px) 4px 34px; }
.product-name { margin: 0 0 16px; color: var(--brand-burgundy); font-size: .78rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.home-intro h1 { margin: 0; max-width: 12ch; color: var(--brand-burgundy); font-family: var(--font-display); font-size: clamp(2.7rem, 12vw, 5.6rem); font-weight: 500; letter-spacing: -.035em; line-height: .96; }
.home-intro > p:last-child { margin: 22px 0 0; color: var(--brand-muted); font-size: 1.05rem; line-height: 1.5; }
.action-list { display: grid; gap: 14px; }
.action-card {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 22px 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: var(--radius-card);
  color: #fffaf5;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(87, 24, 35, .12);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-card:active { transform: scale(.985); }
.action-card:focus-visible { outline: 3px solid var(--brand-ink); outline-offset: 4px; }
.action-card-primary { background: var(--brand-burgundy); }
.action-card-rose { background: #a95f5b; }
.action-card-blue { background: #687187; }
.action-copy { display: grid; gap: 7px; }
.action-copy strong { font-size: clamp(1.18rem, 5vw, 1.42rem); line-height: 1.1; }
.action-copy small { max-width: 34ch; color: #fffaf5; font-size: .86rem; line-height: 1.35; }
.action-arrow { flex: 0 0 auto; font-family: Georgia, serif; font-size: 2.5rem; font-weight: 300; line-height: 1; }
.pilot-note { margin-top: 22px; padding: 18px 20px; border: 1px solid var(--brand-line); border-radius: var(--radius-control); background: var(--surface); }
.pilot-note strong { color: var(--brand-burgundy); font-size: .88rem; }
.pilot-note p { margin: 6px 0 0; color: var(--brand-muted); font-size: .82rem; line-height: 1.45; }
.home-footer { padding: 44px 0 12px; color: var(--brand-burgundy); font-family: var(--font-display); text-align: center; }
.subpage-shell { width: min(100%, 760px); }
.back-link { display: inline-flex; min-height: 48px; align-items: center; padding: 0 14px; border: 1px solid var(--brand-line); border-radius: 999px; background: rgba(255, 250, 245, .74); color: var(--brand-burgundy); font-weight: 700; text-decoration: none; }
.back-link:focus-visible { outline: 3px solid var(--brand-burgundy); outline-offset: 3px; }
.page-heading { padding: 42px 4px 26px; }
.page-heading h1 { margin: 0; color: var(--brand-burgundy); font-family: var(--font-display); font-size: clamp(2.2rem, 10vw, 4.2rem); font-weight: 500; line-height: 1; }
.page-heading p { margin: 16px 0 0; color: var(--brand-muted); line-height: 1.5; }
.history-list { display: grid; gap: 14px; }
.history-card, .empty-state { padding: 22px; border: 1px solid var(--brand-line); border-radius: var(--radius-card); background: var(--surface); box-shadow: 0 10px 24px rgba(87, 24, 35, .08); }
.history-card { display: grid; grid-template-columns: 1fr auto; gap: 10px 18px; }
.history-card h2 { margin: 0; color: var(--brand-burgundy); font-size: 1.06rem; }
.history-card p { margin: 0; color: var(--brand-muted); font-size: .9rem; line-height: 1.45; }
.history-card button { grid-row: 1 / 3; grid-column: 2; align-self: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--brand-line); border-radius: 12px; background: transparent; color: var(--brand-burgundy); font-weight: 700; cursor: pointer; }
.history-card button:focus-visible { outline: 3px solid var(--brand-burgundy); outline-offset: 2px; }
.empty-state { text-align: center; }
.empty-state h2 { margin: 0; color: var(--brand-burgundy); font-family: var(--font-display); font-size: 1.55rem; font-weight: 500; }
.empty-state p { margin: 10px auto 20px; max-width: 36ch; color: var(--brand-muted); line-height: 1.5; }
.empty-state a { display: inline-flex; min-height: 48px; align-items: center; padding: 0 18px; border-radius: 12px; background: var(--brand-burgundy); color: #fffaf5; font-weight: 750; text-decoration: none; }
.history-status { min-height: 1.5em; margin: 18px 4px 0; color: var(--brand-muted); font-size: .85rem; }
@media (min-width: 760px) {
  .app-shell { padding-inline: 32px; }
  .action-card { min-height: 122px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Protect HTML visibility states even when a component uses display: grid. */
[hidden]:not([hidden="until-found"]) { display: none !important; }
