:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1d232b;
  --muted: #5d6772;
  --line: #dde1e6;
  --accent: #2d4f9e;
  --accent-soft: #e8eefa;
  --sun: #d0342b;
  --sat: #1f63b6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 4px 16px rgba(20, 30, 45, 0.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, 'Segoe UI', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- ヘッダー・フッター ---- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(6px);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.logo img { width: 26px; height: 26px; }
.nav {
  display: flex;
  gap: 4px 16px;
  margin-left: auto;
  overflow-x: auto;
  font-size: 14px;
  white-space: nowrap;
  scrollbar-width: none;
}
.nav a {
  padding: 6px 2px;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover,
.nav a[aria-current='page'] { color: var(--accent); }
.lang-switch {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .site-head .wrap { flex-wrap: wrap; gap: 0 12px; padding-top: 6px; }
  .nav { order: 3; width: 100%; margin-left: 0; padding-bottom: 4px; }
  .lang-switch { margin-left: auto; }
}

.site-foot {
  margin-top: 64px;
  padding: 32px 0 40px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 14px;
}
.site-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 12px;
}
.site-foot a { color: var(--muted); }

/* ---- 本文 ---- */
main { display: block; }
.hero { padding: 32px 0 8px; }
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 4.2vw, 36px);
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.hero p { margin: 0; color: var(--muted); }
.crumbs {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.crumbs li + li::before { content: '›'; margin: 0 6px 0 2px; }
section.block { margin-top: 40px; }
h2 {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.4;
}
h3 { margin: 24px 0 8px; font-size: 17px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.note { color: var(--muted); font-size: 14px; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 36px; }

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.field { display: block; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field select,
.field input[type='text'] {
  width: 100%;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid #c9cfd6;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 14px;
  font-size: 14px;
}
.checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); }
.btn.secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}
.gen-actions { margin-top: 18px; }
.gen-actions .btn { width: 100%; }
.gen-actions .note { margin: 10px 0 0; font-size: 13px; line-height: 1.6; }

.tbl-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 15px;
}
table.data th,
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.data thead th {
  background: var(--accent-soft);
  font-size: 13px;
  color: var(--muted);
}
table.data td.sun,
table.data td.hol { color: var(--sun); }
table.data td.sat { color: var(--sat); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.facts ul { margin: 0; padding-left: 1.2em; }
.facts h3 { margin-top: 0; }
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.faq details {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.faq details + details { margin-top: 8px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { margin: 10px 0 0; }

/* ---- 計算ツール共通 ---- */
.tool { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; margin-top: 24px; align-items: start; }
@media (max-width: 900px) { .tool { grid-template-columns: minmax(0, 1fr); } }
.tool-form .fields { margin-top: 0; }
.field small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.field input[type='number'] { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid #c9cfd6; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.stat span { display: block; font-size: 13px; color: var(--muted); }
.stat b { display: block; font-size: 22px; line-height: 1.4; overflow-wrap: anywhere; }
.stat small { display: block; font-size: 12px; color: var(--muted); }
.stat.hot b { color: var(--sun); }
.stat.good b { color: #1d7a46; }
.chart { margin: 20px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.chart figcaption { font-size: 13px; font-weight: 700; color: var(--muted); }
.chart svg { display: block; width: 100%; height: auto; }
.disclaimer { margin-top: 24px; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); font-size: 14px; }
.cross { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.cross a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none; }
.cross a:hover { border-color: var(--accent); }
.cross small { display: block; color: var(--muted); }
table.data th { white-space: nowrap; }
.prose table.data th { width: 9em; }

/* ---- 小さな画面の調整 ---- */
@media (max-width: 720px) {
  .logo { white-space: normal; line-height: 1.3; min-width: 0; }
}
.prose table.data th { width: auto; white-space: nowrap; }
.tbl-wrap table.data td { min-width: 11em; }

/* ---- 入力欄 ---- */
.field > span { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; min-width: 0; }
.inline select { width: auto; flex: none; min-height: 40px; padding: 6px 10px; border: 1px solid #c9cfd6; border-radius: 8px; background: #fff; font: inherit; font-size: 15px; }


/* ---- テスト一覧 ---- */
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-top: 24px; }
.test-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.test-card:hover { border-color: var(--accent); }
.test-card .ico { font-size: 28px; line-height: 1.2; }
.test-card small { color: var(--muted); line-height: 1.5; }
.uses { padding-left: 1.2em; }

/* ---- テスト共通 ---- */
.device-tool { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.device-tool > .wide-controls, .device-tool > .kbd-scroll, .device-tool > .stats, .device-tool > h3, .device-tool > .log,
.device-tool > .pad, .device-tool > .row, .device-tool > .cps-area, .device-tool > .msg, .device-tool > .empty, .device-tool > #pads,
.device-tool > .piano-scroll, .device-tool > .colors, .device-tool > .chart, .device-tool > .touch-canvas { grid-column: 1 / -1; }
.device-tool[data-tool='speaker'] { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .device-tool { grid-template-columns: minmax(0, 1fr); } }
.controls .fields { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
.wide-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.wide-controls .fields { margin: 0; min-width: 240px; }
.wide-controls .checks, .wide-controls .row { margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.row:first-child { margin-top: 0; }
.row .btn { flex: 1 1 auto; }
.out { display: grid; gap: 12px; min-width: 0; }
.msg { margin: 0; padding: 12px 14px; border-radius: 8px; background: #fdeceb; border-left: 4px solid var(--sun); font-size: 14px; }
.msg.info { background: var(--accent-soft); border-left-color: var(--accent); }
.device-tool h3 { margin: 4px 0 0; }
.log { margin: 0; padding: 10px 14px 10px 2.2em; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; line-height: 1.6; }
.log:empty { display: none; }
.log code, .stat code { padding: 0 4px; border-radius: 4px; background: #eef1f6; font-size: 0.95em; overflow-wrap: anywhere; }
.log em { color: var(--sun); font-style: normal; font-weight: 700; }
.log span { color: var(--muted); }
.stat b code { font-size: 18px; }
input[type='range'] { width: 100%; accent-color: var(--accent); }

/* カメラ */
.stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius); background: #10182a; }
.stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.stage video.mirror { transform: scaleX(-1); }
.stage .placeholder { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #9fb0cc; font-size: 14px; }
.stage.live .placeholder { display: none; }
.stage:fullscreen { aspect-ratio: auto; border-radius: 0; }

/* マイク */
.meter { position: relative; height: 34px; border-radius: 8px; background: linear-gradient(90deg, #dff3e8 0 66%, #fff4dc 66% 90%, #fdeceb 90%); overflow: hidden; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 6px; font-size: 11px; color: var(--muted); }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #1d7a46; opacity: 0.8; transition: width 0.06s linear; }
.meter b { position: absolute; top: 0; bottom: 0; width: 3px; left: 0; background: var(--ink); }
.meter span { position: relative; }
.scope { display: block; width: 100%; height: 220px; border-radius: var(--radius); background: #10182a; }
audio { width: 100%; margin-top: 12px; }

/* スピーカー */
.sp-grid { display: grid; grid-template-columns: 90px minmax(0, 1fr) 90px; gap: 12px; align-items: center; }
.sp-side { display: grid; place-items: center; align-content: center; gap: 2px; height: 90px; border: 2px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: 13px; transition: all 0.15s; }
.sp-side b { font-size: 28px; line-height: 1; color: var(--ink); }
.sp-side.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 6px rgba(45, 79, 158, 0.15); }
.sp-mid { display: grid; gap: 8px; }
.sp-btn.on { outline: 3px solid #f2b705; outline-offset: 2px; }
.playing { min-height: 1.7em; margin: 12px 0 0; font-weight: 700; color: var(--accent); }
.device-tool[data-tool='speaker'] .controls { max-width: 760px; }
.device-tool[data-tool='speaker'] .fields { grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) {
  .sp-grid { grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 8px; }
  .sp-side { height: 56px; font-size: 11px; }
  .sp-side b { font-size: 18px; }
  .device-tool[data-tool='speaker'] .fields { grid-template-columns: minmax(0, 1fr); }
}

/* キーボード */
.kbd-scroll { overflow-x: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #e9edf3; }
.kbd { display: flex; gap: 14px; width: max-content; --u: 40px; }
.kb-block { display: flex; flex-direction: column; gap: 4px; }
.kb-row { display: flex; gap: 4px; min-height: var(--u); }
.kb-block .kb-row:first-child { margin-bottom: 8px; }
.key { flex: none; display: grid; place-items: center; width: calc(var(--u) * var(--w) + 4px * (var(--w) - 1)); height: var(--u); padding: 0 2px; border: 1px solid #c3cad5; border-bottom-width: 3px; border-radius: 6px; background: #fff; color: var(--ink); font-size: 11px; line-height: 1.1; text-align: center; white-space: nowrap; overflow: hidden; user-select: none; }
.key.gap { visibility: hidden; }
.key.tested { background: #d9ecff; border-color: #8db4e6; }
.key.down { background: var(--accent); border-color: #1c356f; color: #fff; }
/* テンキーの縦長キー（+ と Enter）は、上の段の要素を2段分の高さにし、下の段の同じキーは隠す */
.kb-block.numpad .kb-row:nth-child(3) .key[data-code='NumpadAdd'],
.kb-block.numpad .kb-row:nth-child(5) .key[data-code='NumpadEnter'] { position: relative; z-index: 1; height: calc(var(--u) * 2 + 4px); margin-bottom: calc(-1 * (var(--u) + 4px)); align-self: flex-start; }
.kb-block.numpad .kb-row:nth-child(4) .key[data-code='NumpadAdd'],
.kb-block.numpad .kb-row:nth-child(6) .key[data-code='NumpadEnter'] { visibility: hidden; }
@media (max-width: 720px) { .kbd { --u: 34px; } .key { font-size: 10px; } }

/* マウス */
.pad { padding: 18px; border: 2px dashed #9fb0cc; border-radius: var(--radius); background: #fff; user-select: none; cursor: crosshair; touch-action: none; }
.pad:focus { outline: none; border-color: var(--accent); }
.mouse-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.mbtn, .mwheel { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fc; text-align: center; }
.mbtn span, .mwheel span { display: block; font-size: 13px; color: var(--muted); }
.mbtn b, .mwheel b { font-size: 26px; }
.mbtn.down { background: var(--accent); color: #fff; }
.mbtn.down span { color: #dbe5ff; }
.mwheel.up b, .mwheel.dn b { color: var(--accent); }
.pad .note { margin: 12px 0 0; text-align: center; }
.cps-area { display: grid; place-items: center; min-height: 160px; padding: 16px; border-radius: var(--radius); background: var(--accent); color: #fff; font-size: 20px; font-weight: 700; text-align: center; user-select: none; cursor: pointer; }
.cps-area.done { background: #1d7a46; }

/* ゲームパッド */
.empty { text-align: center; color: var(--muted); }
.pad.card { cursor: default; border-style: solid; border-width: 1px; border-color: var(--line); margin-bottom: 16px; user-select: auto; }
.pad h3 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.sticks { display: flex; flex-wrap: wrap; gap: 20px; margin: 12px 0; }
.stick { position: relative; width: 110px; height: 110px; border: 3px solid var(--line); border-radius: 50%; background: #f7f9fc; }
.stick i { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: var(--accent); }
.stick small { position: absolute; left: 0; right: 0; bottom: -24px; text-align: center; font-size: 12px; color: var(--muted); }
.stick.drift { border-color: var(--sun); }
.gbtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 30px; }
.gbtn { position: relative; padding: 8px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: center; font-size: 12px; overflow: hidden; }
.gbtn i { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: var(--accent); }
.gbtn span { position: relative; }
.gbtn.down { background: var(--accent); color: #fff; }
.axes { display: grid; gap: 6px; margin: 14px 0; }
.axis { display: grid; grid-template-columns: 4em minmax(0, 1fr) 3.5em; gap: 8px; align-items: center; font-size: 13px; }
.axis .bar { position: relative; height: 10px; border-radius: 5px; background: #e5e9f0; }
.axis .bar i { position: absolute; top: -3px; width: 4px; height: 16px; margin-left: -2px; background: var(--accent); left: 50%; }

/* MIDI */
.inputs { flex-basis: 100%; margin: 0; padding-left: 1.2em; font-size: 14px; }
.inputs:empty { display: none; }
.inputs span { color: var(--muted); }
.inputs em { font-style: normal; font-size: 12px; color: #1d7a46; }
.inputs em.disconnected { color: var(--muted); }
.piano-scroll { overflow-x: auto; padding: 10px; border-radius: var(--radius); background: #1b2333; }
.piano { position: relative; display: flex; width: max-content; height: 120px; }
.pk.w { position: relative; flex: none; width: 18px; height: 120px; margin-right: 1px; border-radius: 0 0 3px 3px; background: #fff; }
.pk.b { position: relative; z-index: 1; flex: none; width: 12px; height: 74px; margin: 0 -6px 0 -7px; border-radius: 0 0 2px 2px; background: #111; }
.pk.on { background: #f2b705; }
.pk small { position: absolute; bottom: 2px; left: 0; right: 0; font-size: 8px; text-align: center; color: var(--muted); }

/* ドット抜け */
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.color-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; font: inherit; font-size: 14px; }
.color-btn i { display: block; width: 100%; height: 56px; border: 1px solid #c3cad5; border-radius: 6px; background: var(--c); }
.color-btn:hover { border-color: var(--accent); }
.overlay { position: fixed; inset: 0; z-index: 100; cursor: none; }
.overlay-hint { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 8px 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 14px; text-align: center; transition: opacity 0.6s; }
.overlay-hint.fade { opacity: 0; }
.overlay-close { position: absolute; right: 12px; top: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 22px; cursor: pointer; opacity: 0.25; }
.overlay-close:hover { opacity: 1; }

/* リフレッシュレート */
.frames { display: block; width: 100%; height: 160px; border-radius: 8px; }
.motion { display: block; width: 100%; height: 120px; border-radius: 8px; }
.chart .field { margin-top: 10px; }

/* タッチ */
.touch-canvas { display: block; width: 100%; height: 60vh; min-height: 320px; border: 2px dashed #9fb0cc; border-radius: var(--radius); background: #fff; touch-action: none; }
@media (max-width: 480px) { .test-grid { grid-template-columns: 1fr 1fr; gap: 8px; } .test-card { padding: 12px; } .test-card small { font-size: 12px; } }
@media (max-width: 480px) { .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; } .stat b { font-size: 18px; } }
