/* Sorajima Speed - Premium Telemetry Console Styles */

:root {
  /* Fonts */
  --font-brand: "Unbounded", system-ui, -apple-system, sans-serif;
  --font-hero: "Jacobs", system-ui, -apple-system, sans-serif;
  --font-main: "Jacobs", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Fira Code", monospace;

  /* Dark Theme Palette (Default) */
  --bg-page: #141414;
  --bg-surface: #191919;
  --bg-card: rgba(26, 26, 26, 0.85);
  --bg-card-hover: rgba(34, 34, 34, 0.95);
  --bg-badge: rgba(255, 255, 255, 0.05);

  --fg-primary: #ffffff;
  --fg-secondary: #a0a0a0;
  --fg-tertiary: #666666;

  --accent: #faa0a0;
  --accent-secondary: #ef73af;
  --accent-contrast: #141414;
  --accent-hover: #ffb8b8;

  --star-fill: #ffffff;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(250, 160, 160, 0.4);
  --border-dotted: 1px dotted rgba(255, 255, 255, 0.2);

  --status-good: #4ade80;
  --status-warn: #fbbf24;
  --status-bad: #f87171;

  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.45);
  --glow-color: rgba(250, 160, 160, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-console: 28px;
  --radius-pill: 9999px;

  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-page: #cddbe9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-badge: rgba(25, 39, 56, 0.06);

  --fg-primary: #141414;
  --fg-secondary: #4a5568;
  --fg-tertiary: #718096;

  --accent: #ef73af;
  --accent-secondary: #e0407b;
  --accent-contrast: #ffffff;
  --accent-hover: #e0407b;

  --star-fill: #141414;
  --border-subtle: rgba(25, 39, 56, 0.12);
  --border-focus: rgba(239, 115, 175, 0.45);
  --border-dotted: 1px dotted rgba(25, 39, 56, 0.25);

  --status-good: #16a34a;
  --status-warn: #d97706;
  --status-bad: #dc2626;

  --shadow-card: 0 20px 50px rgba(25, 39, 56, 0.07);
  --glow-color: rgba(239, 115, 175, 0.2);
}

/* Font Declarations */
@font-face {
  font-family: "Unbounded";
  src: url("assets/fonts/unbounded-cyrillic.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Jacobs";
  src: url("assets/fonts/jacobs-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Jacobs";
  src: url("assets/fonts/jacobs-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Jacobs";
  src: url("assets/fonts/jacobs-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Jacobs";
  src: url("assets/fonts/jacobs-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/mts-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/mts-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/mts-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
}

[data-theme="light"] body {
  background-image:
    linear-gradient(to right, rgba(25, 39, 56, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(25, 39, 56, 0.03) 1px, transparent 1px);
}

/* Site Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 90px;
  pointer-events: none;
}

.header-logo-desktop {
  position: fixed;
  top: 48px;
  left: max(32px, calc(50vw - 580px + 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  z-index: 150;
  pointer-events: auto;
}

.brand-logo-svg {
  width: 32px;
  height: 24px;
}
.logo-accent-path {
  fill: var(--accent);
  transition: fill 0.25s ease;
}
.logo-star-path {
  fill: var(--star-fill);
  transition: fill 0.25s ease;
}

.brand-name {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 20px;
  color: var(--fg-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}
.brand-dot {
  color: var(--accent);
  transition: color 0.25s ease;
}

.header-subbrand-text {
  font-family: var(--font-brand);
  font-weight: 400;
  font-size: 14.5px;
  color: var(--fg-tertiary);
  letter-spacing: -0.02em;
  margin-left: 2px;
  line-height: 1;
}

.header-actions-group {
  position: fixed;
  top: 48px;
  right: max(32px, calc(50vw - 580px + 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 150;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .header-logo-desktop {
    top: 24px;
    left: 20px;
  }
  .header-actions-group {
    top: 24px;
    right: 20px;
    gap: 8px;
  }
}

@media (max-width: 680px) {
  .header-status-pill {
    display: none !important;
  }
  .header-logo-desktop {
    top: 20px;
    left: 16px;
    gap: 8px;
  }
  .brand-logo-svg {
    width: 26px;
    height: 20px;
  }
  .brand-name {
    font-size: 18px;
  }
  .header-subbrand-text {
    font-size: 13px;
  }
  .header-actions-group {
    top: 20px;
    right: 16px;
    gap: 6px;
  }
  .btn-pill-secondary {
    padding: 6px 12px;
    font-size: 12px;
  }
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-secondary);
}

.status-dot-active {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-good);
  box-shadow: 0 0 8px var(--status-good);
  animation: pulse-dot 2.5s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.btn-pill-secondary {
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  color: var(--fg-secondary);
  font-family: var(--font-main);
  font-size: 12.5px;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-pill-secondary:hover {
  color: var(--fg-primary);
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.08);
}
[data-theme="light"] .btn-pill-secondary:hover {
  border-color: rgba(25, 39, 56, 0.35);
  background-color: rgba(25, 39, 56, 0.08);
}

.btn-theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: var(--border-dotted);
  background: var(--bg-badge);
  color: var(--fg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.btn-theme-toggle:hover {
  color: var(--fg-primary);
  border-color: rgba(255, 255, 255, 0.3);
}
.btn-theme-toggle svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
}

/* Page Container */
.page-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 130px 24px 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 10;
}

@media (max-width: 680px) {
  .page-container {
    padding: 95px 16px 60px;
  }
}

/* Hero Section */
.hero-content {
  text-align: center;
  margin-bottom: 34px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--bg-badge);
  border: 1px dotted rgba(239, 115, 175, 0.35);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 18px;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--font-hero);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--fg-primary);
  margin-bottom: 12px;
}
.hero-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  transition: color 0.25s ease;
}

.hero-description {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fg-secondary);
  max-width: 640px;
  margin: 0 auto;
}

/* Unified Telemetry Console */
.speed-console {
  width: 100%;
  max-width: 960px;
  background: rgba(22, 22, 24, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-console);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

[data-theme="light"] .speed-console {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(25, 39, 56, 0.12);
  box-shadow: 0 30px 80px rgba(25, 39, 56, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Console Header */
.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}
[data-theme="light"] .console-header {
  background: rgba(25, 39, 56, 0.02);
}

.console-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fg-secondary);
}

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

.console-node-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-tertiary);
}
.console-node-badge svg {
  opacity: 0.7;
}

/* Console Body - Two Column Telemetry Stage */
.console-body {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 36px;
  padding: 38px 32px 32px;
  align-items: center;
}

@media (max-width: 820px) {
  .console-body {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 24px 20px;
  }
}

/* Left Column - Dial Gauge */
.gauge-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-wrapper {
  position: relative;
  width: 320px;
  height: 205px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.precision-dial-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Dial Ticks */
.dial-tick {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.dial-tick.major {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 2.5;
}
[data-theme="light"] .dial-tick {
  stroke: rgba(25, 39, 56, 0.16);
}
[data-theme="light"] .dial-tick.major {
  stroke: rgba(25, 39, 56, 0.45);
}

/* Dial Track */
.dial-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 8;
  stroke-linecap: round;
}
[data-theme="light"] .dial-track {
  stroke: rgba(25, 39, 56, 0.08);
}

/* Dial Progress Arc */
.dial-progress {
  fill: none;
  stroke: url(#arcGradDark);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 377; /* 377 = empty, 0 = full */
  filter: url(#neonGlow);
  transition: stroke-dashoffset 0.16s ease-out;
}
[data-theme="light"] .dial-progress {
  stroke: url(#arcGradLight);
}

/* Dial Center Display */
.dial-center {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  text-align: center;
}

.dial-current-stage {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.dial-speed-val {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 50px;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
}

.dial-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fg-tertiary);
  margin-top: 4px;
}

/* Live Throughput Canvas Wave */
.throughput-chart-wrap {
  width: 100%;
  max-width: 300px;
  height: 42px;
  margin: 8px auto 18px;
}
#throughputChart {
  width: 100%;
  height: 100%;
  display: block;
}

/* Action CTA Button */
.console-actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

.btn-sorajima-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 260px;
  height: 46px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #ef73af 0%, #faa0a0 100%);
  color: #141414;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(239, 115, 175, 0.35);
  transition: var(--transition);
}
.btn-sorajima-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(239, 115, 175, 0.5);
}
.btn-sorajima-cta:active {
  transform: translateY(0);
}

.btn-sorajima-cta.running {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 80, 80, 0.45);
  color: #ff6b6b;
  box-shadow: none;
}
.btn-sorajima-cta.running:hover {
  background: rgba(255, 80, 80, 0.12);
  border-color: #ff6b6b;
}

/* Right Column - Telemetry Panel & Stepper */
.telemetry-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Stepper Bar */
.stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.025);
  border: var(--border-dotted);
  border-radius: var(--radius-pill);
  padding: 7px 16px;
}
[data-theme="light"] .stepper-bar {
  background: rgba(25, 39, 56, 0.035);
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
  transition: var(--transition);
}
.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-tertiary);
  opacity: 0.4;
  transition: var(--transition);
}
.step-pill.active {
  color: var(--accent);
}
.step-pill.active .step-dot {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1.5s infinite ease-in-out;
}
.step-pill.done {
  color: var(--fg-secondary);
}
.step-pill.done .step-dot {
  background: var(--status-good);
  opacity: 1;
}

.step-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  margin: 0 10px;
}

/* Metrics 2x2 Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.telemetry-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .telemetry-card {
  background: rgba(25, 39, 56, 0.025);
}

.telemetry-card.active-stage {
  border-color: rgba(239, 115, 175, 0.6);
  background: rgba(239, 115, 175, 0.04);
  box-shadow: 0 0 24px rgba(239, 115, 175, 0.12);
}

.tc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tc-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tc-label svg {
  opacity: 0.7;
}

.tc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: var(--transition);
}
.active-stage .tc-status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse-dot 1.5s infinite ease-in-out;
}

.tc-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.tc-val {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.tc-unit {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-tertiary);
}

/* Console Footer Bar */
.console-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-tertiary);
  flex-wrap: wrap;
}
[data-theme="light"] .console-footer {
  background: rgba(25, 39, 56, 0.03);
}

.cf-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cf-k {
  color: var(--fg-tertiary);
}
.cf-v {
  color: var(--fg-secondary);
  font-weight: 600;
}
.cf-sep {
  opacity: 0.3;
}

/* Auth Modal Overlay */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.auth-popup-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 32px 36px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.auth-brand-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.auth-star-svg {
  width: 42px;
  height: 32px;
}

.auth-brand-name {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 24px;
  color: var(--fg-primary);
  letter-spacing: -0.04em;
}

.auth-subbrand {
  font-weight: 400;
  font-size: 18px;
  color: var(--fg-tertiary);
  margin-left: 2px;
}

.auth-input-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field-wrapper {
  position: relative;
  width: 100%;
}

.auth-password-field {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 16px;
  border-radius: var(--radius-pill);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}

.auth-password-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--glow-color);
}

.btn-toggle-eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-toggle-eye:hover {
  color: var(--fg-primary);
}

.auth-error-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--status-bad);
  text-align: center;
}

.btn-auth-enter {
  width: 100%;
  height: 48px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  background-color: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(250, 160, 160, 0.25);
  transition: var(--transition);
}
.btn-auth-enter:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(250, 160, 160, 0.35);
  transform: translateY(-1px);
}

.shake-animation {
  animation: shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 0, 0); }
  40%, 60% { transform: translate3d(5px, 0, 0); }
}

.hidden-element {
  display: none !important;
}
