@property --ring-sweep {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

body {
  --bg: #06100e;
  --panel: rgba(8, 17, 16, 0.96);
  --line: rgba(125, 255, 215, 0.16);
  --ink: #e6fff6;
  --muted: #87aaa0;
  --accent: #7dffd7;
  --accent-soft: rgba(125, 255, 215, 0.12);
  --blue-month: rgba(89, 188, 255, 0.62);
  --red-month: rgba(255, 119, 119, 0.58);
  --future: rgba(130, 151, 145, 0.32);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
  background:
    radial-gradient(circle at top, rgba(125, 255, 215, 0.08), transparent 30rem),
    linear-gradient(180deg, #030707 0%, #06100e 40%, #0a1714 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
}

.app-shell,
.gateway-screen,
.flow-screen {
  min-height: 100vh;
}

/* Ensure HTML hidden attribute works even when display is set by CSS */
[hidden] {
  display: none !important;
}

.gateway-screen,
.flow-screen {
  display: grid;
  place-items: center;
  padding: 1rem;
}

.gateway-frame,
.flow-frame {
  width: min(100%, 42rem);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(12, 23, 21, 0.98), rgba(6, 14, 13, 0.96)),
    var(--panel);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.gateway-frame::before,
.flow-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0, transparent 1px),
    linear-gradient(90deg, rgba(125, 255, 215, 0.02) 0, transparent 1px);
  background-size: 100% 0.34rem, 0.34rem 100%;
  opacity: 0.22;
  pointer-events: none;
}

.gateway-frame {
  padding: 1.4rem 1.2rem;
  display: grid;
  gap: 1rem;
  align-content: center;
  min-height: min(88vh, 44rem);
}

.gateway-title {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: clamp(2rem, 8vw, 3.35rem);
  line-height: 0.98;
  max-width: 12ch;
}

.gateway-copy {
  margin: 0;
  max-width: 30rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.gateway-copy a {
  color: var(--accent);
}

.gateway-actions {
  display: grid;
  gap: 0.8rem;
}

.flow-frame {
  padding: 1rem 0.95rem 1.15rem;
}

.step-complete-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  gap: 1rem;
  align-content: center;
  justify-items: center;
  padding: 1.4rem;
  text-align: center;
  background: rgba(3, 7, 7, 0.88);
  backdrop-filter: blur(0.32rem);
}

.step-complete-message {
  margin: 0;
  max-width: 28rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
}

.progress-bar {
  height: 0.46rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(125, 255, 215, 0.08);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7dffd7, #25d3a8);
  box-shadow: 0 0 18px rgba(125, 255, 215, 0.34);
  transition: width 220ms ease;
}

.progress-copy {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.step-panel[hidden] {
  display: none;
}

.question-card {
  display: grid;
  gap: 1rem;
  min-height: min(74vh, 44rem);
  align-content: start;
  padding: 1.1rem 0 0.2rem;
}

.question-card h1 {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: clamp(1.7rem, 6vw, 2.45rem);
  line-height: 1.06;
}

.microcopy {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
  max-width: 31rem;
}

.calendar-shell {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-top: 0.4rem;
}

.calendar-hover-label {
  position: absolute;
  left: -0.2rem;
  top: 0.35rem;
  transform: translateX(-12%);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(89, 188, 255, 0.28);
  opacity: 0.46;
  pointer-events: none;
}

.calendar-hover-label[data-theme='prior'] {
  -webkit-text-stroke-color: rgba(255, 119, 119, 0.26);
}

.calendar-hover-label[data-theme='current'] {
  -webkit-text-stroke-color: rgba(89, 188, 255, 0.28);
}

.calendar-month {
  border: 1px solid rgba(125, 255, 215, 0.08);
  border-radius: 1rem;
  background: rgba(5, 12, 11, 0.74);
  padding: 0.85rem 0.75rem 0.8rem;
  position: relative;
  z-index: 1;
}

.month-prior {
  box-shadow: inset 0 0 0 1px rgba(255, 119, 119, 0.04);
}

.month-current {
  box-shadow: inset 0 0 0 1px rgba(89, 188, 255, 0.05);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.calendar-weekdays {
  margin-bottom: 0.55rem;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 0.76rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  text-align: center;
}

.calendar-spacer {
  min-height: 2.85rem;
}

.calendar-day {
  min-height: 2.85rem;
  border-radius: 0.92rem;
  border: 1px solid rgba(125, 255, 215, 0.08);
  background: rgba(8, 16, 15, 0.82);
  color: var(--ink);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 1rem;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.month-prior .calendar-day {
  border-color: rgba(255, 119, 119, 0.08);
}

.month-current .calendar-day {
  border-color: rgba(89, 188, 255, 0.08);
}

.calendar-day.is-active {
  cursor: pointer;
}

.calendar-day.is-active:hover,
.calendar-day.is-active:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(125, 255, 215, 0.34);
  background: rgba(12, 28, 24, 0.92);
}

.calendar-day.is-today {
  border-color: rgba(125, 255, 215, 0.72);
  background: linear-gradient(180deg, rgba(125, 255, 215, 0.2), rgba(125, 255, 215, 0.08));
  box-shadow: inset 0 0 0 1px rgba(125, 255, 215, 0.08), 0 0 18px rgba(125, 255, 215, 0.14);
}

.calendar-day.is-future,
.calendar-day.is-outside-window {
  color: var(--future);
  cursor: not-allowed;
}

.calendar-day.is-future {
  background: rgba(8, 16, 15, 0.42);
}

.transition-panel {
  display: grid;
  gap: 1rem;
  align-content: center;
  justify-items: center;
  min-height: min(74vh, 44rem);
  text-align: center;
}

.transition-ring {
  --ring-sweep: 0deg;
  width: 5rem;
  height: 5rem;
  border-radius: 999px;
  background: conic-gradient(var(--accent) var(--ring-sweep), rgba(125, 255, 215, 0.08) 0);
  display: grid;
  place-items: center;
  animation: ring-fill 1.25s linear forwards;
}

.transition-ring::after {
  content: "";
  width: 3.95rem;
  height: 3.95rem;
  border-radius: 999px;
  background: rgba(6, 14, 13, 0.98);
  border: 1px solid rgba(125, 255, 215, 0.12);
}

.transition-ring span {
  position: absolute;
  width: 1.3rem;
  height: 0.72rem;
  border-left: 0.18rem solid var(--accent);
  border-bottom: 0.18rem solid var(--accent);
  transform: rotate(-45deg);
  z-index: 1;
}

@keyframes ring-fill {
  to {
    --ring-sweep: 360deg;
  }
}

.transition-message {
  margin: 0;
  max-width: 27rem;
  font-size: 1.02rem;
  line-height: 1.55;
}

.transition-bar {
  width: min(100%, 16rem);
  height: 0.32rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(125, 255, 215, 0.08);
}

.transition-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7dffd7, #25d3a8);
  transition: width 950ms linear;
}

.field {
  display: grid;
  gap: 0.65rem;
}

.field input,
.field textarea {
  width: 100%;
  min-height: 3.65rem;
  border-radius: 1rem;
  border: 1px solid rgba(125, 255, 215, 0.16);
  background: rgba(4, 10, 10, 0.92);
  color: var(--ink);
  padding: 0.95rem 1rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 1.04rem;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field textarea {
  min-height: 8.5rem;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(125, 255, 215, 0.52);
  box-shadow: 0 0 0 0.18rem rgba(125, 255, 215, 0.1);
}

.field input.is-valid {
  border-color: rgba(125, 255, 215, 0.64);
  box-shadow: 0 0 0 0.18rem rgba(125, 255, 215, 0.08);
}

.field input.is-invalid {
  border-color: rgba(255, 155, 155, 0.66);
  box-shadow: 0 0 0 0.18rem rgba(255, 155, 155, 0.08);
}

.checkbox-line {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0;
}

.terminal-check {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(125, 255, 215, 0.1);
  border-radius: 1rem;
  background: rgba(8, 16, 15, 0.72);
  color: var(--muted);
}

.terminal-check input {
  margin-top: 0.2rem;
}

.fine-print,
.status,
.summary-box,
.fieldset-block legend {
  color: var(--muted);
}

.status {
  min-height: 1.35rem;
  margin: 0;
}

.status[data-kind='success'] {
  color: #9effc7;
}

.status[data-kind='error'] {
  color: #ff9b9b;
}

.touch-kdf-link {
  color: var(--accent);
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
}

.step-actions,
.button-row,
.choice-grid {
  display: grid;
  gap: 0.75rem;
}

.button,
.button-ghost,
.button-muted,
.choice-button {
  width: 100%;
  min-height: 3.6rem;
  border-radius: 1rem;
  padding: 0.95rem 1.15rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  font-size: 0.98rem;
  font-weight: 700;
  transition: transform 140ms ease, filter 140ms ease, border-color 140ms ease, background 140ms ease;
}

.button:hover,
.button-ghost:hover,
.button-muted:hover,
.choice-button:hover,
.button:focus-visible,
.button-ghost:focus-visible,
.button-muted:focus-visible,
.choice-button:focus-visible {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.button {
  background: linear-gradient(135deg, #7dffd7, #24d2a8);
  color: #04100d;
}

.button.is-selected,
.button-muted.is-selected {
  box-shadow: 0 0 0 0.18rem rgba(125, 255, 215, 0.18);
  filter: brightness(1.05);
}

.button-ghost,
.button-muted,
.choice-button {
  border: 1px solid rgba(125, 255, 215, 0.14);
  background: rgba(8, 16, 15, 0.84);
  color: var(--ink);
}

.button-muted {
  color: var(--accent);
}

.choice-button.is-selected {
  border-color: rgba(125, 255, 215, 0.64);
  background: linear-gradient(180deg, rgba(125, 255, 215, 0.16), rgba(125, 255, 215, 0.08));
}

.summary-box,
.fieldset-block {
  border: 1px solid rgba(125, 255, 215, 0.1);
  border-radius: 1rem;
  background: rgba(8, 16, 15, 0.7);
  padding: 0.95rem 1rem;
}

.fieldset-block {
  margin: 0;
}

.summary-box strong {
  color: var(--ink);
  margin-left: 0.35rem;
}

.template-box {
  min-height: 15rem;
  border-radius: 1rem;
  border: 1px solid rgba(125, 255, 215, 0.14);
  background: rgba(2, 6, 6, 0.98);
  color: var(--ink);
  padding: 1rem;
  font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  line-height: 1.5;
}

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

@media (min-width: 720px) {
  .gateway-actions,
  .step-actions,
  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button-row.question-button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button-row.question-button-row .col-span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .gateway-screen,
  .flow-screen {
    padding: 0.75rem;
  }

  .gateway-frame,
  .flow-frame {
    border-radius: 1.15rem;
  }

  .flow-frame {
    padding: 0.92rem 0.82rem 1rem;
  }

  .gateway-frame {
    min-height: min(88vh, 40rem);
    padding: 1.15rem 0.95rem;
  }

  .question-card {
    min-height: min(76vh, 46rem);
  }

  .calendar-hover-label {
    position: static;
    transform: none;
    font-size: 1.45rem;
  }
}
