/* 탭모아 모양: "색인 탭이 달린 바인더". 모눈종이 바탕 위에 흰 종이를 올리고, 도구마다 색인 탭 색이 하나씩 있습니다.
   도구 색은 --hue 하나로 정하고(페이지는 body, 목록은 줄마다), 나머지 색은 여기서 계산합니다. */
:root {
  --hue: 18;
  --paper: #f3f5f1; --grid: rgba(28, 39, 66, .065); --sheet: #ffffff;
  --ink: #1c2742; --muted: #5a6379; --edge: #1c2742; --rule: #d6dbe4;
  --hl: #ffe04d; --hl-ink: #1c2742;
  --ok: #1a7f43; --warn: #b26a00; --bad: #c0392b;
  --font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Sans", "Yu Gothic UI", "Noto Sans KR", "Noto Sans JP", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121829; --grid: rgba(255, 255, 255, .035); --sheet: #1a2238;
    --ink: #e8ecf6; --muted: #9ba5be; --edge: #6d7a9c; --rule: #2c3652;
    --ok: #5fd08a; --warn: #f1b74b; --bad: #f08a7c;
  }
}
/* 도구 색 (탭 색) — --hue 가 바뀌는 자리마다 다시 계산되도록 여기에 둡니다 */
body, .toolnav a, .idx-row {
  --accent: hsl(var(--hue) 62% 42%); --accent-ink: #ffffff; --accent-soft: hsl(var(--hue) 68% 94%);
}
@media (prefers-color-scheme: dark) {
  body, .toolnav a, .idx-row {
    --accent: hsl(var(--hue) 62% 64%); --accent-ink: #121829; --accent-soft: hsl(var(--hue) 34% 20%);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.7 var(--font); overflow-wrap: anywhere;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
/* 한국어만 낱말 중간에서 줄이 바뀌지 않게 (일본어는 띄어쓰기가 없어서 적용하면 안 됨) */
html:lang(ko) body { word-break: keep-all; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--sheet); padding: 8px 12px; border: 1.5px solid var(--edge); border-radius: 6px; z-index: 50; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* 위쪽: 이름표와 색인 탭 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1040px; margin: 0 auto; padding: 16px 16px 12px; }
.logo { background: var(--hl); color: var(--hl-ink); font-weight: 800; font-size: 20px; letter-spacing: -.02em; text-decoration: none; padding: 3px 10px 4px; border-radius: 3px; }
.langs { position: relative; font-size: 14px; }
.langs summary { list-style: none; cursor: pointer; padding: 5px 10px; border: 1.5px solid var(--edge); border-radius: 6px; background: var(--sheet); font-weight: 600; }
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: "▾"; margin-left: 6px; }
.langs-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 150px; background: var(--sheet); border: 1.5px solid var(--edge); border-radius: 6px; display: grid; overflow: hidden; }
.langs-list a { padding: 9px 12px; text-decoration: none; border-bottom: 1px solid var(--rule); }
.langs-list a:last-child { border-bottom: 0; }
.langs-list a:hover, .langs-list a[aria-current] { background: var(--hl); color: var(--hl-ink); }
.toolnav { display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; max-width: 1040px; margin: 0 auto; padding: 4px 16px 0; border-bottom: 1.5px solid var(--edge); scrollbar-width: none; }
.toolnav::-webkit-scrollbar { display: none; }
.toolnav a { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 6px; border: 1.5px solid var(--edge); border-bottom: 0; border-radius: 7px 7px 0 0; background: var(--sheet); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.toolnav a .ico { width: 17px; height: 17px; color: var(--accent); }
.toolnav a:hover { background: var(--accent-soft); }
.toolnav a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); padding-top: 10px; }
.toolnav a[aria-current] .ico { color: inherit; }
.langbar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 16px; background: var(--hl); color: var(--hl-ink); font-size: 14px; }
.langbar a { font-weight: 700; }
.langbar button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; }

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
.hero { padding: 22px 0 14px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(25px, 4.6vw, 34px); font-weight: 800; display: flex; align-items: center; gap: 12px; }
.h-tab { width: 42px; height: 42px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.hero-home { padding: 40px 0 10px; }
.hero-home h1 { font-size: clamp(30px, 6.4vw, 50px); max-width: 15em; letter-spacing: -.03em; display: block; }
.lead { margin: 0; color: var(--muted); max-width: 42em; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 16px; }
.pick a { padding: 5px 12px; border-radius: 6px; border: 1.5px solid var(--edge); background: var(--sheet); text-decoration: none; font-size: 14px; font-weight: 600; }
.pick a:hover { background: var(--hl); color: var(--hl-ink); }

/* 도구를 올려 둔 종이 */
.tool { background: var(--sheet); border: 1.5px solid var(--edge); border-top: 6px solid var(--accent); border-radius: 4px 4px 10px 10px; padding: clamp(14px, 3vw, 24px); margin: 6px 0 30px; min-height: 280px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--edge); background: var(--sheet); font-weight: 700; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-main { background: var(--hl); color: var(--hl-ink); border-color: #1c2742; }
.btn-main:hover { background: #ffd21f; }
.btn-big { min-height: 54px; padding: 12px 26px; font-size: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-c { justify-content: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 38px; padding: 6px 13px; border-radius: 6px; border: 1.5px solid var(--edge); background: var(--sheet); cursor: pointer; font-weight: 600; font-size: 14px; }
.chip:hover { background: var(--accent-soft); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 700; }
textarea, input[type="text"], input[type="number"], select { width: 100%; padding: 10px 12px; border-radius: 6px; border: 1.5px solid var(--edge); background: var(--sheet); }
textarea { min-height: 220px; resize: vertical; line-height: 1.55; font-weight: 400; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.big { font: 800 clamp(52px, 16vw, 136px)/1 var(--font); letter-spacing: -.03em; text-align: center; font-variant-numeric: tabular-nums; margin: 12px 0 18px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: 14px; z-index: 60; }
.stat { display: grid; gap: 2px; padding: 10px 14px; border-radius: 6px; border: 1.5px solid var(--rule); min-width: 100px; text-align: center; }
.stat b { font: 800 26px/1.15 var(--font); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.note { padding: 11px 14px; border-radius: 4px; background: var(--accent-soft); border-left: 4px solid var(--accent); font-size: 14px; margin: 0; }
.note-bad { background: color-mix(in srgb, var(--bad) 13%, transparent); border-left-color: var(--bad); }
.note-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); border-left-color: var(--ok); }

/* 돌림판 */
.wheel-wrap { display: grid; gap: 22px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .wheel-wrap { grid-template-columns: 1fr; } }
.wheel-stage { position: relative; max-width: 520px; margin: 0 auto; width: 100%; aspect-ratio: 1; }
.wheel-stage canvas { width: 100%; height: 100%; display: block; cursor: pointer; border-radius: 50%; border: 2px solid var(--edge); }
.wheel-pin { position: absolute; left: 50%; top: -8px; transform: translateX(-50%); width: 0; height: 0; border: 15px solid transparent; border-top: 30px solid var(--ink); z-index: 2; }
.wheel-hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 22%; aspect-ratio: 1; border-radius: 50%; border: 2px solid #1c2742; background: var(--hl); color: var(--hl-ink); font-weight: 800; font-size: clamp(13px, 2.6vw, 18px); cursor: pointer; z-index: 2; }
.wheel-side { display: grid; gap: 12px; }
.wheel-result { text-align: center; padding: 16px; border-radius: 6px; border: 1.5px solid var(--edge); background: var(--accent-soft); display: grid; gap: 10px; }
.wheel-result b { font-size: clamp(24px, 6vw, 40px); line-height: 1.2; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* 팀 나누기 */
.tp-wrap { display: grid; gap: 22px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
@media (max-width: 760px) { .tp-wrap { grid-template-columns: 1fr; } }
.tp-side, .tp-out { display: grid; gap: 12px; }
.tp-num { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.tp-num input { width: 84px; text-align: center; font-weight: 700; }
.tp-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tp-card { border: 1.5px solid var(--edge); border-top: 5px solid var(--accent); border-radius: 3px 3px 6px 6px; padding: 10px 12px 12px; }
.tp-card h3 { margin: 0 0 6px; font-size: 15px; }
.tp-card ol, .tp-card ul { margin: 0; padding-left: 20px; }
.tp-empty { color: var(--muted); padding: 30px 12px; text-align: center; border: 1.5px dashed var(--edge); border-radius: 6px; }

/* 타이머·스톱워치 */
.tm-set { display: flex; justify-content: center; gap: 8px; margin: 12px 0; }
.tm-set label { display: grid; gap: 4px; text-align: center; font-size: 12px; color: var(--muted); }
.tm-set input { width: 78px; text-align: center; font: 700 22px var(--font); font-variant-numeric: tabular-nums; }
.tool.is-done { animation: flash 1s steps(2) infinite; }
@keyframes flash { 50% { background: var(--hl); color: var(--hl-ink); } }
@media (prefers-reduced-motion: reduce) { .tool.is-done { animation: none; background: var(--hl); color: var(--hl-ink); } }
.tool:fullscreen { display: grid; align-content: center; border: 0; border-radius: 0; }
.tool:fullscreen .big { font-size: 22vw; }
.laps { width: 100%; border-collapse: collapse; margin-top: 18px; font-variant-numeric: tabular-nums; }
.laps th, .laps td { padding: 8px 10px; border-bottom: 1px solid var(--rule); text-align: right; }
.laps th { font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1.5px solid var(--edge); }
.laps td:first-child, .laps th:first-child { text-align: left; }

/* 화면 색 */
.cs-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); margin-bottom: 16px; }
.cs-sw { aspect-ratio: 4/3; border-radius: 6px; border: 1.5px solid var(--edge); cursor: pointer; display: flex; align-items: flex-end; padding: 6px; font-weight: 700; font-size: 13px; }
.cs-sw span { background: #fff; color: #1c2742; padding: 1px 7px; border-radius: 3px; border: 1px solid #1c2742; }
.cs-over { position: fixed; inset: 0; z-index: 100; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.cs-over p { margin: 0 0 24px; padding: 8px 14px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; transition: opacity .6s; }
.cs-over.is-quiet p { opacity: 0; }
.cs-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cs-custom input[type="color"] { width: 56px; height: 44px; padding: 0; border: 1.5px solid var(--edge); border-radius: 6px; background: none; }

/* 클릭 속도 */
.ck-pad { width: 100%; min-height: 240px; border-radius: 8px; border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--ink); cursor: pointer; font-weight: 800; font-size: clamp(18px, 4vw, 26px); user-select: none; -webkit-user-select: none; touch-action: manipulation; display: grid; place-items: center; padding: 16px; margin: 14px 0; }
.ck-pad.is-on { border-style: solid; }
.ck-pad:active { filter: brightness(.96); }
.ck-stats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* 마이크 */
.mic-meter { height: 24px; border-radius: 4px; border: 1.5px solid var(--edge); overflow: hidden; margin: 16px 0 8px; }
.mic-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn) 75%, var(--bad)); transition: width .06s linear; }
.mic-wave { width: 100%; height: 120px; border-radius: 4px; border: 1.5px solid var(--rule); display: block; }
.mic-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; margin: 14px 0; }
.mic-info dt { color: var(--muted); }
.mic-info dd { margin: 0; font-weight: 600; }
.tool audio { width: 100%; margin-top: 10px; }

/* 키보드 */
.kb-stage { outline: none; border-radius: 6px; border: 1.5px dashed var(--edge); padding: 12px; position: relative; }
.kb-stage:focus { border-color: var(--accent); border-style: solid; }
.kb-cover { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--sheet) 84%, transparent); border-radius: 6px; font-weight: 800; font-size: 18px; cursor: pointer; z-index: 2; text-align: center; padding: 12px; }
.kb-stage:focus .kb-cover { display: none; }
.kb-scroll { overflow-x: auto; padding-bottom: 6px; }
.kb { display: flex; gap: 14px; width: max-content; margin: 0 auto; font-size: 11px; }
.kb-block { display: grid; gap: 4px; align-content: start; }
.kb-row { display: flex; gap: 4px; }
.kb-key { --w: 1; width: calc(var(--w) * 38px + (var(--w) - 1) * 4px); height: 38px; border-radius: 5px; border: 1.5px solid var(--rule); display: grid; place-items: center; font-weight: 600; white-space: nowrap; overflow: hidden; }
.kb-gap { --w: 1; width: calc(var(--w) * 38px + (var(--w) - 1) * 4px); height: 38px; }
.kb-key.is-hit { background: var(--accent-soft); border-color: var(--accent); }
.kb-key.is-down { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.kb-last { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.kb-extra { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.kb-extra span { padding: 3px 9px; border-radius: 4px; border: 1.5px solid var(--accent); font-size: 12px; font-weight: 600; }

/* 설명 글 */
.doc { max-width: 700px; }
.doc h2 { font-size: 21px; font-weight: 800; margin: 38px 0 10px; }
.doc h3 { font-size: 17px; margin: 22px 0 4px; }
.doc p { margin: 0 0 12px; }
.doc ol, .doc ul { padding-left: 22px; margin: 0 0 12px; display: grid; gap: 6px; }
.doc-page h1 { font-size: clamp(26px, 5vw, 36px); font-weight: 800; margin: 30px 0 0; }
.faq { border-top: 1.5px solid var(--edge); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq details:last-child { border-bottom: 1.5px solid var(--edge); }
.faq summary { cursor: pointer; font-weight: 700; padding: 12px 2px; }
.faq p { margin: 0 2px 14px; }
.doc ul.why { list-style: none; padding: 0; gap: 0; }
.why li { padding: 10px 0; border-bottom: 1px solid var(--rule); }
.why li:first-child { border-top: 1.5px solid var(--edge); }
.why li:last-child { border-bottom: 1.5px solid var(--edge); }
.doc p.byline { margin-top: 30px; font-size: 13px; color: var(--muted); }
.more h2 { font-size: 20px; font-weight: 800; margin: 34px 0 12px; }

/* 도구 목록: 바인더 목차처럼 */
.idx { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); background: var(--sheet); border: 1.5px solid var(--edge); border-radius: 8px; overflow: hidden; }
.idx-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 14px; padding: 12px 16px 12px 12px; text-decoration: none; border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.idx-row:hover { background: var(--accent-soft); }
.idx-tab { width: 44px; height: 44px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.idx-text { display: grid; gap: 1px; min-width: 0; }
.idx-text b { font-size: 16px; }
.idx-text span { color: var(--muted); font-size: 14px; line-height: 1.45; }

.foot { border-top: 1.5px solid var(--edge); max-width: 1040px; margin: 10px auto 0; padding: 22px 16px 44px; font-size: 14px; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.foot nav a { color: var(--ink); font-weight: 600; }
.foot p { margin: 4px 0; max-width: 44em; }
.copy { font-size: 12px; }
