:root {
  --ink: #e8eef6;
  --muted: #8ea0b5;
  --cta-a: #2ec4b6;
  --cta-b: #3b82f6;
  --header-h: 84px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Plus Jakarta Sans", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background: #05070b;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button, a, select { font-family: inherit; }

.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;
}

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
  padding: 0 4.4vw;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  text-decoration: none;
  color: var(--ink);
}
.brand svg { width: 34px; height: 34px; }
.brand-name {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav a {
  color: #9aaabb;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}
.nav a:hover,
.nav a.is-active { color: #fff; }
.nav-contact {
  margin-left: 8px;
  padding: 8px 20px;
  border: 1.5px solid #3a4658;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.lang-wrap { flex: 0 0 auto; }
.lang-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid #3a4658;
  border-radius: 999px;
  padding: 8px 34px 8px 14px;
  background-color: rgba(255, 255, 255, 0.06);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%239aaabb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  outline: none;
}
.lang-select:focus {
  border-color: var(--cta-a);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.18);
}
.lang-select option {
  color: #0f172a;
  background: #fff;
}

.menu-btn {
  display: none;
  width: 44px;
  height: 44px;
  border: 1.5px solid #64748b;
  border-radius: 12px;
  background: #111827;
  cursor: pointer;
  flex: 0 0 44px;
}
.menu-btn span,
.menu-btn span::before,
.menu-btn span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #e8eef6;
  border-radius: 2px;
  position: relative;
  margin: 0 auto;
}
.menu-btn span::before,
.menu-btn span::after {
  content: "";
  position: absolute;
  left: 0;
}
.menu-btn span::before { top: -6px; }
.menu-btn span::after { top: 6px; }

.story {
  min-height: calc(100svh - var(--header-h));
  display: grid;
  grid-template-columns: minmax(280px, 42%) 1fr;
  align-items: stretch;
  padding: 0 4.4vw 4vh;
  gap: 2vw;
}
.copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 6vh;
  max-width: 36rem;
}
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #7b8aa3;
  text-transform: uppercase;
  margin-bottom: 22px;
}
h1 {
  font-size: clamp(32px, 3.2vw, 52px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.lead {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--muted);
  font-weight: 500;
}
.lead em {
  font-style: normal;
  color: #cbd5e1;
  font-weight: 600;
}
.story-body {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}
.story-body p {
  font-size: 15px;
  line-height: 1.7;
  color: #9aabbd;
  font-weight: 500;
}
.points {
  margin-top: 22px;
  display: grid;
  gap: 10px;
  list-style: none;
}
.points li {
  position: relative;
  padding-left: 18px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #b6c3d4;
  font-weight: 500;
}
.points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cta-a), var(--cta-b));
}
.cta {
  margin-top: 28px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 250px;
  padding: 16px 28px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(90deg, var(--cta-a) 0%, #2f9fe0 52%, var(--cta-b) 100%);
  box-shadow: 0 14px 30px rgba(43, 140, 210, 0.28);
  text-decoration: none;
  width: fit-content;
}
.cta-zh { font-size: 18px; font-weight: 700; }
.cta-en { font-size: 13px; font-weight: 500; opacity: 0.92; }
.caption {
  margin-top: 14px;
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 600;
}
.visual {
  min-height: 0;
  display: grid;
  place-items: center;
}
.visual img {
  width: 100%;
  height: min(78vh, 860px);
  object-fit: contain;
  object-position: center;
}

@media (max-width: 980px) {
  :root { --header-h: 72px; }
  .story {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .nav {
    position: absolute;
    top: calc(var(--header-h) - 6px);
    right: 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 220px;
    padding: 10px;
    border-radius: 16px;
    background: rgba(12, 18, 28, 0.96);
    box-shadow: var(--shadow);
    display: none;
    z-index: 50;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; border-radius: 10px; }
  .nav-contact { margin: 6px 0 0; text-align: center; }
  .menu-btn { display: flex; align-items: center; justify-content: center; }
  .copy { padding-bottom: 0; order: 2; max-width: none; }
  .visual { order: 1; }
  .visual img { height: min(52vh, 480px); }
}

@media (max-width: 640px) {
  .site-header { padding: 0 18px; gap: 10px; }
  .story { padding: 8px 18px 28px; }
  .cta { width: 100%; }
  .brand-name { font-size: 18px; }
}

.auth-main {
  min-height: calc(100svh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 0 4.4vw 8vh;
}
.auth-card {
  width: min(100%, 440px);
  padding: 36px 32px 32px;
  border: 1px solid #243044;
  border-radius: 20px;
  background: rgba(12, 18, 28, 0.88);
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: clamp(28px, 3vw, 36px);
}
.auth-card h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.auth-card .lead {
  margin-bottom: 8px;
}
.auth-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.auth-field span {
  font-size: 13px;
  font-weight: 600;
  color: #9aaabb;
}
.auth-field input,
.chat-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid #3a4658;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 15px;
}
.auth-field input:focus,
.chat-form textarea:focus {
  outline: none;
  border-color: var(--cta-a);
  box-shadow: 0 0 0 3px rgba(46, 196, 182, 0.18);
}
.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}
.auth-btn {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(90deg, var(--cta-a) 0%, #2f9fe0 52%, var(--cta-b) 100%);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.auth-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.auth-btn-ghost {
  border: 1.5px solid #3a4658;
  background: transparent;
  color: var(--ink);
}
.auth-links {
  margin-top: 16px;
  font-size: 14px;
}
.auth-links a {
  color: var(--cta-a);
  text-decoration: none;
  font-weight: 600;
}
.auth-msg {
  margin-top: 12px;
  color: #f87171;
  font-size: 14px;
  font-weight: 500;
}
.auth-ack {
  margin-top: 14px;
  color: var(--cta-a);
  font-size: 14px;
  font-weight: 600;
}
.auth-restoring {
  color: var(--muted);
  font-weight: 600;
}
.agent-card {
  width: min(100%, 720px);
}
.spalling-app {
  display: block;
  width: 100%;
  height: min(78vh, 980px);
  margin-top: 16px;
  border: 0;
  border-radius: 16px;
  background: #020617;
}
body:has(.spalling-app) .agent-card {
  width: min(100%, 1100px);
}
.bot-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.bot-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid #334155;
  background: rgba(255, 255, 255, 0.04);
  color: #c5d0e0;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.bot-chip:hover {
  border-color: rgba(46, 230, 200, 0.45);
  color: #e8eef7;
}
.bot-chip.is-active {
  border-color: rgba(46, 230, 200, 0.7);
  background: linear-gradient(135deg, rgba(46, 230, 200, 0.22), rgba(20, 184, 166, 0.18));
  color: #f4fbf9;
}
.chat-log {
  margin-top: 18px;
  max-height: 48vh;
  overflow: auto;
  display: grid;
  gap: 12px;
}
.chat-turn {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #243044;
  background: rgba(255, 255, 255, 0.03);
}
.chat-who {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7b8aa3;
  font-weight: 700;
  margin-bottom: 6px;
}
.chat-text {
  font-size: 15px;
  line-height: 1.55;
  color: #d5deea;
}
.chat-operator {
  border-color: rgba(46, 196, 182, 0.35);
}
.chat-form {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
