/* ============================================================
   New API Status Monitor - Dark Cyber Compact Theme
   战天下出品 - 紧凑暗色科技风
   ============================================================ */

:root {
  --bg-primary: #080b12;
  --panel-bg: rgba(13, 17, 23, 0.85);
  --panel-border: rgba(56, 189, 248, 0.08);
  --card-bg: rgba(15, 23, 42, 0.6);
  --card-bg-hover: rgba(15, 23, 42, 0.8);
  --card-border: rgba(148, 163, 184, 0.08);
  --card-border-hover: rgba(56, 189, 248, 0.15);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-bright: #f8fafc;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.15);
  --green: #34d399;
  --green-glow: rgba(52, 211, 153, 0.25);
  --yellow: #fbbf24;
  --yellow-glow: rgba(251, 191, 36, 0.25);
  --red: #f87171;
  --red-glow: rgba(248, 113, 113, 0.25);
  --empty: #374151;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
}

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

html, body {
  min-height: 100vh;
  font-family: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 16px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, #080b12 0%, #0c1220 50%, #080b12 100%);
}

.page-shell { position: relative; max-width: 1200px; margin: 0 auto; }

/* --- Ambient Orbs (smaller, subtler) --- */
.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}
.ambient-1 {
  width: 300px; height: 300px;
  top: -80px; left: -60px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.1), transparent 70%);
  animation: drift1 18s ease-in-out infinite alternate;
}
.ambient-2 {
  width: 250px; height: 250px;
  bottom: -40px; right: -50px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08), transparent 70%);
  animation: drift2 22s ease-in-out infinite alternate;
}
.ambient-3 {
  width: 180px; height: 180px;
  top: 40%; left: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.05), transparent 70%);
  animation: drift3 15s ease-in-out infinite alternate;
}
@keyframes drift1 { 0% { transform: translate(0,0); } 100% { transform: translate(30px,20px); } }
@keyframes drift2 { 0% { transform: translate(0,0); } 100% { transform: translate(-20px,-30px); } }
@keyframes drift3 { 0% { transform: translate(-50%,0); } 100% { transform: translate(-45%,15px); } }

/* --- Main Panel --- */
.embed-panel {
  position: relative;
  z-index: 1;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.04), 0 4px 20px rgba(0,0,0,0.25);
}

/* --- Header: compact --- */
.panel-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
}
.hero-copy { max-width: 600px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 700;
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent), 0 0 14px rgba(56, 189, 248, 0.25);
  animation: pulse-live 2s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

h1 {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

/* Hero Stats: compact inline */
.hero-stats {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.hero-stat {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255, 0.03);
  border: 1px solid rgba(255,255,255, 0.06);
  transition: all 0.25s ease;
}
.hero-stat:hover { border-color: rgba(255,255,255, 0.1); }

.hero-stat-primary {
  background: linear-gradient(135deg, rgba(56,189,248,0.07), rgba(56,189,248,0.02));
  border-color: rgba(56,189,248,0.1);
}

.hero-stat-label {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-stat-value {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-bright);
}

.hero-stat-primary .hero-stat-value {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Meta Card: compact */
.meta-card {
  min-width: 180px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255, 0.03);
  border: 1px solid rgba(255,255,255, 0.06);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 11px;
}
.meta-row-strong span { color: var(--text-muted); }
.meta-row-strong strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.meta-row + .meta-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.meta-row strong {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
}

/* --- Toolbar / Segmented: compact pills --- */
.toolbar { margin-top: 14px; }

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255, 0.03);
  border: 1px solid rgba(255,255,255, 0.06);
}

.segmented button {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
}
.segmented button:hover {
  color: var(--text-primary);
  background: rgba(255,255,255, 0.04);
}
.segmented button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(56,189,248,0.85), rgba(99,102,241,0.75));
  box-shadow: 0 2px 10px rgba(56,189,248,0.2);
}

/* --- State Message --- */
.state-message {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255, 0.02);
  border: 1px dashed rgba(255,255,255, 0.07);
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
}
.state-message.loading { animation: shimmer 2s ease-in-out infinite; }
@keyframes shimmer { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.state-message.error {
  color: var(--red);
  border-color: rgba(248,113,113,0.18);
  background: rgba(248,113,113,0.05);
}

/* --- Cards Grid: 2 columns on desktop --- */
.cards {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* --- Status Card: compact --- */
.status-card {
  position: relative;
  padding: 14px 14px 14px 18px;
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  animation: cardFadeIn 0.35s ease backwards;
  animation-delay: var(--delay, 0s);
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-card:hover {
  transform: translateY(-2px);
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 20px rgba(56,189,248,0.04);
}

/* Left accent bar */
.status-accent {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--empty);
  border-radius: 0 2px 2px 0;
}
.status-card-green .status-accent {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}
.status-card-yellow .status-accent {
  background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow-glow);
}
.status-card-red .status-accent {
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

/* Card Top */
.card-top {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: flex-start;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Status Dot: breathing */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--empty);
  flex-shrink: 0;
}
.status-dot.green {
  background: var(--green);
  box-shadow: 0 0 4px var(--green-glow);
  animation: breathe-g 3s ease-in-out infinite;
}
.status-dot.yellow {
  background: var(--yellow);
  box-shadow: 0 0 4px var(--yellow-glow);
  animation: breathe-y 3s ease-in-out infinite;
}
.status-dot.red {
  background: var(--red);
  box-shadow: 0 0 4px var(--red-glow);
  animation: breathe-r 2s ease-in-out infinite;
}
@keyframes breathe-g {
  0%,100% { box-shadow: 0 0 3px var(--green-glow); }
  50% { box-shadow: 0 0 8px var(--green-glow), 0 0 16px rgba(52,211,153,0.15); }
}
@keyframes breathe-y {
  0%,100% { box-shadow: 0 0 3px var(--yellow-glow); }
  50% { box-shadow: 0 0 8px var(--yellow-glow), 0 0 16px rgba(251,191,36,0.15); }
}
@keyframes breathe-r {
  0%,100% { box-shadow: 0 0 3px var(--red-glow); }
  50% { box-shadow: 0 0 8px var(--red-glow), 0 0 16px rgba(248,113,113,0.2); }
}

.model-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* Status Pill: small */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-pill.green {
  color: var(--green);
  background: rgba(52,211,153, 0.1);
  border-color: rgba(52,211,153, 0.18);
}
.status-pill.yellow {
  color: var(--yellow);
  background: rgba(251,191,36, 0.1);
  border-color: rgba(251,191,36, 0.18);
}
.status-pill.red {
  color: var(--red);
  background: rgba(248,113,113, 0.1);
  border-color: rgba(248,113,113, 0.18);
}
.status-pill.empty {
  color: var(--text-muted);
  background: rgba(100,116,139, 0.1);
  border-color: rgba(100,116,139, 0.12);
}

.card-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
}

/* Metric Grid: compact */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 10px;
  text-align: right;
  flex-shrink: 0;
}
.metric-label {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.metric-value {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-bright);
}
.metric-success { color: var(--text-bright); }

/* --- Timeline: compact --- */
.timeline-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255, 0.04);
}

.timeline {
  display: grid;
  gap: 3px;
  align-items: end;
  min-height: 48px;
  width: 100%;
  overflow: visible;
}

.timeline-slot {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0; padding: 0;
  cursor: pointer;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.timeline-bar {
  display: block;
  width: 100%;
  min-width: 4px;
  border-radius: 3px 3px 1px 1px;
  transition: all 0.18s ease;
  opacity: 0.85;
}
.timeline-slot:hover .timeline-bar,
.timeline-slot:focus-visible .timeline-bar {
  transform: translateY(-1px) scaleY(1.06);
  opacity: 1;
}

.timeline-bar.green {
  background: linear-gradient(180deg, #6ee7b7, #10b981);
  box-shadow: 0 1px 6px rgba(52,211,153, 0.18);
}
.timeline-slot:hover .timeline-bar.green { box-shadow: 0 2px 12px rgba(52,211,153,0.3); }

.timeline-bar.yellow {
  background: linear-gradient(180deg, #fde68a, #d97706);
  box-shadow: 0 1px 6px rgba(251,191,36, 0.18);
}
.timeline-slot:hover .timeline-bar.yellow { box-shadow: 0 2px 12px rgba(251,191,36,0.3); }

.timeline-bar.red {
  background: linear-gradient(180deg, #fca5a5, #dc2626);
  box-shadow: 0 1px 6px rgba(248,113,113, 0.18);
}
.timeline-slot:hover .timeline-bar.red { box-shadow: 0 2px 12px rgba(248,113,113,0.3); }

.timeline-bar.empty {
  background: linear-gradient(180deg, #475569, #1e293b);
  box-shadow: none;
  opacity: 0.45;
}
.timeline-slot:hover .timeline-bar.empty { opacity: 0.65; }

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* --- Tooltip --- */
.tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.12);
  box-shadow: 0 12px 36px rgba(0,0,0,0.35), 0 0 16px rgba(56,189,248,0.06);
  backdrop-filter: blur(14px);
  pointer-events: none;
}
.tooltip-title {
  margin: 0 0 6px;
  color: var(--text-bright);
  font-size: 12px;
  font-weight: 700;
}
.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-secondary);
  font-size: 11px;
}
.tooltip-row + .tooltip-row { margin-top: 4px; }
.tooltip-row strong { color: var(--text-bright); font-weight: 600; }

/* --- Footer --- */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255, 0.04);
  color: var(--text-muted);
  font-size: 11px;
}
.footer-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
}

/* --- Responsive --- */
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  body { padding: 10px; }
  .embed-panel { padding: 14px; }
  .panel-header, .card-top { flex-direction: column; }
  .hero-stats { width: 100%; }
  .hero-stat { flex: 1 1 0; min-width: 0; }
  .meta-card, .metric-grid { width: 100%; min-width: 0; }
  .metric-grid { text-align: left; }
  .meta-row-strong strong { font-size: 14px; }
  h1 { font-size: 20px; }
  .model-name { font-size: 13px; }
  .metric-value { font-size: 16px; }
  .hero-stat-value { font-size: 18px; }
  .cards { gap: 8px; }
}

/* --- Misc --- */
::selection { background: rgba(56,189,248,0.25); color: #fff; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }
