:root {
  --bg-start: #0a0e27;
  --bg-end: #1a0f3d;
  --card-bg: rgba(15, 18, 45, 0.85);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.72);
  --border: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 25%, rgba(79, 127, 255, 0.4), transparent 45%),
    radial-gradient(circle at 80% 35%, rgba(168, 85, 255, 0.35), transparent 50%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
}

.page,
.scene {
  min-height: 100vh;
}

.scene {
  position: relative;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 40%, rgba(79, 127, 255, 0.3), transparent 50%),
    radial-gradient(circle at 65% 25%, rgba(168, 85, 255, 0.25), transparent 50%);
  filter: blur(28px);
}

.card {
  position: relative;
  min-height: 100vh;
  padding: 34px;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.header {
  margin-bottom: 22px;
  text-align: center;
  min-height: 40px;
  position: relative;
}

.back-button {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.45);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.22), rgba(168, 85, 255, 0.16));
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.title {
  margin: 0;
  font-size: clamp(1.7rem, 3.8vw, 2.3rem);
  background: linear-gradient(135deg, #4f7fff, #a855ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.section {
  margin-bottom: 18px;
}

.is-hidden {
  display: none;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.93rem;
  font-weight: 600;
}

.textarea,
.input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 12px;
  font-family: inherit;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.textarea {
  min-height: 160px;
  resize: vertical;
}

.token-textarea {
  min-height: 120px;
}

.body-textarea {
  min-height: 120px;
}

.private-key-textarea {
  min-height: 160px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.check-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 0.93rem;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: center;
}

.env-select {
  width: 100%;
}

.query-main-btn {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  position: relative;
  overflow: hidden;
  transition: opacity 0.2s;
}

/* 按钮加载中：禁用点击 + shimmer 光扫 */
.query-main-btn.loading {
  pointer-events: none;
  opacity: 0.88;
}
.query-main-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.18) 50%, transparent 100%);
  animation: btn-shimmer 1.1s ease-in-out infinite;
}
@keyframes btn-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* 转圈 spinner */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  margin-right: 7px;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.action-row-jwt {
  grid-template-columns: 1fr 1fr;
}

.action-button {
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
  padding: 12px;
  cursor: pointer;
}

.manual-json-input {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  margin-bottom: 10px;
}

.parse-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.prod-btn {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.38), rgba(59, 130, 246, 0.35));
  border-color: rgba(52, 211, 153, 0.58);
}

.sandbox-btn {
  background: linear-gradient(135deg, rgba(168, 85, 255, 0.45), rgba(79, 127, 255, 0.35));
  border-color: rgba(168, 85, 255, 0.58);
}

.both-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.45), rgba(99, 102, 241, 0.35));
  border-color: rgba(245, 158, 11, 0.58);
}

.jwt-btn {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.45), rgba(59, 130, 246, 0.38));
  border-color: rgba(14, 165, 233, 0.58);
}

.p8-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.45), rgba(79, 127, 255, 0.36));
  border-color: rgba(168, 85, 247, 0.58);
}

/* 结果区扫描线动画 */
.result-output {
  position: relative;
  overflow: hidden;
}
.result-output.scanning::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #a78bfa, #60a5fa, #34d399, transparent);
  animation: scan-line 1.3s ease-in-out infinite;
  pointer-events: none;
  border-radius: 2px;
  z-index: 1;
}
@keyframes scan-line {
  0%   { top: 0%;   opacity: 0.8; }
  80%  { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

/* 状态徽章脂动 */
.status-badge.pulsing {
  animation: badge-pulse 1s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
}

.status-badge {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  color: var(--muted);
}

.result-output {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 35, 0.8);
  color: #dbe7ff;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
}

.parsed-output {
  max-height: none;
  overflow: visible;
  min-height: 56px;
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@media (max-width: 900px) {
  .card {
    padding: 22px;
  }

  .header {
    text-align: left;
    padding-top: 42px;
  }

  .two-cols,
  .action-row {
    grid-template-columns: 1fr;
  }
}
