/* =====================================================================
   CHROMA — color picker
   Aesthetic: dark laboratory. Hairline grid, monospaced data, and exactly
   one source of chroma on the page — the color the user just picked.
   ===================================================================== */

/* ------------------------------- webfont ----------------------------- */
/* DM Mono · Martian Mono — Google Fonts(OFL)를 자체 호스팅한다.
   서드파티 오리진 2곳(fonts.googleapis / fonts.gstatic)을 제거해 모바일에서
   DNS+TLS 왕복 2회를 없애기 위함. 파일은 public/fonts/ 에 있고
   unicode-range 는 구글이 만든 서브셋 경계를 그대로 유지한다. */
/* latin-ext */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/aFTU7PB1QTsUX8KYthSQBK6PYK3EXw.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/aFTU7PB1QTsUX8KYthqQBK6PYK0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/aFTR7PB1QTsUX8KYvumzEY2tbYf-Vlh3uA.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/aFTR7PB1QTsUX8KYvumzEYOtbYf-Vlg.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTS9wXulPFlwYA.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 500;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTq9wXulPFk.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTS9wXulPFlwYA.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 600;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTq9wXulPFk.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTS9wXulPFlwYA.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Martian Mono';
  font-style: normal;
  font-weight: 700;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/2V0PKIcADoYhV6w87xrTKjs4CYElh_VS9YA4TlTnaTq9wXulPFk.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 이서윤체 — 눈누 배포, 상업적 웹폰트 사용 허용(재배포 금지라 CDN 링크로만 쓴다).
   ⚠️ 선언만 해 둔 것이고 사이트 본문에는 쓰지 않는다. 실제 사용처는
   /theme-builder/ 의 카카오톡 미리보기 안 텍스트뿐이다(@font-face 는 실제로
   사용될 때만 다운로드되므로 다른 페이지에는 비용이 없다).
   굵기가 400 하나뿐이라 굵게 쓰면 가짜 볼드가 되니 위계는 크기로 잡을 것. */
@font-face {
  font-family: 'IsYun';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2202-2@1.0/LeeSeoyun.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------- tokens ------------------------------ */
:root {
  --bg:        #0a0a0b;
  --bg-2:      #101013;
  --surface:   #141418;
  --surface-2: #1b1b20;
  --line:      rgba(255, 255, 255, 0.085);
  --line-2:    rgba(255, 255, 255, 0.16);
  --ink:       #f0eee9;
  --ink-2:     #a5a29b;
  --ink-3:     #6e6b65;
  --ok:        #4ade80;
  --no:        #f87171;

  /* live color, overwritten by app.js */
  --c:     #ff6347;
  --c-rgb: 255, 99, 71;
  --c-ink: #000000;

  --font-ui: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
             "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  /* 카카오톡 미리보기 전용 (theme-builder) */
  --font-kakao: 'IsYun', "Apple SD Gothic Neo", "Pretendard Variable", sans-serif;
  /* 라틴은 Martian/DM Mono, 한글 글리프는 Pretendard 로 자동 폴백된다 */
  --font-display: "Martian Mono", "Pretendard Variable", Pretendard,
                  ui-monospace, "SFMono-Regular", monospace;
  --font-mono: "DM Mono", "Pretendard Variable", Pretendard,
               ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r:   4px;
  --r-lg: 8px;
  --shell: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="light"] {
  --bg:        #f6f4ef;
  --bg-2:      #efece5;
  --surface:   #ffffff;
  --surface-2: #f7f5f0;
  --line:      rgba(24, 22, 18, 0.11);
  --line-2:    rgba(24, 22, 18, 0.22);
  --ink:       #17150f;
  --ink-2:     #5d5a52;
  --ink-3:     #8b877e;
  --ok:        #15803d;
  --no:        #b91c1c;
}

/* ------------------------------- reset ------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3, p, figure { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* 한국어는 어절 단위로 줄바꿈해야 읽힌다 */
:root[lang="ko"] h1, :root[lang="ko"] h2, :root[lang="ko"] h3,
:root[lang="ko"] p, :root[lang="ko"] summary, :root[lang="ko"] li {
  word-break: keep-all;
  overflow-wrap: break-word;
}
/* 일본어는 금칙 처리가 필요하다 — 없으면 장음(ー)·촉음이 행두로 밀려난다 */
:root[lang="ja"] h1, :root[lang="ja"] h2, :root[lang="ja"] h3,
:root[lang="ja"] p, :root[lang="ja"] summary, :root[lang="ja"] li {
  line-break: strict;
  overflow-wrap: break-word;
}
/* CJK 에 라틴용 트래킹을 그대로 쓰면 자간이 벌어져 보인다 */
:root[lang="ko"] .eyebrow[data-i18n], :root[lang="ja"] .eyebrow[data-i18n],
:root[lang="ko"] .stack-head h3, :root[lang="ja"] .stack-head h3,
:root[lang="ko"] .harmony__name span:first-child,
:root[lang="ja"] .harmony__name span:first-child {
  font-family: var(--font-ui);
  letter-spacing: 0.05em;
}

:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 2px;
  border-radius: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------- atmosphere / texture ---------------------- */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 96px 96px;
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
/* 색이 바뀔 때마다 다시 칠해지는 레이어다.
   radial-gradient 자체가 이미 부드러우므로 filter: blur() 를 쓰지 않는다
   — 화면 전체 크기에 블러를 걸면 드래그 중 매 프레임 재합성돼 렉이 생긴다. */
body::after {
  content: "";
  position: fixed;
  top: -18vh; left: 50%;
  width: min(1400px, 150vw); height: 88vh;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%,
              rgba(var(--c-rgb), 0.2) 0%,
              rgba(var(--c-rgb), 0.09) 42%,
              rgba(var(--c-rgb), 0) 72%);
  pointer-events: none;
  transition: background 300ms var(--ease);
  z-index: 0;
}
[data-theme="light"] body::after { opacity: 0.65; }

/* 드래그 중에는 값 전환 애니메이션과 배경 블러를 끈다 (프레임당 재합성 비용 제거) */
body.is-dragging::after,
body.is-dragging .wordmark__dot,
body.is-dragging .hero h1 .lit,
body.is-dragging .readout__hex,
body.is-dragging .btn--accent { transition: none; }
body.is-dragging .masthead { backdrop-filter: none; background: var(--bg); }

.shell { position: relative; z-index: 1; }

/* ------------------------------- header ------------------------------ */
.masthead {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.masthead__in {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 32px);
  display: flex; align-items: center; gap: 24px;
}
.wordmark {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.22em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark__dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px rgba(var(--c-rgb), 0.18);
  transition: background 320ms var(--ease), box-shadow 320ms var(--ease);
}
.nav { display: flex; gap: 2px; margin-left: auto; }
@media (max-width: 820px) { .nav { display: none; } .tools { margin-left: auto; } }
.nav a {
  padding: 7px 11px;
  font-size: 12.5px; color: var(--ink-2);
  text-decoration: none; border-radius: var(--r);
  transition: color 160ms, background 160ms;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }

.tools { display: flex; gap: 6px; align-items: center; }

/* 언어 전환 — JS 토글이 아니라 실제 링크여야 크롤러가 각 언어판을 따라간다 */
.langs { display: flex; gap: 1px; }
.langs .lang {
  padding: 7px 8px;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--ink-3); text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: color 160ms, background 160ms, border-color 160ms;
}
.langs .lang:hover { color: var(--ink); background: var(--surface-2); }
.langs .lang.is-on {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-2);
}

.footlangs { display: flex; flex-wrap: wrap; gap: 14px; }
.footlangs .lang { color: var(--ink-2); text-decoration: none; }
.footlangs .lang:hover { color: var(--ink); }
.footlangs .lang.is-on { color: var(--ink-3); }

/* 다른 언어판 안내 배너 — 자동 리다이렉트 대신 제안만 한다 */
.langbar {
  position: relative; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 9px clamp(16px, 4vw, 32px);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.langbar[hidden] { display: none; }
.langbar a {
  color: var(--ink);
  text-underline-offset: 3px;
  text-decoration-color: var(--c);
}
.langbar button {
  margin-left: auto;
  padding: 2px 8px;
  color: var(--ink-3); font-size: 16px; line-height: 1;
}
.langbar button:hover { color: var(--ink); }
.iconbtn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-2);
  font-family: var(--font-display);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  transition: color 160ms, border-color 160ms, background 160ms;
}
.iconbtn:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }
.iconbtn svg { width: 16px; height: 16px; }

/* -------------------------------- hero ------------------------------- */
.hero {
  max-width: var(--shell);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 76px) clamp(16px, 4vw, 32px) 26px;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px; background: var(--line-2);
}
.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(32px, 6.2vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 600;
  max-width: 19ch;
}
/* CJK 는 1글자 폭이 라틴의 2배라 ch 기준 max-width 가 너무 좁아진다 */
:root[lang="ko"] .hero h1, :root[lang="ja"] .hero h1 { max-width: 26ch; }
.hero h1 .lit {
  color: var(--c);
  transition: color 320ms var(--ease);
}
.hero p {
  max-width: 58ch;
  color: var(--ink-2);
  font-size: clamp(14px, 1.5vw, 16px);
}

/* ------------------------------- layout ------------------------------ */
main { max-width: var(--shell); margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px) 80px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
}
@media (min-width: 1080px) {
  /* 사이드바를 행 높이만큼 늘려야 안쪽 광고의 sticky 가 스크롤을 따라간다 */
  .layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: stretch; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.panel--pad { padding: clamp(16px, 2.4vw, 24px); }

section + section { margin-top: clamp(36px, 5vw, 56px); }

.sect-head { margin-bottom: 18px; }
.sect-head h2 {
  margin: 10px 0 6px;
  font-size: clamp(19px, 2.4vw, 25px);
  font-weight: 600; letter-spacing: -0.025em;
}
.sect-head p { color: var(--ink-2); font-size: 13.5px; max-width: 62ch; }

/* ------------------------------- picker ------------------------------ */
/* minmax(0,…) 가 없으면 열이 input 의 max-content 폭까지 늘어나 모바일에서 가로 스크롤이 생긴다 */
.picker { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) {
  .picker { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
}

.picker__left { padding: clamp(14px, 2vw, 20px); min-width: 0; }
.picker__right {
  border-top: 1px solid var(--line);
  padding: clamp(14px, 2vw, 20px);
  min-width: 0;
}
@media (min-width: 720px) {
  .picker__right { border-top: 0; border-left: 1px solid var(--line); }
}

/* saturation / value field */
.sv {
  position: relative;
  aspect-ratio: 4 / 3;
  min-height: 190px;
  border-radius: var(--r);
  cursor: crosshair;
  touch-action: none;
  background:
    linear-gradient(to top, #000, rgba(0, 0, 0, 0)),
    linear-gradient(to right, #fff, rgba(255, 255, 255, 0)),
    var(--hue, #f00);
  overflow: hidden;
  border: 1px solid var(--line);
}
.sv__handle {
  position: absolute;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.5);
  background: transparent;
  pointer-events: none;
}
.sv:focus-visible { outline-offset: 3px; }

/* sliders */
.slider {
  position: relative;
  height: 16px;
  margin-top: 16px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  border: 1px solid var(--line);
}
.slider--hue {
  background: linear-gradient(90deg, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%,
                                     #00f 67%, #f0f 83%, #f00 100%);
}
.slider--alpha {
  background-color: #fff;
  background-image:
    linear-gradient(90deg, rgba(var(--c-rgb), 0), rgba(var(--c-rgb), 1)),
    conic-gradient(#cfcfcf 0 25%, #fff 0 50%, #cfcfcf 0 75%, #fff 0);
  background-size: 100% 100%, 12px 12px;
}
.slider__handle {
  position: absolute; top: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--ink);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

/* input + action row */
.field {
  display: flex; align-items: center; gap: 10px;
  margin-top: 18px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  transition: border-color 160ms;
}
.field:focus-within { border-color: rgba(var(--c-rgb), 0.7); }
.field__chip {
  width: 22px; height: 22px; flex: none;
  border-radius: 3px;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.field input {
  flex: 1; min-width: 0;
  padding: 12px 0;
  background: none; border: 0; outline: none;
  font-family: var(--font-mono);
  font-size: 14px; letter-spacing: 0.01em;
}
.field input::placeholder { color: var(--ink-3); }
.field.is-bad { border-color: var(--no); }

.actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 12px;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 12.5px; color: var(--ink-2);
  text-decoration: none;          /* <a class="btn"> 도 쓰이므로 */
  cursor: pointer;
  transition: color 160ms, border-color 160ms, transform 160ms var(--ease);
}
.btn:hover { color: var(--ink); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn--accent {
  background: var(--c); color: var(--c-ink);
  border-color: transparent;
  transition: background 320ms var(--ease), color 320ms var(--ease), transform 160ms;
}
.btn--accent:hover { color: var(--c-ink); filter: brightness(1.08); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* --------------------------- readout column -------------------------- */
.readout__hex {
  display: block; width: 100%;
  padding: 6px 0 12px;
  text-align: left;
  font-family: var(--font-display);
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--c);
  transition: color 320ms var(--ease);
  word-break: break-all;
}
.readout__hex:hover { filter: brightness(1.15); }

.codes { border-top: 1px solid var(--line); }
.code {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background 140ms;
}
.code:hover { background: var(--surface-2); }
.code__key {
  flex: none; width: 46px;
  font-family: var(--font-display);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3);
}
.code__val {
  flex: 1; min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code__copy {
  flex: none;
  font-family: var(--font-display);
  font-size: 8.5px; letter-spacing: 0.12em;
  color: var(--ink-3);
  opacity: 0; transition: opacity 140ms;
}
.code:hover .code__copy, .code:focus-visible .code__copy { opacity: 1; }
.code.is-copied { background: rgba(var(--c-rgb), 0.14); }
.code.is-copied .code__copy { opacity: 1; color: var(--c); }

.meta {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 14px;
  font-size: 11.5px; color: var(--ink-3);
}
.meta b {
  font-family: var(--font-mono);
  font-weight: 400; color: var(--ink-2);
}

/* ------------------------------ image pick --------------------------- */
.dropzone {
  position: relative;
  display: grid; place-items: center;
  min-height: 180px;
  padding: 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  background: var(--bg-2);
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 160ms, background 160ms;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--c);
  background: rgba(var(--c-rgb), 0.06);
  color: var(--ink-2);
}
.imgstage { position: relative; display: none; }
.imgstage.is-on { display: block; }
.imgstage canvas {
  width: 100%; height: auto;
  border-radius: var(--r);
  border: 1px solid var(--line);
  cursor: crosshair;
  display: block;
}
.loupe {
  position: absolute;
  width: 84px; height: 84px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  transform: translate(-50%, -130%);
  display: none;
  overflow: hidden;
  background: var(--surface);
}
.loupe.is-on { display: block; }
.loupe canvas { width: 100%; height: 100%; border: 0; border-radius: 50%; image-rendering: pixelated; }
.loupe::after {
  content: ""; position: absolute; inset: 50% auto auto 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border: 1.5px solid #fff; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

/* ------------------------------- harmony ----------------------------- */
.harmonies { display: grid; gap: 14px; }
@media (min-width: 700px) { .harmonies { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.harmony {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.harmony__name {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 13px;
  font-family: var(--font-display);
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.harmony__row { display: flex; height: 74px; }
.swatch {
  flex: 1; position: relative;
  display: flex; align-items: flex-end;
  padding: 7px;
  transition: flex 260ms var(--ease);
}
.swatch:hover { flex: 1.35; }
.swatch span {
  font-family: var(--font-mono);
  font-size: 9.5px;
  opacity: 0; transition: opacity 160ms;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.swatch:hover span, .swatch:focus-visible span { opacity: 0.92; }

/* -------------------------------- scale ------------------------------ */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); }
@media (min-width: 700px) { .scale { grid-template-columns: repeat(10, 1fr); } }
.scale .swatch {
  height: 92px;
  flex-direction: column; justify-content: space-between; align-items: flex-start;
}
.scale .swatch:hover { flex: 1; }
.scale .swatch b {
  font-family: var(--font-display);
  font-size: 9px; letter-spacing: 0.1em; opacity: 0.75; font-weight: 600;
}
.scale .swatch.is-base { box-shadow: inset 0 0 0 2px var(--ink); }

/* ------------------------------ contrast ----------------------------- */
.contrasts { display: grid; gap: 14px; }
@media (min-width: 700px) { .contrasts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ctest { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.ctest__demo {
  padding: 26px 18px;
  font-size: 19px; font-weight: 500;
  letter-spacing: -0.01em;
}
.ctest__body { padding: 13px 15px 15px; background: var(--surface); }
.ctest__ratio {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.ctest__ratio small {
  font-family: var(--font-ui);
  font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--ink-3);
}
.grades { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.grade {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px; color: var(--ink-2);
}
.grade::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--no);
}
.grade.is-pass { color: var(--ink); }
.grade.is-pass::before { background: var(--ok); }

/* --------------------------- saved / recent -------------------------- */
.swatchgrid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.chip {
  position: relative;
  width: 46px; height: 46px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 180ms var(--ease);
}
.chip:hover { transform: translateY(-3px); }
.chip__x {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line-2);
  font-size: 11px; line-height: 1;
  opacity: 0; transition: opacity 140ms;
}
.chip:hover .chip__x, .chip__x:focus-visible { opacity: 1; }
.empty { color: var(--ink-3); font-size: 13px; }

.stack-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.stack-head h3 {
  font-family: var(--font-display);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
}
.linkbtn {
  font-size: 11.5px; color: var(--ink-3);
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line-2);
}
.linkbtn:hover { color: var(--ink); }

/* -------------------------------- prose ------------------------------ */
.prose { max-width: 68ch; }
.prose p { color: var(--ink-2); font-size: 14.5px; margin-bottom: 14px; }
.faq { max-width: 68ch; margin-top: 26px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  padding: 15px 26px 15px 0;
  position: relative;
  cursor: pointer; list-style: none;
  font-size: 14.5px; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 13px;
  font-family: var(--font-display); color: var(--ink-3);
  transition: transform 220ms var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { padding: 0 0 16px; color: var(--ink-2); font-size: 14px; }

/* --------------------------------- ads ------------------------------- */
.ad {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ad--top    { min-height: 90px;  margin: 0 auto 6px; max-width: var(--shell); padding: 0 clamp(16px, 4vw, 32px); }
.ad--mid    { min-height: 250px; margin: clamp(36px, 5vw, 56px) 0 0; }
.ad--bottom { min-height: 250px; margin-top: clamp(36px, 5vw, 56px); }
.ad--rail   { min-height: 600px; position: sticky; top: 88px; }
@media (max-width: 1079px) { .ad--rail { display: none; } }

.ad--placeholder {
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 11px,
                              rgba(var(--c-rgb), 0.028) 11px, rgba(var(--c-rgb), 0.028) 22px);
}
.ad__label {
  font-family: var(--font-display);
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3);
}
.ad .adsbygoogle { width: 100%; }

/* the rail column also holds saved colors on desktop */
.rail { display: block; }
.rail > * + * { margin-top: 24px; }

/* ------------------------------- footer ------------------------------ */
.foot {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.foot__in {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 32px);
  display: flex; flex-wrap: wrap; gap: 14px 26px;
  align-items: center;
  font-size: 12.5px; color: var(--ink-3);
}
.foot a { color: var(--ink-2); text-decoration: none; }
.foot a:hover { color: var(--ink); }
.foot__sep { margin-left: auto; }

/* -------------------------------- toast ------------------------------ */
.toast {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 60;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 200ms, transform 260ms var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

/* ===================================================================== *
   파생 페이지 (변환기 · 색 상세 · 색 목록)
   ===================================================================== */
.doc-main {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 32px) 80px;
}
.doc-main section + section { margin-top: clamp(32px, 4.5vw, 48px); }

.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-3);
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs i { font-style: normal; opacity: 0.45; }

.pagehead { margin: 20px 0 30px; }
.pagehead h1 {
  font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.1; letter-spacing: -0.035em; font-weight: 600;
  margin-bottom: 10px;
}
.pagehead p { color: var(--ink-2); max-width: 62ch; font-size: 14.5px; }

.pagehead--color {
  display: grid; gap: 20px; align-items: center;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 640px) {
  .pagehead--color { grid-template-columns: 190px minmax(0, 1fr); gap: 26px; }
}
.swatch-hero {
  display: flex; align-items: flex-end;
  aspect-ratio: 1 / 1;
  max-width: 190px;
  padding: 12px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
}

/* 링크 카드 그리드 — 변환기 목록 */
.linkgrid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.linkcard {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 160ms, transform 200ms var(--ease), background 160ms;
}
.linkcard:hover {
  border-color: rgba(var(--c-rgb), 0.55);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.linkcard b {
  display: block;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.linkcard span { font-size: 12.5px; color: var(--ink-3); }

/* 색 스와치 줄 — 목록·비슷한 색 */
.chipline { display: flex; flex-wrap: wrap; gap: 8px; }
.chipline .swatch {
  flex: 0 0 auto;
  width: 136px; height: 66px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  text-decoration: none;
  align-items: flex-end;
}
.chipline .swatch:hover { flex: 0 0 auto; transform: translateY(-2px); }
.chipline .swatch span { opacity: 0.95; font-size: 11px; }

.famnav {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 26px;
}
.famnav a {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--ink-2); text-decoration: none;
}
.famnav a:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }

.famgroup { scroll-margin-top: 80px; }
.famgroup .sect-head h2 { display: flex; align-items: baseline; gap: 8px; }
.famgroup .sect-head small {
  font-family: var(--font-display);
  font-size: 10px; color: var(--ink-3); font-weight: 600;
}

/* 예시 표 */
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table thead th {
  font-family: var(--font-display);
  font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.table tbody th { font-weight: 500; }
.table code { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }
.table tr:last-child th, .table tr:last-child td { border-bottom: 0; }
.dot {
  display: inline-block;
  width: 11px; height: 11px; margin-right: 8px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  vertical-align: -1px;
}

.conv .readout__hex { font-size: clamp(22px, 3.4vw, 34px); }

/* ===================================================================== *
   터치 기기 (pointer: coarse)
   마우스 전용 가정 두 가지를 걷어낸다.
   ① 얇은 히트 영역 — 슬라이더 16px 은 손가락으로 못 잡는다
   ② hover 로만 드러나는 UI — 터치엔 hover 가 없어 아예 도달 불가였다
      (저장한 색의 삭제 × 버튼이 대표적)
   ===================================================================== */
@media (pointer: coarse) {
  /* 트랙 두께는 그대로 두고 위아래로 보이지 않는 히트 영역만 넓힌다 */
  .slider { position: relative; }
  .slider::before {
    content: "";
    position: absolute;
    inset: -12px 0;
  }
  .slider__handle { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
  .sv__handle { width: 24px; height: 24px; margin: -12px 0 0 -12px; }

  /* 작은 링크·버튼에 최소 44px 높이를 준다 */
  .langs .lang { padding: 12px 10px; }
  .nav a { padding: 12px 11px; }
  .linkbtn { display: inline-block; padding: 11px 0; }
  .footlangs .lang { padding: 10px 0; }
  .wordmark { padding: 10px 0; }
  .crumbs a, .crumbs span { padding: 6px 0; }
  .famnav a { padding: 10px 14px; }

  /* hover 로만 보이던 것들을 상시 노출 */
  .chip__x { opacity: 1; }
  .swatch span, .swatch b { opacity: 0.92; }
  .code__copy { opacity: 0.55; }

  /* 스와치가 hover 로 넓어지는 연출은 터치에서 의미가 없다 */
  .swatch:hover { flex: 1; }
  .chipline .swatch:hover { transform: none; }
  .chip:hover { transform: none; }
}

/* ------------------------- entrance choreography --------------------- */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 620ms var(--ease) both; }
  .rise:nth-child(2) { animation-delay: 60ms; }
  .rise:nth-child(3) { animation-delay: 120ms; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
