:root {
  color-scheme: light;
  --ink: #172019;
  --muted: #677169;
  --line: #dfe5df;
  --surface: #ffffff;
  --surface-2: #f4f7f3;
  --bg: #f7f9f6;
  --lime: #b9ed57;
  --amber: #a76200;
  --red: #c53b32;
  --blue: #1769aa;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  background: radial-gradient(circle at 12% 0%, #e9f6dd 0, transparent 34rem), var(--bg);
  color: var(--ink);
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 36px; }
.masthead { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 32px; }
.step { color: #5b7f19; font-size: 12px; font-weight: 800; letter-spacing: .18em; margin: 0 0 8px; }
h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1; letter-spacing: -.055em; margin: 0; }
.workspace { display: grid; grid-template-columns: minmax(310px, .82fr) minmax(0, 1.38fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 55px #24332612; }
.controls, .results { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 24px; }
.panel-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.text-button { color: var(--muted); background: transparent; border: 0; padding: 6px 0; font-size: 13px; }
.field-grid { display: grid; gap: 14px; }
.primary-fields { grid-template-columns: repeat(3, 1fr); }
label { position: relative; display: grid; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
input, select { width: 100%; color: var(--ink); background: #fbfcfa; border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: none; }
input:focus, select:focus { border-color: #89b837; box-shadow: 0 0 0 3px #89b83720; }
.advanced { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.advanced summary { color: var(--ink); font-weight: 750; cursor: pointer; }
.score-fields { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.suffix { position: absolute; right: 12px; bottom: 12px; color: var(--muted); }
.switch-row { grid-template-columns: auto 1fr; align-items: start; margin: 20px 0; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--lime); }
.switch-row strong, .switch-row small { display: block; color: var(--ink); }
.switch-row small { color: var(--muted); line-height: 1.45; margin-top: 4px; font-weight: 450; }
.draw-mode-row { margin: 20px 0; }
.draw-mode-row small { color: var(--muted); line-height: 1.5; font-weight: 450; }
.precision-row { margin-bottom: 18px; }
.calculate-button { width: 100%; display: flex; justify-content: space-between; border: 0; border-radius: 12px; margin-top: 22px; padding: 15px 17px; background: var(--lime); color: #11150f; font-weight: 850; }
.error { color: var(--red); background: #fff4f2; border: 1px solid #efb8b3; border-radius: 10px; padding: 12px; }
.run-meta { color: var(--muted); font-size: 12px; padding-top: 7px; }
.cut-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cut-card { min-height: 126px; display: flex; flex-direction: column; border-radius: 14px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.cut-card.accent { background: var(--lime); color: #11150f; border-color: var(--lime); }
.cut-card span, .cut-card small { font-size: 12px; color: var(--muted); }
.cut-card.accent span, .cut-card.accent small { color: #344324; }
.cut-card strong { font-size: 32px; margin: 10px 0 auto; letter-spacing: -.04em; }
.table-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 28px 0 12px; }
.table-heading h3 { margin: 0; font-size: 17px; }
.table-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: 11px; font-weight: 650; }
.status { display: inline-block; border-radius: 999px; min-width: 44px; padding: 5px 8px; text-align: center; font-size: 11px; font-weight: 800; }
.status.safe { color: #4d7311; background: #eaf8d2; }
.status.likely { color: var(--blue); background: #e8f4fc; }
.status.bubble { color: var(--amber); background: #fff2dc; }
.status.unlikely { color: var(--muted); background: #eef1ed; }
.id-summary { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.max-count { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; font-weight: 500; }
.empty-state, .loading { min-height: 330px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--muted); }
.empty-state p { line-height: 1.7; }
.mini-chart { display: flex; align-items: end; gap: 6px; height: 72px; margin-bottom: 16px; }
.mini-chart i { width: 10px; border-radius: 4px 4px 0 0; background: #b7c1b8; }
.mini-chart i:nth-child(1), .mini-chart i:nth-child(5) { height: 18px; }
.mini-chart i:nth-child(2), .mini-chart i:nth-child(4) { height: 42px; }
.mini-chart i:nth-child(3) { height: 68px; background: var(--lime); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--lime); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 840px) {
  .shell { width: min(100% - 22px, 680px); padding-top: 30px; }
  .masthead { margin-bottom: 24px; }
  .workspace { grid-template-columns: 1fr; }
  .primary-fields { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 16px, 520px); }
  .masthead { display: block; }
  .controls, .results { padding: 18px; }
  .primary-fields, .score-fields { grid-template-columns: 1fr 1fr; }
  .primary-fields label:first-child { grid-column: 1 / -1; }
  .cut-cards { grid-template-columns: 1fr 1fr; }
  .cut-card.accent { grid-column: 1 / -1; min-height: 112px; }
  .table-heading { display: block; }
  .table-heading p { margin-top: 6px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-bottom: 1px solid var(--line); padding: 14px 0; }
  td { border: 0; padding: 0; text-align: right; }
  td:first-child { grid-column: 1 / -1; }
  td::before { content: attr(data-label); color: var(--muted); float: left; margin-right: 10px; font-size: 11px; }
}
