:root {
  --bg: #f6f7f9; --panel: #fff; --line: #dfe3e8; --text: #1b1f24; --muted: #5d6673;
  --accent: #1f5fd1; --accent-text: #fff; --warn: #9a5b00; --danger: #c0362c;
  --checker-a: #fff; --checker-b: #e9ecf0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b; --panel: #1d2127; --line: #2f353d; --text: #e8ebef; --muted: #98a2b0;
    --accent: #5b8def; --accent-text: #0b1220; --warn: #e0a64a; --danger: #ff7b70;
    --checker-a: #262b32; --checker-b: #1d2127;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

.top { background: var(--panel); border-bottom: 1px solid var(--line); padding-top: 14px; position: sticky; top: 0; z-index: 5; }
.top .wrap:first-child { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.brand { font-size: 20px; text-decoration: none; color: var(--text); letter-spacing: -.3px; }
.brand b { color: var(--accent); }
.brand small { font-size: 12px; color: var(--muted); margin-left: 4px; }
.tag { margin: 0; color: var(--muted); font-size: 13px; }
#tabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
#tabs a { flex: none; padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
#tabs a .ti { margin-right: 6px; opacity: .7; }
#tabs a:hover { color: var(--text); }
#tabs a[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

main { padding-top: 20px; padding-bottom: 40px; }
.sub { color: var(--muted); margin: 0 0 16px; }
footer { color: var(--muted); font-size: 12px; padding-bottom: 32px; }

.drop { border: 2px dashed var(--line); border-radius: 12px; background: var(--panel); padding: 28px 16px; text-align: center; cursor: pointer; transition: border-color .15s; }
.drop.over, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop strong { display: block; font-size: 16px; margin-bottom: 2px; }
.drop span { color: var(--muted); font-size: 13px; }

.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 14px 0; align-items: start; }
.controls label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.controls label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 600; }
.controls select, .controls input[type=range] { width: 100%; }
select, textarea, input[type=text], input:not([type]) { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; width: 100%; }
select { width: 100%; }
textarea { resize: vertical; }
.val { color: var(--muted); font-weight: 400; margin-left: 4px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
details.adv { margin: 0 0 14px; }
details.adv > summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
details.adv .controls { margin-top: 6px; }

.stage { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) { .stage { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.card h2 { font-size: 13px; margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.card h2 small { color: var(--muted); font-weight: 400; }
.card h2 select { width: auto; margin-left: auto; padding: 3px 6px; font-size: 12px; }
.view { height: min(58vh, 520px); display: flex; align-items: center; justify-content: center; position: relative;
  background-color: var(--checker-a);
  background-image: linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%),
                    linear-gradient(45deg, var(--checker-b) 25%, transparent 25%, transparent 75%, var(--checker-b) 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px; }
.view[data-bg="white"] { background: #fff; }
.view[data-bg="dark"] { background: #111; }
.view > img { max-width: 100%; max-height: 100%; object-fit: contain; }
.busy { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--panel) 70%, transparent); font-weight: 600; z-index: 4; }
.tool.loading .busy { display: flex; }

.compare { position: relative; width: 100%; height: 100%; user-select: none; touch-action: pan-y; }
.compare > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.cmp-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); box-shadow: 0 0 0 1px #fff8; pointer-events: none; }
.cmp-tag { position: absolute; top: 8px; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #000a; color: #fff; pointer-events: none; }
.cmp-tag.l { left: 8px; } .cmp-tag.r { right: 8px; }

.palette-box { margin: 4px 0 8px; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.palette input[type=color] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.actions select { width: auto; }
button { font: inherit; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
.info { color: var(--muted); font-size: 13px; }
.notes { color: var(--muted); font-size: 13px; }
.notes .warn, .warn { color: var(--warn); }
.err { color: var(--danger); margin-top: 8px; }
.err:empty { display: none; }

/* QR */
.qr-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 800px) { .qr-layout { grid-template-columns: 1fr; } }
.qr-form .field, .field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.colors { display: flex; gap: 16px; margin: 4px 0 12px; }
.colors input { vertical-align: middle; }
.qr-preview { width: 100%; aspect-ratio: 1; background: var(--checker-a); border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 8px; overflow: hidden; }
.qr-preview svg { display: block; }
.empty { color: var(--muted); text-align: center; padding: 0 20px; }

/* 아이콘 팩 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip { padding: 5px 12px; border-radius: 99px; font-size: 13px; }
.controls .go { align-self: end; }
.sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.setcard { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px; }
.setcard.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.setcard em { color: var(--accent); font-style: normal; font-size: 12px; }
.setcard small { color: var(--muted); }
.settable h3 { margin: 12px 0 2px; font-size: 15px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.icard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px 8px; text-align: center; }
.icard.none { opacity: .55; }
.ipreview { height: 60px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; }
.ipreview img { width: 40px; height: 40px; }
.altbtn { background: #fff; }
.ilabel { font-weight: 600; margin-top: 4px; }
.iname { font-size: 11px; color: var(--muted); word-break: break-all; }
.alts { margin-top: 6px; text-align: left; font-size: 12px; }
.alts summary { cursor: pointer; color: var(--muted); text-align: center; }
.altrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; justify-content: center; }
.altbtn { padding: 3px; border-radius: 6px; line-height: 0; }
.altbtn.on { border-color: var(--accent); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #111d; color: #fff; padding: 9px 16px; border-radius: 99px; opacity: 0; pointer-events: none; transition: .2s; z-index: 20; font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
