:root {
  --surface-canvas: #f5f5f7;
  --surface-primary: #ffffff;
  --surface-subtle: #fbfbfd;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-strong-secondary: #5f5f65;
  --border-subtle: #d2d2d7;
  --accent-primary: #0071e3;
  --accent-hover: #0066cc;
  --ipad-tint: #e8f2ff;
  --mac-tint: #f0edff;
  --mac-accent: #7d5bd6;
  --status-positive: #248a3d;
  --status-warning: #b25000;
  --status-negative: #d70015;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 12px;
  --radius-md: 20px;
  --shadow-panel: 0 2px 18px rgba(0, 0, 0, 0.06);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--surface-canvas); }

body {
  margin: 0;
  color: var(--text-primary);
  background: var(--surface-canvas);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.015em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

button, input { font: inherit; }

button:focus-visible, input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent-primary) 40%, transparent);
  outline-offset: 3px;
}

.page-shell {
  width: min(100% - 32px, 1440px);
  margin-inline: auto;
  padding-block: clamp(32px, 6vw, 80px);
}

.masthead { max-width: 880px; margin-bottom: var(--space-12); }
.eyebrow { margin: 0 0 var(--space-3); color: var(--accent-hover); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 56px); line-height: 1.08; letter-spacing: -.04em; }
.lede { max-width: 720px; margin: var(--space-4) 0 0; color: var(--text-secondary); font-size: 19px; }

.currency-toolbar {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  justify-content: start;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-8);
}
.control-label { margin: 0 0 var(--space-2); color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.currency-toggle { display: inline-flex; padding: var(--space-1); background: var(--surface-primary); border: 1px solid var(--border-subtle); border-radius: 999px; }
.currency-button {
  min-width: 72px;
  min-height: 44px;
  padding-inline: var(--space-4);
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
.currency-button:hover { color: var(--accent-primary); }
.currency-button[aria-pressed="true"] { color: var(--surface-primary); background: var(--accent-primary); }
.fx-field { display: flex; align-items: center; gap: var(--space-2); min-height: 48px; color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.fx-field input { width: 112px; min-height: 44px; padding: 0 var(--space-3); color: var(--text-primary); background: var(--surface-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); font-weight: 700; text-align: right; }
.fx-help { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 12px; }
.fx-error { grid-column: 1 / -1; margin: 0; color: var(--status-negative); font-size: 12px; font-weight: 600; }
.fx-field input[aria-invalid="true"] { border-color: var(--status-negative); }

.simulator {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  overflow: hidden;
  background: var(--surface-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}

.control-panel { padding: clamp(24px, 4vw, 48px); }
.summary-panel { display: grid; align-content: center; padding: clamp(24px, 4vw, 48px); background: var(--surface-subtle); border-left: 1px solid var(--border-subtle); }
.section-title { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -.025em; }
.section-copy { margin: var(--space-2) 0 0; color: var(--text-secondary); }
.nowrap { white-space: nowrap; }

.control-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); }
.reset-button {
  min-height: 44px;
  padding: 0 var(--space-4);
  color: var(--accent-primary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease-out, border-color 150ms ease-out, transform 150ms ease-out;
}
.reset-button:hover { color: var(--accent-hover); border-color: var(--accent-primary); }
.reset-button:active { transform: scale(.98); }

.quantity-stack { margin-top: var(--space-6); border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
.quantity-control { padding: var(--space-6) 0; }
.quantity-control + .quantity-control { border-top: 1px solid var(--border-subtle); }
.quantity-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-3); }
.quantity-heading label { font-size: 17px; font-weight: 700; }
.quantity-heading p { margin: var(--space-1) 0 0; color: var(--text-secondary); font-size: 12px; }
.quantity-heading .boe-total-line { color: var(--accent-hover); font-weight: 600; }
.boe-total-line strong { color: inherit; }
.quantity-input-wrap { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }
.quantity-input-wrap input {
  width: 132px;
  min-height: 44px;
  padding: 0 var(--space-3);
  color: var(--text-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 700;
  text-align: right;
}
.quantity-input-wrap span { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.quantity-input-wrap input[aria-invalid="true"] { border-color: var(--status-negative); }
.quantity-error { margin: var(--space-2) 0 0; color: var(--status-negative); font-size: 12px; font-weight: 600; }

input[type="range"] { width: 100%; height: 44px; margin: 0; accent-color: var(--accent-primary); cursor: pointer; }
.mac-control input[type="range"] { accent-color: var(--mac-accent); }
.range-ends { display: flex; justify-content: space-between; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.boe-presets { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.preset {
  min-height: 44px;
  min-width: 64px;
  padding: 0 var(--space-3);
  color: var(--accent-primary);
  background: transparent;
  border: 1px solid var(--accent-primary);
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  transition: color 150ms ease-out, background 150ms ease-out, transform 150ms ease-out;
}
.preset:hover, .preset[aria-pressed="true"] { color: var(--surface-primary); background: var(--accent-primary); }
.preset:active { transform: scale(.98); }

.formula { margin: var(--space-8) 0 0; padding-top: var(--space-6); border-top: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: 14px; }
.formula strong { color: var(--text-primary); }
.total-label { margin: 0; color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.total-value { margin: var(--space-2) 0; font-variant-numeric: tabular-nums; font-size: clamp(44px, 7vw, 72px); font-weight: 700; line-height: 1; letter-spacing: -.05em; }
.total-meta { margin: 0; color: var(--text-secondary); font-size: 14px; }

.product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-8); }
.metric { padding: var(--space-6); border-radius: var(--radius-sm); }
.metric.ipad { background: var(--ipad-tint); }
.metric.mac { background: var(--mac-tint); }
.metric-label { margin: 0; font-size: 14px; font-weight: 700; }
.metric-units { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin: var(--space-2) 0 0; color: var(--text-strong-secondary); font-size: 12px; }
.metric-units strong { color: var(--text-primary); font-size: 16px; font-variant-numeric: tabular-nums; }
.metric-value { margin: var(--space-2) 0 0; font-variant-numeric: tabular-nums; font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.metric-detail { margin: var(--space-1) 0 0; color: var(--text-strong-secondary); font-size: 12px; }
html[data-currency="KRW"] .total-value { font-size: clamp(36px, 5vw, 52px); }
html[data-currency="KRW"] .metric-value { font-size: 22px; }

.contribution { display: flex; height: 10px; margin-top: var(--space-6); overflow: hidden; background: var(--border-subtle); border-radius: 999px; }
.contribution-ipad { background: var(--accent-primary); }
.contribution-mac { background: var(--mac-accent); }

.section { margin-top: clamp(48px, 7vw, 88px); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: var(--space-6); margin-bottom: var(--space-6); }
.section-heading p { max-width: 620px; margin: 0; color: var(--text-secondary); }
.table-wrap { overflow-x: auto; background: var(--surface-primary); border-radius: var(--radius-sm); }
.scroll-hint { display: none; margin: var(--space-2) 0 0; color: var(--text-secondary); font-size: 12px; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { padding: var(--space-4) var(--space-6); text-align: left; font-size: 19px; font-weight: 700; }
th, td { padding: var(--space-4) var(--space-6); text-align: right; border-top: 1px solid var(--border-subtle); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--text-secondary); background: var(--surface-subtle); font-size: 12px; letter-spacing: .03em; }
tbody tr[data-active="true"] { background: var(--ipad-tint); }
tbody tr:last-child td { font-weight: 700; }

.assumptions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.assumption-card { padding: var(--space-6); background: var(--surface-primary); border-radius: var(--radius-sm); }
.assumption-card h3 { margin: 0 0 var(--space-4); font-size: 19px; }
.assumption-list { display: grid; grid-template-columns: 1fr auto; gap: var(--space-3) var(--space-6); margin: 0; }
.assumption-list dt { color: var(--text-secondary); }
.assumption-list dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }
.note { margin-top: var(--space-6); padding: var(--space-4); color: var(--text-secondary); background: var(--surface-subtle); border-left: 3px solid var(--status-warning); font-size: 14px; }
.note strong { color: var(--status-warning); }
.footer { margin-top: var(--space-12); padding-top: var(--space-6); color: var(--text-secondary); border-top: 1px solid var(--border-subtle); font-size: 12px; }

@media (max-width: 900px) {
  .simulator { grid-template-columns: 1fr; }
  .summary-panel { border-top: 1px solid var(--border-subtle); border-left: 0; }
  .section-heading { display: block; }
  .section-heading p { margin-top: var(--space-2); }
  .scroll-hint { display: block; }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 24px, 1440px); padding-block: var(--space-8); }
  .masthead { margin-bottom: var(--space-8); }
  .lede { font-size: 16px; }
  .product-grid, .assumptions { grid-template-columns: 1fr; }
  .control-panel-heading { display: block; }
  .reset-button { margin-top: var(--space-4); }
  .quantity-heading { align-items: start; }
  .quantity-input-wrap input { width: 116px; font-size: 19px; }
  .boe-presets { display: grid; grid-template-columns: repeat(3, 1fr); }
  .preset { padding-inline: var(--space-2); }
  .control-panel, .summary-panel { padding: var(--space-6); }
  .currency-toolbar { grid-template-columns: 1fr; align-items: start; }
  .fx-help { grid-column: auto; }
  html[data-currency="KRW"] .total-value { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) { .preset, .reset-button { transition: none; } }
