/* Firecracker Pool — 深色科技感设计系统。
   基调:近黑蓝底 + 火焰橙/电光青双强调;克制的玻璃卡片;仅两处动效(火焰呼吸/开机环)。 */

:root {
  --bg: #0a0e17;
  --bg-2: #0f1522;
  --card: rgba(22, 30, 48, 0.72);
  --line: rgba(120, 150, 210, 0.16);
  --txt: #e8edf6;
  --txt-2: #93a0bb;
  --flame: #ff6a2b;
  --cyan: #38d5e0;
  --ok: #3ecf8e;
  --err: #ff5470;
  --radius: 14px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: var(--bg);
  color: var(--txt);
  font-family:
    -apple-system, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

/* 背景网格 + 顶部光晕 */
#bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      1200px 500px at 70% -10%,
      rgba(255, 106, 43, 0.13),
      transparent 60%
    ),
    radial-gradient(
      900px 420px at 15% -8%,
      rgba(56, 213, 224, 0.1),
      transparent 60%
    ),
    linear-gradient(rgba(120, 150, 210, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 210, 0.05) 1px, transparent 1px);
  background-size:
    auto,
    auto,
    44px 44px,
    44px 44px;
}

/* 顶栏 */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 14, 23, 0.75);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-flame {
  width: 14px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, var(--flame), #ffb03a);
  box-shadow: 0 0 14px rgba(255, 106, 43, 0.75);
  animation: flame 2.4s ease-in-out infinite;
}
@keyframes flame {
  50% {
    transform: scaleY(1.12) translateY(-1px);
    box-shadow: 0 0 22px rgba(255, 106, 43, 0.95);
  }
}
.brand-name {
  font-weight: 700;
  letter-spacing: 0.4px;
}
.brand-tag {
  font-size: 11px;
  color: var(--cyan);
  border: 1px solid rgba(56, 213, 224, 0.4);
  padding: 1px 8px;
  border-radius: 99px;
}
#nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-link {
  color: var(--txt-2);
  text-decoration: none;
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav-link:hover {
  color: var(--txt);
}
.nav-user {
  font-size: 13px;
  color: var(--cyan);
}

/* 视图容器 */
.view {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}
.hidden {
  display: none !important;
}
.view-title {
  font-size: 28px;
  margin: 0 0 6px;
}
.view-sub {
  color: var(--txt-2);
  margin: 0 0 28px;
}

/* 登录页 hero + 卡片 */
#view-auth {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.25;
  margin: 0 0 14px;
}
.grad {
  background: linear-gradient(90deg, var(--flame), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--txt-2);
  font-size: 16px;
  max-width: 520px;
}
.hero-points {
  list-style: none;
  display: flex;
  gap: 34px;
  padding: 0;
  margin: 30px 0 0;
}
.hero-points li {
  display: flex;
  flex-direction: column;
}
.hero-points b {
  font-size: 26px;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}
.hero-points span {
  font-size: 12.5px;
  color: var(--txt-2);
}

.auth-card,
.prov-card,
.plan-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}
.auth-card {
  padding: 28px;
}
.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}
.tab {
  flex: 1;
  padding: 9px 0;
  background: none;
  color: var(--txt-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.tab.active {
  color: var(--txt);
  border-color: var(--flame);
  background: rgba(255, 106, 43, 0.1);
}
#auth-form label {
  display: block;
  font-size: 13px;
  color: var(--txt-2);
  margin-bottom: 14px;
}
#auth-form input {
  width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  background: var(--bg-2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
}
#auth-form input:focus {
  outline: none;
  border-color: var(--cyan);
}
.btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  background: linear-gradient(90deg, var(--flame), #ff8d3a);
  color: #1a0d05;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(255, 106, 43, 0.35);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}
.form-msg {
  min-height: 1.4em;
  font-size: 13.5px;
  color: var(--err);
  margin: 10px 0 0;
}
.form-msg.ok {
  color: var(--ok);
}
.auth-note {
  font-size: 12.5px;
  color: var(--txt-2);
  margin: 16px 0 0;
  text-align: center;
}

/* 商店 */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
.plan-card {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.plan-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--flame), var(--cyan));
}
.plan-name {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
.plan-price {
  font-size: 30px;
  color: var(--cyan);
  font-weight: 700;
}
.plan-specs {
  color: var(--txt-2);
  font-size: 13.5px;
}
.plan-blurb {
  font-size: 14px;
  min-height: 3em;
}

/* 开机进度 */
#view-provision {
  display: flex;
  justify-content: center;
}
.prov-card {
  max-width: 520px;
  width: 100%;
  padding: 40px;
  text-align: center;
}
.prov-ring {
  width: 96px;
  height: 96px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 3px solid rgba(56, 213, 224, 0.25);
  border-top-color: var(--cyan);
  animation: spin 1.1s linear infinite;
  display: grid;
  place-items: center;
}
.prov-ring.done {
  animation: none;
  border-color: var(--ok);
}
.prov-core {
  width: 34px;
  height: 42px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: linear-gradient(180deg, var(--flame), #ffb03a);
  box-shadow: 0 0 26px rgba(255, 106, 43, 0.8);
  animation: flame 1.8s ease-in-out infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#prov-title {
  font-size: 22px;
  margin: 0 0 18px;
}
.prov-steps {
  list-style: none;
  padding: 0;
  margin: 0 auto 8px;
  max-width: 300px;
  text-align: left;
}
.prov-steps li {
  padding: 7px 0 7px 30px;
  color: var(--txt-2);
  font-size: 14.5px;
  position: relative;
}
.prov-steps li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 13px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
}
.prov-steps li.active {
  color: var(--txt);
}
.prov-steps li.active::before {
  border-color: var(--cyan);
  background: rgba(56, 213, 224, 0.35);
}
.prov-steps li.done {
  color: var(--ok);
}
.prov-steps li.done::before {
  border-color: var(--ok);
  background: var(--ok);
}
#btn-enter-chat {
  margin-top: 18px;
}

/* 聊天 */
#chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 260px);
  min-height: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  overflow: hidden;
}
#chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--txt-2);
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8a03a;
  margin-right: 8px;
}
.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(62, 207, 142, 0.8);
}
.dot.err {
  background: var(--err);
}
.chat-tenant {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
#chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 76%;
  padding: 11px 15px;
  border-radius: 13px;
  font-size: 14.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.user {
  align-self: flex-end;
  background: rgba(255, 106, 43, 0.16);
  border: 1px solid rgba(255, 106, 43, 0.32);
}
.msg.agent {
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.msg.sys {
  align-self: center;
  background: none;
  border: none;
  color: var(--txt-2);
  font-size: 12.5px;
}
/* 思考中气泡:三点脉冲 + 计时(照 Binance AI「Thought for Ns」) */
.msg.agent.thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--txt-2);
}
.msg.agent.thinking .dots {
  display: inline-flex;
  gap: 4px;
}
.msg.agent.thinking .dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.4;
  animation: think-pulse 1.2s ease-in-out infinite;
}
.msg.agent.thinking .dots i:nth-child(2) {
  animation-delay: 0.18s;
}
.msg.agent.thinking .dots i:nth-child(3) {
  animation-delay: 0.36s;
}
.msg.agent.thinking .think-t {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
@keyframes think-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
#chat-input:disabled,
#chat-form .btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#chat-form {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
#chat-input {
  flex: 1;
  padding: 11px 14px;
  background: var(--bg-2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
}
#chat-input:focus {
  outline: none;
  border-color: var(--cyan);
}
#chat-form .btn-primary {
  width: auto;
  padding: 11px 26px;
  margin: 0;
}

/* 说明抽屉 */
#about-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(430px, 92vw);
  z-index: 30;
  background: rgba(13, 18, 30, 0.97);
  border-left: 1px solid var(--line);
  padding: 30px 28px;
  overflow-y: auto;
  backdrop-filter: blur(16px);
  box-shadow: -22px 0 60px rgba(0, 0, 0, 0.5);
}
#about-drawer h3 {
  margin-top: 4px;
}
#about-drawer p,
#about-drawer li {
  font-size: 14px;
  color: var(--txt-2);
}
#about-drawer b {
  color: var(--txt);
}
#about-drawer code {
  font-family: ui-monospace, monospace;
  font-size: 12.5px;
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--cyan);
}
#about-drawer a {
  color: var(--cyan);
}
.about-close {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 22px;
  background: none;
  border: none;
  color: var(--txt-2);
  cursor: pointer;
}

#foot {
  text-align: center;
  color: var(--txt-2);
  font-size: 12px;
  padding: 26px 16px 34px;
}

@media (max-width: 860px) {
  #view-auth {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .hero-points {
    gap: 22px;
    flex-wrap: wrap;
  }
  .view {
    padding: 30px 18px 60px;
  }
  #topbar {
    padding: 12px 16px;
  }
}
