/* 기기테스트편. 템플릿 기본 스타일에 도구 화면을 더했다. 색은 :root 토큰만 쓰고, 간격 4 8 12 16 24 32 48 64, 글자 12 14 16 18 20 24 30 안에서만 쓴다. */
:root {
  --ink: hsl(220 15% 13%);
  --ink-2: hsl(220 8% 38%);
  --ink-3: hsl(220 6% 58%);
  --line: hsl(220 10% 87%);
  --line-2: hsl(220 10% 94%);
  --bg: hsl(0 0% 100%);
  --bg-2: hsl(220 20% 97%);
  --accent: hsl(220 60% 40%);
  --accent-2: hsl(220 60% 94%);
  --accent-ink: hsl(220 65% 26%);
  --warn: hsl(4 70% 42%);
  --warn-2: hsl(4 80% 95%);
  --radius: 4px;
  --font: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg); font-feature-settings: "tnum" 1; }
::selection { background: var(--accent-2); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; margin: 0; font-weight: 700; }
h1 { font-size: 24px; margin-top: 16px; margin-bottom: 12px; }
h2 { font-size: 20px; margin-top: 48px; margin-bottom: 12px; }
p { margin: 0 0 12px; max-width: 65ch; }
@media (min-width: 720px) { h1 { font-size: 30px; } h2 { font-size: 24px; } }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 16px 64px; }
.site-head { border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 12px; max-width: 72rem; margin: 0 auto; padding: 12px 16px; color: var(--ink); text-decoration: none; }
.brand-name { font-weight: 700; font-size: 18px; }
.brand-tag { color: var(--ink-2); font-size: 14px; }
@media (max-width: 480px) { .brand-tag { display: none; } }
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 16px 48px; color: var(--ink-2); font-size: 14px; }
.site-foot p { max-width: 72rem; margin: 0 auto 8px; }
.crumbs { font-size: 14px; color: var(--ink-3); margin-top: 16px; }
.crumbs a { color: var(--ink-2); }

.lead { font-size: 18px; line-height: 1.5; margin-bottom: 24px; }
.basis, .sub { color: var(--ink-3); font-size: 14px; }
.list { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; margin: 12px 0 24px; }
th, td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
th { font-size: 14px; font-weight: 500; color: var(--ink-2); }

.prose { max-width: 65ch; }
.prose h2 { margin-top: 32px; }
.ad { margin: 24px 0; }
.preview-note { background: var(--accent-2); color: var(--accent-ink); padding: 8px 16px; font-size: 14px; text-align: center; }

/* 머리 내비 */
.site-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; max-width: 72rem; margin: 0 auto; border-bottom: 0; }
.site-head .brand { margin: 0; }
.tool-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 16px 12px; font-size: 14px; }
.tool-nav a { color: var(--ink-2); text-decoration: none; }
.tool-nav a:hover { color: var(--accent); }
body > .site-head + main { border-top: 1px solid var(--line); }
@media (min-width: 720px) { .tool-nav { padding: 12px 16px; } }

/* 버튼 */
button { font: inherit; font-size: 16px; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--ink-3); }
button:disabled { color: var(--ink-3); cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
button.primary:hover { background: var(--accent-ink); }
button.link { border: 0; padding: 0; background: none; color: var(--accent); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
select { font: inherit; font-size: 16px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); max-width: 100%; }
.check { font-size: 14px; color: var(--ink-2); white-space: nowrap; }
[hidden] { display: none !important; }

/* 도구 영역 */
.tool { background: var(--bg-2); padding: 16px; margin: 24px 0; border-radius: var(--radius); }
.tool > :last-child { margin-bottom: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.swatch { font-size: 14px; padding: 4px 12px; }
.facts-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0; }
.facts-dl dt { color: var(--ink-2); font-size: 14px; }
.facts-dl dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .facts-dl { grid-template-columns: 1fr; gap: 0; } .facts-dl dd { margin-bottom: 8px; } }
ol { padding-left: 24px; max-width: 65ch; }
ol li { margin-bottom: 8px; }

/* 키보드 */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 0 0 16px; }
.stats div { min-width: 0; }
.stats .wide { grid-column: 1 / -1; }
.stats dt { font-size: 14px; color: var(--ink-2); }
.stats dd { margin: 0; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.legend { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.legend .key { min-width: 0; height: auto; padding: 0 8px; }
.kb-scroll { overflow-x: auto; padding-bottom: 8px; }
.kb { display: flex; gap: 24px; align-items: flex-start; width: max-content; }
.kb-row { display: flex; gap: 4px; margin-bottom: 4px; }
.key { --w: 1; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: calc(var(--w) * 40px + (var(--w) - 1) * 4px); height: 40px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-size: 12px; line-height: 1.2; color: var(--ink); user-select: none; }
.key small { font-size: 12px; color: var(--ink-3); }
.key.hit { background: var(--accent-2); border-color: var(--accent); }
.key.down { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.key.down small { color: var(--accent-2); }

/* 마우스 */
.pad { display: flex; align-items: center; justify-content: center; text-align: center; height: 192px; padding: 16px; border: 1px dashed var(--ink-3); border-radius: var(--radius); background: var(--bg); color: var(--ink-2); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.mouse-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.mb { display: flex; flex-direction: column; min-width: 96px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.mb .name { font-size: 14px; color: var(--ink-2); }
.mb .n { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mb .d { font-size: 12px; color: var(--warn); min-height: 16px; }
.mb.down { background: var(--accent-2); border-color: var(--accent); }
.mb.warn { border-color: var(--warn); background: var(--warn-2); }

/* 마이크 */
.meter { position: relative; height: 16px; background: var(--line-2); border-radius: var(--radius); overflow: hidden; margin: 12px 0 8px; }
.meter .bar { height: 100%; width: 0; background: var(--accent); }
.meter .peak { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: var(--ink); }
audio { vertical-align: middle; max-width: 100%; }
.pan { display: flex; flex-wrap: wrap; gap: 8px; }

/* 웹캠 */
video { display: block; width: 100%; max-width: 640px; aspect-ratio: 16 / 9; background: var(--ink); border-radius: var(--radius); margin: 12px 0; }
video.mirror { transform: scaleX(-1); }

/* 전체 화면 단색 */
.screen-overlay { position: fixed; inset: 0; z-index: 1000; cursor: none; }
.screen-hint { position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%); max-width: calc(100% - 32px); margin: 0; padding: 8px 16px; border-radius: var(--radius); background: hsl(0 0% 0% / 0.7); color: hsl(0 0% 100%); font-size: 14px; text-align: center; transition: opacity 0.4s; }
.screen-hint.gone { opacity: 0; }

/* 기준 표: 좁은 화면에서는 행을 세로로 쌓는다 */
table.stack td, table.stack th { overflow-wrap: anywhere; }
table.stack td .sub, table.stack th .sub { display: inline-block; margin-top: 4px; font-weight: 400; }
table.stack tbody th { color: var(--ink); font-size: 16px; font-weight: 600; min-width: 8em; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.stack th, table.stack td { display: block; border: 0; padding: 4px 0; }
  table.stack th { font-size: 16px; font-weight: 700; color: var(--ink); }
  table.stack td::before { content: attr(data-label); display: block; font-size: 12px; color: var(--ink-3); }
}
.statements { padding-left: 0; list-style: none; max-width: 65ch; }
.statements li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.statements .sub { display: block; margin-top: 4px; }
