/* SkyBreak Platform - Design System */
:root {
  --bg-primary: #07090e;
  --bg-secondary: #0d111a;
  --bg-card: #131926;
  --bg-card-hover: #182032;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --glow-cyan: rgba(6, 182, 212, 0.25);
  --glow-emerald: rgba(16, 185, 129, 0.25);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background grid glow */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 15% 70%, rgba(99, 102, 241, 0.06) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 17, 26, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--glow-cyan);
}

.brand-logo-icon svg {
  width: 22px;
  height: 22px;
  color: #fff;
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.probe-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

.select-control {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-control:hover, .select-control:focus {
  border-color: var(--border-focus);
}

/* Hero Section */
.hero-section {
  padding: 48px 0 32px 0;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 9999px;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}

.hero-title {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 760px;
  margin: 0 auto 36px auto;
  color: var(--text-muted);
  font-size: 1.05rem;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-meta {
  font-size: 0.78rem;
  color: var(--accent-emerald);
  font-weight: 500;
}

/* Filter & Controls Toolbar */
.toolbar-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 24px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px 10px 42px;
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #06b6d4, #3b82f6);
  color: #fff;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 22px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Category Filter Tags */
.filter-tags-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-pill:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.filter-pill.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--accent-blue);
  color: #60a5fa;
}

/* Leaderboard Table */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 40px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  background: rgba(13, 17, 26, 0.95);
  padding: 16px 20px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  cursor: pointer;
}

.leaderboard-table th:hover {
  color: var(--text-main);
}

.leaderboard-table td {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
  vertical-align: middle;
}

.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Table Cells */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--bg-card);
  color: var(--text-muted);
}

.rank-1 {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #000;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.rank-2 {
  background: linear-gradient(135deg, #e2e8f0, #94a3b8);
  color: #000;
}

.rank-3 {
  background: linear-gradient(135deg, #f97316, #b45309);
  color: #fff;
}

.model-name-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.model-name-text {
  font-weight: 700;
  color: #fff;
  font-size: 0.96rem;
}

.provider-badge {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.model-desc-small {
  font-size: 0.76rem;
  color: var(--text-dim);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.latency-meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.latency-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
}

.val-fast { color: var(--accent-emerald); }
.val-med { color: var(--accent-amber); }
.val-slow { color: var(--accent-rose); }

.latency-bar-track {
  width: 90px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.latency-bar-fill {
  height: 100%;
  border-radius: 2px;
}

.bar-fast { background: var(--accent-emerald); }
.bar-med { background: var(--accent-amber); }
.bar-slow { background: var(--accent-rose); }

.tps-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #38bdf8;
}

.price-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.price-in {
  color: #cbd5e1;
}

.price-out {
  color: var(--text-dim);
  font-size: 0.78rem;
}

.cache-discount-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.cell-actions {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--border-focus);
}

/* Calculator & Code Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  max-width: 640px;
  width: 100%;
  padding: 28px;
  position: relative;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.code-snippet-box {
  background: #05070a;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8;
  overflow-x: auto;
  position: relative;
  margin-bottom: 16px;
}

/* Calculator Section */
.calc-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 36px;
  margin-bottom: 48px;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.calc-slider-group {
  margin-bottom: 20px;
}

.calc-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.calc-slider {
  width: 100%;
  accent-color: var(--accent-cyan);
}

/* Sponsor & Affiliate Banner */
.sponsor-banner {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 16px;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 48px;
}

.sponsor-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
}

.sponsor-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 40px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--accent-cyan);
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr; }
  .sponsor-banner { flex-direction: column; text-align: center; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-right .probe-status-pill { display: none; }
  .hero-title { font-size: 2rem; }
}
