@font-face {
  font-family: 'NeueMontreal';
  src: url('/fonts/NeueMontreal-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --green: #4CAF50;
  --orange: #E5A030;
  --red: #E05555;
  --sev-good: #4CAF50;
}

body.dark {
  --bg: #191919;
  --bg-surface: #1E1E1E;
  --bg-card: #1E1E1E;
  --bg-card-hover: #252525;
  --bg-badge: #2A2A2A;
  --text: #E5E5E5;
  --text-secondary: #999999;
  --text-muted: #8A8A8A;
  --border: #2E2E2E;
  --accent: #A69986;
  --accent-hover: #BAB1A1;
  --input-bg: #141414;
  --bg-fix: #252525;
  --shadow-card: none;
}

body.light {
  --bg: #F0EDE6;
  --bg-surface: rgba(42, 24, 16, 0.025);
  --bg-card: rgba(42, 24, 16, 0.025);
  --bg-card-hover: rgba(42, 24, 16, 0.04);
  --bg-badge: rgba(42, 24, 16, 0.06);
  --text: #2A1810;
  --text-secondary: rgba(42, 24, 16, 0.72);
  --text-muted: rgba(42, 24, 16, 0.35);
  --border: rgba(42, 24, 16, 0.10);
  --accent: #C4A882;
  --accent-hover: #B09572;
  --input-bg: #F0EDE6;
  --bg-fix: rgba(42, 24, 16, 0.03);
  --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.05);
}

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

/* Scrollbar minimalista global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
body.light ::-webkit-scrollbar-thumb { background: rgba(42,24,16,0.12); }
body.light ::-webkit-scrollbar-thumb:hover { background: rgba(42,24,16,0.20); }
html { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent; }
html.light-scroll { scrollbar-color: rgba(42,24,16,0.12) transparent; }

body {
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

[hidden] { display: none !important; }

/* ── Header ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  z-index: 850;
}

header h1 {
  font-size: 1.375em;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.3s;
}

#theme-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.3s, border-color 0.3s, color 0.3s;
}
#theme-toggle:hover { background: var(--bg-card-hover); }

/* ── Main ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Input Section ── */
#input-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 0 40px;
  text-align: center;
  transition: padding 0.4s;
}

#input-section.compact {
  padding: 16px 0 20px;
}

@media (min-width: 769px) {
  #input-section.compact {
    position: fixed;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    width: 100%;
    max-width: 700px;
    padding: 16px 24px 20px;
    filter: brightness(0.7);
    transition: filter 0.3s ease;
  }

  #input-section.compact:hover,
  #input-section.compact:focus-within {
    filter: brightness(1);
  }

  body.light #input-section.compact {
    filter: brightness(0.9);
  }

  body.light #input-section.compact:hover,
  body.light #input-section.compact:focus-within {
    filter: brightness(1);
  }
}

.hero-title {
  font-size: 2.75em;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
  letter-spacing: -1px;
  transition: color 0.3s;
}

#input-section.compact .hero-title,
#input-section.compact .hero-subtitle { display: none; }

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1em;
  margin-bottom: 36px;
  transition: color 0.3s;
}

.input-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 600px;
}

#url-input {
  flex: 1;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 1em;
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
}
#url-input:focus { outline: none; border-color: var(--accent); }
#url-input:disabled { opacity: 0.5; cursor: not-allowed; }
#url-input::placeholder { color: var(--text-muted); }

#url-input:-webkit-autofill,
#url-input:-webkit-autofill:hover,
#url-input:-webkit-autofill:focus,
#url-input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  caret-color: var(--accent);
  transition: background-color 5000s ease-in-out 0s;
}

#url-input::selection {
  background: var(--accent);
  color: var(--text);
}

#url-input::-moz-selection {
  background: var(--accent);
  color: var(--text);
}

#analyze-btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s, opacity 0.2s, background 0.3s;
}
#analyze-btn:hover { background: var(--accent-hover); transform: scale(1.02); }
#analyze-btn:active { transform: scale(0.98); }
#analyze-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

#analyze-btn .spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading Fullpage ── */
#loading-fullpage {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: loadingFadeIn 0.3s ease;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-spinner {
  animation: loadingFadeIn 0.5s ease;
}

.loading-text {
  font-size: 1.125em;
  color: var(--text-secondary);
  font-weight: 500;
}

.loading-url {
  font-size: 0.875em;
  color: var(--text-muted);
  word-break: break-all;
  max-width: 400px;
}

@keyframes loadingFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Error Fullpage ── */
#error-fullpage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  animation: loadingFadeIn 0.3s ease;
}

.error-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 400px;
}

.error-title {
  font-size: 1.125em;
  font-weight: 600;
  color: var(--text);
}


.btn-retry-full {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-retry-full:hover { background: var(--accent-hover); transform: scale(1.02); }
.btn-retry-full:active { transform: scale(0.98); }

/* ── Results Section ── */
#results-section { padding-bottom: 48px; padding-top: 20px; }

@media (min-width: 769px) {
  #results-section { padding-bottom: 25vh; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeUp 0.4s ease-out both; }

/* ── Strategy Tabs ── */
.strategy-tabs {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 32px;
}

.strategy-tab {
  position: relative;
  padding: 12px 16px;
  font-size: 1em;
  font-weight: 400;
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.strategy-tab:hover { color: var(--text); }
.strategy-tab.active {
  color: var(--text);
  font-weight: 600;
}

.strategy-tab .material-icons {
  font-size: 1.125em;
  vertical-align: middle;
}

.tab-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* ── Preview ── */
.preview-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.preview-container {
  position: relative;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-card);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.preview-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: none;
  transform-origin: top left;
  pointer-events: none;
}

.preview-desktop {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.preview-desktop iframe {
  width: 1440px;
  height: 900px;
}

.preview-mobile {
  width: 320px;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 28px;
  border: 3px solid var(--border);
}

.preview-mobile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 22px;
  background: var(--border);
  border-radius: 0 0 14px 14px;
  z-index: 2;
  transition: background 0.3s;
}

.preview-mobile iframe {
  width: 375px;
  height: 812px;
}

.preview-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: var(--bg-surface);
  z-index: 3;
}

.preview-fallback-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 1.25em;
}

.preview-fallback p {
  font-size: 0.9375em;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Scores Row (4 circles) ── */
.scores-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-height: 130px;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.score-ring {
  position: relative;
  width: 100px;
  height: 100px;
}

.score-ring svg {
  transform: rotate(-90deg);
  width: 100px;
  height: 100px;
}

.score-ring .ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
  transition: stroke 0.3s;
}

.score-ring .ring-fg {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.score-ring .score-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75em;
  font-weight: 700;
}

.score-ring .score-null {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  color: var(--text-muted);
}

.score-label {
  font-size: 0.875em;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
  max-width: 100px;
  transition: color 0.3s;
}

/* ── Summary ── */
.summary-block {
  text-align: center;
  margin-bottom: 40px;
}

.summary-text {
  color: var(--text-secondary);
  font-size: 1em;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto 6px;
  transition: color 0.3s;
}

.summary-url {
  font-size: 0.875em;
  color: var(--text-muted);
  word-break: break-all;
  transition: color 0.3s;
}

/* ── Vitals Grid ── */
.vitals-section { margin-bottom: 40px; }

.section-title {
  font-size: 1.375em;
  font-weight: 600;
  margin-bottom: 16px;
}

.vitals-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.vital-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.vital-card:hover { background: var(--bg-card-hover); }

.vital-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.vital-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vital-label {
  font-size: 0.875em;
  color: var(--text-secondary);
  line-height: 1.3;
  font-weight: 500;
  transition: color 0.3s;
}

.vital-abbr {
  display: block;
  font-size: 0.875em;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
  transition: color 0.3s;
}

.vital-value {
  font-size: 2em;
  font-weight: 700;
  line-height: 1;
}

.vital-suffix {
  font-size: 0.875em;
  font-weight: 400;
  color: var(--text-secondary);
  margin-left: 2px;
}

.vital-empty {
  font-size: 1.75em;
  color: var(--text-muted);
  transition: color 0.3s;
}

.vital-empty-label {
  font-size: 0.875em;
  color: var(--text-muted);
  margin-top: 2px;
  transition: color 0.3s;
}

/* ── Page Details ── */
.page-details-section {
  margin-bottom: 48px;
}

.details-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}

.details-summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 20px 0;
}

.detail-cell {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--border);
}

.detail-cell:last-child {
  border-right: none;
}

.detail-value {
  font-size: 2em;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.detail-label {
  font-size: 0.875em;
  color: var(--text-secondary);
}

.details-divider {
  height: 1px;
  background: var(--border);
  width: 100%;
}

.details-breakdown-section {
  padding: 20px 24px 24px;
}

.breakdown-title {
  font-size: 0.875em;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--bg-badge);
}

.breakdown-segment {
  height: 100%;
  transition: opacity 0.2s;
}

.breakdown-segment:hover {
  opacity: 0.8;
}

.breakdown-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875em;
}

.breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.breakdown-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.breakdown-name {
  color: var(--text);
  font-weight: 500;
}

.breakdown-stat {
  color: var(--text-secondary);
  font-size: 0.875em;
}

/* ── Filmstrip ── */
.filmstrip-section {
  margin-bottom: 48px;
}

.filmstrip-subtitle {
  font-size: 0.875em;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.filmstrip-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 20px;
  overflow-x: auto;
  box-shadow: var(--shadow-card);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.filmstrip-frames {
  display: flex;
  gap: 12px;
  min-width: min-content;
}

.filmstrip-frame {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.filmstrip-timestamp {
  font-size: 0.8125em;
  color: var(--text-secondary);
  font-weight: 500;
}

.filmstrip-image-wrap {
  position: relative;
  width: 120px;
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-badge);
  border: 1px solid var(--border);
}

.filmstrip-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.filmstrip-marker-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  pointer-events: none;
  z-index: 2;
}

.filmstrip-frame-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 20px;
}

.filmstrip-badge {
  font-size: 0.6875em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.filmstrip-marker-TTFB, .filmstrip-badge-TTFB { background: #E05555; }
.filmstrip-marker-FCP,  .filmstrip-badge-FCP  { background: #E5A030; }
.filmstrip-marker-LCP,  .filmstrip-badge-LCP  { background: var(--accent); }
.filmstrip-marker-TTI,  .filmstrip-badge-TTI  { background: #9B7FB3; }
.filmstrip-marker-Total, .filmstrip-badge-Total { background: #4CAF50; }

.filmstrip-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.filmstrip-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875em;
  color: var(--text);
}

.filmstrip-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filmstrip-legend-value {
  color: var(--text-secondary);
  font-weight: 500;
}

.filmstrip-container::-webkit-scrollbar {
  height: 6px;
}

.filmstrip-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Cache Plugin Selector ── */
.cache-plugin-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

.cache-plugin-label {
  font-size: 0.875em;
  color: var(--text-secondary);
  font-weight: 500;
}

.cache-plugin-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-badge);
  border-radius: 8px;
}

.cache-plugin-tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875em;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.cache-plugin-tab:hover {
  color: var(--text);
}

.cache-plugin-tab.active {
  background: var(--accent);
  color: #fff;
}

body.light .cache-plugin-tab.active {
  color: #EDEAE5;
}

/* ── Issues ── */
.issues-section { margin-bottom: 16px; }

.category-accordion { margin-bottom: 12px; }

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  user-select: none;
  transition: background 0.2s, border-color 0.3s, box-shadow 0.3s;
}
.category-header:hover { background: var(--bg-card-hover); }

.category-header[data-category="security"] {
  opacity: 0.3;
  transition: opacity 0.2s, background 0.2s, border-color 0.3s, box-shadow 0.3s;
}

.category-header[data-category="security"]:hover,
.category-accordion.open > .category-header[data-category="security"] {
  opacity: 1;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-name {
  font-size: 0.875em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.category-badge {
  background: var(--bg-badge);
  color: var(--text-secondary);
  font-size: 0.875em;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 6px;
  transition: background 0.3s, color 0.3s;
}

.category-chevron {
  color: var(--text-muted);
  font-size: 0.875em;
  transition: transform 0.25s, color 0.3s;
  width: 20px;
  text-align: center;
}

.category-accordion.open .category-chevron {
  transform: rotate(90deg);
}

.category-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.category-body-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0 0;
}

.issue-item {
  background: var(--bg-surface);
  border-radius: 12px;
  padding: 20px;
  transition: background 0.3s;
}

.issue-item-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.sev-badge {
  font-size: 0.875em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}
.sev-badge.critical { background: rgba(224,85,85,0.15); color: var(--red); }
.sev-badge.warning  { background: rgba(229,160,48,0.15); color: var(--orange); }
.sev-badge.info     { background: rgba(76,175,80,0.15); color: var(--sev-good); }

.issue-item-title {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.4;
}

.issue-item-desc {
  color: var(--text-secondary);
  font-size: 1em;
  line-height: 1.6;
  margin-bottom: 10px;
  transition: color 0.3s;
}

.issue-item-fix {
  background: var(--bg-fix);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: background 0.3s;
}

.issue-item-fix-label {
  font-weight: 600;
  font-size: 0.9375em;
  margin-bottom: 4px;
  color: var(--text);
}

.issue-item-fix-text {
  color: var(--text-secondary);
  font-size: 0.9375em;
  line-height: 1.6;
  transition: color 0.3s;
}

.issue-item-impact {
  font-size: 0.9375em;
  color: var(--accent);
  margin-bottom: 8px;
  transition: color 0.3s;
}

.affected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.affected-tag {
  background: var(--bg-badge);
  color: var(--text-secondary);
  font-size: 0.875em;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 5px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  max-width: 600px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

.affected-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.affected-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 32px 24px;
  max-width: 1200px;
  margin: 0 auto;
}


/* ── Responsive ── */
@media (max-width: 768px) {
  body { overflow-x: hidden; }
  header { padding: 16px; }
  main { padding: 0 16px; }
  #input-section { padding: 48px 0 24px; }
  #input-section.compact {
    position: static;
    transform: none;
    filter: none;
    max-width: none;
    padding: 12px 16px 16px;
  }
  .hero-title { font-size: 2em; }
  .input-row { flex-direction: column; }
  #analyze-btn { justify-content: center; }
  .scores-row { gap: 16px; }
  .score-ring { width: 80px; height: 80px; }
  .score-ring svg { width: 80px; height: 80px; }
  .score-ring .score-num { font-size: 1.375em; }
  .score-label { font-size: 0.875em; }
  .vitals-cards { grid-template-columns: repeat(2, 1fr); }
  .vital-card { padding: 15px; }
  .vital-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
  .vital-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .details-summary-row { grid-template-columns: 1fr 1fr; padding: 0; }
  .detail-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
  }
  .detail-cell:nth-child(2n) { border-right: none; }
  .detail-cell:nth-last-child(-n+2) { border-bottom: none; }
  .detail-value { font-size: 1.5em; }
  .details-breakdown-section { padding: 16px; }
  .breakdown-list { grid-template-columns: 1fr 1fr; }
  .filmstrip-image-wrap { width: 80px; }
  .filmstrip-timestamp { font-size: 0.75em; }
  .filmstrip-badge { font-size: 0.625em; padding: 1px 6px; }
  .filmstrip-legend { gap: 12px 16px; }
  .cache-plugin-selector { flex-direction: row; align-items: center; gap: 12px; width: fit-content; justify-content: flex-start; }
  .cache-plugin-tabs { width: auto; flex: 0 0 auto; }
  .cache-plugin-tab { flex: 0 0 auto; padding: 6px 14px; }
  .issue-item { padding: 16px; }

  p,
  .section-title,
  .summary-text,
  .breakdown-name,
  .breakdown-stat,
  .detail-label,
  .chat-header-title,
  .error-title,
  .filmstrip-subtitle {
    text-wrap: pretty;
  }

  .hero-subtitle {
    text-wrap: balance;
  }
  .affected-tag {
    max-width: 100%;
    white-space: normal;
    word-break: break-all;
  }
  .preview-mobile { max-width: 240px; }
  footer { padding: 24px 16px; }
}

@media (max-width: 480px) {
  .vital-value { font-size: 1.625em; }
  .scores-row { gap: 12px; }
  .score-ring { width: 72px; height: 72px; }
  .score-ring svg { width: 72px; height: 72px; }
  .score-ring .score-num { font-size: 1.25em; }
  .preview-mobile { max-width: 200px; }
}

@media (max-width: 393px) {
  .vitals-cards { grid-template-columns: 1fr; }
  .scores-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    justify-items: center;
  }
}

/* ── Input Overlay ── */
.input-overlay {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 60%,
    var(--bg) 100%
  );
  z-index: 899;
  pointer-events: none;
}

@media (max-width: 768px) {
  .input-overlay {
    display: none !important;
  }
}

/* ── Skeleton Loading ── */
.skeleton {
  background: var(--bg-card);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    transparent 100%
  );
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

body.light .skeleton::after {
  background: linear-gradient(
    90deg,
    rgba(42, 24, 16, 0.02) 0%,
    rgba(42, 24, 16, 0.05) 50%,
    rgba(42, 24, 16, 0.02) 100%
  );
}

@keyframes skeleton-pulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Chat Widget ── */
.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 999;
}

#chat-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  z-index: 1001;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.15s, background 0.3s;
}
#chat-fab.visible { display: flex; }
#chat-fab:hover { transform: scale(1.05); }

#chat-panel {
  display: none;
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 440px;
  height: 500px;
  max-height: 70vh;
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.15);
  flex-direction: column;
  z-index: 1000;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s, transform 0.2s, background 0.3s, border-color 0.3s;
}
#chat-panel.open {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.chat-header {
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: border-color 0.3s;
}
.chat-header-title {
  font-size: 1em;
  font-weight: 700;
  color: var(--text);
}

.chat-context-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 0.75em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.chat-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.chat-clear-btn:hover {
  color: var(--text);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
body.light .chat-messages::-webkit-scrollbar-thumb { background: rgba(42,24,16,0.12); }
body.light .chat-messages::-webkit-scrollbar-thumb:hover { background: rgba(42,24,16,0.20); }
body.light .chat-messages { scrollbar-color: rgba(42,24,16,0.12) transparent; }
body.light .chat-overlay { background: rgba(42,24,16,0.4); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.light #chat-panel { border-color: rgba(42,24,16,0.10); background: #F0EDE6; }
body.light .chat-header { border-bottom-color: rgba(42,24,16,0.07); }
body.light .chat-input-wrap { border-top-color: rgba(42,24,16,0.07); }
body.light .chat-msg.user { background: #1C0F08; color: #E8DDD0; }
body.light #chat-fab { background: #C4A882; color: #1C0F08; }
body.light #chat-fab svg { stroke: #E8DDD0; }
body.light #chat-fab.open svg { stroke: #E8DDD0; }
body.light #analyze-btn { color: #EDEAE5; }
body.light #analyze-btn .spinner { border-color: rgba(28,15,8,0.3); border-top-color: #1C0F08; }
body.light #url-input:focus { border-color: rgba(196,168,130,0.5); }
body.light #theme-toggle { color: rgba(42,24,16,0.50); }
body.light .sev-badge.critical { background: rgba(224,85,85,0.08); }
body.light .sev-badge.warning { background: rgba(229,160,48,0.08); }
body.light .sev-badge.info { background: rgba(76,175,80,0.08); }

.chat-msg {
  max-width: 92%;
  padding: 10px 12px;
  font-size: 0.9375em;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-radius: 12px 12px 0 12px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text);
  border-radius: 12px 12px 12px 0;
  transition: background 0.3s, color 0.3s;
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: 12px 12px 12px 0;
  transition: background 0.3s;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatDot 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chat-input-wrap {
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  position: relative;
  transition: border-color 0.3s;
}
.chat-input-wrap .chat-input {
  width: 100%;
  padding: 10px 44px 10px 16px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--bg-badge);
  color: var(--text);
  font-size: 1em;
  font-family: 'NeueMontreal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
  resize: none;
  overflow-y: hidden;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
}
.chat-input-wrap .chat-input:focus { border-color: var(--accent); }
.chat-input-wrap .chat-input::placeholder {
  color: var(--text-muted);
  transition: color 0.3s;
}
.chat-input-wrap .chat-input:disabled { opacity: 0.5; }
.chat-send-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-muted);
  transition: color 0.2s;
}
.chat-send-btn.active { color: var(--accent); }
.chat-send-btn:disabled { cursor: not-allowed; opacity: 0.5; }

@media (max-width: 768px) {
  #chat-panel {
    top: 16px;
    right: 16px;
    bottom: 88px;
    left: 16px;
    width: auto;
    max-width: 480px;
    margin-left: auto;
    height: auto;
    max-height: calc(100vh - 120px);
    border-radius: 12px;
  }
  #chat-panel.open ~ .chat-overlay,
  .chat-overlay.visible {
    display: block;
  }
  #chat-panel::before {
    content: '';
    position: absolute;
    bottom: -13px;
    right: 23px;
    width: 0;
    height: 0;
    border-left: 13px solid transparent;
    border-right: 13px solid transparent;
    border-top: 13px solid var(--border);
    z-index: 1000;
  }
  #chat-panel::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid var(--bg-surface);
    z-index: 1001;
  }
}
