/* 택슈런스 홈페이지 — 태블릿 상담 + A4 출력 (v1.02) */
:root {
  --navy-950: #07111f;
  --navy-900: #0b1a2e;
  --navy-800: #12263f;
  --navy-700: #1a3454;
  --navy-100: #e8eef6;
  --gold-500: #c9a227;
  --gold-400: #dfc15a;
  --gold-100: #f8f1d8;
  --mint-100: #e6f7f1;
  --ink: #122033;
  --muted: #5c6b7e;
  --line: rgba(18, 38, 63, 0.12);
  --card: #ffffff;
  --soft: #f3f6fa;
  --shadow: 0 14px 40px rgba(7, 17, 31, 0.1);
  --radius: 18px;
  --radius-sm: 12px;
  /* 한글 깨짐 방지: 로컬 맑은고딕 우선 + Noto */
  --font: "Noto Sans KR", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo",
    "Segoe UI", sans-serif;
  --a4-width: 210mm;
  --content-max: 1100px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--soft);
  letter-spacing: -0.02em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== Top bar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 24px 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(11, 26, 46, 0.22);
}

.brand-mark img {
  width: 100%;
  height: 100%;
}

.brand-text strong {
  display: block;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--navy-900);
}

.brand-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 500;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--navy-100);
  color: var(--navy-800);
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.gold {
  background: var(--gold-100);
  color: #7a6110;
}

.ver {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.btn-print {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--navy-900);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.btn-print:active {
  transform: scale(0.98);
}

/* ===== Screens ===== */
.screen {
  display: none;
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 22px 24px calc(24px + var(--safe-bottom));
}

.screen.active {
  display: block;
  animation: fadeUp 0.3s ease;
}

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

.back-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.btn-back {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy-800);
  font-weight: 700;
}

.screen-kicker {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold-500);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.screen-title {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  line-height: 1.28;
  letter-spacing: -0.04em;
  color: var(--navy-900);
  font-weight: 800;
}

.screen-sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 52ch;
  font-weight: 500;
}

/* ===== Home hero ===== */
#screen-home.active {
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  min-height: 250px;
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(260px, 0.95fr);
  background: linear-gradient(135deg, #0b1a2e 0%, #153055 60%, #0f243f 100%);
  color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 26px 24px 26px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(135deg, #0b1a2e 0%, #12304f 100%);
}

.hero-visual {
  position: relative;
  z-index: 1;
  min-height: 250px;
  max-height: 280px;
  overflow: hidden;
}

.hero-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11, 26, 46, 0.55) 0%, transparent 35%);
  z-index: 1;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-100);
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 2.8vw, 2.35rem);
  line-height: 1.22;
  letter-spacing: -0.045em;
  font-weight: 800;
  max-width: 14ch;
}

.hero p {
  margin: 0;
  max-width: 40ch;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.98rem;
  line-height: 1.65;
  font-weight: 500;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.hero-stat {
  min-width: 112px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-stat b {
  display: block;
  font-size: 1.1rem;
  color: var(--gold-400);
  letter-spacing: -0.03em;
}

.hero-stat span {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 500;
}

/* path cards with images */
.path-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.path-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(7, 17, 31, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
}

.path-card:hover,
.path-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(7, 17, 31, 0.12);
  outline: none;
}

.path-photo {
  position: relative;
  height: 118px;
  overflow: hidden;
}

.path-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.path-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(transparent, rgba(7, 17, 31, 0.35));
}

.path-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  background: #fff;
}

.path-card h2 {
  margin: 0 0 6px;
  font-size: 1.28rem;
  letter-spacing: -0.04em;
  color: var(--navy-900);
  font-weight: 800;
  line-height: 1.25;
}

.path-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.48;
  font-size: 0.86rem;
  font-weight: 500;
  flex: 1;
}

.path-go {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy-800);
  font-weight: 800;
  font-size: 0.9rem;
}

.path-go i {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy-900);
  color: #fff;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 0.8rem;
}

.home-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed rgba(18, 38, 63, 0.18);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
  font-weight: 500;
}

/* ===== Layout ===== */
.two-col {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: 14px;
  align-items: start;
}

.page-banner {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(7, 17, 31, 0.04);
}

.page-banner img {
  width: 140px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
}

.page-banner .banner-text strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  color: var(--navy-900);
}

.page-banner .banner-text span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 500;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(7, 17, 31, 0.045);
  padding: 16px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: var(--navy-900);
  font-weight: 800;
}

.benefit-list {
  display: grid;
  gap: 8px;
}

.benefit-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--soft);
  align-items: start;
}

.benefit-item .thumb {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.benefit-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.benefit-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.92rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.benefit-item span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  font-weight: 500;
}

.expense-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.92rem;
}

.expense-banner.no {
  background: #fdeeee;
  color: #9b2c2c;
  border: 1px solid #f3c6c6;
}

.expense-banner.yes {
  background: var(--mint-100);
  color: #0f6b52;
  border: 1px solid #b7e5d4;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  max-width: 420px;
}

.seg-btn,
.chip {
  min-height: 50px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--navy-800);
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: 0.14s ease;
}

.seg-btn.active,
.chip.active {
  background: var(--navy-900);
  color: #fff;
  border-color: var(--navy-900);
  box-shadow: 0 8px 18px rgba(11, 26, 46, 0.16);
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip-row.years {
  grid-template-columns: repeat(3, 1fr);
}

.chip {
  min-height: 48px;
  font-size: 0.88rem;
  padding: 6px 4px;
}

.chip small {
  display: block;
  font-weight: 600;
  opacity: 0.8;
  font-size: 0.68rem;
  margin-top: 2px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  padding: 12px;
  border-radius: 12px;
  background: var(--soft);
}

.metric.highlight {
  background: linear-gradient(160deg, #12263f, #1a3a60);
  color: #fff;
}

.metric .label {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.metric.highlight .label {
  color: rgba(255, 255, 255, 0.72);
}

.metric .value {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.2;
}

.metric .sub {
  margin-top: 4px;
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 500;
}

.metric.highlight .sub {
  color: var(--gold-400);
}

.chart-wrap {
  position: relative;
  height: 260px;
  padding: 4px 2px 0;
}

.chart-legend-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 500;
}

.insight {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--gold-100);
  color: #5d4a12;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 700;
}

.disclaimer {
  margin-top: 10px;
  font-size: 0.72rem;
  color: #7a8796;
  line-height: 1.45;
  font-weight: 500;
}

/* Family */
.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.step {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.step .n {
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--gold-500);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.step strong {
  display: block;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
  font-size: 0.92rem;
}

.step span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 500;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.input {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 500;
}

.input:focus {
  outline: 2px solid rgba(18, 38, 63, 0.18);
  border-color: var(--navy-700);
}

textarea.input {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

.pay-box {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, #0f223a, #183456);
  color: #fff;
}

.pay-box .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.pay-box .price {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--gold-400);
}

.btn-primary {
  min-height: 50px;
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #2c2204;
  font-weight: 800;
  font-size: 1rem;
}

.btn-secondary {
  min-height: 46px;
  width: 100%;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--navy-800);
  font-weight: 800;
}

.checkline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 500;
}

.checkline input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: var(--navy-900);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 0.22s ease;
  z-index: 100;
  max-width: min(90vw, 440px);
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 태블릿 가로(약 1024+)는 3열 유지, 좁은 화면만 1열 */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 170px;
    order: -1;
  }

  .hero-visual::before {
    background: linear-gradient(180deg, transparent 40%, rgba(11, 26, 46, 0.75));
  }

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

  .two-col {
    grid-template-columns: 1fr;
  }

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

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

/* 중간 태블릿: 경로 카드 3열 유지, 비교만 1열 */
@media (min-width: 901px) and (max-width: 1100px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .path-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar,
  .screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  .top-meta .pill.tablet-only {
    display: none;
  }

  .page-banner {
    grid-template-columns: 100px 1fr;
  }

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

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

@media (min-width: 1100px) {
  .chip-row.years {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* =========================================
   A4 출력 비율
   ========================================= */
@page {
  size: A4 portrait;
  margin: 12mm 12mm 14mm;
}

@media print {
  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .topbar {
    position: static;
    border: none;
    padding: 0 0 8mm;
    background: #fff;
  }

  .btn-print,
  .btn-back,
  .toast,
  .pill.tablet-only {
    display: none !important;
  }

  .app {
    min-height: auto;
  }

  .screen {
    display: none !important;
    padding: 0;
    max-width: none;
    animation: none;
  }

  /* 현재 활성 화면만 출력 */
  .screen.active {
    display: block !important;
  }

  .hero {
    break-inside: avoid;
    min-height: 52mm;
    box-shadow: none;
    border: 1px solid #d0d7e2;
  }

  .hero-visual {
    min-height: 52mm;
  }

  .hero-visual img,
  .path-photo img,
  .page-banner img {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .path-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3mm;
  }

  .path-card {
    box-shadow: none;
    border: 1px solid #d0d7e2;
    break-inside: avoid;
  }

  .path-photo {
    height: 28mm;
  }

  .two-col {
    grid-template-columns: 0.9fr 1.1fr;
    gap: 4mm;
  }

  .card {
    box-shadow: none;
    border: 1px solid #d0d7e2;
    break-inside: avoid;
    padding: 3.5mm;
  }

  .chart-wrap {
    height: 70mm;
  }

  .result-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric.highlight {
    background: #12263f !important;
    color: #fff !important;
  }

  .chip,
  .seg-btn {
    min-height: 9mm;
    box-shadow: none;
  }

  .chip.active,
  .seg-btn.active {
    background: #0b1a2e !important;
    color: #fff !important;
  }

  .page-banner {
    box-shadow: none;
    break-inside: avoid;
  }

  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .home-note,
  .disclaimer {
    font-size: 8.5pt;
  }

  .screen-title {
    font-size: 16pt;
  }

  .hero h1 {
    font-size: 16pt;
  }

  a {
    text-decoration: none;
    color: inherit;
  }
}
