/* ==========================================================================
   겨울 전기요금·누진세 계산기 — styles.css
   모바일 퍼스트(375~430px 최적), 라이트/다크 카드 UI
   ========================================================================== */

/* ── 1. 디자인 토큰 ───────────────────────────────────────── */
:root {
  --bg: #eef2f8;
  --bg-1: #dbe7f8;
  --bg-2: #f7f9fc;
  --card: #ffffff;
  --card-2: #f5f8fd;
  --card-3: #eef3fb;
  --text: #0e1726;
  --text-soft: #35455c;
  --muted: #64748b;
  --muted-2: #8294ab;
  --line: #e2e9f4;
  --line-strong: #cfdaea;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #e8f0ff;
  --brand-ink: #1e40af;
  --ice: #0ea5e9;
  --hot: #f97316;
  --hot-soft: #fff2e7;
  --hot-ink: #c2410c;
  --tier1: #16a34a;
  --tier2: #f59e0b;
  --tier3: #ef4444;
  --tier4: #8b5cf6;
  --ok: #10b981;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 16px -10px rgba(15, 23, 42, .18);
  --shadow: 0 2px 4px rgba(15, 23, 42, .03), 0 14px 34px -18px rgba(15, 23, 42, .28);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --ring: 0 0 0 3px rgba(37, 99, 235, .22);
  --header-h: 62px;
}

[data-theme="dark"] {
  --bg: #070c16;
  --bg-1: #0c1526;
  --bg-2: #080e19;
  --card: #101a2b;
  --card-2: #0c1524;
  --card-3: #16233a;
  --text: #e8eefb;
  --text-soft: #c3d0e4;
  --muted: #91a2bb;
  --muted-2: #7c8ea8;
  --line: #1d2a41;
  --line-strong: #2a3a55;
  --brand: #4f8cff;
  --brand-strong: #3b76e8;
  --brand-soft: #152540;
  --brand-ink: #a9c6ff;
  --ice: #38bdf8;
  --hot: #fb923c;
  --hot-soft: #2a1a10;
  --hot-ink: #fdba74;
  --tier1: #34d399;
  --tier2: #fbbf24;
  --tier3: #f87171;
  --tier4: #a78bfa;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 18px -12px rgba(0, 0, 0, .8);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 18px 40px -22px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(79, 140, 255, .3);
}

/* ── 2. 기본 ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(120% 60% at 50% -10%, var(--bg-1) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, button { font-family: inherit; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: var(--brand); color: #fff; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 0 0 12px 12px;
  background: var(--brand); color: #fff; font-weight: 700;
  transition: top .2s ease;
}
.skip-link:focus { top: 0; }

/* ── 3. 레이아웃 ─────────────────────────────────────────── */
.app-shell {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

/* ── 4. 헤더 ─────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--header-h);
  padding: 10px 2px;
  margin: 0 -14px;
  padding-left: 16px;
  padding-right: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { display: block; width: 34px; height: 34px; flex: 0 0 34px; color: var(--brand); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text p {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, background .2s ease;
}
.icon-btn:hover { background: var(--card-2); }
.icon-btn:active { transform: scale(.95); }
.install-btn { font-size: 12.5px; color: var(--brand-ink); background: var(--brand-soft); border-color: transparent; }

/* ── 5. 탭 ───────────────────────────────────────────────── */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 14px 0 12px;
  padding: 4px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 8px 6px;
  border: 0; border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.02em;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.tab-emoji { font-size: 15px; }
.tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 14px -10px rgba(15, 23, 42, .4);
}
.tab:active { transform: scale(.99); }

/* ── 6. 카드 ─────────────────────────────────────────────── */
.card {
  position: relative;
  margin-bottom: 12px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.card-head { margin-bottom: 16px; }
.card h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.3;
}
.card-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ── 7. 입력 필드 ────────────────────────────────────────── */
.field { margin-top: 18px; }
.field:first-of-type { margin-top: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.field-row .field { margin-top: 0; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: -.01em;
}
.field-label small { font-weight: 600; color: var(--muted); font-size: 11px; margin-left: 4px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label-row .field-label { margin-bottom: 8px; }
.field-help { margin-top: 7px; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.field-help strong { color: var(--text-soft); font-weight: 700; }

.input-wrap {
  display: flex; align-items: center; gap: 8px;
  height: 60px; padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input-wrap:focus-within { border-color: var(--brand); box-shadow: var(--ring); background: var(--card); }
.input-wrap input {
  width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text);
  font-size: 26px; font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.input-wrap input:focus { outline: none; box-shadow: none; }
.input-wrap .unit { flex: 0 0 auto; font-size: 13px; font-weight: 700; color: var(--muted); }
.input-wrap-sm { height: 50px; }
.input-wrap-sm input { font-size: 19px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute; right: 14px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select-wrap select {
  width: 100%; height: 50px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px; font-weight: 700;
  appearance: none; -webkit-appearance: none;
  background-image: none;
}
.select-wrap select:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }

.season-note {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
}

/* 세그먼트 버튼 */
.segmented {
  display: flex; gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
}
.segmented button {
  flex: 1 1 0;
  min-height: 48px;
  padding: 7px 6px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px; font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.segmented button span { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted-2); margin-top: 1px; }
.segmented button.is-active {
  background: var(--card);
  color: var(--brand-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .07), 0 4px 10px -8px rgba(15, 23, 42, .5);
}
.segmented button.is-active span { color: var(--brand); }
.segmented-sm button { min-height: 42px; font-size: 12.5px; }

/* 슬라이더 */
.range {
  --fill: 35%;
  width: 100%;
  height: 34px;
  margin: 8px 0 0;
  padding: 0;
  background: transparent;
  appearance: none; -webkit-appearance: none;
}
.range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand) 0 var(--fill), var(--line) var(--fill) 100%);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  margin-top: -9px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
  transition: transform .15s ease;
}
[data-theme="dark"] .range::-webkit-slider-thumb { background: #e8eefb; }
.range:active::-webkit-slider-thumb { transform: scale(1.08); }
.range::-moz-range-track {
  height: 6px; border-radius: 999px; background: var(--line);
}
.range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--brand); }
.range::-moz-range-thumb {
  width: 18px; height: 18px; border: 3px solid var(--brand); border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
}
.range:focus-visible { box-shadow: none; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chips button {
  flex: 1 1 0;
  min-width: 54px; min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-2);
  color: var(--text-soft);
  font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: all .15s ease;
}
.chips button:hover { border-color: var(--brand); color: var(--brand-ink); }
.chips button:active { transform: scale(.96); }
.chips button.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }

/* 복지할인 */
.discount-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  overflow: hidden;
}
.discount-box > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 14px;
  list-style: none;
  cursor: pointer;
  font-size: 13px; font-weight: 700;
  color: var(--text-soft);
}
.discount-box > summary::-webkit-details-marker { display: none; }
.discount-box > summary::after {
  content: "";
  width: 7px; height: 7px; margin-left: 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease;
}
.discount-box[open] > summary::after { transform: rotate(-135deg); }
.summary-title { margin-right: auto; }
.badge-soft {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--card-3);
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge-soft.is-on { background: var(--brand-soft); color: var(--brand-ink); }
.discount-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 2px 14px 0;
}
.toggle {
  display: flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track {
  position: relative; flex: 0 0 34px;
  width: 34px; height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background .2s ease;
}
.toggle-track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .3);
  transition: transform .2s ease;
}
.toggle input:checked + .toggle-track { background: var(--brand); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { box-shadow: var(--ring); }
.toggle:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.toggle-text { font-size: 12px; font-weight: 700; color: var(--text-soft); line-height: 1.25; }
.toggle-text small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.discount-box .field-help { padding: 10px 14px 13px; margin-top: 0; }

/* ── 8. 결과 카드 ────────────────────────────────────────── */
.result-card { padding-bottom: 14px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.result-label { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: -.01em; }
.result-amount {
  display: flex; align-items: baseline; gap: 2px;
  margin-top: 2px;
  font-size: 40px; font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.result-amount .won { font-size: 17px; font-weight: 800; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.result-amount-hot { color: var(--hot); }
.result-amount-hot .plus { font-size: 30px; font-weight: 800; margin-right: 1px; }
.result-sub { margin-top: 3px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tier-badge {
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
  background: color-mix(in srgb, var(--tier2) 16%, transparent);
  color: color-mix(in srgb, var(--tier2) 72%, var(--text));
  border: 1px solid color-mix(in srgb, var(--tier2) 32%, transparent);
}
.tier-badge[data-tier="1"],
.tier-pill[data-tier="1"] {
  background: color-mix(in srgb, var(--tier1) 16%, transparent);
  color: color-mix(in srgb, var(--tier1) 76%, var(--text));
  border-color: color-mix(in srgb, var(--tier1) 34%, transparent);
}
.tier-badge[data-tier="3"],
.tier-pill[data-tier="3"] {
  background: color-mix(in srgb, var(--tier3) 15%, transparent);
  color: color-mix(in srgb, var(--tier3) 78%, var(--text));
  border-color: color-mix(in srgb, var(--tier3) 34%, transparent);
}
.tier-badge[data-tier="4"],
.tier-pill[data-tier="4"] {
  background: color-mix(in srgb, var(--tier4) 18%, transparent);
  color: color-mix(in srgb, var(--tier4) 80%, var(--text));
  border-color: color-mix(in srgb, var(--tier4) 34%, transparent);
}
.tier-badge[data-tier="2"],
.tier-pill[data-tier="2"] { border: 1px solid color-mix(in srgb, var(--tier2) 32%, transparent); }

/* 게이지 */
.gauge { margin-top: 26px; --tier-color: var(--tier2); }
.gauge-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--card-3);
}
.gauge-seg {
  position: absolute; top: 0; bottom: 0;
  background: var(--seg);
  opacity: .22;
}
.gauge-seg1 { background: var(--tier1); border-radius: 999px 0 0 999px; z-index: 1; }
.gauge-seg2 { background: var(--tier2); z-index: 1; }
.gauge-seg3 { background: var(--tier3); border-radius: 0 999px 999px 0; z-index: 1; }
.gauge-super {
  position: absolute; top: 0; bottom: 0;
  border-radius: 0 999px 999px 0;
  background: repeating-linear-gradient(45deg, var(--tier4) 0 4px, transparent 4px 8px);
  opacity: .38;
  z-index: 1;
}
.gauge-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tier-color) 78%, #ffffff) 0%, var(--tier-color) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28);
  z-index: 2;
  transition: width .45s cubic-bezier(.22, .68, 0, 1), background .3s ease;
}
.gauge-marker {
  position: absolute; top: 50%; left: 0;
  width: 3px; height: 28px;
  border-radius: 3px;
  background: var(--text);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2.5px var(--card);
  z-index: 3;
  transition: left .45s cubic-bezier(.22, .68, 0, 1);
}
.gauge-marker-label {
  position: absolute; left: 50%; bottom: 22px;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--text);
  color: var(--card);
  font-size: 10px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gauge-scale {
  position: relative;
  height: 18px;
  margin-top: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.gauge-scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.gauge-scale span:first-child { left: 0; transform: none; }
.gauge-scale span:last-child { left: 100%; transform: translateX(-100%); }
.gauge-scale .gauge-tick { color: var(--tier4); }

/* 인사이트 문구 */
.insight {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -.01em;
}
.insight strong { font-weight: 800; }
.insight.is-warn { background: var(--hot-soft); color: var(--hot-ink); }

/* 상세 내역 */
.breakdown-box { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.breakdown-box > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 4px 0;
  list-style: none; cursor: pointer;
  font-size: 12.5px; font-weight: 800; color: var(--text-soft);
}
.breakdown-box > summary::-webkit-details-marker { display: none; }
.summary-hint { font-size: 10.5px; font-weight: 600; color: var(--muted-2); }
.breakdown { margin-top: 6px; }
.bd-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
  font-size: 12.5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.bd-row:last-child { border-bottom: 0; }
.bd-row .bd-label { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bd-row .bd-label small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.bd-row .bd-value { font-weight: 700; white-space: nowrap; }
.bd-row.sub { padding: 4px 0 4px 10px; font-size: 11.5px; color: var(--muted); border-bottom-style: dotted; }
.bd-row.sub .bd-value { font-weight: 600; }
.bd-row.discount .bd-value { color: var(--tier1); }
.bd-row.total {
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 0;
  font-size: 14px;
  color: var(--text);
}
.bd-row.total .bd-label { font-weight: 800; }
.bd-row.sum { font-weight: 800; color: var(--text); border-top: 1px dashed var(--line-strong); }
.bd-row.total .bd-value { font-weight: 900; font-size: 16px; letter-spacing: -.02em; }
.bd-note { margin-top: 8px; font-size: 10.5px; line-height: 1.5; color: var(--muted-2); }

/* 버튼 */
.result-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; min-height: 50px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 14px; font-weight: 800;
  letter-spacing: -.02em;
  transition: transform .15s ease, background .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-ghost { background: var(--card-2); border-color: var(--line); color: var(--text-soft); }
.btn-sm { width: auto; min-height: 42px; padding: 8px 14px; font-size: 12.5px; }

/* ── 9. 광고 슬롯 ────────────────────────────────────────── */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 80px;
  margin: 12px 0;
  border: 1px dashed color-mix(in srgb, var(--line-strong) 65%, transparent);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-2);
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase;
  overflow: hidden;
  opacity: .8;
}
.ad-slot:empty { min-height: 0; border: 0; margin: 0; }
.ad-slot--live { display: block; min-height: 0; border: 0; margin: 14px 0; background: transparent; }
.ad-slot--live ins { display: block; width: 100%; }

/* ── 10. 제휴 · 비교 ─────────────────────────────────────── */
.promo-card .card-head { margin-bottom: 12px; }
.compare {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  overflow: hidden;
}
.compare-head, .compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 50px 76px;
  align-items: center;
  gap: 4px;
  padding: 9px 10px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.compare-head {
  color: var(--muted-2);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  letter-spacing: -.01em;
}
.compare-head span:not(:first-child), .compare-row span:not(:first-child) { text-align: right; }
.compare-row { border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); font-size: 11.5px; color: var(--text-soft); }
.compare-row:last-child { border-bottom: 0; }
.compare-row .cmp-name { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 5px; min-width: 0; white-space: nowrap; overflow: hidden; }
.compare-row .cmp-name em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
.compare-row .cmp-watt { color: var(--muted); }
.compare-row .cmp-cost { font-weight: 700; }
.compare-row.is-best { background: color-mix(in srgb, var(--tier1) 9%, transparent); }
.compare-row.is-best .cmp-cost { color: color-mix(in srgb, var(--tier1) 82%, var(--text)); }
.compare-note { padding: 9px 12px; font-size: 10.5px; color: var(--muted-2); line-height: 1.45; border-top: 1px solid var(--line); }

.promo-grid { display: grid; gap: 8px; margin-top: 14px; }
.promo-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.promo-thumb {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 0 0 48px; width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--brand-soft);
  line-height: 1;
}
.promo-thumb b { font-size: 15px; font-weight: 800; color: var(--brand-ink); letter-spacing: -.03em; }
.promo-thumb i { font-style: normal; font-size: 9px; font-weight: 700; color: var(--brand); letter-spacing: .08em; margin-top: 2px; }
.promo-body { min-width: 0; flex: 1 1 auto; }
.promo-name { font-size: 13px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; }
.promo-meta { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.promo-cta {
  flex: 0 0 auto;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px; font-weight: 800;
  white-space: nowrap;
}
.promo-cta:hover { text-decoration: none; background: color-mix(in srgb, var(--brand) 16%, transparent); }
.ad-disclosure { margin-top: 10px; font-size: 10.5px; line-height: 1.45; color: var(--muted-2); }

/* ── 11. 기기 목록 ───────────────────────────────────────── */
.device-list { display: grid; gap: 7px; }
.device {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  overflow: hidden;
  transition: border-color .2s ease, background .2s ease;
}
.device.is-on { border-color: var(--brand); background: var(--brand-soft); }
.device-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
}
.device-head input[type="checkbox"] {
  flex: 0 0 18px;
  width: 18px; height: 18px;
  margin: 0;
  border-radius: 5px;
  accent-color: var(--brand);
}
.device-emoji { font-size: 18px; line-height: 1; }
.device-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.device-name { font-size: 13px; font-weight: 800; letter-spacing: -.02em; }
.device-meta { font-size: 10.5px; color: var(--muted); }
.device-kwh {
  flex: 0 0 auto;
  font-size: 11px; font-weight: 800;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.device.is-on .device-kwh { color: var(--brand-ink); }
.device-hours {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 10px;
}
.device-hours-label { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.device-hours .range { margin: 0; height: 30px; flex: 1 1 auto; }
.device-hours output {
  flex: 0 0 52px;
  text-align: right;
  font-size: 11.5px; font-weight: 800;
  color: var(--brand-ink);
  font-variant-numeric: tabular-nums;
}
.device--custom .device-name-input {
  width: 100%;
  padding: 2px 0;
  border: 0; border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 13px; font-weight: 800;
}
.device--custom .device-name-input:focus { outline: none; border-bottom-color: var(--brand); }
.custom-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 12px; }
.custom-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.custom-fields input {
  height: 40px; padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.custom-fields label:first-child { grid-column: 1 / -1; }
.custom-fields input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

/* ── 12. 시뮬레이터 결과 ─────────────────────────────────── */
.sim-result { padding-top: 16px; }
.sim-result.is-empty .result-amount-hot { color: var(--muted-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; filter: none; }
.sim-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  overflow: hidden;
}
.sim-cell { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--card-2); }
.sim-cell span { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.sim-cell strong { font-size: 14px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.tier-flow {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.tier-pill {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card-2);
  color: var(--text-soft);
  font-size: 12px; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tier-arrow { color: var(--muted-2); font-weight: 800; font-size: 13px; }
.tier-flow[data-jump="true"] .tier-arrow { color: var(--hot); }
.jump-badge {
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--hot-soft);
  color: var(--hot-ink);
  font-size: 11px; font-weight: 800;
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hot) 35%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--hot) 0%, transparent); }
}

/* ── 13. 팁 ──────────────────────────────────────────────── */
.tips-card h2 { margin-bottom: 10px; }
.tips { display: grid; gap: 10px; }
.tips li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}
.tips li::before {
  content: "";
  position: absolute; left: 2px; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  opacity: .65;
}
.tips strong { color: var(--text-soft); font-weight: 800; }

/* ── 14. 푸터 ────────────────────────────────────────────── */
.app-footer {
  margin-top: 18px;
  padding: 18px 4px 8px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.6;
}
.app-footer .disclaimer { margin-bottom: 10px; }
.app-footer strong { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; font-weight: 700; }
.footer-links a { color: var(--muted); }
.footer-meta { display: flex; flex-wrap: wrap; gap: 6px; font-variant-numeric: tabular-nums; }
.app-footer .ad-disclosure { margin-top: 10px; }

/* ── 15. 토스트 · 기타 ───────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(88vw, 380px);
  padding: 12px 18px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--card);
  font-size: 12.5px; font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript {
  margin: 20px auto; max-width: 480px; padding: 16px;
  border-radius: 14px; background: #fff3cd; color: #664d03;
  font-size: 13px; text-align: center;
}

/* ── 16. 반응형 ──────────────────────────────────────────── */
@media (min-width: 420px) {
  body { font-size: 15.5px; }
  .brand-text h1 { font-size: 17px; }
  .result-amount { font-size: 44px; }
}
@media (min-width: 768px) {
  body { padding: 18px 0 48px; }
  .app-shell { padding: 0 20px 40px; }
  .app-header { border-radius: 18px; margin: 0 0 4px; position: relative; background: transparent; backdrop-filter: none; border-bottom: 0; }
  .card { padding: 22px 22px; margin-bottom: 14px; }
  .result-amount { font-size: 48px; }
  .tabs { margin-top: 4px; }
  .app-footer { padding: 22px 6px 10px; font-size: 11px; }
}
@media (min-width: 1024px) {
  .app-shell { max-width: 600px; }
}

/* ── 17. 모션 최소화 ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ── 18. 인쇄 ────────────────────────────────────────────── */
@media print {
  .app-header, .tabs, .ad-slot, .promo-card, .result-actions, .toast, .tips-card { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ── 함께 많이 쓰는 계산기 ─────────────────────────────────── */
.related-apps { margin: 18px 0 14px; }
.related-apps h2 { color: var(--text); font-size: 14px; font-weight: 800; margin: 0 2px 9px; }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.related-app {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-decoration: none;
  transition: border-color .14s ease, transform .14s ease;
}
.related-app:hover { border-color: var(--brand); transform: translateY(-2px); }
.related-app strong { color: var(--text); font-size: 13px; font-weight: 800; }
.related-app span { color: var(--muted); font-size: 11px; line-height: 1.5; }
@media (max-width: 360px) { .related-grid { grid-template-columns: 1fr; } }

/* 좁은 화면에서 상품명이 단어 중간에서 끊기지 않도록 합니다 */
@media (max-width: 430px) {
  .promo-name, .promo-meta { word-break: keep-all; overflow-wrap: break-word; }
  .promo-cta { padding-left: 8px; padding-right: 8px; }
}
