/* =============================================================================
   E-Bike Cleanliness Score — premium SaaS surface
   Key improvements: glass panels, html.dark WCAG-friendly palette, reduced
   motion support, sticky mobile bar, focus-visible, CSS variables for one
   source of theme truth.
   ============================================================================= */

:root {
  /* System stack only — avoids render-blocking font requests (Lighthouse / offline). */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 8px 32px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.55);
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #4f6cf7;
  --accent-hover: #3d5aef;
  --surface-2: #f1f5f9;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --score-low: #ef4444;
  --score-mid: #f59e0b;
  --score-high: #22c55e;
}

html.dark {
  --shadow-soft: 0 12px 48px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  --glass-bg: rgba(15, 23, 42, 0.75);
  --glass-border: rgba(148, 163, 184, 0.18);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --surface-2: #1e293b;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --score-low: #f87171;
  --score-mid: #fbbf24;
  --score-high: #4ade80;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  overflow-x: clip;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.25), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.18), transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #eef2ff 45%, #f1f5f9 100%);
  transition: background 0.4s ease;
}

html.dark .app-bg {
  background:
    radial-gradient(1000px 500px at 15% -5%, rgba(99, 102, 241, 0.2), transparent 55%),
    radial-gradient(800px 400px at 95% 10%, rgba(14, 165, 233, 0.12), transparent 45%),
    linear-gradient(165deg, #020617 0%, #0f172a 50%, #111827 100%);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

.wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px 100px;
}

@media (min-width: 900px) {
  .wrapper {
    padding: 24px 24px 32px;
  }
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

/* Header */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 14px;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.brand-mark {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(79, 108, 247, 0.35));
}

.app-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-subtitle {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--surface-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.icon-btn:hover {
  transform: translateY(-1px);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html.dark .icon-btn {
  background: rgba(30, 41, 59, 0.9);
}

.theme-icon-dark {
  display: none;
}
html.dark .theme-icon-light {
  display: none;
}
html.dark .theme-icon-dark {
  display: inline;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(79, 108, 247, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chip-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(79, 108, 247, 0.4);
}
.chip-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.chip-btn[hidden] {
  display: none !important;
}

/* Upgrade banner */
.upgrade-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.upgrade-banner__badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
}
.upgrade-banner__text {
  flex: 1;
  color: var(--text-muted);
  min-width: 200px;
}
.upgrade-banner__cta {
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  padding: 8px 4px;
  border-radius: 8px;
}
.upgrade-banner__cta:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html.dark .upgrade-banner__cta {
  color: var(--accent-hover);
}

/* Main grid */
.main-grid {
  display: grid;
  gap: 18px;
}
@media (min-width: 900px) {
  .main-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.tool-column,
.results-column {
  padding: 22px 20px 24px;
}

.section-heading {
  margin: 0 0 18px;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.field-group {
  margin-bottom: 20px;
  border: none;
  padding: 0;
}
.field-group legend {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 10px;
  padding: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

input[type="range"] {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 8px 0 4px;
}

.slider-value {
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 4px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.option-grid--4 {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 480px) {
  .option-grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.option-box {
  min-height: 48px;
  padding: 12px 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
.option-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}
.option-box:active {
  transform: translateY(0) scale(0.98);
}
.option-box:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.option-box.selected {
  background: linear-gradient(145deg, var(--accent), #6366f1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 28px rgba(79, 108, 247, 0.4);
  transform: translateY(-1px);
}

html.dark .option-box {
  background: rgba(30, 41, 59, 0.85);
}
html.dark .option-box:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.selected-label {
  margin-top: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Results */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.face-wrap {
  margin-bottom: 8px;
}

.face-container {
  font-size: clamp(3.5rem, 12vw, 5rem);
  line-height: 1;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  will-change: transform;
  filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.15));
}
html.dark .face-container {
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.5));
}

.face-container.is-happy {
  animation: bounce-soft 0.6s ease;
}
.face-container.is-worry {
  animation: shake-soft 0.5s ease;
}

@keyframes bounce-soft {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  70% {
    transform: scale(0.96);
  }
}

@keyframes shake-soft {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px) rotate(-2deg);
  }
  40% {
    transform: translateX(4px) rotate(2deg);
  }
  60% {
    transform: translateX(-3px);
  }
}

.score-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.score-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 100%;
  text-align: center;
}
.score {
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html.dark .score {
  background: linear-gradient(135deg, #a5b4fc, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
}
.score-suffix {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.status-pill {
  margin: 10px 0 6px;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
}
.status-pill[data-tier="excellent"] {
  color: var(--score-high);
  border-color: rgba(34, 197, 94, 0.35);
}
.status-pill[data-tier="good"] {
  color: #0d9488;
  border-color: rgba(13, 148, 136, 0.35);
}
html.dark .status-pill[data-tier="good"] {
  color: #5eead4;
}
.status-pill[data-tier="attention"] {
  color: var(--warning);
}
.status-pill[data-tier="critical"] {
  color: var(--danger);
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  margin: 12px 0 8px;
}
.confidence-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.confidence-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--glass-border);
}
.confidence-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #94a3b8, var(--accent));
  transition: width 0.35s ease;
}
.confidence-value {
  font-size: 0.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: right;
}

.score-bar {
  width: 100%;
  max-width: 360px;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 16px 0 12px;
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.08);
}
html.dark .score-bar {
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.35);
}

.score-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--score-low), var(--score-mid), var(--score-high));
  background-size: 200% 100%;
  transition: box-shadow 0.3s ease;
  box-shadow: 0 0 20px rgba(79, 108, 247, 0.25);
  will-change: width;
}

.advice {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  font-size: 0.95rem;
  text-align: left;
  max-width: 100%;
  width: 100%;
}

.insights-block {
  width: 100%;
  text-align: left;
  margin-bottom: 16px;
}
.insights-title {
  margin: 14px 0 8px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.insight-primary {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}
.checklist,
.priority-list {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.checklist li,
.priority-list li {
  margin-bottom: 6px;
}
.priority-list {
  list-style: disc;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.btn-primary,
.btn-secondary {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 6px 20px rgba(79, 108, 247, 0.35);
}
.btn-primary:hover {
  transform: translateY(-1px);
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}
html.dark .btn-secondary:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.toast {
  min-height: 1.25em;
  margin: 10px 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
}

/* Gamification / habit loop */
.habit-card {
  margin-top: 16px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

.habit-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.habit-stat {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
}

.habit-stat__label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.habit-stat__value {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
  font-weight: 800;
}

.xp-track {
  margin-top: 10px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}

.xp-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f59e0b, #f97316, #ec4899);
  transition: width 0.35s ease;
}

.habit-mission {
  margin: 10px 0 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.habit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.habit-note {
  margin: 8px 0 0;
  min-height: 1.25em;
  font-size: 0.85rem;
  color: var(--success);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.badge-chip {
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  padding: 8px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
}

.badge-chip--new {
  animation: pulse-glow 0.85s ease;
}

.score-display.is-boosted .score {
  animation: pop-score 0.45s ease;
}

@keyframes pop-score {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0.22); }
  100% { box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
}

.reward-burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99997;
  overflow: hidden;
}

.reward-burst {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.reward-burst__emoji {
  position: absolute;
  font-size: 1.25rem;
  opacity: 0;
  animation: burst-fly 900ms ease forwards;
}

@keyframes burst-fly {
  0% { transform: translate(0, 0) scale(0.6); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1); opacity: 0; }
}

@media (max-width: 540px) {
  .habit-stats {
    grid-template-columns: 1fr;
  }
  .badge-grid {
    grid-template-columns: 1fr;
  }
}

/* Premium card */
.premium-card {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(245, 158, 11, 0.45);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.08), transparent);
}
html.dark .premium-card {
  border-color: rgba(251, 191, 36, 0.35);
  background: linear-gradient(145deg, rgba(251, 191, 36, 0.1), transparent);
}
.premium-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.premium-card__title {
  margin: 0;
  font-size: 1.05rem;
}
.premium-card__text {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.signup-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 480px) {
  .signup-form {
    flex-direction: row;
    align-items: stretch;
  }
  .signup-input {
    flex: 1;
  }
}
.signup-input {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}
.signup-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
.premium-hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Mobile sticky */
.mobile-sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  justify-content: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
}
@media (min-width: 900px) {
  .mobile-sticky {
    display: none;
  }
}
.sticky-btn {
  flex: 1;
  max-width: 140px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text);
}
.sticky-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Footer */
.app-footer {
  margin-top: 20px;
  padding: 16px 20px;
}
.footer-note {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.tool-extra-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.tool-toggle-btn {
  min-height: 44px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  background: var(--surface-2);
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tool-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}
.tool-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html.dark .tool-toggle-btn:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
}

/* Legal + popups */
.legal-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
.legal-popup-box {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
  text-align: center;
}
html.dark .legal-popup-box {
  background: #0f172a;
  color: var(--text);
  border: 1px solid #334155;
}
.legal-popup-icon {
  font-size: 42px;
  margin-bottom: 12px;
}
.legal-popup-box h3 {
  margin: 0 0 14px;
  font-size: 24px;
}
.legal-popup-box p {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 0 0 14px;
}
.legal-popup-box button {
  margin-top: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 48px;
}
.legal-popup-box button:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  padding: 20px;
  min-height: 100vh;
}
.popup-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease;
}
.popup-box {
  width: 100%;
  max-width: 720px;
  background: #fff;
  color: #111827;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
  position: relative;
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid #e5e7eb;
}
html.dark .popup-box {
  background: #0f172a;
  color: #f9fafb;
  border-color: #1e293b;
}
.popup-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  font-size: 18px;
  cursor: pointer;
}
html.dark .popup-close {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
}
.popup-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  width: 100%;
  min-height: 140px;
  margin-top: 12px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 14px;
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
html.dark textarea {
  background: #020617;
  color: #e2e8f0;
  border-color: #334155;
}

.copy-btn {
  margin-top: 14px;
  background: var(--success);
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}

.similar-tools h3 {
  margin-top: 0;
}
.similar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.similar-list li {
  margin-bottom: 10px;
}
.similar-list a {
  display: block;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.similar-list a:hover {
  text-decoration: underline;
}
html.dark .similar-list a {
  background: #111827;
  color: #93c5fd;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
