/* 개발자 도구 모음 — 밝고 심플한 모던 디자인 */

/* ── 토큰: 라이트 기본 ─────────────────────────────── */
:root {
  --bg: #fbfcfd;
  --surface: #ffffff;
  --surface-2: #f2f5f7;
  --text: #1a1f26;
  --muted: #5b6874;
  --faint: #8b98a5;
  --accent: #0d9488;        /* 틸(청록) */
  --accent-strong: #0f766e;
  --accent-soft: #e6f5f3;
  --ok: #0d9488;
  --err: #dc2626;
  --border: #e3e8ec;
  --shadow: 0 1px 2px rgba(16,24,32,.04), 0 8px 24px rgba(16,24,32,.06);
  --radius: 14px;
  --mono: "JetBrains Mono", "D2Coding", "Consolas", ui-monospace, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Malgun Gothic", sans-serif;
}

/* 다크: OS 선호 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #171d26;
    --surface-2: #1e2732;
    --text: #e8edf2;
    --muted: #9aa8b5;
    --faint: #6b7885;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #16302d;
    --ok: #2dd4bf;
    --err: #f87171;
    --border: #26303c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
/* 토글이 강제하는 테마 (미디어쿼리보다 우선) */
:root[data-theme="light"] {
  --bg: #fbfcfd; --surface: #ffffff; --surface-2: #f2f5f7;
  --text: #1a1f26; --muted: #5b6874; --faint: #8b98a5;
  --accent: #0d9488; --accent-strong: #0f766e; --accent-soft: #e6f5f3;
  --ok: #0d9488; --err: #dc2626; --border: #e3e8ec;
  --shadow: 0 1px 2px rgba(16,24,32,.04), 0 8px 24px rgba(16,24,32,.06);
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #171d26; --surface-2: #1e2732;
  --text: #e8edf2; --muted: #9aa8b5; --faint: #6b7885;
  --accent: #2dd4bf; --accent-strong: #5eead4; --accent-soft: #16302d;
  --ok: #2dd4bf; --err: #f87171; --border: #26303c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

.wrap { max-width: 820px; margin: 0 auto; padding: 0 20px; }

/* ── 헤더 ──────────────────────────────────────────── */
.site-header {
  position: relative;
  padding: 48px 0 20px;
  text-align: center;
}
.site-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.site-header h1 .brace { color: var(--accent); font-family: var(--mono); }
.tagline { margin: 0; color: var(--muted); font-size: 0.98rem; }

/* 테마 토글 */
.theme-toggle {
  position: absolute;
  top: 20px; right: 20px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  display: grid; place-items: center;
  box-shadow: var(--shadow);
  transition: transform .15s ease, background .25s ease;
}
.theme-toggle:hover { transform: scale(1.08); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 광고 자리 ─────────────────────────────────────── */
.ad-slot {
  margin: 20px auto;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  color: var(--faint);
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ── 탭 ────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 20px auto;
  padding: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  justify-content: center;
}
.tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--sans);
  transition: all .18s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: var(--shadow);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 도구 패널 ─────────────────────────────────────── */
.tool { display: none; }
.tool.active { display: block; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tool.active { animation: none; } }

.tool > h2 {
  margin: 6px 0 4px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.desc { color: var(--muted); margin: 0 0 18px; font-size: 0.92rem; }

/* ── 입력/버튼 ─────────────────────────────────────── */
textarea, input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 0.95rem;
  font-family: var(--mono);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--faint); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--sans);
  transition: background .15s ease, transform .1s ease;
}
button:hover { background: var(--accent-strong); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover { background: var(--border); }

.status { min-height: 22px; margin: 8px 0; font-size: 0.88rem; font-weight: 500; }
.status.ok { color: var(--ok); }
.status.error { color: var(--err); }

.output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 15px;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

/* 정규식 */
.regex-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.slash { color: var(--faint); font-size: 1.4rem; font-family: var(--mono); }
.flags { max-width: 130px; }
#regex-output mark { background: var(--accent-soft); color: var(--accent-strong); padding: 1px 3px; border-radius: 4px; font-weight: 600; }

/* 색상 */
.color-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.color-row label { flex: 1; min-width: 150px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.color-row input[type="color"] { width: 60px; height: 48px; padding: 3px; cursor: pointer; border-radius: 10px; }
.color-preview { height: 96px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }

/* 타임스탬프 / UUID 개수 */
.ts-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.ts-row label { flex: 1; min-width: 190px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }

/* ── 설명 박스 ─────────────────────────────────────── */
.guide {
  margin-top: 24px;
  padding: 18px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.guide h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--text); font-weight: 700; }
.guide p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.7; }
.guide code {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--accent-strong);
}

/* ── 푸터 ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 28px 0;
  text-align: center;
}
.site-footer p { color: var(--faint); font-size: 0.84rem; margin: 4px 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 600px) {
  .site-header { padding-top: 60px; }
  .tabs { border-radius: 16px; }
  .tab { flex: 1 1 auto; text-align: center; }
}
