/* === SPEEDPROMPT CUSTOM BRAND STYLING === */

:root {
  /* ---- Golden-ratio scale (phi = 1.618) ---- */
  --phi: 1.618;
  --s-1: 0.382rem;
  --s-2: 0.618rem;
  --s-3: 1rem;
  --s-4: 1.618rem;
  --s-5: 2.618rem;
  --s-6: 4.236rem;
  --t-sm: 0.786rem;
  --t-base: 1rem;
  --t-md: 1.272rem;
  --t-lg: 1.618rem;
  --t-xl: 2.618rem;
  --t-2xl: 4.236rem;

  /* ---- Neutrals (DARK = default) ---- */
  --color-bg-slate-950: #020617;
  --color-bg-slate-900: #0f172a;
  --color-bg-grad: #1e1b4b;
  --color-surface: #1e293b;
  --color-border: #1e293b;
  --color-border-strong: #334155;
  --color-card-bg: rgba(30, 41, 59, 0.45);
  --color-header-bg: rgba(15, 23, 42, 0.6);
  --color-white: #ffffff;
  --color-text: #e2e8f0;
  --color-text-soft: #94a3b8;
  --color-text-muted: #64748b;
  --color-text-muted-2: #475569;

  /* ---- Accents ---- */
  --color-accent-cyan: #38bdf8;
  --color-accent-cyan-hover: #0ea5e9;
  --color-accent-coral: #ff5a36;
  --color-accent-coral-hover: #e04826;
  --color-accent-green: #10b981;

  /* ---- Theme widget (dark default) ---- */
  --tt-panel-bg: #161d2e;
  --tt-panel-border: rgba(255, 255, 255, 0.12);
  --tt-panel-text: #f0f2f8;
  --tt-panel-muted: #9aa3b8;
  --tt-btn-bg: #232c42;
  --tt-btn-bg-hover: #2e3850;
  --tt-btn-active-bg: #38bdf8;
  --tt-btn-active-text: #07111f;
  --tt-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);

  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-card: 20px;
  --radius-inner: 12px;
  --transition-speed: 0.25s;
}

/* === RESET & SYSTEM FOUNDATIONS === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--color-bg-slate-950);
  background-image: radial-gradient(circle at top right, var(--color-bg-grad) 0%, var(--color-bg-slate-950) 60%);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.5;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--color-accent-cyan);
  text-decoration: none;
  transition: opacity var(--transition-speed);
}

a:hover {
  opacity: 0.85;
}

/* === DESKTOP HEADER === */
header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-header-bg);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  color: var(--color-accent-cyan);
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.brand-logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-white);
}

.subdomain-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  color: var(--color-accent-cyan);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-weight: 500;
}

/* === MAIN PORT CONTAINER === */
main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 3.5rem 2rem;
}

/* === CENTRAL HERO CARD === */
.main-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(16px);
  padding: 3.5rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 640px) {
  .main-card {
    padding: 2rem 1.5rem;
  }
}

.badge-accent {
  background: rgba(255, 90, 54, 0.08);
  color: var(--color-accent-coral);
  border: 1px solid rgba(255, 90, 54, 0.2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.45rem 1rem;
  border-radius: 30px;
}

.main-card h2 {
  font-size: 2.75rem;
  font-weight: 900;
  color: var(--color-white);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

@media (max-width: 640px) {
  .main-card h2 {
    font-size: 2rem;
  }
}

.subtitle-desc {
  font-size: 1.05rem;
  color: var(--color-text-soft);
  line-height: 1.6;
  max-width: 600px;
}

/* === INPUT ROW ELEMENT === */
.input-row {
  display: flex;
  width: 100%;
  max-width: 680px;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

@media (max-width: 640px) {
  .input-row {
    flex-direction: column;
  }
}

.modern-input {
  flex: 1;
  background: var(--color-header-bg);
  border: 1.5px solid var(--color-border);
  color: var(--color-white);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-inner);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-speed);
}

.modern-input:focus {
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  background: var(--color-header-bg);
}

.modern-btn {
  background: var(--color-accent-cyan);
  color: var(--color-bg-slate-950);
  border: none;
  padding: 1rem 1.75rem;
  border-radius: var(--radius-inner);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: all var(--transition-speed) ease;
}

.modern-btn:hover {
  background: var(--color-accent-cyan-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
}

.modern-btn:active {
  transform: translateY(1px);
}

/* === STATUS LOGGER TERMINAL === */
.status-console {
  width: 100%;
  max-width: 680px;
  background: var(--color-bg-slate-950);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-inner);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.terminal-header {
  background: var(--color-bg-slate-900);
  border-bottom: 1px solid var(--color-border);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ef4444; }
.dot.yellow { background: #eab308; }
.dot.green { background: #22c55e; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.terminal-body {
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-align: left;
  min-height: 120px;
  max-height: 200px;
  overflow-y: auto;
}

.log-line {
  margin-bottom: 0.45rem;
  line-height: 1.5;
  color: var(--color-text);
}

.log-line.text-thought {
  color: var(--color-text-muted);
  font-style: italic;
}

.log-line.text-success {
  color: var(--color-accent-green);
  font-weight: 700;
}

/* === AUDIT DYNAMIC RESULTS GRID === */
.audit-results-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 900px) {
  .audit-results-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

.results-card {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 1.5rem;
}

/* Scorecard Visuals */
.scorecard {
  align-items: center;
  text-align: center;
}

.grade-dial-wrapper {
  position: relative;
  width: 120px;
  height: 120px;
}

.progress-ring__circle-bg {
  stroke-dasharray: 314;
}

.progress-ring__circle {
  stroke-dasharray: 314;
  stroke-dashoffset: 60;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.6s ease;
}

.grade-text-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
}

.grade-letter {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--color-white);
  line-height: 1;
}

.grade-score {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  font-weight: 700;
}

.card-subtitle {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-soft);
}

.metrics-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px dashed var(--color-border);
  padding-top: 1.25rem;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
}

.metric-label {
  color: var(--color-text-soft);
}

.metric-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-white);
}

.r2-report-btn {
  width: 100%;
  border: 1px solid var(--color-border);
  background: rgba(30, 41, 59, 0.3);
  color: var(--color-accent-cyan);
  padding: 0.85rem;
  border-radius: var(--radius-inner);
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-speed);
}

.r2-report-btn:hover {
  background: var(--color-accent-cyan);
  color: var(--color-bg-slate-950);
}

/* === HIGHLIGHTED GOLD HAR CTA === */
.har-cta-wrap { width: 100%; }
.har-cta-btn {
  width: 100%;
  cursor: pointer;
  border: 1.5px solid #f3c155;
  background: linear-gradient(135deg, #f7c64e 0%, #e8a317 55%, #d6920f 100%);
  color: #2a1c05;
  padding: 1.05rem 1.5rem;
  border-radius: var(--radius-inner);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  font-family: var(--font-sans);
  box-shadow: 0 8px 24px rgba(232, 163, 23, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: all var(--transition-speed) ease;
  animation: harGlow 2.6s ease-in-out infinite;
}
.har-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(232, 163, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.har-cta-btn:active { transform: translateY(0); }
.har-cta-btn svg { flex-shrink: 0; color: #2a1c05; }
.har-cta-spark {
  font-size: 1.15rem;
  color: #fff;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.85));
}
.har-cta-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.har-cta-title { font-weight: 800; font-size: 1rem; letter-spacing: -0.01em; }
.har-cta-sub { font-weight: 600; font-size: 0.74rem; opacity: 0.8; }
@keyframes harGlow {
  0%, 100% { box-shadow: 0 8px 24px rgba(232, 163, 23, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
  50% { box-shadow: 0 10px 32px rgba(232, 163, 23, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
}
@media (prefers-reduced-motion: reduce) { .har-cta-btn { animation: none; } }
@media (max-width: 640px) {
  .har-cta-btn { padding: 0.9rem 1rem; gap: 0.6rem; }
  .har-cta-sub { display: none; }
}

/* Customizer UI inside Sandbox column */
.customizer-box {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-bottom: 1px dashed var(--color-border);
  padding-bottom: 1.25rem;
}

.customizer-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.customizer-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.customizer-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.framework-swatches {
  display: flex;
  gap: 0.4rem;
}

.swatch {
  flex: 1;
  background: var(--color-bg-slate-900);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-muted);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  transition: all var(--transition-speed);
}

.swatch:hover {
  border-color: var(--color-text-muted-2);
  color: var(--color-text-soft);
}

.swatch.active {
  background: var(--color-accent-cyan);
  border-color: var(--color-accent-cyan);
  color: var(--color-bg-slate-950);
}

.aggression-slider {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 10px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.aggression-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  border: 3.5px solid var(--color-accent-coral);
  cursor: pointer;
}

/* Code Sandbox Terminal View */
.code-terminal {
  width: 100%;
  background: var(--color-bg-slate-950);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-inner);
  overflow: hidden;
}

.terminal-copy-btn, .recipe-copy-btn {
  background: var(--color-border);
  border: 1px solid var(--color-border);
  color: var(--color-white);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.terminal-copy-btn:hover, .recipe-copy-btn:hover {
  background: var(--color-accent-cyan);
  color: var(--color-bg-slate-950);
  border-color: var(--color-accent-cyan);
}

.terminal-code-body {
  width: 100%;
  min-height: 180px;
  max-height: 300px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 1.25rem;
  resize: vertical;
}

/* Prompt Recipe Box elements */
.recipe-box {
  width: 100%;
  background: rgba(30, 41, 59, 0.2);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-inner);
  overflow: hidden;
}

.recipe-header {
  background: rgba(30, 41, 59, 0.3);
  border-bottom: 1.5px dashed var(--color-border);
  padding: 0.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.recipe-body {
  width: 100%;
  height: 80px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-soft);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.85rem;
  resize: none;
}

/* === SCAN HISTORY COMPONENT === */
.history-section {
  width: 100%;
  max-width: 680px;
  border-top: 1px dashed var(--color-border);
  padding-top: 2rem;
  text-align: left;
}

.history-title {
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item {
  background: rgba(30, 41, 59, 0.2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-inner);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.history-item:hover {
  border-color: var(--color-text-muted-2);
  background: rgba(30, 41, 59, 0.35);
}

.hist-left {
  display: flex;
  flex-direction: column;
}

.hist-domain {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-white);
}

.hist-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

.hist-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.hist-badge {
  background: var(--color-border);
  color: var(--color-accent-cyan);
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

/* === CLOUDFLARE SHIELD BADGE === */
.shield-row {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

.cloudflare-shield {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--color-border);
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.cloudflare-shield strong {
  color: #f38020;
  font-weight: 800;
}

.shield-icon {
  color: var(--color-accent-cyan);
}

/* === TOAST COMPONENT === */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--color-white);
  color: var(--color-bg-slate-950);
  border-radius: var(--radius-inner);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateY(0);
}

.toast-icon {
  background: var(--color-accent-green);
  color: white;
  font-size: 0.72rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
}

.toast-text {
  font-size: 0.85rem;
  font-weight: 700;
}

/* === SETTINGS DRAWER ROW === */
.settings-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: 760px;
  gap: var(--s-3);
  margin: 0.25rem auto 0.5rem;
  text-align: left;
}
.settings-group { min-width: 0; display: flex; flex-direction: column; }
.modern-select { width: 100%; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .settings-row {
    flex-direction: column;
    gap: 0.75rem;
  }
}

.settings-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.settings-group label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  padding-left: 0.25rem;
}

.modern-select {
  background: var(--color-header-bg);
  border: 1.5px solid var(--color-border);
  color: var(--color-white);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-inner);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-speed);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.85rem;
  padding-right: 2.5rem;
}

.modern-select:focus {
  border-color: var(--color-accent-cyan);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
  background: var(--color-header-bg);
}

.modern-select option {
  background: var(--color-bg-slate-900);
  color: var(--color-white);
}

/* === UPGRADED DESIGN SYSTEM === */

/* SpeedPrompt Grade Banner */
.grade-banner-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--color-border);
  padding: 1.5rem 2.25rem;
  border-radius: var(--radius-inner);
  min-width: 140px;
  text-align: center;
  transition: all var(--transition-speed);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

.grade-big-letter {
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.05em;
  font-family: var(--font-sans);
}

.grade-label-title {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  margin-top: 0.5rem;
}

/* Dynamic Grade Glow States */
.grade-theme-A {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
}
.grade-theme-A .grade-big-letter {
  color: #10b981;
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.grade-theme-B {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.2);
}
.grade-theme-B .grade-big-letter {
  color: #38bdf8;
  text-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
}

.grade-theme-C {
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.2);
}
.grade-theme-C .grade-big-letter {
  color: #f59e0b;
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

.grade-theme-D {
  border-color: rgba(255, 90, 54, 0.4);
  box-shadow: 0 0 25px rgba(255, 90, 54, 0.2);
}
.grade-theme-D .grade-big-letter {
  color: #ff5a36;
  text-shadow: 0 0 15px rgba(255, 90, 54, 0.5);
}

.grade-theme-E, .grade-theme-F {
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
}
.grade-theme-E .grade-big-letter, .grade-theme-F .grade-big-letter {
  color: #ef4444;
  text-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* Linear Dual Score Bars */
.gauge-bar-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

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

.gauge-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text-soft);
}

.gauge-percent {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--color-white);
}

.gauge-track {
  width: 100%;
  height: 8px;
  background: rgba(30, 41, 59, 0.8);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.gauge-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.performance-fill {
  background: linear-gradient(90deg, #0ea5e9 0%, #10b981 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.structure-fill {
  background: linear-gradient(90deg, #6366f1 0%, #ec4899 100%);
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
}

.overall-score-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* Core Web Vitals Panel styles */
.cwv-gauge-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  width: 100%;
}

@media (min-width: 480px) {
  .cwv-gauge-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.cwv-item-card {
  background: var(--color-header-bg);
  border: 1px solid var(--color-border);
  padding: 1.15rem 1rem;
  border-radius: var(--radius-inner);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-speed);
}

.cwv-item-card:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-2px);
}

.cwv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cwv-title {
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.cwv-badge-status {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cwv-badge-status.status-good {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.cwv-badge-status.status-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.cwv-badge-status.status-poor {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.cwv-metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-white);
  font-family: var(--font-mono);
}

.cwv-description {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* === INTERACTIVE WATERFALL TIMELINE === */
.waterfall-card {
  background: rgba(15, 23, 42, 0.35) !important;
  backdrop-filter: blur(20px);
}

.waterfall-chart-wrapper {
  margin-top: 0.5rem;
  background: var(--color-bg-slate-950);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-inner);
  padding: 0.75rem 0;
  max-height: 400px;
  overflow-y: auto;
}

.wf-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(30, 41, 59, 0.4);
  padding: 0.6rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.wf-row:hover {
  background: rgba(30, 41, 59, 0.3);
}

.wf-row.expanded {
  background: rgba(30, 41, 59, 0.45);
}

.wf-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1rem;
}

.wf-file-icon {
  font-size: 0.85rem;
  min-width: 16px;
  display: inline-block;
  text-align: center;
}

.wf-file-name {
  color: var(--color-white);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-file-meta {
  color: var(--color-text-muted-2);
  font-size: 0.65rem;
}

.wf-right {
  position: relative;
  width: 100%;
  height: 20px;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.wf-timeline-bar {
  display: flex;
  height: 100%;
  border-radius: 3px;
  overflow: hidden;
  position: absolute;
}

.wf-seg {
  height: 100%;
  position: relative;
  cursor: help;
  transition: opacity var(--transition-speed);
}

.wf-seg:hover {
  opacity: 0.85;
}

.wf-seg-dns { background: #38bdf8; }
.wf-seg-connect { background: #a855f7; }
.wf-seg-ssl { background: #f59e0b; }
.wf-seg-ttfb { background: #ff5a36; }
.wf-seg-download { background: #10b981; }

/* Waterfall Expanded Resource Info Box */
.wf-details-box {
  grid-column: 1 / -1;
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 1.75rem;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.wf-details-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .wf-details-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.wf-details-col h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 0.25rem;
}

.wf-details-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  color: var(--color-text-soft);
}

.wf-details-tbl td {
  padding: 0.25rem 0;
}

.wf-details-tbl td:first-child {
  font-weight: 700;
  color: var(--color-text-muted);
  width: 120px;
}

.wf-advice-card {
  background: rgba(255, 90, 54, 0.05);
  border: 1px solid rgba(255, 90, 54, 0.15);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-inner);
  font-size: 0.8rem;
  color: var(--color-text);
  line-height: 1.5;
}


/* ===================================================================
   THEME PALETTES — Light / Matrix (Dark is the :root default)
   =================================================================== */
html[data-theme="light"] {
  --color-bg-slate-950: #f6f8fc;
  --color-bg-slate-900: #ffffff;
  --color-bg-grad: #dbe4ff;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-card-bg: rgba(255, 255, 255, 0.82);
  --color-header-bg: rgba(255, 255, 255, 0.72);
  --color-white: #0f172a;
  --color-text: #1e293b;
  --color-text-soft: #475569;
  --color-text-muted: #64748b;
  --color-text-muted-2: #94a3b8;
  --tt-panel-bg: #ffffff;
  --tt-panel-border: rgba(0, 0, 0, 0.1);
  --tt-panel-text: #0f1117;
  --tt-panel-muted: #5a5f72;
  --tt-btn-bg: #eef1f7;
  --tt-btn-bg-hover: #e2e7f0;
  --tt-btn-active-bg: #0ea5e9;
  --tt-btn-active-text: #ffffff;
  --tt-shadow: 0 8px 28px rgba(15, 17, 23, 0.14), 0 2px 8px rgba(15, 17, 23, 0.08);
}
html[data-theme="light"] body {
  background-color: #f6f8fc;
  background-image: radial-gradient(circle at top right, #dbe4ff 0%, #f6f8fc 60%);
  color: var(--color-text);
}

html[data-theme="matrix"] {
  --color-bg-slate-950: #000000;
  --color-bg-slate-900: #050d06;
  --color-bg-grad: #001a0a;
  --color-surface: #081109;
  --color-border: rgba(0, 255, 102, 0.22);
  --color-border-strong: rgba(0, 255, 102, 0.4);
  --color-card-bg: rgba(8, 17, 9, 0.55);
  --color-header-bg: rgba(0, 0, 0, 0.9);
  --color-white: #00ff66;
  --color-text: #00ff66;
  --color-text-soft: #46c878;
  --color-text-muted: #2f9e58;
  --color-text-muted-2: #1f7a40;
  --color-accent-cyan: #00ff66;
  --color-accent-cyan-hover: #5bff9a;
  --color-accent-coral: #9fe82e;
  --color-accent-coral-hover: #7fc81e;
  --color-accent-green: #00ff66;
  --tt-panel-bg: #0a1a0a;
  --tt-panel-border: rgba(0, 255, 102, 0.35);
  --tt-panel-text: #00ff66;
  --tt-panel-muted: #00aa44;
  --tt-btn-bg: #0a2a12;
  --tt-btn-bg-hover: #0f3a1c;
  --tt-btn-active-bg: #00ff66;
  --tt-btn-active-text: #000000;
  --font-sans: 'JetBrains Mono', 'Courier New', monospace;
}
html[data-theme="matrix"] body {
  background-color: #000000;
  background-image: none;
  color: #00ff66;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
}
html[data-theme="matrix"] img { filter: hue-rotate(80deg) saturate(0.6) brightness(0.9); }

body, header, .results-card, .main-card, select, input {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

/* ===================================================================
   FAVICON beside the URL input
   =================================================================== */
.url-favicon {
  width: 0;
  height: 24px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0;
  margin: 0;
  transition: opacity .25s ease, width .25s ease, margin .25s ease;
}
.url-favicon.show { width: 24px; opacity: 1; margin-right: var(--s-2); }

/* ===================================================================
   THEME WIDGET (gear, bottom-right) + EFFECTS
   =================================================================== */
.tt-widget { position: fixed; right: 20px; bottom: 20px; z-index: 10000; font-family: var(--font-sans); color: var(--tt-panel-text); user-select: none; }
.tt-toggle { width: 48px; height: 48px; border-radius: 50%; background: var(--tt-panel-bg); border: 1px solid var(--tt-panel-border); box-shadow: var(--tt-shadow); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s ease; color: var(--tt-panel-text); }
.tt-toggle:hover { transform: translateY(-2px); }
.tt-toggle svg { width: 22px; height: 22px; }
.tt-panel { position: absolute; right: 0; bottom: 60px; width: 224px; background: var(--tt-panel-bg); border: 1px solid var(--tt-panel-border); border-radius: 14px; box-shadow: var(--tt-shadow); padding: 14px; opacity: 0; transform: translateY(8px) scale(.96); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.tt-widget.open .tt-panel { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.tt-panel-title { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tt-panel-muted); margin-bottom: 10px; }
.tt-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tt-mode-btn { display: flex; align-items: center; gap: 7px; padding: 8px 10px; background: var(--tt-btn-bg); border: none; border-radius: 9px; color: var(--tt-panel-text); font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: background .15s ease; font-family: inherit; }
.tt-mode-btn:hover { background: var(--tt-btn-bg-hover); }
.tt-mode-btn.active { background: var(--tt-btn-active-bg); color: var(--tt-btn-active-text); }
.tt-mode-btn.full-width { grid-column: 1 / -1; justify-content: center; }
.tt-mode-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.tt-slider-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--tt-panel-border); display: none; }
.tt-widget.effect-on .tt-slider-wrap { display: block; }
.tt-slider-label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--tt-panel-muted); margin-bottom: 6px; font-weight: 600; }
.tt-slider { width: 100%; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; background: var(--tt-btn-bg); outline: none; }
.tt-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--tt-btn-active-bg); cursor: pointer; border: 2px solid var(--tt-panel-bg); }
.tt-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--tt-btn-active-bg); cursor: pointer; border: 2px solid var(--tt-panel-bg); }
.tt-exit-flashlight { position: absolute; right: 0; bottom: 60px; display: none; align-items: center; gap: 8px; padding: 11px 16px; background: #fff7d6; color: #1a1408; border: 1px solid rgba(255,210,80,0.6); border-radius: 999px; font-family: var(--font-sans); font-size: 0.82rem; font-weight: 700; cursor: pointer; white-space: nowrap; box-shadow: 0 0 24px rgba(255,210,80,0.45), 0 6px 18px rgba(0,0,0,0.35); }
.tt-exit-flashlight svg { width: 16px; height: 16px; }
.tt-widget.effect-on .tt-exit-flashlight { display: inline-flex; }
.tt-widget.effect-on .tt-panel { bottom: 112px; }
@media (max-width: 520px) { .tt-widget { right: 14px; bottom: 14px; } .tt-panel { width: 200px; } }

/* Flashlight overlay */
.tt-flashlight { position: fixed; inset: 0; pointer-events: none; z-index: 9998; background: #000; opacity: 0; transition: opacity .25s ease;
  -webkit-mask: radial-gradient(circle at var(--tt-x,50vw) var(--tt-y,50vh), transparent 0, transparent calc(var(--tt-r,320px) - 60px), rgba(0,0,0,0.85) calc(var(--tt-r,320px) - 10px), #000 var(--tt-r,320px));
          mask: radial-gradient(circle at var(--tt-x,50vw) var(--tt-y,50vh), transparent 0, transparent calc(var(--tt-r,320px) - 60px), rgba(0,0,0,0.85) calc(var(--tt-r,320px) - 10px), #000 var(--tt-r,320px)); }
html[data-theme="flashlight"] .tt-flashlight { opacity: 1; }
.tt-flashlight-glow { position: fixed; inset: 0; pointer-events: none; z-index: 9997; opacity: 0; transition: opacity .25s ease;
  background: radial-gradient(circle at var(--tt-x,50vw) var(--tt-y,50vh), rgba(255,240,180,0.16) 0, rgba(255,220,120,0.07) calc(var(--tt-r,320px) * 0.5), transparent var(--tt-r,320px)); }
html[data-theme="flashlight"] .tt-flashlight-glow { opacity: 1; }

/* Matrix rain canvas */
.tt-matrix-rain { position: fixed; inset: 0; z-index: 9990; pointer-events: none; opacity: 0; transition: opacity .5s ease; mix-blend-mode: screen; }
html[data-theme="matrix"] .tt-matrix-rain { opacity: 0.22; }

/* ===================================================================
   GOLDEN-RATIO RHYTHM (phi = 1.618) — spacing + type scale
   =================================================================== */
.main-card { padding: var(--s-6) var(--s-5) var(--s-5); }
.main-card h2 { line-height: 1.146; letter-spacing: -0.02em; }
.input-row { gap: var(--s-2); align-items: center; }
.results-card { padding: var(--s-4); }
.cwv-gauge-grid { gap: var(--s-3); }
.card-subtitle { font-size: var(--t-md); letter-spacing: -0.01em; }
.tt-panel { gap: var(--s-2); }

/* ===================================================================
   STATUS CONSOLE — always a dark terminal (readable in every theme)
   =================================================================== */
.status-console { background: #020617 !important; border-color: #1e293b !important; color: #cbd5e1 !important; }
.status-console .log-line { color: #cbd5e1; }
.status-console .log-line.text-thought { color: #94a3b8; }
.status-console .log-line.text-success { color: #34d399; }

/* ===================================================================
   NAV (How To Move The Needle style) + flashlight trigger
   =================================================================== */
.desktop-nav { display: flex; align-items: center; gap: var(--s-4); }
.nav-link { color: var(--color-text-soft); font-weight: 600; font-size: 0.92rem; transition: color .2s ease; }
.nav-link:hover { color: var(--color-text); opacity: 1; }
.logo-container { display: flex; align-items: center; gap: 0.5rem; color: var(--color-white); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #fffbef 100%);
  color: #14213d; border: 1.25px solid rgba(214,158,32,0.55);
  font-weight: 700; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 2px rgba(15,26,61,0.05);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.nav-cta:hover { opacity: 1; transform: translateY(-1px); border-color: rgba(214,158,32,0.95);
  box-shadow: 0 0 0 3px rgba(255,200,80,0.22), 0 6px 18px rgba(214,158,32,0.18); }
.nav-cta svg { width: 15px; height: 15px; color: #e8a317; }
html[data-theme="dark"] .nav-cta, html[data-theme="flashlight"] .nav-cta {
  background: linear-gradient(135deg, #0f1a3d 0%, #1a2a55 55%, #0f1a3d 100%);
  color: #fff7d6; border-color: rgba(255,210,80,0.4); }
html[data-theme="matrix"] .nav-cta {
  background: linear-gradient(135deg,#000 0%,#001a0a 55%,#000 100%); color: #00ff66;
  border-color: rgba(0,255,102,0.55); font-family: var(--font-mono); }
html[data-theme="matrix"] .nav-cta svg { color: #00ff66; }
@media (max-width: 860px) { .desktop-nav .nav-link { display: none; } }

/* Theme panel opened from the nav anchors top-right */
.tt-widget.from-nav .tt-panel { position: fixed; top: 70px; right: 24px; bottom: auto; left: auto; }
.tt-widget.from-nav.effect-on .tt-panel { bottom: auto; }
@media (max-width: 560px) { .tt-widget.from-nav .tt-panel { right: 14px; top: 64px; } }

/* ===================================================================
   FOOTER (How To Move The Needle style)
   =================================================================== */
.site-footer { border-top: 1px solid var(--color-border); margin-top: var(--s-6);
  padding: var(--s-5) var(--s-4) var(--s-3); background: var(--color-bg-slate-900); }
.footer-inner { max-width: 1200px; margin: 0 auto; display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-4); }
.footer-logo { font-weight: 800; font-size: 1.1rem; color: var(--color-white); }
.footer-tagline { color: var(--color-text-soft); margin-top: var(--s-2); max-width: 320px; font-size: 0.9rem; line-height: 1.5; }
.footer-socials { display: flex; gap: 10px; margin-top: var(--s-3); }
.footer-socials a { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--color-border);
  display: inline-flex; align-items: center; justify-content: center; color: var(--color-text-soft); font-weight: 700; }
.footer-col h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-muted); margin-bottom: var(--s-2); }
.footer-col a { display: block; color: var(--color-text-soft); font-size: 0.9rem; margin-bottom: 0.55rem; }
.footer-col a:hover, .footer-socials a:hover { color: var(--color-accent-cyan); opacity: 1; }
.footer-bottom { max-width: 1200px; margin: var(--s-4) auto 0; padding-top: var(--s-3);
  border-top: 1px solid var(--color-border); display: flex; justify-content: space-between;
  flex-wrap: wrap; gap: var(--s-2); color: var(--color-text-muted); font-size: 0.82rem; }
.footer-legal { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.footer-legal a { color: var(--color-text-muted); }
.footer-legal a:hover { color: var(--color-text); opacity: 1; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-inner { grid-template-columns: 1fr; } }
