:root {
  --bg-base: #f4f5f7;
  --glass-bg: rgba(255, 255, 255, 0.76);
  --glass-border: rgba(255, 255, 255, 0.92);
  --glass-shadow: 0 14px 36px -12px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.03);
  --surface-sub: rgba(241, 244, 248, 0.78);
  --text-primary: #111318;
  --text-secondary: #5c6472;
  --text-muted: #8b93a1;
  --divider: rgba(15, 23, 42, 0.07);

  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.13);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --coral: #f43f5e;
  --coral-soft: rgba(244, 63, 94, 0.13);
  --violet: #8b5cf6;
  --violet-soft: rgba(139, 92, 246, 0.13);

  --cta-bg: #14161b;
  --cta-text: #ffffff;
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
}

body.dark-theme {
  --bg-base: #0c0d10;
  --glass-bg: rgba(23, 25, 31, 0.78);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.55);
  --surface-sub: rgba(33, 36, 45, 0.75);
  --text-primary: #f5f7fa;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --divider: rgba(255, 255, 255, 0.07);

  --cta-bg: #f5f7fa;
  --cta-text: #0f1115;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  transition: background-color 0.35s ease, color 0.35s ease;
  overflow-x: hidden;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

/* Arka Plan Ambiyans Küreleri (Mavisiz Sıcak/Zümrüt/Lavanta) */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(95px);
  opacity: 0.42;
  transition: opacity 0.4s ease;
}

body.dark-theme .orb {
  opacity: 0.22;
}

.orb-1 {
  width: 460px;
  height: 460px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.35), transparent 70%);
}

.orb-2 {
  width: 420px;
  height: 420px;
  top: 15%;
  right: -90px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.28), transparent 70%);
}

.orb-3 {
  width: 480px;
  height: 480px;
  bottom: -150px;
  left: 35%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.24), transparent 70%);
}

/* Cam Yüzey */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-xl);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.28s ease, box-shadow 0.28s ease;
}

body.dark-theme .glass-panel {
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Ana Kokpit Düzeni */
.cockpit-shell {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

/* Üst Bar */
.top-bar {
  padding: 12px 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--emerald-soft);
  color: var(--emerald);
  display: grid;
  place-items: center;
}

.brand-titles {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-titles h1 {
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.badge-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-emerald {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.badge-violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.net-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface-sub);
  border: 1px solid var(--divider);
  font-size: 0.78rem;
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 3px var(--emerald-soft);
  flex-shrink: 0;
}

.net-sep {
  color: var(--text-muted);
}

.net-ip {
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.action-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--surface-sub);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: transform 0.16s ease, background-color 0.2s ease;
}

.ctrl-btn:hover {
  transform: translateY(-1px);
  background: var(--glass-bg);
}

.ctrl-btn:active {
  transform: scale(0.97);
}

.count-chip {
  background: var(--emerald-soft);
  color: var(--emerald);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.68rem;
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 16px;
  align-items: stretch;
}

/* Sol Kadran Kartı */
.gauge-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.gauge-card.phase-glow-emerald {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: var(--glass-shadow), 0 0 32px rgba(16, 185, 129, 0.12);
}

.gauge-card.phase-glow-amber {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: var(--glass-shadow), 0 0 32px rgba(245, 158, 11, 0.12);
}

.gauge-card.phase-glow-coral {
  border-color: rgba(244, 63, 94, 0.45);
  box-shadow: var(--glass-shadow), 0 0 32px rgba(244, 63, 94, 0.12);
}

.gauge-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.step-track {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-sub);
  padding: 4px;
  border-radius: 999px;
}

.step-pill {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  transition: all 0.25s ease;
}

.step-pill.active-step {
  background: var(--text-primary);
  color: var(--bg-base);
}

.step-pill.done-step {
  color: var(--emerald);
  background: var(--emerald-soft);
}

.scale-tag {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.gauge-stage {
  position: relative;
  width: 100%;
  height: 225px;
  display: grid;
  place-items: center;
}

#speed-gauge {
  width: 240px;
  height: 225px;
  display: block;
}

.gauge-readout {
  position: absolute;
  top: 53%;
  left: 50%;
  transform: translate(-50%, -46%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.speed-number {
  font-size: 2.65rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.unit-toggle-btn {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 2px 7px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-toggle-btn:hover {
  background: var(--surface-sub);
  border-color: var(--divider);
  color: var(--text-primary);
}

.phase-badge {
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: var(--emerald-soft);
  color: var(--emerald);
  white-space: nowrap;
}

.phase-badge.phase-upload {
  background: var(--amber-soft);
  color: var(--amber);
}

.phase-badge.phase-ping {
  background: var(--coral-soft);
  color: var(--coral);
}

/* Butonlar */
.cta-row {
  display: flex;
  gap: 10px;
}

.primary-btn {
  flex: 1;
  height: 48px;
  border: none;
  border-radius: 15px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 22px -6px rgba(0, 0, 0, 0.24);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn.btn-running {
  background: var(--coral);
  color: #ffffff;
}

.secondary-btn {
  height: 48px;
  padding: 0 15px;
  border-radius: 15px;
  border: 1px solid var(--divider);
  background: var(--surface-sub);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  background: var(--glass-bg);
}

.hidden {
  display: none !important;
}

/* Canlı Akış Grafiği */
.wave-box {
  background: var(--surface-sub);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 11px 14px 8px;
}

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

.wave-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.wave-val {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
}

#wave-chart {
  width: 100%;
  height: 54px;
  display: block;
}

/* Sağ Sütun */
.right-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.metric-card.card-active-emerald {
  border-color: var(--emerald);
  box-shadow: var(--glass-shadow), 0 0 0 1px var(--emerald);
}

.metric-card.card-active-amber {
  border-color: var(--amber);
  box-shadow: var(--glass-shadow), 0 0 0 1px var(--amber);
}

.metric-card.card-active-coral {
  border-color: var(--coral);
  box-shadow: var(--glass-shadow), 0 0 0 1px var(--coral);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.icon-chip {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.chip-emerald {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.chip-amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.chip-coral {
  background: var(--coral-soft);
  color: var(--coral);
}

.chip-violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.metric-val {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.metric-unit {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.metric-sub {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* Hat Kalite Endeksi */
.quality-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.quality-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quality-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.quality-info h2 {
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.quality-info p {
  font-size: 0.77rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.quality-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scenario-chips {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sc-chip {
  font-size: 0.67rem;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--surface-sub);
  border: 1px solid var(--divider);
  color: var(--text-muted);
  transition: all 0.25s ease;
}

.sc-chip.sc-ok {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.25);
  color: var(--emerald);
}

.sc-chip.sc-warn {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.25);
  color: var(--amber);
}

.score-pill {
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--surface-sub);
  border: 1px solid var(--divider);
  font-size: 0.98rem;
  font-weight: 800;
}

.score-pill small {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quality-bar-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-sub);
  overflow: hidden;
}

.quality-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald), #34d399, var(--amber));
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Alt İkili Kartlar */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.detail-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-title-group {
  display: flex;
  align-items: center;
  gap: 11px;
}

.detail-title-group h3 {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.detail-title-group p {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.grade-badge {
  min-width: 30px;
  height: 28px;
  padding: 0 9px;
  border-radius: 9px;
  background: var(--surface-sub);
  border: 1px solid var(--divider);
  font-size: 0.78rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.grade-A {
  background: var(--emerald-soft);
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.28);
}

.grade-B {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.28);
}

.grade-F {
  background: var(--coral-soft);
  color: var(--coral);
  border-color: rgba(244, 63, 94, 0.28);
}

.stat-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  border-radius: 12px;
  background: var(--surface-sub);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.stat-row strong {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Alt Bilgi */
.footer-note {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-top: 2px;
}

/* Geçmiş Çekmecesi */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.history-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(440px, calc(100vw - 28px));
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  z-index: 50;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.history-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-head h3 {
  font-size: 1rem;
  font-weight: 800;
}

.drawer-head p {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-danger-btn {
  background: var(--coral-soft);
  color: var(--coral);
  border: none;
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.close-drawer-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background: var(--surface-sub);
  color: var(--text-primary);
  cursor: pointer;
}

.table-wrap {
  overflow-y: auto;
  flex: 1;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.history-table th {
  text-align: left;
  padding: 8px 6px;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--divider);
}

.history-table td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--divider);
}

.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 10px !important;
}

/* Tablet ve Mobil Optimizasyonu */
@media (max-width: 1080px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .cockpit-shell {
    padding: 12px 12px 24px;
    gap: 12px;
    justify-content: flex-start;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
  }

  .brand-cluster {
    justify-content: space-between;
  }

  .header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .net-pill {
    justify-content: center;
    font-size: 0.74rem;
    padding: 7px 10px;
  }

  .action-pills {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }

  .ctrl-btn {
    justify-content: center;
    height: 36px;
  }

  .gauge-card {
    padding: 16px;
  }

  .gauge-stage {
    height: 205px;
  }

  #speed-gauge {
    width: 220px;
    height: 205px;
  }

  .speed-number {
    font-size: 2.35rem;
  }

  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .metric-card {
    padding: 14px;
    gap: 9px;
    border-radius: 18px;
  }

  .metric-val {
    font-size: 1.48rem;
  }

  .quality-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .quality-right {
    width: 100%;
    justify-content: space-between;
  }

  .scenario-chips {
    flex-wrap: wrap;
  }

  .bottom-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .detail-card {
    padding: 15px;
    border-radius: 18px;
  }
}
