/* 문법: docs/DESIGN.md. 출처는 라이트박스 위 광학 일치 카드(peek-a-boo, Termatrex). */
:root {
  --desk: #e3ebc8;
  --case: #4b5d45;
  --case-ink: #eef2ea;
  --light: #f1f7fa;
  --off: #22272a;
  --card: #a9b8ad;
  --ink: #15181a;
  --sub: #4f534d;
  --line: #bcc4a6;
  --paper: #f7f9f8;
  --mask-film: #0e1011;
  --hole-off: #3a4246;
  --rocker: #6b7a72;
  --film: #d6dbd8;
  /* 상태 표시(성분 대조 결과) */
  --hit: #b3261e;
  --hit-bg: #fde7e5;
  --mask: #7a5a00;
  --mask-bg: #fff3c9;
  --func: #1b5aa6;
  --func-bg: #e4eefb;
  --ok: #24693d;
  --ok-bg: #e3f3e8;
  --radius: 4px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --body: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--desk); color: var(--ink); font: 16px/1.5 var(--body); }
ivel-bar { display: block; height: 44px; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px 64px; }
header.svc { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
header.svc h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
header.svc p { margin: 0; color: var(--sub); font-size: 13px; }
.svc-r { display: flex; align-items: center; gap: 8px; flex: none; }
.svc-r .lang { color: var(--sub); font-size: 14px; text-underline-offset: 3px; padding: 4px 2px; }
section { margin-top: 18px; }
#finder { margin-top: 8px; }
h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
h3 { font-size: 14px; margin: 16px 0 6px; display: flex; align-items: center; gap: 6px; }
label.big { display: block; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
textarea {
  width: 100%; min-height: 128px; padding: 12px; font: 15px/1.5 var(--body); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn { min-height: 34px; border: 1.5px solid var(--ink); background: var(--paper); padding: 6px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 600; }
.btn.ghost { border-color: var(--line); background: transparent; }
.btn:active { transform: translateY(1px); }

/* 라이트박스: 초록 칠 금속 몸체, 평평한 확산판, 아래 스위치 줄 */
.box { position: relative; background: var(--case); border-radius: 6px; padding: 10px 10px 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25), 0 2px 0 rgba(0, 0, 0, 0.18); }
.panel { position: relative; overflow: hidden; border-radius: 2px; background: var(--off); min-height: 120px; }
.box[data-state="demo"] .panel, .box[data-state="lit"] .panel { background: var(--light); }
.panel svg.demo { display: block; width: 100%; height: auto; }
.lightrect { fill: var(--light); }
.dc path { fill: var(--card); fill-opacity: 0.62; stroke: rgba(0, 0, 0, 0.18); stroke-width: 1; }
.dc-a { animation: slide-a 8s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
.dc-b { animation: slide-b 11s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate; }
@keyframes slide-a { 0% { transform: translateX(calc(-3 * var(--p))); } 42%, 58% { transform: translateX(0); } 100% { transform: translateX(calc(2 * var(--p))); } }
@keyframes slide-b { 0% { transform: translateX(calc(1 * var(--p))); } 45%, 55% { transform: translateX(0); } 100% { transform: translateX(calc(-1 * var(--p))); } }
.panel .tag { position: absolute; right: 6px; bottom: 6px; padding: 2px 8px; border-radius: 2px; background: var(--case); color: var(--case-ink); font-size: 12px; font-weight: 600; }

.grid { display: grid; grid-template-columns: 18px repeat(var(--cols), 1fr); background: var(--case); gap: 0; }
.ax { color: var(--case-ink); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.cell { position: relative; aspect-ratio: 1; background: var(--cover, var(--off)); }
.cell::before { content: ""; position: absolute; inset: 22%; border-radius: 50%; background: transparent; }
.box[data-state="off"] .cell { background: var(--off); }
.box[data-state="off"] .cell:not(.lv-none)::before { background: var(--hole-off); }
.box[data-state="lit"] .cell::before { background: var(--h, transparent); }
.box[data-state="lit"] .cell.lv-mask::before { background: var(--mask-film); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
/* 겹친 점의 테: 판(덮개) 색에 맞춰 --ring을 정한다(카드 1~2장은 어두운 테, 3장 이상은 밝은 테). 점 테와 판 대비 3:1 이상 */
.box[data-state="lit"] .cell.lv-full::before, .box[data-state="lit"] .cell.lv-part::before, .box[data-state="lit"] .cell.lv-one::before { box-shadow: 0 0 0 1.5px var(--ring, rgba(255, 255, 255, 0.85)); }

/* 연출: 카드가 한 장씩 내려앉고, 한 번에 켜지고(깜빡임 없음), 목록이 올라온다 */
.fly { position: absolute; inset: 0; border-radius: 2px; pointer-events: none; opacity: 0; background: rgba(169, 184, 173, 0.55); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); animation: drop 220ms var(--ease) calc(var(--i) * 180ms) both, fade 200ms linear calc(var(--on) + 60ms) forwards; }
.fly-good { background: rgba(14, 16, 17, 0.12); }
@keyframes drop { from { opacity: 0; transform: translateY(-36px) rotate(-1.2deg); } to { opacity: 1; transform: none; } }
@keyframes fade { to { opacity: 0; } }
.box.reveal .cell { animation: on-cover 180ms linear var(--on) both; }
.box.reveal .cell::before { animation: on-hole 180ms linear var(--on) both; }
@keyframes on-cover { from { background: var(--off); } }
@keyframes on-hole { from { background: var(--hole-off); } }
.common-box.reveal li { animation: rise 140ms var(--ease) calc(var(--on, 900ms) + 260ms + var(--i) * 70ms) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.box-bar { display: flex; align-items: center; gap: 8px; padding: 10px 0; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 16px 6px 10px; border: 0; border-radius: var(--radius); background: var(--light); color: var(--ink); font-size: 16px; font-weight: 800; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.switch i { width: 12px; height: 20px; border-radius: 2px; background: var(--off); box-shadow: inset 0 -9px 0 var(--rocker); }
.box[data-state="lit"] .switch i { box-shadow: inset 0 9px 0 var(--rocker); }
.switch:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0, 0, 0, 0.35); }
.tg { min-height: 32px; padding: 4px 10px; border: 1.5px solid rgba(238, 242, 234, 0.55); border-radius: var(--radius); background: transparent; color: var(--case-ink); font-size: 13px; font-weight: 600; }
.tg[aria-pressed="true"] { background: rgba(0, 0, 0, 0.28); border-color: var(--case-ink); }
.tg[aria-pressed="true"]::before { content: "✓ "; }

.lv { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--sub); }
.lv li { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--h, var(--light)); box-shadow: 0 0 0 1.5px var(--case); }
.sw.lv-mask { background: var(--mask-film); }

.common-box { margin-top: 10px; padding: 10px 14px 14px; background: var(--paper); border-radius: var(--radius); border: 1.5px solid var(--line); }
.common-box h3 { margin-top: 4px; }
.common-box.preview { padding: 8px 12px; }
.common-box .pv { margin: 0; font-size: 14px; word-break: keep-all; }
.common-box .pv .ex-tag { margin-left: 0; }
ol.common { list-style: none; margin: 0; padding: 0; }
ol.common li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
ol.common li:last-child { border-bottom: 0; }
ol.common b { font-size: 16px; }
ol.common span.cnt { color: var(--sub); font-size: 13px; font-variant-numeric: tabular-nums; }
.xy { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 26px; padding: 0 6px; border-radius: var(--radius); background: var(--h, var(--light)); color: var(--ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1.5px var(--case); }
ol.common li.base { color: var(--sub); }
ol.common li.base b { font-weight: 500; }
.btn.mini { min-height: 28px; padding: 2px 10px; font-size: 13px; border-width: 1px; margin-left: auto; }
.btn.mini.done { border-color: var(--line); color: var(--sub); cursor: default; }
#share { margin-top: 10px; }
.need { color: var(--sub); font-size: 14px; margin: 0; }
p.use { margin: -4px 0 10px; color: var(--sub); font-size: 14px; }
.ex-tag { display: inline-block; margin: 0 6px; padding: 1px 7px; border-radius: 2px; background: var(--case); color: var(--case-ink); font-size: 12px; font-weight: 600; vertical-align: middle; }
ol.common li .btn.mini { margin-left: auto; }
.brk { display: none; }
@media (max-width: 480px) { .brk { display: block; flex-basis: 100%; height: 0; } }
.fnote { font-size: 12px; color: var(--sub); margin: 6px 0 0; }

/* 제품 카드: 위 두 모서리 따냄, 윗변 구멍 줄, 안 맞음은 반투명 카드, 맞음은 검은 점 필름 */
.rack-h { margin-top: 22px; }
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.slot { position: relative; padding: 18px 10px 10px; display: flex; flex-direction: column; gap: 6px; background: var(--card); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%, 0 10px); }
.slot .punch { position: absolute; left: 14px; right: 14px; top: 5px; height: 7px; background: radial-gradient(circle at 3.5px 3.5px, var(--desk) 2.6px, transparent 3px) 0 0 / 14px 7px repeat-x; }
.slot.s-good { background: var(--film); box-shadow: inset 0 0 0 1.5px var(--mask-film); }
.slot.s-good .punch { background: radial-gradient(circle at 3.5px 3.5px, var(--mask-film) 2.6px, transparent 3px) 0 0 / 14px 7px repeat-x; }
.slot-head { display: flex; align-items: center; gap: 6px; }
.verdict { min-height: 28px; border: 0; border-radius: 2px; padding: 3px 9px; font-size: 13px; font-weight: 700; background: var(--case); color: var(--case-ink); flex: none; }
.s-good .verdict { background: var(--mask-film); color: var(--light); }
.slot-name { flex: 1; min-width: 0; min-height: 28px; border: 0; border-bottom: 1px solid rgba(21, 24, 26, 0.35); background: transparent; padding: 3px 2px; font: 14px var(--body); color: var(--ink); }
.slot-name::placeholder { color: var(--ink); opacity: 0.8; }
.slot-text { min-height: 92px; font-size: 14px; padding: 8px; background: var(--paper); border-color: rgba(21, 24, 26, 0.25); }
.x { min-width: 28px; min-height: 28px; border: 0; background: transparent; font-size: 18px; line-height: 1; padding: 2px 6px; color: inherit; }

/* 제품 하나 대조, 빼기 목록 */
section.check { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.grps { display: flex; flex-wrap: wrap; gap: 6px; }
.grp { min-height: 32px; border: 1.5px solid var(--line); background: var(--paper); padding: 4px 10px; border-radius: var(--radius); font-size: 14px; }
.grp.on { border-color: var(--hit); background: var(--hit-bg); color: var(--hit); font-weight: 700; }
.grp.on::before { content: "⊘ "; }
.names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.name { display: inline-flex; align-items: center; gap: 2px; border: 1.5px solid var(--hit); color: var(--hit); background: var(--hit-bg); padding: 0 2px 0 10px; border-radius: var(--radius); font-size: 14px; font-weight: 700; }
form.add { display: flex; gap: 6px; margin-top: 8px; }
form.add input { flex: 1 1 180px; min-width: 0; padding: 7px 10px; font: 15px var(--body); border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.status { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius); font-size: 17px; background: var(--paper); }
.status .dot { width: 12px; height: 12px; border-radius: 2px; background: var(--sub); flex: none; }
.status.hit { background: var(--hit-bg); color: var(--hit); }
.status.hit .dot { background: var(--hit); }
.status.clear { background: var(--ok-bg); color: var(--ok); }
.status.clear .dot { background: var(--ok); }
.status.masked, .status.partial { background: var(--mask-bg); color: var(--mask); }
.status.masked .dot { background: transparent; border: 2px dashed var(--mask); }
.status.partial .dot { background: transparent; border: 2px dotted var(--mask); }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--sub); font-size: 13px; margin: 10px 0 6px; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
ol.chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: baseline; gap: 6px; min-height: 30px; border: 1.5px solid var(--line); background: var(--paper); padding: 4px 9px; border-radius: var(--radius); font-size: 14px; text-align: left; }
.chip .pos { font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }
.chip.hit { border-color: var(--hit); background: var(--hit-bg); color: var(--hit); font-weight: 700; }
.chip.hit .pos { color: var(--hit); }
.chip.frag { border-style: dashed; border-color: var(--mask); background: var(--mask-bg); }
.chip.allg { box-shadow: inset 0 -3px 0 var(--mask); }
.chip.func:not(.hit) { border-color: var(--func); background: var(--func-bg); color: var(--func); }
.chip.unk { border-style: dotted; color: var(--sub); }
.chip.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
dl.detail { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; padding: 10px 12px; background: var(--paper); border-radius: var(--radius); font-size: 14px; }
dl.detail dt { color: var(--sub); }
dl.detail dd { margin: 0; }
.func ul { margin: 0; padding-left: 18px; font-size: 14px; }
.func b { color: var(--func); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12px; color: var(--sub); margin: 0 0 8px; padding: 0; list-style: none; }
.legend li { display: inline-flex; align-items: center; gap: 4px; }
.legend i { display: inline-block; width: 14px; height: 10px; border: 1.5px solid var(--line); border-radius: 2px; }
.legend i.hit { border-color: var(--hit); background: var(--hit-bg); }
.legend i.frag { border: 1.5px dashed var(--mask); background: var(--mask-bg); }
.legend i.allg { box-shadow: inset 0 -3px 0 var(--mask); }
.legend i.func { border-color: var(--func); background: var(--func-bg); }
.legend i.unk { border-style: dotted; }
ul.similar { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
ul.similar li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 6px 0; }
ul.similar span { color: var(--sub); font-size: 13px; }
a.buy { font-weight: 700; color: var(--ink); }
.tip { position: relative; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; font-size: 12px; font-weight: 700; line-height: 1; padding: 0; flex: none; }
#tipbox {
  position: fixed; z-index: 50; max-width: min(320px, calc(100vw - 16px)); padding: 8px 10px; border-radius: var(--radius);
  background: var(--ink); color: var(--light); font-size: 13px; line-height: 1.45;
}
footer { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--sub); font-size: 12px; }
footer p { margin: 4px 0; }
footer a { color: inherit; }
.affil { margin: 0 0 6px; font-size: 14px; color: var(--ink); }
.affil .ad { display: inline-block; padding: 0 6px; border-radius: 2px; background: var(--case); color: var(--case-ink); font-size: 12px; font-weight: 700; }

dialog#fb { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 6px; padding: 16px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
dialog#fb::backdrop { background: rgba(21, 24, 26, 0.45); }
dialog#fb h2 { margin-top: 0; }
#fb-msg { min-height: 120px; }
.fb-st { min-height: 1.5em; margin: 6px 0 0; font-size: 14px; color: var(--sub); }

@media (max-width: 520px) {
  header.svc h1 { font-size: 18px; }
  header.svc p { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .dc-a, .dc-b, .fly, .box.reveal .cell, .box.reveal .cell::before, .common-box.reveal li { animation: none !important; }
  .fly { display: none; }
}
.panel:has(> .grid) { min-height: 0; background: var(--case) !important; }

textarea::placeholder, input::placeholder { color: var(--sub); opacity: 1; }
.slot-name::placeholder { color: var(--ink); opacity: 0.8; }
