/* 생활 도구함 — 시안 C(바둑판 타일) + 화려한 움직임
   규칙표: 글자 12·14·16·20·28·clamp(32~64) / 굵기 400·600·700 / 간격 4·8·12·16·24·32·48·64
           모서리 10·16·24(+알약 99) / 그림자 2단 / 강조색 하나(--ac) */
:root {
  --bg: #f4f3ef; --panel: #ffffff; --soft: #f7f6f2; --line: #e4e2dc;
  --t1: #17181a; --t2: #55565b; --t3: #6b6c71; --top: rgba(244, 243, 239, .78); --cat: #faf9f7;
  --ac: #1f6f5c; --ac-2: #e3eee9; --ac-ink: #ffffff; --danger: #c2412d;
  --r1: 10px; --r2: 16px; --r3: 24px;
  --sh1: 0 1px 2px rgba(23, 24, 26, .05);
  --sh2: 0 18px 40px -12px rgba(23, 24, 26, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
[data-theme="dark"] {
  --bg: #0f1211; --panel: #171b1a; --soft: #1d2221; --line: #2a302e;
  --t1: #eef1f0; --t2: #a9b0ad; --t3: #7c8481; --top: rgba(15, 18, 17, .78); --cat: #141817;
  --ac: #4fc9a4; --ac-2: #18302a; --ac-ink: #0b1411; --danger: #ff8a73;
  --sh1: 0 1px 2px rgba(0, 0, 0, .3);
  --sh2: 0 18px 40px -12px rgba(0, 0, 0, .6);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--t1);
  font: 16px/1.6 "Pretendard Variable", Pretendard, system-ui, -apple-system, "Malgun Gothic", sans-serif;
  letter-spacing: -.01em; min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; word-break: keep-all;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: var(--ac); color: var(--ac-ink); }

/* 배경 물결(캔버스) · 커서 빛 · 폭죽 캔버스 */
.tb-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.tb-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
.tb-cursor {
  position: fixed; left: 0; top: 0; width: 420px; height: 420px; margin: -210px 0 0 -210px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--ac) 14%, transparent), transparent 65%);
  pointer-events: none; z-index: -1; transition: opacity .4s; will-change: transform; opacity: 0;
}
.tb-cursor.on { opacity: 1;
}

/* 머리 */
.tb-top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: var(--top); border-bottom: 1px solid transparent; transition: border-color .3s; }
.tb-top.scrolled { border-bottom-color: var(--line); }
.tb-top-in { max-width: 1240px; margin: 0 auto; padding: 0 32px; height: 68px; display: flex; align-items: center; gap: 16px; }
.tb-logo { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-weight: 700; font-size: 16px; white-space: nowrap; }
.tb-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 22px; height: 22px; }
.tb-mark i { border-radius: 3px; background: var(--t1); transition: transform .5s var(--spring), background .3s; }
.tb-mark i:nth-child(2), .tb-mark i:nth-child(3) { background: var(--ac); }
.tb-logo:hover .tb-mark i:nth-child(1) { transform: translate(-2px, -2px) rotate(-12deg); }
.tb-logo:hover .tb-mark i:nth-child(2) { transform: translate(2px, -2px) rotate(12deg); }
.tb-logo:hover .tb-mark i:nth-child(3) { transform: translate(-2px, 2px) rotate(12deg); }
.tb-logo:hover .tb-mark i:nth-child(4) { transform: translate(2px, 2px) rotate(-12deg); }

.tb-nav { position: relative; display: flex; gap: 2px; margin-left: auto; padding: 4px; border-radius: 99px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--sh1); }
.tb-nav a { position: relative; z-index: 1; padding: 7px 14px; border-radius: 99px; font-size: 14px; color: var(--t2); white-space: nowrap; transition: color .3s; }
.tb-nav a:hover { color: var(--t1); }
.tb-nav a.on { color: var(--ac-ink); font-weight: 600; }
.tb-pill { position: absolute; top: 4px; left: 0; height: calc(100% - 8px); width: 0; border-radius: 99px; background: var(--t1);
  transition: transform .45s var(--spring), width .45s var(--spring); }
[data-theme="dark"] .tb-pill { background: var(--ac); }
[data-theme="light"] .tb-nav a.on, :root:not([data-theme]) .tb-nav a.on { color: #fff; }

.tb-icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; flex: none; transition: transform .3s var(--spring), border-color .2s; }
.tb-icon-btn:hover { border-color: var(--t3); transform: rotate(-12deg) scale(1.06); }
.tb-icon-btn:active { transform: scale(.9); }
.tb-burger { display: none; margin-left: auto; }

/* 본문 */
.tb-main { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 16px 32px 64px; }
.tb-page { animation: tbPage .6s var(--ease); }
@keyframes tbPage { from { opacity: 0; transform: translateY(12px); filter: blur(6px); } }
.tb-in { opacity: 0; animation: tbIn .8s var(--ease) forwards; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes tbIn { from { opacity: 0; transform: translateY(28px) scale(.98); } to { opacity: 1; transform: none; } }

.tb-hero { padding: 48px 0 32px; max-width: 820px; }
.tb-eyebrow { margin: 0 0 16px; font-size: 14px; color: var(--ac); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.tb-eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ac); animation: tbPulse 2s infinite; }
@keyframes tbPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ac) 50%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.tb-hero h1 { margin: 0 0 16px; font-size: clamp(34px, 5.4vw, 64px); line-height: 1.12; letter-spacing: -.04em; font-weight: 700; }
.tb-rot { display: inline-block; color: var(--ac); position: relative; white-space: nowrap; }
.tb-rot::after { content: ""; position: absolute; left: 0; right: 0; bottom: .02em; height: .1em; border-radius: 99px; background: currentColor; opacity: .25;
  transform-origin: left; animation: tbLine 2.6s var(--ease) infinite; }
@keyframes tbLine { 0% { transform: scaleX(0); } 30%, 80% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }
.tb-rot .ch { display: inline-block; animation: tbCh .5s var(--spring) both; }
@keyframes tbCh { from { opacity: 0; transform: translateY(.5em) rotate(8deg); filter: blur(4px); } }
.tb-lead { margin: 0; font-size: 18px; color: var(--t2); max-width: 36em; }

/* 타일 (도구 카드·흐르는 띠) */
.tb-tile {
  --mx: 50%; --my: 50%; --rx: 0deg; --ry: 0deg;
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r3); box-shadow: var(--sh1);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s var(--ease), box-shadow .4s, border-color .3s;
}
.tb-tile::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(360px circle at var(--mx) var(--my), color-mix(in srgb, var(--ac) 12%, transparent), transparent 60%); }
.tb-tile::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; padding: 1px;
  background: radial-gradient(240px circle at var(--mx) var(--my), var(--ac), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.tb-tile:hover { box-shadow: var(--sh2); }
.tb-tile:hover::before, .tb-tile:hover::after { opacity: 1; }
.tb-tile > * { position: relative; z-index: 1; }
.tb-tile.tb-in { animation-name: tbTileIn; }
@keyframes tbTileIn { from { opacity: 0; transform: perspective(900px) translateY(40px) rotateX(14deg) scale(.96); } to { opacity: 1; } }
.tb-tile-hd { display: flex; gap: 12px; align-items: flex-start; }
.tb-tile-hd > svg { width: 36px; height: 36px; padding: 8px; border-radius: var(--r1); background: var(--ac-2); color: var(--ac); transition: transform .5s var(--spring); }
.tb-tile:hover .tb-tile-hd > svg { transform: rotate(-10deg) scale(1.12); }
.tb-tile h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4; }
.tb-tile p { margin: 0; font-size: 14px; color: var(--t3); }
.tb-t-marquee { height: 72px; padding: 0; justify-content: center; background: var(--t1); border-color: var(--t1); }
[data-theme="dark"] .tb-t-marquee { background: var(--ac-2); border-color: var(--ac-2); }
.tb-marq { display: flex; width: max-content; animation: tbMarq 38s linear infinite; }
.tb-marq span { white-space: nowrap; font-size: 20px; font-weight: 600; color: var(--bg); padding-right: 32px; letter-spacing: -.02em; }
[data-theme="dark"] .tb-marq span { color: var(--ac); }
@keyframes tbMarq { to { transform: translateX(-50%); } }

.tb-ring { position: relative; display: grid; place-items: center; }
.tb-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.tb-ring circle { fill: none; stroke-width: 10; }
.tb-ring-bg { stroke: var(--ac-2); }
.tb-ring-fg { stroke: var(--ac); stroke-linecap: round; stroke-dasharray: 1000; stroke-dashoffset: 0; transition: stroke-dashoffset .6s var(--ease); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--ac) 45%, transparent)); }
.tb-ring > b, .tb-ring > small { position: absolute; }
@keyframes tbPop { from { opacity: 0; transform: scale(.7) translateY(12px); } }
@keyframes tbSlide { from { opacity: 0; transform: translateX(-16px); } }
@keyframes tbGrow { from { transform: scaleX(0); } }
@keyframes tbRise { from { transform: scaleY(0); } }

/* 분류 박스 (홈은 4개, 분류 페이지는 1개) */
.tb-cats { display: flex; flex-direction: column; gap: 16px; }
.tb-cat { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r3);
  background: var(--cat); }
.tb-cat-hd { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.tb-cat-hd > svg { width: 40px; height: 40px; padding: 10px; border-radius: var(--r1); background: var(--ac); color: var(--ac-ink); }
.tb-cat-hd h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 20px; letter-spacing: -.02em; line-height: 1.3; }
.tb-cat-n { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--ac-2); color: var(--ac); }
.tb-cat-hd p { margin: 4px 0 0; font-size: 14px; color: var(--t2); }
.tb-cat-more { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px 8px 0; font-size: 14px; font-weight: 600; color: var(--ac); text-decoration: none; }
.tb-cat-more svg { width: 16px; height: 16px; transition: transform .4s var(--spring); }
.tb-cat-more:hover svg { transform: translateX(4px); }
.tb-cat-grid { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 12px; }
.tb-cat[data-cat="analyze"] { --n: 2; }
.tb-cat-full { grid-template-columns: 1fr; padding: 0; border: 0; background: none; }
.tb-cat-full .tb-cat-hd { flex-direction: row; align-items: center; gap: 16px; padding: 32px 0 0; }
.tb-cat-full .tb-cat-hd > svg { width: 48px; height: 48px; padding: 12px; border-radius: var(--r2); animation: tbSpin .9s var(--spring) both; }
.tb-cat-full .tb-cat-hd h2 { font-size: 28px; letter-spacing: -.03em; }
.tb-cat-full .tb-cat-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.tb-cat-full .tb-tool { min-height: 168px; }
.tb-tool { color: inherit; text-decoration: none; min-height: 148px; padding: 20px; }
.tb-tool .tb-tile-hd { padding-right: 32px; }
.tb-tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.tb-tags span { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); color: var(--t2); }
.tb-tile .tb-go { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 99px; color: var(--t3);
  transition: background .3s, color .3s, transform .4s var(--spring); }
.tb-go svg { width: 16px; height: 16px; }
.tb-tool:hover .tb-go { background: var(--ac); color: var(--ac-ink); transform: rotate(-45deg); }
.tb-t-marquee { margin-top: 16px; }
.tb-crumb { display: inline-flex; align-items: center; gap: 4px; margin-top: 24px; padding: 4px 12px 4px 8px; height: 32px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel); color: var(--t2); font-size: 14px; text-decoration: none; transition: color .2s, border-color .2s, transform .3s var(--spring); }
.tb-crumb svg { width: 16px; height: 16px; transform: rotate(180deg); }
.tb-crumb:hover { color: var(--ac); border-color: var(--ac); transform: translateX(-3px); }
.tb-crumb + .tb-head { padding-top: 16px; }
#page-unit .tb-crumb, #page-timer .tb-crumb, #page-memo .tb-crumb, #page-dday .tb-crumb, #page-pw .tb-crumb { margin-left: max(0px, calc(50% - 320px)); }

/* 도구 화면 */
.tb-head { display: flex; align-items: center; gap: 16px; padding: 32px 0 24px; }
.tb-head > svg { width: 48px; height: 48px; padding: 12px; border-radius: var(--r2); background: var(--ac); color: var(--ac-ink); animation: tbSpin .9s var(--spring) both; }
@keyframes tbSpin { from { transform: rotate(-120deg) scale(.4); opacity: 0; } }
.tb-head h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; line-height: 1.3; }
.tb-head p { margin: 0; color: var(--t2); font-size: 14px; }
#page-unit .tb-head, #page-timer .tb-head, #page-memo .tb-head, #page-dday .tb-head, #page-pw .tb-head { max-width: 640px; margin: 0 auto; }

.tb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tb-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r3); padding: 24px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-shadow: var(--sh1); }
.tb-box h3 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.tb-narrow { max-width: 640px; width: 100%; margin: 0 auto; }
.tb-box label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--t2); }
input[type=text], input[type=number], input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; min-width: 0; height: 48px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r1);
  background: var(--soft); transition: border-color .2s, box-shadow .3s, background .2s;
}
textarea { height: auto; min-height: 120px; padding: 12px 16px; line-height: 1.6; resize: vertical; color: var(--t1); }
textarea[spellcheck=false] { font: 14px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; }
input[type=color] { flex: none; width: 56px; height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--soft); cursor: pointer; }
.tb-box label input[type=color] { width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--t3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ac); background: var(--panel); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 18%, transparent); }
.tb-row { display: flex; gap: 8px; align-items: center; }
.tb-row > input, .tb-row > select { flex: 1; }
.tb-center { justify-content: center; }

.tb-btn { position: relative; overflow: hidden; height: 48px; padding: 0 24px; border: 0; border-radius: var(--r1); background: var(--ac); color: var(--ac-ink);
  font-weight: 600; cursor: pointer; white-space: nowrap; flex: none; transition: transform .3s var(--spring), box-shadow .3s; }
.tb-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--ac) 70%, transparent); }
.tb-btn:active { transform: scale(.95); }
.tb-ghost { background: var(--panel); color: var(--t1); border: 1px solid var(--line); }
.tb-ghost:hover { box-shadow: var(--sh2); }
.tb-grow { flex: 1; }
.tb-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .3; transform: scale(0); animation: tbRip .6s ease-out forwards; pointer-events: none; }
@keyframes tbRip { to { transform: scale(4); opacity: 0; } }

.tb-out { margin: 4px 0 0; padding: 16px; background: var(--ac-2); border-radius: var(--r2); font-size: 15px; color: var(--t2); min-height: 56px; }
.tb-out b { color: var(--ac); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-out.pop { animation: tbBump .45s var(--spring); }
@keyframes tbBump { 40% { transform: scale(1.03); } }
.tb-muted { color: var(--t3); font-size: 14px; margin: 0; text-align: center; }
.tb-muted b { color: var(--ac); }
.tb-empty { color: var(--t3); font-size: 14px; margin: 0; padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r2); }

/* 단위 변환 */
.tb-seg { display: flex; gap: 4px; padding: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 99px; }
.tb-seg button { flex: 1; height: 36px; border: 0; background: none; border-radius: 99px; cursor: pointer; font-size: 14px; color: var(--t2); transition: background .3s, color .3s, transform .3s var(--spring); }
.tb-seg button:hover { color: var(--t1); }
.tb-seg button.on { background: var(--panel); color: var(--t1); font-weight: 600; box-shadow: var(--sh1); }
.tb-seg button:active { transform: scale(.94); }
.tb-big-input { height: 72px !important; font-size: 32px !important; font-weight: 600; letter-spacing: -.02em; }
.tb-unit-row #unSwap.spin svg { animation: tbSwap .5s var(--spring); }
@keyframes tbSwap { from { transform: rotate(-180deg); } }
.tb-unit-out { margin: 0; padding: 24px 16px; text-align: center; border-radius: var(--r2); background: var(--ac-2); font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--ac); overflow-wrap: anywhere; }
.tb-unit-out .ch { display: inline-block; animation: tbCh .4s var(--spring) both; white-space: pre; }

/* 타이머 */
.tb-timer { align-items: center; gap: 24px; }
.tb-modes { width: 100%; }
.tb-ring-main { width: min(320px, 78vw); aspect-ratio: 1; }
.tb-ring-main circle { stroke-width: 8; }
.tb-clock { font-size: clamp(48px, 14vw, 72px); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.tb-ring-main.run .tb-clock { animation: tbTick 1s steps(1) infinite; }
.tb-ring-main.run::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 2px solid var(--ac); opacity: 0; animation: tbWave 2s ease-out infinite; }
@keyframes tbWave { from { transform: scale(.85); opacity: .5; } to { transform: scale(1.18); opacity: 0; } }
.tb-bar { display: none; }
.tb-ring-main.done { animation: tbShake .6s; }
@keyframes tbShake { 20%, 60% { transform: rotate(-4deg); } 40%, 80% { transform: rotate(4deg); } }

/* 목록 */
.tb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tb-list li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel);
  animation: tbItem .5s var(--spring) both; transition: transform .3s var(--ease), border-color .2s; }
.tb-list li:hover { transform: translateX(4px); border-color: var(--t3); }
.tb-list li.out { animation: tbOut .35s var(--ease) forwards; }
@keyframes tbItem { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes tbOut { to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: -4px 0; } }
.tb-txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tb-when { color: var(--t3); font-size: 12px; white-space: nowrap; }
.tb-del { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--t3); cursor: pointer; border-radius: 99px; flex: none; transition: .2s; }
.tb-del svg { width: 16px; height: 16px; }
.tb-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); transform: rotate(90deg); }
.tb-dnum { min-width: 72px; text-align: center; padding: 4px 8px; border-radius: var(--r1); background: var(--ac); color: var(--ac-ink); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-dnum.past { background: var(--soft); color: var(--t3); }
.tb-dnum.today { animation: tbPulse 1.6s infinite; }

/* 비밀번호 */
.tb-pw { display: block; padding: 24px 16px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r2); text-align: center;
  font: 500 22px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; overflow-wrap: anywhere; min-height: 80px; }
.tb-meter { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.tb-meter i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ac); transition: width .6s var(--spring), background .4s; }
.tb-range { gap: 8px !important; }
.tb-range b { color: var(--ac); }
input[type=range] { accent-color: var(--ac); width: 100%; height: 32px; }
.tb-checks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tb-checks label { position: relative; flex-direction: row; }
.tb-checks input { position: absolute; opacity: 0; }
.tb-checks span { flex: 1; height: 44px; display: grid; place-items: center; border-radius: var(--r1); border: 1px solid var(--line); color: var(--t2); cursor: pointer; transition: .3s var(--spring); }
.tb-checks input:checked + span { background: var(--ac-2); border-color: var(--ac); color: var(--ac); font-weight: 600; }
.tb-checks input:focus-visible + span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 25%, transparent); }
.tb-checks span:active { transform: scale(.92); }

/* ===== 만들기·분석·변환 도구 공용 ===== */
.tb-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 12px; align-items: start; }
.tb-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.tb-mt { margin-top: 12px; }
.tb-wrap { flex-wrap: wrap; }
.tb-end { align-items: flex-end; }
.tb-outhd { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tb-outhd h3 { margin: 0; }
.tb-outhd small, .tb-box h3 small { font-size: 14px; font-weight: 400; color: var(--t3); }
.tb-box h3 small { margin-left: 8px; }
.tb-hint { margin: 0; font-size: 12px; color: var(--t3); line-height: 1.6; }
.tb-sm { height: 36px; padding: 0 16px; font-size: 14px; }
a.tb-btn, label.tb-btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tb-box label.tb-btn { flex-direction: row; font-size: 16px; color: var(--t1); cursor: pointer; }
.tb-mono, .tb-pre, .tb-hl, .tb-diff { font: 14px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tb-pre { margin: 0; padding: 16px; min-height: 56px; max-height: 320px; overflow: auto; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r1);
  white-space: pre-wrap; overflow-wrap: anywhere; color: var(--t1); }
.tb-pre-tall { min-height: 200px; max-height: 560px; }
.tb-pre.bad { color: var(--danger); }
.tb-err { margin: 0; padding: 12px 16px; border-radius: var(--r1); background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 14px; animation: tbShakeX .4s; }
@keyframes tbShakeX { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tb-seg-wrap { flex-wrap: wrap; border-radius: var(--r2); }
.tb-seg-wrap button { flex: 1 1 30%; }

/* 끌어 놓는 칸 */
.tb-box .tb-drop { align-items: center; justify-content: center; gap: 8px; padding: 32px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--r2); background: var(--soft); transition: border-color .3s, background .3s, transform .4s var(--spring); }
.tb-drop svg { width: 40px; height: 40px; color: var(--ac); transition: transform .5s var(--spring); }
.tb-drop b { font-size: 16px; color: var(--t1); }
.tb-drop small { font-size: 12px; color: var(--t2); }
.tb-box .tb-drop:hover, .tb-box .tb-drop.over { border-color: var(--ac); background: var(--ac-2); }
.tb-drop:hover svg { transform: translateY(-6px); }
.tb-box .tb-drop.over { transform: scale(1.02); }
.tb-drop.over svg { animation: tbHop .6s var(--spring) infinite alternate; }
@keyframes tbHop { to { transform: translateY(-10px) scale(1.1); } }

/* 이미지 줄이기 */
.tb-imlist { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow: auto; }
.tb-imrow { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r2); animation: tbItem .5s var(--spring) both; }
.tb-imrow img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r1); background: var(--soft); }
.tb-iminfo { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tb-iminfo b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-iminfo small { font-size: 12px; color: var(--t3); }
.tb-save { font-size: 14px; font-weight: 700; padding: 4px 8px; border-radius: 99px; background: var(--ac-2); color: var(--ac); font-variant-numeric: tabular-nums; }
.tb-save.up { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* 팔레트·대비 */
.tb-swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.tb-sw { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 8px; border: 0; border-radius: var(--r1); cursor: pointer; text-align: left;
  animation: tbPop .5s var(--spring) both; transition: transform .3s var(--spring), box-shadow .3s; }
.tb-sw:hover { transform: translateY(-4px) scale(1.04); box-shadow: var(--sh2); z-index: 1; }
.tb-sw b { font-size: 14px; }
.tb-sw span { font: 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tb-sw small { margin-top: auto; font-size: 12px; }
.tb-ctprev { display: flex; flex-direction: column; gap: 8px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r2); transition: background .4s, color .4s; }
.tb-ctprev b { font-size: 28px; letter-spacing: -.02em; line-height: 1.3; }
.tb-ctprev span { font-size: 16px; }
.tb-ctnum { display: flex; align-items: baseline; gap: 4px; }
.tb-ctnum b { font-size: clamp(28px, 4vw, 48px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tb-ctnum span { font-size: 20px; color: var(--t3); }
.tb-badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tb-badges span { padding: 8px 12px; border-radius: var(--r1); font-size: 14px; font-weight: 600; animation: tbPop .45s var(--spring) both; }
.tb-badges span:nth-child(2) { animation-delay: 50ms; } .tb-badges span:nth-child(3) { animation-delay: 100ms; } .tb-badges span:nth-child(4) { animation-delay: 150ms; }
.tb-badges .ok { background: var(--ac-2); color: var(--ac); }
.tb-badges .no { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* 사진 색 뽑기 */
.tb-cpimg { width: 100%; max-height: 360px; object-fit: contain; border-radius: var(--r2); background: var(--soft); animation: tbPop .6s var(--spring) both; }
.tb-cplist { display: flex; flex-direction: column; gap: 8px; }
.tb-cprow { display: grid; grid-template-columns: 40px 120px minmax(0, 1fr) 56px; grid-template-areas: "sw hex bar pct" "sw rgb bar pct"; align-items: center; column-gap: 12px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); color: var(--t1); text-align: left; cursor: pointer;
  animation: tbItem .5s var(--spring) both; transition: transform .3s var(--ease), border-color .2s; }
.tb-cprow:hover { transform: translateX(4px); border-color: var(--t3); }
.tb-cprow > i { grid-area: sw; width: 40px; height: 40px; border-radius: var(--r1); border: 1px solid var(--line); }
.tb-cprow > b { grid-area: hex; font: 600 14px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.tb-cprow > small { grid-area: rgb; font-size: 12px; color: var(--t3); }
.tb-cpbar { grid-area: bar; height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.tb-cpbar i { display: block; height: 100%; border-radius: inherit; transform-origin: left; animation: tbGrow .8s var(--ease) both; }
.tb-cprow > em { grid-area: pct; font-style: normal; font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* 글자 수 · JSON 숫자 칸 */
.tb-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tb-stats-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tb-stats div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; border-radius: var(--r2); background: var(--soft); border: 1px solid var(--line); }
.tb-stats b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-stats div:first-child b { color: var(--ac); }
.tb-stats span { font-size: 12px; color: var(--t3); }
.tb-freq { display: flex; flex-direction: column; gap: 8px; }
.tb-frow { display: grid; grid-template-columns: minmax(64px, 120px) minmax(0, 1fr) 48px; align-items: center; gap: 12px; font-size: 14px; }
.tb-frow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-frow i { display: block; height: 8px; border-radius: 99px; background: var(--ac); transform-origin: left; animation: tbGrow .7s var(--ease) both; }
.tb-frow b { font-weight: 600; color: var(--t2); text-align: right; }

/* 글 비교 */
.tb-diffsum { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-diffsum b { padding: 4px 12px; border-radius: 99px; font-size: 14px; animation: tbPop .4s var(--spring) both; }
.tb-diffsum .add { background: var(--ac-2); color: var(--ac); }
.tb-diffsum .del { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--t1); }
.tb-diffsum span { font-size: 14px; color: var(--t3); }
.tb-box .tb-check1 { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.tb-check1 input { width: 24px; height: 24px; accent-color: var(--ac); }
.tb-diff { max-height: 560px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r2); background: var(--soft); }
.tb-dl { display: grid; grid-template-columns: 40px 40px 24px minmax(0, 1fr); animation: tbSlide .4s var(--ease) both; }
.tb-dn { padding: 0 8px; text-align: right; font-size: 12px; color: var(--t2); user-select: none; }
.tb-dop { text-align: center; font-weight: 700; }
.tb-dl code { font: inherit; padding-right: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tb-dl.add { background: color-mix(in srgb, var(--ac) 14%, transparent); }
.tb-dl.add .tb-dop { color: var(--t1); }
.tb-dl.del { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.tb-dl.del .tb-dop { color: var(--t1); }
.tb-dl.gap { color: var(--t3); background: var(--panel); font-style: italic; }

/* 표 분석 */
.tb-colgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tb-colcard { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r3); box-shadow: var(--sh1); }
.tb-colhd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tb-colhd b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-type { flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--ac-2); color: var(--ac); }
.tb-colbody:empty { display: none; }
.tb-hist { display: flex; align-items: flex-end; gap: 2px; height: 56px; }
.tb-hist i { flex: 1; background: var(--ac); border-radius: 4px 4px 0 0; transform-origin: bottom; animation: tbRise .6s var(--spring) both; }
.tb-toplist { display: flex; flex-direction: column; gap: 4px; }
.tb-toplist div { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 6px; overflow: hidden; font-size: 14px; }
.tb-toplist i { position: absolute; inset: 0 auto 0 0; background: var(--ac-2); transform-origin: left; animation: tbGrow .7s var(--ease) both; }
.tb-toplist span, .tb-toplist b { position: relative; }
.tb-toplist span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-toplist b { font-size: 12px; color: var(--t2); }
.tb-kv { display: flex; flex-direction: column; }
.tb-kv div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; animation: tbSlide .4s var(--ease) both; }
.tb-kv div:last-child { border-bottom: 0; }
.tb-kv span { flex: none; color: var(--t3); }
.tb-kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
#tsOut b, #dtOut b, #bdOut b { cursor: pointer; transition: color .2s; }
#tsOut b:hover, #dtOut b:hover, #bdOut b:hover { color: var(--ac); }
.tb-tablewrap { overflow: auto; max-height: 400px; border: 1px solid var(--line); border-radius: var(--r2); }
.tb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tb-table th, .tb-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.tb-table th { position: sticky; top: 0; background: var(--soft); font-weight: 600; }

/* 정규식 */
.tb-regex { display: flex; align-items: center; gap: 4px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--soft);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; transition: border-color .2s, box-shadow .3s; }
.tb-regex span { font-size: 20px; color: var(--t3); }
.tb-regex input { font-family: inherit; border: 0; background: none; padding: 0 4px; }
.tb-regex input:first-of-type { flex: 1; }
.tb-regex input:last-of-type { width: 72px; flex: none; }
.tb-regex input:focus, .tb-regex input:hover { box-shadow: none; background: none; }
.tb-regex:focus-within { border-color: var(--ac); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ac) 18%, transparent); }
.tb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tb-chips button { height: 36px; padding: 0 16px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--t2); font-size: 14px; cursor: pointer;
  transition: color .2s, border-color .2s, transform .3s var(--spring); }
.tb-chips button:hover { color: var(--ac); border-color: var(--ac); transform: translateY(-2px); }
.tb-chips button:active { transform: scale(.94); }
.tb-hl { padding: 12px 16px; max-height: 300px; overflow: auto; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r1); white-space: pre-wrap; overflow-wrap: anywhere; }
.tb-hl mark { color: inherit; background: color-mix(in srgb, var(--ac) 28%, transparent); border-radius: 4px; box-shadow: inset 0 -2px var(--ac); animation: tbMark .5s var(--spring) both; }
.tb-hl mark.b { background: color-mix(in srgb, #e5a92f 32%, transparent); box-shadow: inset 0 -2px #c98a10; }
@keyframes tbMark { from { background: transparent; box-shadow: none; } }
.tb-rxlist { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.tb-rxrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r1); background: var(--soft); font-size: 14px; animation: tbItem .4s var(--spring) both; }
.tb-rxi { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 99px; background: var(--ac); color: var(--ac-ink); font-size: 12px; font-weight: 700; }
.tb-rxrow code { font: 600 14px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; min-width: 0; }
.tb-rxg { font: 12px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--t2); }

/* JSON 색 */
.tb-pre .jk { color: var(--ac); font-weight: 600; }
.tb-pre .js { color: #9a4f12; }
.tb-pre .jn { color: #2a5db0; }
.tb-pre .jb { color: #8a2fa8; }
[data-theme="dark"] .tb-pre .js { color: #f0b071; }
[data-theme="dark"] .tb-pre .jn { color: #7fb2ff; }
[data-theme="dark"] .tb-pre .jb { color: #d38cf0; }

.tb-foot { text-align: center; color: var(--t3); font-size: 12px; padding: 24px; }
.tb-toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 24px) scale(.9); background: var(--t1); color: var(--bg); padding: 12px 24px; border-radius: 99px;
  opacity: 0; pointer-events: none; transition: .45s var(--spring); font-size: 14px; font-weight: 600; z-index: 60; }
.tb-toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* 넓은 화면 */
@media (min-width: 1600px) {
  .tb-top-in, .tb-main { max-width: 1520px; }
  .tb-cat { grid-template-columns: 280px minmax(0, 1fr); }
  .tb-cat[data-cat="analyze"] { --n: 4; }
}
/* 태블릿 */
@media (max-width: 1040px) {
  .tb-burger { display: grid; }
  .tb-nav { display: none; position: absolute; top: 68px; left: 16px; right: 16px; flex-direction: column; border-radius: var(--r3); padding: 8px; box-shadow: var(--sh2); }
  .tb-nav.open { display: flex; animation: tbDrop .4s var(--spring); }
  .tb-nav a { padding: 12px 16px; border-radius: var(--r1); opacity: 0; animation: tbIn .4s var(--ease) forwards; }
  .tb-nav a:nth-of-type(2) { animation-delay: 30ms } .tb-nav a:nth-of-type(3) { animation-delay: 60ms } .tb-nav a:nth-of-type(4) { animation-delay: 90ms }
  .tb-nav a:nth-of-type(5) { animation-delay: 120ms } .tb-nav a:nth-of-type(6) { animation-delay: 150ms } .tb-nav a:nth-of-type(7) { animation-delay: 180ms }
  .tb-nav a.on { background: var(--t1); color: var(--bg); }
  [data-theme="dark"] .tb-nav a.on { background: var(--ac); color: var(--ac-ink); }
  .tb-pill { display: none; }
  .tb-grid { grid-template-columns: 1fr 1fr; }
  .tb-cat { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
  .tb-cat-hd { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tb-cat-hd > div { flex: 1; min-width: 0; }
  .tb-cat-more { margin: 0; }
  .tb-cat-grid, .tb-cat[data-cat="analyze"] .tb-cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-split { grid-template-columns: 1fr; }
}
@keyframes tbDrop { from { opacity: 0; transform: translateY(-12px) scale(.97); } }
/* 휴대폰 */
@media (max-width: 640px) {
  .tb-top-in { padding: 0 16px; gap: 8px; height: 60px; }
  .tb-nav { top: 60px; }
  .tb-main { padding: 8px 16px 48px; }
  .tb-hero { padding: 24px 0 24px; }
  .tb-lead { font-size: 16px; }
  .tb-t-marquee { min-height: 0; height: 64px; }
  .tb-cat { padding: 16px; }
  .tb-cat-hd > svg { display: none; }
  .tb-cat-more { width: 100%; }
  .tb-cat-grid, .tb-cat[data-cat="analyze"] .tb-cat-grid, .tb-cat-full .tb-cat-grid { grid-template-columns: 1fr; gap: 8px; }
  .tb-tool, .tb-cat-full .tb-tool { min-height: 0; padding: 16px; gap: 8px; }
  .tb-tool .tb-tile-hd > svg { width: 32px; height: 32px; padding: 7px; }
  .tb-cat-full .tb-cat-hd > svg { display: block; }
  .tb-cat-full .tb-cat-hd { padding-top: 16px; }
  .tb-cat-full .tb-cat-hd h2 { font-size: 24px; }
  .tb-crumb { margin-top: 16px; }
  .tb-grid2 { grid-template-columns: 1fr; }
  .tb-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-sw { min-height: 64px; }
  .tb-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-stats-sm { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-imrow { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .tb-imrow img { width: 48px; height: 48px; }
  .tb-imrow a { grid-column: 1 / -1; }
  .tb-cprow { grid-template-columns: 40px minmax(0, 1fr) 56px; grid-template-areas: "sw hex pct" "sw bar pct"; row-gap: 4px; }
  .tb-cprow > small { display: none; }
  .tb-dl { grid-template-columns: 28px 28px 20px minmax(0, 1fr); }
  .tb-dn { padding: 0 4px; }
  .tb-seg-wrap button { flex-basis: 45%; }
  .tb-frow { grid-template-columns: 80px minmax(0, 1fr) 40px; }
  .tb-grid { grid-template-columns: 1fr; }
  .tb-box { padding: 20px 16px; }
  .tb-head { padding: 16px 0; }
  .tb-head h2 { font-size: 24px; }
  #mmForm, #ddForm { flex-wrap: wrap; }
  #mmForm input, #ddForm input { flex: 1 1 100%; }
  #mmForm .tb-btn, #ddForm .tb-btn { flex: 1; }
  .tb-checks { grid-template-columns: 1fr 1fr; }
  .tb-unit-out { font-size: 22px; }
  .tb-pw { font-size: 18px; }
}

/* 움직임 줄이기 설정을 켠 사람에게는 연출을 끈다 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .tb-in { opacity: 1; }
  .tb-cursor, .tb-bg { display: none; }
}
