/* EO Forge Messenger — D design (Helvetica + liquid glass)
   Palette: FORANGE #ff542e, warm near-black background, warm ink text
*/

:root {
  --forange: #ff542e;
  --forange-dim: #e6491f;
  --forange-glow: rgba(255, 84, 46, 0.15);
  --bg: #0e0e0e;
  --surface: #171717;
  --surface-elev: #1e1e1e;
  --surface-hover: #232323;
  --ink: #f5f0e8;
  --ink-2: #e8e2d4;
  --muted: #8a8478;
  --muted-2: #5c5852;
  --border: #262626;
  --border-strong: #3a3a3a;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  font-feature-settings: "ss01", "kern";
  background-image:
    radial-gradient(ellipse 1000px 700px at 20% 10%, rgba(255, 84, 46, 0.06), transparent 60%),
    radial-gradient(ellipse 900px 600px at 85% 90%, rgba(255, 84, 46, 0.04), transparent 60%),
    radial-gradient(ellipse 800px 500px at 50% 50%, rgba(245, 240, 232, 0.02), transparent 70%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

/* ---------- Passcode gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 1000px 700px at 20% 10%, rgba(255, 84, 46, 0.08), transparent 60%),
    radial-gradient(ellipse 900px 600px at 85% 90%, rgba(255, 84, 46, 0.05), transparent 60%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 1;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.gate.hidden { display: flex !important; opacity: 0; pointer-events: none; }
.gate.dismissed { display: none !important; }

.gate-inner {
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.gate-eyebrow {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.005em;
  margin-bottom: 32px;
}
.gate-eyebrow .strong,
.brand-mark .strong {
  color: var(--ink);
  font-weight: 500;
}
.gate-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 52px;
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 0 0 16px;
  color: var(--ink);
}
.gate-title .forge { color: var(--forange); }
.gate-sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 32px;
  letter-spacing: -0.005em;
}
.gate-form {
  display: flex;
  gap: 10px;
  width: 100%;
}
.gate-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  padding: 14px 18px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}
.gate-input::placeholder { color: var(--muted-2); }
.gate-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 84, 46, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 0 0 3px var(--forange-glow);
}
.gate-error {
  color: var(--forange);
  font-size: 13px;
  margin-top: 14px;
  min-height: 16px;
  letter-spacing: -0.005em;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: -0.005em;
}
.topbar-right { display: flex; gap: 10px; }

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 1px 2px rgba(0, 0, 0, 0.15);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}

/* ---------- Main stage ---------- */

.main { max-width: 820px; margin: 0 auto; padding: 72px 40px 96px; }

.wordmark {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 68px;
  line-height: 0.95;
  letter-spacing: -0.045em;
  margin: 0 0 64px;
  color: var(--ink);
}
.wordmark .forge { color: var(--forange); }

/* ---------- Steps ---------- */

.step, .cta-row {
  margin-bottom: 56px;
  overflow: hidden;
  max-height: 1400px;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    max-height 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    margin-bottom 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform, max-height;
}
.step.locked, .cta-row.locked {
  opacity: 0;
  transform: translateY(20px);
  max-height: 0;
  margin-bottom: 0;
  pointer-events: none;
}
.cta-row { margin-bottom: 0; margin-top: 24px; display: flex; gap: 10px; }
.cta-row.locked { margin-bottom: 0; }

.step-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px;
}
.step-num {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}
.step-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}
.step-title .optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 14px;
  font-style: italic;
}

/* ---------- Options ---------- */

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.option-grid.three { grid-template-columns: repeat(3, 1fr); }

.option {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 20px 22px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 1px 3px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.option::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  pointer-events: none;
}
.option:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.3);
}
.option.selected {
  background: rgba(255, 84, 46, 0.1);
  border-color: rgba(255, 84, 46, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 84, 46, 0.3),
    0 8px 32px -8px rgba(255, 84, 46, 0.35);
}
.option-title {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.option-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: -0.005em;
}

/* Custom option — signals "off the menu" */
.option-custom {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.15);
}
.option-custom:hover { border-color: rgba(255, 255, 255, 0.28); }
.option-custom.selected { border-style: solid; }

/* Inline custom-description input */
.custom-input-wrap {
  margin-top: 10px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    margin-top 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.custom-input-wrap.active {
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.custom-input, .context-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  padding: 16px 20px;
  border-radius: 16px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.5;
  resize: vertical;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-sizing: border-box;
}
.custom-input::placeholder, .context-input::placeholder { color: var(--muted-2); }
.custom-input:focus, .context-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 84, 46, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 3px var(--forange-glow);
}

/* ---------- CTAs ---------- */

.cta {
  background: linear-gradient(180deg, #ff6944 0%, #ff542e 50%, #e64a26 100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 32px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.2),
    0 8px 24px -4px rgba(255, 84, 46, 0.35);
  position: relative;
  overflow: hidden;
}
.cta::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent);
  border-radius: 999px 999px 0 0;
  pointer-events: none;
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2),
    0 4px 8px rgba(0, 0, 0, 0.25),
    0 12px 32px -4px rgba(255, 84, 46, 0.5);
}
.cta:active { transform: translateY(0); }
.cta:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.cta-secondary {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 14px 24px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.15);
  position: relative;
}
.cta-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

/* ---------- Output ---------- */

.summary {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 20px;
}
.summary .tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink-2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.loading {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 14px;
  margin-bottom: 16px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--forange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.output-body {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--forange);
  border-radius: 18px;
  padding: 24px 28px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  min-height: 60px;
  white-space: pre-wrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 4px 16px rgba(0, 0, 0, 0.2);
}
.output-body:empty { display: none; }
.output-body .alt-header {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--forange);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 20px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.output-body .alt-header:first-child { margin-top: 0; }
.output-error {
  color: var(--forange);
  font-size: 14px;
  margin-top: 16px;
}
.output-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 20px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; }

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 40px;
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
  letter-spacing: -0.005em;
}
.footer .dim { color: var(--muted); }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .topbar { padding: 18px 22px; }
  .main { padding: 48px 22px 72px; }
  .wordmark { font-size: 52px; letter-spacing: -0.04em; margin-bottom: 48px; }
  .step { margin-bottom: 44px; }
  .step-title { font-size: 20px; }
  .option-grid, .option-grid.three { grid-template-columns: 1fr !important; }
  .option { padding: 18px 20px; }
  .option-title { font-size: 15px; }
  .option-desc { font-size: 12.5px; }
  .cta-row { flex-direction: column; align-items: stretch; }
  .cta, .cta-secondary { width: 100%; text-align: center; }
  .output-actions button { width: 100%; }
  .footer { padding: 20px 22px; font-size: 11px; line-height: 1.6; }
}
@media (max-width: 420px) {
  .topbar {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .topbar-right { align-self: stretch; }
  .icon-btn { width: 100%; text-align: center; }
  .wordmark { font-size: 42px; }
  .brand-mark { font-size: 12px; }
  .gate-title { font-size: 38px; }
  .gate-form { flex-direction: column; }
  .gate-form .cta { width: 100%; text-align: center; }
}
