:root {
  --primary: #1a56db;
  --primary-light: #e8effc;
  --accent: #10b981;
  --accent-dark: #059669;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Header */
header {
  text-align: center;
  padding: 40px 0 32px;
}
header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
header p {
  color: var(--text-muted);
  font-size: 15px;
  max-width: 480px;
  margin: 0 auto;
}
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 .icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.icon-blue { background: var(--primary-light); }
.icon-green { background: #d1fae5; }

/* Form */
.form-group {
  margin-bottom: 20px;
}
.form-group:last-child {
  margin-bottom: 0;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
input[type="text"], input[type="number"], input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.12);
}
.input-prefix {
  position: relative;
}
.input-prefix input {
  padding-left: 28px;
}
.input-prefix::before {
  content: '$';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 17px;
  font-weight: 500;
  pointer-events: none;
}
.input-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Button */
.btn-primary {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
  margin-top: 4px;
}
.btn-primary:hover { background: #1347b8; }
.btn-primary:active { transform: scale(0.99); }

/* Results */
#results {
  display: none;
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Score Ring */
.score-section {
  text-align: center;
  padding: 20px 0 8px;
}
.score-ring-wrapper {
  position: relative;
  display: inline-block;
  width: 180px;
  height: 180px;
}
.score-ring-wrapper svg {
  transform: rotate(-90deg);
}
.score-ring-bg {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 10;
}
.score-ring-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease, stroke 0.3s;
}
.score-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-pct {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}
.score-pct-suffix {
  font-size: 20px;
  font-weight: 600;
}
.score-subtext {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.score-verdict {
  font-size: 18px;
  font-weight: 600;
  margin-top: 16px;
}
.score-description {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 6px auto 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.stat-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Progress bar comparison */
.comparison-bar {
  margin-top: 16px;
}
.bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.bar-header span:first-child { font-weight: 600; }
.bar-header span:last-child { color: var(--text-muted); }
.bar-track {
  height: 16px;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 1s ease;
  min-width: 4px;
}
.bar-target {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: var(--text);
  border-radius: 2px;
  z-index: 2;
}
.bar-target-label {
  position: absolute;
  top: -20px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Tip card */
.tip-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg);
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}
.tip-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: #fef3c7;
}
.tip-content h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}
.tip-content p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Action bar */
.action-bar {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.btn-secondary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.btn-secondary svg {
  width: 16px;
  height: 16px;
}

/* Share URL */
.share-url-box {
  display: none;
  margin-top: 12px;
  animation: fadeUp 0.3s ease;
}
.share-url-box.visible { display: block; }
.share-url-inner {
  display: flex;
  gap: 8px;
  align-items: center;
}
.share-url-inner input {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.btn-copy {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.btn-copy:hover { background: #1347b8; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 100;
  pointer-events: none;
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footnote */
.footnote {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 24px 0 12px;
  line-height: 1.5;
}
.footnote a {
  color: var(--primary);
  text-decoration: none;
}

/* ===== Disclaimer Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  padding: 32px;
  position: relative;
  animation: modalSlideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
}
.modal .btn-primary {
  margin-top: 8px;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

/* Ad slot in disclaimer */
.ad-slot {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0 8px;
}
.ad-slot-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.ad-slot-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.ad-slot-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}
.ad-slot-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.ad-slot-link:hover { text-decoration: underline; }

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 24px 20px 32px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.footer-links a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--primary); }
.footer-sep {
  color: var(--border);
  font-size: 13px;
}
.footer-copy {
  font-size: 11px;
  color: var(--text-muted);
}

/* Print styles */
@media print {
  body { background: white; }
  .container { max-width: 100%; padding: 0; }
  .no-print { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  #inputSection { display: none; }
  #results { display: block !important; }
  header { padding: 20px 0 16px; }
  .print-header { display: block !important; }
  .score-ring-fill { transition: none; }
  .bar-fill { transition: none; }
  .site-footer { display: none; }
  .modal-overlay { display: none !important; }

  .print-report-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 16px;
    margin-bottom: 20px;
  }
  .print-report-header h2 {
    font-size: 20px;
    color: var(--primary);
  }
  .print-report-header p {
    font-size: 12px;
    color: var(--text-muted);
  }
}

.print-header { display: none; }

/* Responsive */
@media (max-width: 480px) {
  .container { padding: 16px 14px 48px; }
  header h1 { font-size: 24px; }
  .card { padding: 20px; }
  .stats-grid { grid-template-columns: 1fr; }
  .action-bar { flex-direction: column; }
  .score-ring-wrapper { width: 150px; height: 150px; }
  .score-pct { font-size: 32px; }
  .modal { padding: 24px; }
}
