/* ============================================
   Compound Interest Calculator — "The Compound"
   Dark editorial finance aesthetic
   ============================================ */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,800;1,9..144,400;1,9..144,600&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --bg: #09090b;
  --surface: #111113;
  --card: #18181b;
  --card-hover: #1f1f23;
  --card-border: #27272a;
  --card-border-light: #3f3f46;
  --primary: #2dd4bf;
  --primary-dark: #0d9488;
  --primary-light: #5eead4;
  --primary-glow: rgba(45, 212, 191, 0.15);
  --accent: #fbbf24;
  --accent-dark: #d97706;
  --accent-glow: rgba(251, 191, 36, 0.15);
  --text: #f5f5f4;
  --text-muted: #a8a29e;
  --text-dim: #78716c;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px rgba(45, 212, 191, 0.08);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Noise texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---------- Container ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(45, 212, 191, 0.1); }
  50% { box-shadow: 0 0 35px rgba(45, 212, 191, 0.2); }
}

@keyframes countBadge {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

.animate-in {
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-in-d1 { animation-delay: 0.1s; }
.animate-in-d2 { animation-delay: 0.2s; }
.animate-in-d3 { animation-delay: 0.3s; }
.animate-in-d4 { animation-delay: 0.4s; }
.animate-in-d5 { animation-delay: 0.5s; }
.animate-in-d6 { animation-delay: 0.6s; }

/* ---------- Hero ---------- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  display: flex;
  align-items: center;
}

/* Gradient orbs */
.hero::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(45, 212, 191, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -100px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(45, 212, 191, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.2);
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.5rem);
  font-weight: 700;
  font-variation-settings: 'SOFT' 100;
  line-height: 1.08;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, #f5f5f4 0%, #2dd4bf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 20px;
  line-height: 1.7;
}

.hero-subtitle em {
  color: var(--accent);
  font-style: italic;
}

/* Decorative growth curve SVG */
.hero-curve {
  margin: 16px auto 0;
  max-width: 480px;
  opacity: 0.6;
}

.hero-curve svg {
  width: 100%;
  height: auto;
}

.hero-curve .curve-path {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: drawLine 2.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 32px;
}

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

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-body);
  color: var(--text);
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* ---------- Section Divider ---------- */
.section-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--card-border), transparent);
  margin: 0;
}

/* ---------- Section Headers ---------- */
.section-header {
  margin-bottom: 28px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 80;
  margin-bottom: 6px;
}

.section-header p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ---------- Calculator Card ---------- */
.calculator-section {
  margin: 0 0 48px;
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.calculator-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}

.calculator-card:hover {
  border-color: var(--card-border-light);
}

.card-header {
  padding: 32px 36px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 80;
}

.card-description {
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* ---------- Form ---------- */
.calc-form {
  padding: 28px 36px 36px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.label-icon {
  font-size: 0.95rem;
  opacity: 0.8;
}

.label-period {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-prefix, .input-suffix {
  padding: 0 14px;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.9rem;
  user-select: none;
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 13px 4px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font-body);
  font-weight: 500;
  outline: none;
  -moz-appearance: textfield;
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.input-wrapper input::-webkit-outer-spin-button,
.input-wrapper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.select-wrapper select {
  cursor: pointer;
  padding-right: 36px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 14px center;
  background-size: 14px;
}

.select-wrapper select option {
  background: var(--card);
  color: var(--text);
}

/* ---------- Advanced Options ---------- */
.advanced-options {
  margin-bottom: 24px;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.advanced-panel {
  margin-top: 16px;
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  animation: slideDown 0.25s ease;
}

.advanced-panel .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.hidden { display: none; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #09090b;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(45, 212, 191, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary .btn-icon {
  font-size: 1.2rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-glow);
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

.btn-accent {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-accent:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 25px var(--accent-glow);
}

/* ---------- Results ---------- */
.results-section {
  scroll-margin-top: 20px;
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}

.results-header {
  margin-bottom: 28px;
}

.results-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 80;
  margin-bottom: 4px;
}

/* ---------- Summary Cards ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-border-light), transparent);
  opacity: 0.5;
  transition: opacity var(--transition);
}

.summary-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-border-light);
  box-shadow: var(--shadow);
}

.summary-card:hover::before {
  opacity: 1;
}

.summary-card.accent {
  border-color: rgba(45, 212, 191, 0.2);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.04), transparent);
}

.summary-card.accent::before {
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 1;
}

.summary-card.accent:hover {
  border-color: rgba(45, 212, 191, 0.4);
  box-shadow: var(--shadow-glow);
}

.card-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  line-height: 1;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.card-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.card-value {
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.summary-card.accent .card-value {
  color: var(--primary);
}

/* Counter animation class */
.card-value.counting {
  animation: countBadge 0.3s ease;
}

/* ---------- Charts ---------- */
.chart-container {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}

.chart-container:hover {
  border-color: var(--card-border-light);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 60;
}

.chart-legend-custom {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

.dot-teal { background: var(--primary); }
.dot-green { background: #34d399; }
.dot-gold { background: var(--accent); }

.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 350px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 400px;
}

.chart-sm {
  max-width: 420px;
  margin: 24px auto;
}

.chart-sm-wrapper {
  min-height: 280px;
  display: flex;
  justify-content: center;
}

/* ---------- Table ---------- */
.table-container {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
  transition: border-color var(--transition);
}

.table-container:hover {
  border-color: var(--card-border-light);
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 60;
}

.table-actions {
  display: flex;
  gap: 10px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead th {
  padding: 13px 18px;
  text-align: right;
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface);
  border-bottom: 1px solid var(--card-border);
  font-family: var(--font-body);
}

.data-table thead th:first-child { text-align: left; }

.data-table tbody tr {
  border-bottom: 1px solid rgba(39, 39, 42, 0.6);
  transition: background var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(45, 212, 191, 0.03);
}

.data-table tbody tr:last-child {
  border-bottom: none;
  font-weight: 700;
  background: rgba(45, 212, 191, 0.05);
}

.data-table td {
  padding: 11px 18px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
}

.data-table td:first-child { text-align: left; }

.empty-state {
  text-align: center !important;
  color: var(--text-dim);
  padding: 44px 18px !important;
  font-style: italic;
  font-weight: 400 !important;
}

/* ---------- Share Section ---------- */
.share-section {
  text-align: center;
  padding: 12px 0 48px;
}

.share-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 60;
  margin-bottom: 18px;
  color: var(--text-dim);
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- SEO Content ---------- */
.seo-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 48px 0;
  animation: fadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

.seo-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color var(--transition);
}

.seo-card:hover {
  border-color: var(--card-border-light);
}

.seo-card:first-child,
.seo-card:last-child {
  grid-column: 1 / -1;
}

.seo-card h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  font-variation-settings: 'SOFT' 80;
  margin-bottom: 16px;
  color: var(--primary-light);
}

.seo-card p {
  color: var(--text-muted);
  margin-bottom: 14px;
  font-size: 0.95rem;
  line-height: 1.8;
}

.seo-card p:last-child { margin-bottom: 0; }

.seo-card strong { color: var(--text); }

.formula-box {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}

.formula-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.03), transparent);
  pointer-events: none;
}

.formula-box code {
  font-size: 1.4rem;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.formula-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.formula-list li {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.formula-list strong {
  color: var(--text);
  font-weight: 600;
}

.use-cases {
  list-style: none;
  display: grid;
  gap: 10px;
}

.use-cases li {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.use-cases li:hover {
  background: var(--card-hover);
  border-color: var(--card-border-light);
}

.use-cases strong {
  color: var(--text);
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--card-border);
  padding: 44px 0;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.footer-brand strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: 'SOFT' 60;
}

.footer-brand p {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform var(--transition);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-links a:hover::after {
  transform: scaleX(1);
}

.footer-bottom p {
  color: var(--text-dim);
  font-size: 0.78rem;
  text-align: center;
  opacity: 0.7;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 24px;
  background: var(--card);
  border: 1px solid var(--card-border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
  backdrop-filter: blur(20px);
}

.toast.hidden { display: none; }

@keyframes slideIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Loading Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(9, 9, 11, 0.2);
  border-top-color: #09090b;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--card-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--card-border-light);
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .seo-content {
    grid-template-columns: 1fr;
  }

  .seo-card:first-child,
  .seo-card:last-child {
    grid-column: 1;
  }

  .hero {
    min-height: 0;
    padding: 60px 0 40px;
  }
}

@media (max-width: 700px) {
  .hero {
    padding: 48px 0 32px;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 2.8rem);
  }

  .hero-stats {
    gap: 24px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .calc-form {
    padding: 20px;
  }

  .card-header {
    padding: 24px 20px 16px;
  }

  .card-header h2 {
    font-size: 1.15rem;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .summary-card {
    padding: 16px;
    gap: 14px;
  }

  .card-icon {
    font-size: 1.3rem;
  }

  .chart-container {
    padding: 18px;
  }

  .chart-sm {
    max-width: 100%;
  }

  .table-header {
    padding: 16px 18px;
  }

  .data-table td,
  .data-table th {
    padding: 10px 12px;
  }

  .data-table {
    font-size: 0.82rem;
  }

  .seo-card {
    padding: 24px;
  }

  .advanced-panel .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .container {
    padding: 0 16px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .share-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .table-actions {
    width: 100%;
  }

  .table-actions .btn-secondary {
    flex: 1;
    justify-content: center;
  }

  .chart-legend-custom {
    flex-direction: column;
    gap: 6px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

@media (max-width: 400px) {
  .form-grid {
    gap: 14px;
  }

  .calc-form {
    padding: 16px;
  }

  .card-header {
    padding: 20px 16px 14px;
  }

  .input-wrapper input,
  .input-wrapper select {
    padding: 11px 4px;
    font-size: 0.9rem;
  }
}

/* ---------- Print ---------- */
@media print {
  body { background: white !important; color: black !important; }
  body::after { display: none !important; }
  .hero { background: white !important; border-bottom: 2px solid #ddd; min-height: 0; padding: 40px 0 20px; }
  .hero h1 .gradient-text { -webkit-text-fill-color: black; }
  .hero::before, .hero::after { display: none; }
  .hero-curve { display: none; }
  .calculator-card, .chart-container, .table-container, .seo-card, .summary-card {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    background: white !important;
    break-inside: avoid;
  }
  .btn-primary, .btn-secondary, .btn-accent, .share-section, .toast, .hero-badge, .hero-stats, .footer-links a::after {
    display: none !important;
  }
  .card-value { color: black !important; }
  .data-table thead th { background: #f5f5f5 !important; color: black !important; }
  .data-table tbody tr:last-child { background: #f0f0f0 !important; }
  .formula-box code { color: #1a1a1a !important; }
  .seo-card h2 { color: #1a1a1a !important; }
  .chart-wrapper canvas { max-height: 280px; }
  .input-wrapper { border: 1px solid #ddd !important; }
  .input-wrapper input, .input-wrapper select { color: black !important; }
  .input-prefix, .input-suffix { color: #666 !important; }
  .select-wrapper select { background: none !important; }
  .summary-card.accent { background: #fafafa !important; }
  .summary-card::before { display: none; }
  .footer { border-top-color: #ddd; }
  .footer-links a { color: #666; }
}
