/* ── CORE DESIGN SYSTEM ── */
:root {
  /* LIGHT THEME (Nature & Calm) */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-2: #f1f5f9;
  --color-surface-offset: #e2e8f0;
  --color-border: #cbd5e1;
  --color-divider: #e2e8f0;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-text-faint: #94a3b8;

  --color-primary: #0891b2;
  --color-primary-hover: #0e7490;
  --color-primary-bg: #ecfeff;
  --color-primary-light: #cffafe;

  --color-success: #15803d;
  --color-success-bg: #f0fdf4;
  --color-warning: #b45309;
  --color-warning-bg: #fffbeb;
  --color-error: #be123c;
  --color-error-bg: #fff1f2;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;

  --font-body: 'Noto Sans KR', sans-serif;
  --font-mono: 'Inter', monospace;
}

[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-2: #334155;
  --color-surface-offset: #475569;
  --color-border: #334155;
  --color-divider: #334155;
  --color-text: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-faint: #64748b;

  --color-primary: #22d3ee;
  --color-primary-hover: #67e8f9;
  --color-primary-bg: #083344;
  --color-primary-light: #164e63;

  --color-success: #4ade80;
  --color-success-bg: #064e3b;
  --color-warning: #fbbf24;
  --color-warning-bg: #78350f;
  --color-error: #fb7185;
  --color-error-bg: #4c0519;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

/* ── BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s ease;
}

/* ── HEADER ── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  background-color: color-mix(in srgb, var(--color-surface), transparent 10%);
}
.header-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 0 1.5rem; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 0.75rem;
  text-decoration: none; color: var(--color-text);
  transition: transform 0.2s;
}
.logo:hover { transform: translateY(-1px); }
.logo-icon {
  width: 44px; height: 44px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.logo-img {
  width: 100%; height: 100%;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast; /* 선명도 향상 */
}
.logo-text { 
  display: flex; flex-direction: column; line-height: 1.1; 
  font-size: 1.2rem; font-weight: 800; letter-spacing: -0.8px;
}
.logo-sub { 
  font-size: 0.75rem; color: var(--color-primary); font-weight: 700; 
  margin-left: 0; margin-top: 0.1rem; letter-spacing: 0;
}

.header-right { display: flex; align-items: center; gap: 1rem; }
.badge-pill {
  font-size: 0.75rem; font-weight: 700;
  background: var(--color-primary-bg);
  color: var(--color-primary);
  padding: 0.25rem 0.875rem; border-radius: 999px;
  border: 1px solid var(--color-primary-light);
}
.theme-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.theme-btn:hover { background: var(--color-surface-offset); color: var(--color-text); transform: rotate(15deg); }

/* ── HERO ── */
.hero {
  background: radial-gradient(circle at top left, var(--color-primary) 0%, #003032 100%);
  padding: 4rem 1.5rem 3.5rem;
  text-align: center;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; top:0; left:0; right:0; bottom:0;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm56-76c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c3.314 0 6-2.686 6-6s-2.686-6-6-6-6 2.686-6 6 2.686 6 6 6zm-45 41c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm83 15c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM62 92c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM1 17c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm84 7c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM71 51c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='rgba(255,255,255,0.05)' fill-rule='evenodd'/%3E%3C/svg%3E");
  pointer-events: none;
}
.hero-badge {
  display: inline-block;
  font-size: 0.75rem; font-weight: 700;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.375rem 1rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 1.5rem; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800; color: #fff;
  line-height: 1.15; letter-spacing: -1px;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.1rem; color: rgba(255, 255, 255, 0.85);
  max-width: 600px; margin: 0 auto 2.5rem;
  font-weight: 400;
}
.hero-stats { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }
.hero-stat {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 0.75rem 1.75rem;
  text-align: center; transition: transform 0.2s;
}
.hero-stat:hover { transform: translateY(-3px); background: rgba(255, 255, 255, 0.12); }
.hero-stat-num { font-size: 1.5rem; font-weight: 800; color: #fff; line-height: 1; }
.hero-stat-label { font-size: 0.75rem; color: rgba(255, 255, 255, 0.6); margin-top: 0.25rem; font-weight: 600; }

/* ── ADSENSE ── */
.ad-container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  text-align: center;
  overflow: hidden;
  min-height: 100px;
}
.ad-container .adsbygoogle {
  margin: 0 auto !important;
}

/* ── TABS ── */
.tabs-section { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem 0; }
.tabs-label {
  font-size: 0.75rem; font-weight: 800;
  color: var(--color-text-faint);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 1rem; padding-left: 0.25rem;
}
.tabs-nav {
  display: flex; gap: 0.75rem; flex-wrap: wrap;
}
.tab-btn {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.tab-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-bg);
  transform: translateY(-1px);
}
.tab-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 8px 16px -4px rgba(8, 145, 178, 0.4);
}
.tab-icon { font-size: 1.1rem; }

/* ── MAIN LAYOUT ── */
.main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.calc-panel { display: none; opacity: 0; transform: translateY(15px); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.calc-panel.active { display: grid; grid-template-columns: 1fr 380px; gap: 2rem; opacity: 1; transform: translateY(0); }

/* ── CALCULATOR CARD ── */
.calc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.calc-header {
  padding: 2rem 2.25rem 1.5rem;
  border-bottom: 1px solid var(--color-divider);
  background: linear-gradient(to bottom, var(--color-surface-2), var(--color-surface));
}
.calc-title { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 0.5rem; }
.calc-emoji { font-size: 1.75rem; }
.calc-name { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; }
.calc-desc { font-size: 0.95rem; color: var(--color-text-muted); line-height: 1.5; }
.calc-body { padding: 2.25rem; }

/* ── FORM ── */
.form-group { margin-bottom: 1.5rem; }
.form-label {
  display: block; font-size: 0.9rem; font-weight: 700;
  color: var(--color-text-muted); margin-bottom: 0.625rem;
}
.form-label span { font-weight: 400; color: var(--color-text-faint); font-size: 0.8rem; margin-left: 0.375rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

.input-wrap { position: relative; }
.input-unit {
  position: absolute; right: 1.25rem; top: 50%; transform: translateY(-50%);
  font-size: 0.875rem; color: var(--color-text-faint); pointer-events: none;
  font-weight: 600;
}
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 0.875rem 3rem 0.875rem 1.125rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem; font-family: var(--font-body);
  transition: all 0.2s ease;
  appearance: none; font-weight: 500;
}
input:focus, select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
  background: var(--color-surface);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 1rem center; background-size: 16px;
}

.calc-btn {
  width: 100%; padding: 1.125rem;
  background: var(--color-primary);
  color: #fff; border: none; border-radius: var(--radius-lg);
  font-size: 1.05rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 15px -3px rgba(8, 145, 178, 0.3);
  margin-top: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.calc-btn:hover { background: var(--color-primary-hover); transform: translateY(-2px); box-shadow: 0 12px 20px -5px rgba(8, 145, 178, 0.4); }
.calc-btn:active { transform: translateY(0); }

/* ── RESULT PANEL ── */
.result-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  position: sticky; top: 100px; overflow: hidden;
  height: fit-content;
}
.result-header {
  padding: 2rem 1.75rem;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
  color: #fff;
}
.result-header-label { font-size: 0.8rem; font-weight: 700; opacity: 0.8; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 0.5rem; }
.result-main-value { font-size: 2.25rem; font-weight: 900; letter-spacing: -1px; line-height: 1.1; }
.result-main-sub { font-size: 0.9rem; opacity: 0.85; margin-top: 0.5rem; font-weight: 500; }

.result-body { padding: 1.75rem; }
.result-empty { padding: 4rem 1rem; text-align: center; color: var(--color-text-faint); }
.result-empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }

.result-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.875rem 0; border-bottom: 1px solid var(--color-divider);
  font-size: 0.95rem;
}
.result-row:last-child { border-bottom: none; }
.result-row-label { color: var(--color-text-muted); font-weight: 500; }
.result-row-value { font-weight: 700; font-family: var(--font-mono); color: var(--color-text); }
.result-row.highlight {
  background: var(--color-primary-bg);
  margin: 0.5rem -1.75rem; padding: 1rem 1.75rem; border-bottom: none; box-shadow: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
}
.result-row.highlight .result-row-label { color: var(--color-primary); font-weight: 700; }
.result-row.highlight .result-row-value { color: var(--color-primary); font-size: 1.1rem; }
.result-row.plus .result-row-value { color: var(--color-success); }
.result-row.minus .result-row-value { color: var(--color-error); }

.result-section-title {
  font-size: 0.75rem; font-weight: 800; color: var(--color-text-faint);
  letter-spacing: 1px; text-transform: uppercase; margin: 1.5rem 0 0.75rem;
}
.result-divider { border: none; border-top: 2px solid var(--color-divider); margin: 1rem 0; }

/* ── CTA ── */
.related-cta {
  margin-top: 1.5rem; background: var(--color-surface-2);
  border-radius: var(--radius-lg); padding: 1.25rem; border: 1px solid var(--color-border);
}
.related-cta-title { font-size: 0.8rem; font-weight: 800; color: var(--color-text-muted); margin-bottom: 0.75rem; }
.related-link {
  display: flex; align-items: center; gap: 0.625rem; font-size: 0.875rem; color: var(--color-primary);
  text-decoration: none; padding: 0.375rem 0; font-weight: 600; transition: color 0.15s ease;
}
.related-link:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* ── HELPERS ── */
.info-box {
  background: var(--color-primary-bg); border: 1.5px solid var(--color-primary-light);
  border-radius: var(--radius-lg); padding: 1.125rem 1.5rem; margin-bottom: 1.75rem;
  font-size: 0.9rem; color: var(--color-primary); line-height: 1.6;
}
.toggle-group {
  display: flex; background: var(--color-surface-2); padding: 0.25rem;
  border-radius: var(--radius-lg); border: 1.5px solid var(--color-border);
}
.toggle-opt {
  flex: 1; padding: 0.625rem; border: none; background: transparent;
  font-size: 0.9rem; font-weight: 700; color: var(--color-text-muted);
  cursor: pointer; border-radius: var(--radius-md); transition: all 0.2s ease;
}
.toggle-opt.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* ── RATE GRID ── */
.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.rate-item {
  background: var(--color-surface);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.rate-item-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.rate-item-value {
  font-size: 1.05rem;
  color: var(--color-primary);
  font-weight: 800;
  font-family: var(--font-mono);
}

/* ── FOOTER ── */
.site-footer {
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  padding: 3rem 1.5rem; text-align: center; color: var(--color-text-faint); font-weight: 500;
}

/* ── MOBILE ── */
@media (max-width: 900px) {
  .calc-panel.active { grid-template-columns: 1fr; }
  .result-panel { position: static; margin-top: 1.5rem; }
  .hero { padding: 3rem 1.5rem 2.5rem; }
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .tabs-nav { gap: 0.5rem; }
  .tab-btn { font-size: 0.875rem; padding: 0.625rem 1rem; }
}
