:root {
  --bg: #071426;
  --panel: rgba(8, 24, 45, .78);
  --panel-strong: rgba(9, 29, 56, .9);
  --line: rgba(138, 205, 255, .26);
  --line-strong: rgba(170, 222, 255, .46);
  --text: #eef8ff;
  --muted: #a9c2d7;
  --soft: #d8ebff;
  --cyan: #52d8ff;
  --blue: #358dff;
  --gold: #e8bf66;
  --green: #35e5b2;
  --danger: #ff6b92;
  --shadow: 0 24px 70px rgba(0, 15, 40, .42);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #06111f; }
body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
  background: var(--bg);
}

.world-bg {
  position: fixed;
  inset: 0;
  z-index: -4;
  background: url("sao-agent-bg.jpg") center / cover no-repeat;
  filter: saturate(.82) brightness(.52) contrast(1.06);
  transform: scale(1.02);
}

.sky-vignette {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(5, 14, 30, .86), rgba(7, 22, 43, .62) 34%, rgba(8, 24, 43, .72) 64%, rgba(5, 12, 25, .92)),
    radial-gradient(circle at 50% 20%, rgba(48, 130, 255, .18), transparent 32%),
    linear-gradient(180deg, rgba(1, 6, 18, .34), rgba(1, 8, 20, .74));
  pointer-events: none;
}

.hud-rings {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .42;
  background-image:
    linear-gradient(rgba(111, 198, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111, 198, 255, .08) 1px, transparent 1px),
    linear-gradient(135deg, transparent 0 44%, rgba(96, 211, 255, .16) 45%, transparent 47%),
    linear-gradient(45deg, transparent 0 56%, rgba(232, 191, 102, .12) 57%, transparent 59%),
    radial-gradient(circle at 72% 22%, transparent 0 90px, rgba(104, 205, 255, .18) 91px, transparent 93px),
    radial-gradient(circle at 22% 70%, transparent 0 130px, rgba(232, 191, 102, .14) 131px, transparent 133px);
  background-size: 64px 64px, 64px 64px, 420px 420px, 520px 520px, auto, auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(155, 214, 255, .24);
  background: rgba(4, 13, 27, .84);
  backdrop-filter: blur(18px) saturate(1.1);
}

.header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  clip-path: polygon(50% 0, 94% 50%, 50% 100%, 6% 50%);
  background: linear-gradient(135deg, var(--cyan), var(--blue) 48%, var(--gold));
  box-shadow: 0 0 28px rgba(82, 216, 255, .5);
}

.brand::after {
  content: "SYSTEM ONLINE";
  margin-left: 8px;
  padding: 5px 8px;
  border: 1px solid rgba(82, 216, 255, .34);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  border-radius: 4px;
  background: rgba(82, 216, 255, .08);
}

.brand strong { display: block; font-size: 18px; }
.brand em { display: block; color: var(--muted); font-size: 12px; font-style: normal; margin-top: 2px; }

.product-switch,
.language-switch {
  display: flex;
  gap: 8px;
  align-items: center;
}

.product-switch {
  justify-self: center;
}

.language-switch {
  justify-self: end;
}

.page-switch,
.language-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(147, 207, 255, .22);
  color: var(--soft);
  text-decoration: none;
  background: rgba(7, 23, 46, .64);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  border-radius: 6px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color .18s ease, color .18s ease, background .18s ease, transform .18s ease;
}

.page-switch:hover,
.language-switch a:hover {
  border-color: rgba(147, 207, 255, .46);
  transform: translateY(-1px);
}

.page-switch.active,
.language-switch a.active {
  color: #061527;
  border-color: rgba(255,255,255,.65);
  background: linear-gradient(135deg, #e7fbff, #58d9ff 45%, #d9b25a);
  box-shadow: 0 14px 34px rgba(70, 186, 255, .28);
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 80px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy,
.status-card,
.control-deck,
.card,
.stepper,
.workflow-tabs,
.guide-cards article {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(10, 30, 58, .82), rgba(7, 18, 36, .72));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(16px) saturate(1.1);
  border-radius: 8px;
}

.hero-copy {
  min-height: 214px;
  padding: 36px 40px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: -35px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(90, 210, 255, .22);
  border-radius: 50%;
  box-shadow: inset 0 0 36px rgba(82, 216, 255, .12);
}

.hero-copy::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 28px;
  right: 28px;
  bottom: 28px;
  border: 1px solid rgba(82, 216, 255, .16);
  clip-path: polygon(0 0, 34px 0, 34px 1px, 1px 1px, 1px 34px, 0 34px, 0 0, 100% 0, 100% 34px, calc(100% - 1px) 34px, calc(100% - 1px) 1px, calc(100% - 34px) 1px, calc(100% - 34px) 0, 100% 0, 100% 100%, calc(100% - 34px) 100%, calc(100% - 34px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 34px), 100% calc(100% - 34px), 100% 100%, 0 100%, 0 calc(100% - 34px), 1px calc(100% - 34px), 1px calc(100% - 1px), 34px calc(100% - 1px), 34px 100%, 0 100%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 62px);
  line-height: 1.05;
}

.hero-copy h1 span {
  color: transparent;
  background: linear-gradient(110deg, #ffffff, var(--cyan), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
}

.lead {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--soft);
  line-height: 1.8;
  font-size: 16px;
}

.status-card {
  padding: 26px;
  display: grid;
  align-content: center;
  gap: 12px;
}

.status-core { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stock-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
.stock-title { color: var(--muted); }
#stock-label { color: var(--text); }
.stock-desc, .stock-time { color: var(--muted); font-size: 13px; }
.stock-variants { display: grid; gap: 10px; }
.stock-variant { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 12px; border: 1px solid rgba(141, 207, 255, .18); border-radius: 6px; background: rgba(255,255,255,.04); }
.stock-variant strong { margin-left: auto; }

.control-deck {
  padding: 14px;
}

.workflow-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px;
  margin-bottom: 14px;
  background: rgba(4, 14, 30, .68);
  gap: 6px;
}

.compact-tabs .workflow-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.workflow-tabs button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 5px;
  color: var(--soft);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.workflow-tabs button:hover {
  background: rgba(82, 216, 255, .08);
}

.workflow-tabs button.active {
  color: #061527;
  background: linear-gradient(135deg, var(--cyan), var(--blue) 52%, var(--gold));
}

.hidden { display: none !important; }

.stepper {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  margin: 0 0 14px;
  overflow: hidden;
}

.stepper li {
  min-height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid rgba(141, 207, 255, .15);
  color: var(--muted);
  min-width: 0;
}

.stepper li:last-child { border-right: 0; }
.stepper li.active { color: var(--text); background: linear-gradient(90deg, rgba(82, 216, 255, .18), rgba(232, 191, 102, .09)); }
.stepper span { color: var(--gold); font-family: Consolas, monospace; font-weight: 800; }
.stepper em { font-style: normal; font-weight: 800; }

.card { margin-bottom: 14px; overflow: hidden; }
.card-head { padding: 26px 28px 16px; border-bottom: 1px solid rgba(141, 207, 255, .16); }
.card-head h2, .guide-section h2 { margin: 0 0 8px; font-size: 22px; }

.card-head h2::before,
.guide-section h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 18px;
  margin-right: 10px;
  vertical-align: -2px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: linear-gradient(180deg, var(--cyan), var(--gold));
  box-shadow: 0 0 16px rgba(82, 216, 255, .48);
}
.card-head p, .guide-lead, .field-hint { margin: 0; color: var(--muted); line-height: 1.7; }
.card-body { padding: 24px 28px 28px; }

.field { display: grid; gap: 10px; margin-bottom: 18px; }
.field-label { color: var(--soft); font-weight: 800; }
.input {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(145, 213, 255, .28);
  border-radius: 6px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(3, 12, 25, .66);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.textarea { padding: 14px 16px; resize: vertical; line-height: 1.55; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; }
.input:focus { border-color: rgba(82, 216, 255, .72); box-shadow: 0 0 0 4px rgba(82, 216, 255, .13); }

.notice {
  border: 1px solid rgba(232, 191, 102, .28);
  background: rgba(232, 191, 102, .08);
  border-radius: 6px;
  padding: 14px 16px;
  color: var(--soft);
}
.notice ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }

.actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.actions.split { justify-content: space-between; }
.actions.center { justify-content: center; }

.btn-primary,
.btn-ghost,
.tab-action,
button {
  font: inherit;
}
.btn-primary,
.btn-ghost {
  min-height: 46px;
  border-radius: 6px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  transition: filter .18s ease, transform .18s ease, border-color .18s ease;
}
.btn-primary {
  border: 1px solid rgba(255,255,255,.42);
  color: #061527;
  background: linear-gradient(135deg, #e9fbff, var(--cyan) 42%, var(--gold));
  box-shadow: 0 18px 34px rgba(40, 160, 255, .22);
}
.btn-ghost {
  border: 1px solid rgba(141, 207, 255, .28);
  color: var(--soft);
  background: rgba(255,255,255,.04);
}

.btn-primary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.product-summary,
.confirm-list {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(141, 207, 255, .18);
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  margin-bottom: 18px;
}
.product-summary { grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; }
.product-summary-label, .chip-muted, .confirm-list dt { color: var(--muted); }
.chip-plan, .chip-muted { min-width: 0; overflow-wrap: anywhere; }
.confirm-list div { display: grid; grid-template-columns: 120px 1fr; gap: 14px; }
.confirm-list dt, .confirm-list dd { margin: 0; }

.state-block { text-align: center; padding: 24px 0; }
.state-block h2 { margin: 0 0 10px; }
.progress-log { margin-top: 16px; color: var(--muted); }

.query-results { display: grid; gap: 12px; }
.query-row, .query-item {
  border: 1px solid rgba(141, 207, 255, .18);
  border-radius: 6px;
  padding: 14px;
  background: rgba(255,255,255,.04);
}

.guide-section { padding: 20px 8px 8px; }
.guide-section h2, .guide-lead { padding-left: 8px; }
.guide-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
  align-items: stretch;
}
.guide-cards:has(#guide-step4-card.hidden) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.guide-cards article {
  min-width: 0;
  height: 100%;
  padding: 22px;
  display: flex;
  flex-direction: column;
}
.guide-num {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #061527;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  font-weight: 900;
}
.guide-cards h3 { margin: 14px 0 10px; }
.guide-cards ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.8; }
.guide-actions { margin-top: auto; padding-top: 14px; }
.guide-actions .btn-primary { width: 100%; }

.cookie-guide-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
}
.cookie-guide-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}
.cookie-guide-panel {
  position: relative;
  width: min(720px, calc(100% - 32px));
  margin: 8vh auto;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}
.cookie-guide-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,.04);
  border-radius: 6px;
}
.cookie-guide-steps { color: var(--muted); line-height: 1.8; }
.cookie-guide-warning { border: 1px solid rgba(232, 191, 102, .28); background: rgba(232, 191, 102, .08); padding: 14px; border-radius: 6px; }

.toast {
  position: fixed;
  left: 50%;
  top: 92px;
  z-index: 300;
  min-width: min(520px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 15px 20px;
  border: 1px solid rgba(141, 207, 255, .42);
  border-radius: 8px;
  color: var(--text);
  text-align: center;
  font-weight: 800;
  line-height: 1.55;
  background: linear-gradient(145deg, rgba(10, 30, 58, .96), rgba(7, 18, 36, .94));
  box-shadow: 0 22px 60px rgba(0, 12, 30, .52), inset 0 1px 0 rgba(255,255,255,.1);
  backdrop-filter: blur(18px) saturate(1.12);
  opacity: 0;
  transform: translate(-50%, -14px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.success {
  border-color: rgba(53, 229, 178, .56);
  box-shadow: 0 22px 60px rgba(0, 70, 80, .36), 0 0 28px rgba(53, 229, 178, .18);
}

.toast.error {
  border-color: rgba(255, 107, 146, .62);
  box-shadow: 0 22px 60px rgba(80, 0, 28, .34), 0 0 28px rgba(255, 107, 146, .16);
}

@media (max-width: 900px) {
  .header-inner { grid-template-columns: 1fr; padding: 14px 0; gap: 12px; }
  .brand { justify-self: center; }
  .brand::after { display: none; }
  .product-switch, .language-switch { justify-self: center; overflow-x: auto; max-width: 100%; }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-copy { padding: 28px; min-height: auto; }
  .hero-copy h1 { font-size: 42px; }
  .workflow-tabs, .stepper, .guide-cards, .guide-cards:has(#guide-step4-card.hidden) { grid-template-columns: 1fr; }
  .compact-tabs .workflow-tabs { grid-template-columns: 1fr; }
  .product-summary { grid-template-columns: 1fr; }
  .confirm-list div { grid-template-columns: 1fr; }
  .toast { top: 82px; }
}
