*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #06061a;
  --purple: #a78bfa;
  --pink: #e879f9;
  --blue: #60a5fa;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --card-bg: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.08);
  --positive: #86efac;
  --negative: #fda4af;
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.10);
}

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 32px;
}

/* ── Background orbs ── */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.orb-1 {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.14) 0%, transparent 70%);
  top: -200px;
  right: -200px;
  animation: drift-a 22s ease-in-out infinite;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(232, 121, 249, 0.10) 0%, transparent 70%);
  bottom: 0px;
  left: -150px;
  animation: drift-b 28s ease-in-out infinite;
}

.orb-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.08) 0%, transparent 70%);
  top: 40%;
  right: 20%;
  animation: drift-a 34s ease-in-out infinite 8s;
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0); }
  40%       { transform: translate(40px, -30px); }
  70%       { transform: translate(-20px, 25px); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0); }
  35%       { transform: translate(-35px, -20px); }
  65%       { transform: translate(25px, 35px); }
}

/* ── Layout ── */
main {
  position: relative;
  z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 72px 24px 16px;
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 56px;
}

header h1 {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, var(--purple) 45%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
  line-height: 1.2;
  padding-bottom: 0.08em;
}

.tagline {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
}

/* ── Form card ── */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 36px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-bottom: 44px;
}

.inputs {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr 1.2fr;
  gap: 20px;
  margin-bottom: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 11px;
  padding: 13px 15px;
  color: var(--text);
  /* 16px minimum prevents iOS Safari auto-zoom */
  font-size: 16px;
  font-family: inherit;
  font-weight: 500;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input:focus {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.10);
}

input::placeholder {
  color: rgba(148, 163, 184, 0.35);
  font-weight: 400;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.45) sepia(0.3) hue-rotate(220deg);
  cursor: pointer;
  opacity: 0.7;
}

input[type="date"] {
  color-scheme: dark;
}

.input-wrap {
  position: relative;
}

.prefix {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  pointer-events: none;
}

.input-wrap input {
  padding-left: 27px;
}

button[type="submit"] {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18) 0%, rgba(232, 121, 249, 0.15) 100%);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 13px;
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}

button[type="submit"]:hover {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.28) 0%, rgba(232, 121, 249, 0.22) 100%);
  border-color: rgba(167, 139, 250, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(167, 139, 250, 0.12);
}

button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-arrow {
  display: inline-block;
  transition: transform 0.2s;
}

button[type="submit"]:hover .btn-arrow {
  transform: translateX(4px);
}

/* ── Results section ── */
#results {
  scroll-margin-top: 12px;
}

/* ── Loading ── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 64px 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(167, 139, 250, 0.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error ── */
.error-card {
  background: rgba(253, 164, 175, 0.07);
  border: 1px solid rgba(253, 164, 175, 0.18);
  border-radius: 16px;
  padding: 20px 24px;
  color: var(--negative);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.5;
}

/* ── Result card ── */
.result-card {
  background: linear-gradient(
    145deg,
    rgba(167, 139, 250, 0.07) 0%,
    rgba(15, 12, 35, 0.6) 40%,
    rgba(96, 165, 250, 0.06) 100%
  );
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 26px;
  padding: 36px;
  margin-bottom: 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.06),
    0 24px 60px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(167, 139, 250, 0.05);
  animation: fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Narrative prose */
.narrative-lead {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* Highlighted spans within the narrative sentence */
.hl-amount {
  color: var(--text);
  font-weight: 700;
}

.hl-name {
  color: var(--purple);
  font-weight: 600;
}

.hl-ticker {
  color: var(--purple);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hl-date {
  color: var(--text);
  font-weight: 600;
}

.value-focal {
  margin-bottom: 20px;
}

.value-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.today-label {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.current-value {
  font-size: 3.4rem;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 12px;
}

.gain-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gain-amount {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.gain-pct {
  font-size: 0.88rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.narrative-tail {
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.5);
  font-weight: 400;
}

.date-note {
  margin-top: 20px;
  padding: 12px 16px;
  background: rgba(167, 139, 250, 0.07);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-left: 3px solid rgba(167, 139, 250, 0.5);
  border-radius: 10px;
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.date-note strong {
  color: var(--text);
  font-weight: 600;
}

/* Gain colours */
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.positive-pill {
  background: rgba(134, 239, 172, 0.10);
  border: 1px solid rgba(134, 239, 172, 0.22);
  color: var(--positive);
}

.negative-pill {
  background: rgba(253, 164, 175, 0.10);
  border: 1px solid rgba(253, 164, 175, 0.22);
  color: var(--negative);
}

/* ── Share buttons ── */
.share-row {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.20);
  border-radius: 8px;
  color: var(--purple);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.38);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0);
}

.share-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.share-btn.copied {
  color: var(--positive);
  background: rgba(134, 239, 172, 0.08);
  border-color: rgba(134, 239, 172, 0.20);
}

/* ── Benchmarks ── */
.benchmarks-section {
  animation: fade-up 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.comp-intro {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.benchmarks-list {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.bench-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
  gap: 12px;
}

.bench-row:last-child {
  border-bottom: none;
}

.bench-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.bench-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.bench-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.bench-sym {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(148, 163, 184, 0.45);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.bench-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.bench-val {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.bench-ret {
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 70px;
  text-align: right;
  white-space: nowrap;
}

/* ── Ad slots ── */
.ad-slot {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.ad-slot-mid {
  margin: 0 0 44px;
}

.ad-slot-bottom {
  margin-top: 44px;
}

/* ── Footer ── */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--card-border);
  margin-top: 16px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.4);
}

.footer-disclaimer {
  margin-top: 10px;
  font-size: 0.73rem;
  color: rgba(148, 163, 184, 0.35);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ── Fixed ToccaTech bar ── */
.toccatech-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  text-align: center;
  padding: 6px 16px;
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.4);
  background: rgba(6, 6, 26, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.toccatech-bar a {
  color: rgba(148, 163, 184, 0.55);
  text-decoration: none;
  font-weight: 700;
  pointer-events: auto;
  transition: color 0.2s;
}

.toccatech-bar a:hover {
  color: var(--text-muted);
}

/* ── Legal pages ── */
.legal-wrap {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 100px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 48px;
  transition: color 0.2s;
}

.legal-back:hover { color: var(--text); }

.legal-back::before { content: '←'; }

.legal-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, var(--purple) 45%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.legal-updated {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.45);
  margin-bottom: 48px;
}

.legal-body h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 36px 0 12px;
  letter-spacing: -0.01em;
}

.legal-body h2:first-child { margin-top: 0; }

.legal-body p,
.legal-body li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 12px;
}

.legal-body ul,
.legal-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.legal-body a {
  color: var(--purple);
  text-decoration: none;
}

.legal-body a:hover { text-decoration: underline; }

.legal-body strong {
  color: var(--text);
  font-weight: 600;
}

/* Contact form */
.contact-form {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 36px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  margin-top: 36px;
}

.contact-form .field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.contact-form label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.contact-form textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 11px;
  padding: 13px 15px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 400;
  width: 100%;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form textarea:focus {
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.10);
}

.contact-form button {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18) 0%, rgba(232, 121, 249, 0.15) 100%);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 13px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.contact-form button:hover {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.28) 0%, rgba(232, 121, 249, 0.22) 100%);
  border-color: rgba(167, 139, 250, 0.45);
}

/* FAQ accordion */
.faq-list {
  margin-top: 36px;
}

.faq-item {
  border-bottom: 1px solid var(--card-border);
  padding: 20px 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-q {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.4;
}

.faq-a {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 620px) {
  main {
    padding: 48px 16px 8px;
  }

  header h1 {
    font-size: 2rem;
  }

  .form-card {
    padding: 24px 20px;
  }

  .inputs {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .result-card {
    padding: 26px 22px;
  }

  .current-value {
    font-size: 2.8rem;
  }

  .narrative-lead {
    font-size: 0.97rem;
  }

  .bench-row {
    padding: 12px 16px;
  }
}
