:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0f172a;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 14px;
  --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', '맑은 고딕', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header & Navigation */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none !important;
}

.brand-badge {
  background: var(--primary);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.main-nav a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.15s ease;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Main Container */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

/* Hero Banner */
.page-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 2.2rem 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}

.page-hero .badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.page-hero h1 {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.55rem;
}

.page-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  max-width: 760px;
}

/* Calculator Grid Layout */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 840px) {
  .calc-grid {
    grid-template-columns: 1fr;
  }
  .page-hero {
    padding: 1.6rem 1.3rem;
  }
  .page-hero h1 {
    font-size: 1.45rem;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

/* Form Controls */
.form-group {
  margin-bottom: 1.15rem;
}

.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.93rem;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.form-hint {
  font-size: 0.82rem;
  color: var(--primary);
  font-weight: 600;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.78rem 2.8rem 0.78rem 0.95rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--accent);
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select {
  padding-right: 1rem;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.input-unit {
  position: absolute;
  right: 0.95rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  pointer-events: none;
}

/* Quick Preset Buttons */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.btn-preset {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.btn-preset:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 0.9rem 1.2rem;
  font-size: 1.02rem;
  font-weight: 800;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  margin-top: 0.4rem;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

/* Result Highlight Box */
.result-highlight {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 12px;
  padding: 1.35rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

.result-highlight .label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.3rem;
}

.result-highlight .value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: -0.5px;
}

.result-highlight .sub {
  font-size: 0.86rem;
  color: #3b82f6;
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Breakdown List */
.breakdown-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.94rem;
}

.breakdown-item.total {
  font-weight: 800;
  color: var(--accent);
  background: #f8fafc;
  padding: 0.8rem 0.5rem;
  border-radius: 8px;
  margin-top: 0.4rem;
}

.breakdown-item .name {
  color: var(--text-muted);
  font-weight: 600;
}

.breakdown-item .amount {
  font-weight: 700;
  color: var(--text);
}

/* Content & SEO Sections */
.content-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.85rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}

.content-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--primary-light);
}

.content-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1.35rem 0 0.55rem;
}

.content-section p {
  color: #334155;
  margin-bottom: 0.9rem;
  font-size: 0.97rem;
}

.content-section ul,
.content-section ol {
  padding-left: 1.3rem;
  margin-bottom: 1rem;
  color: #334155;
}

.content-section li {
  margin-bottom: 0.45rem;
  font-size: 0.96rem;
}

.formula-box {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.2rem;
  border-radius: 0 10px 10px 0;
  margin: 1rem 0;
  font-weight: 600;
  color: var(--accent);
}

/* Responsive Data Table */
.table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 540px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
  font-weight: 700;
}

.data-table th {
  background: #f1f5f9;
  color: var(--accent);
  font-weight: 800;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.data-table .highlight-col {
  color: var(--primary-dark);
  font-weight: 800;
  background: #eff6ff;
}

/* Tool Hub Cards (Index Page) */
.tool-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.2rem;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none !important;
  color: var(--text);
}

.tool-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.tool-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.95rem;
}

.tool-card h3 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.45rem;
}

.tool-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tool-card-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.faq-question {
  width: 100%;
  text-align: left;
  background: #f8fafc;
  border: none;
  padding: 1rem 1.2rem;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question:hover {
  background: #f1f5f9;
}

.faq-answer {
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 0.94rem;
  color: #334155;
  background: #fff;
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 2.5rem 1.25rem;
  margin-top: 3rem;
  font-size: 0.88rem;
}

.footer-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.footer-links a {
  color: #cbd5e1;
  font-weight: 600;
}

.footer-links a:hover {
  color: #fff;
}

/* Share & Copy Action Bar */
.share-bar {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.btn-share {
  flex: 1;
  min-width: 140px;
  background: #ffffff;
  border: 1.5px solid #93c5fd;
  color: var(--primary-dark);
  padding: 0.58rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-share:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Keyword Pill Grid (Internal SEO Links) */
.keyword-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.keyword-pill {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: #334155;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.keyword-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 0.75rem 1.35rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast-msg.show {
  opacity: 1;
}
