:root {
  --bg: #0b0e14;
  --bg-2: #121722;
  --card: #161c29;
  --line: #262f42;
  --text: #e7ecf5;
  --muted: #94a0b8;
  --accent: #36d7b7;
  --accent-2: #5b8cff;
  --warn: #ffb547;
  --bad: #ff5d6c;
  --good: #3ddc84;
  --radius: 14px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Hiragino Sans", "Yu Gothic", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 20, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 12px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo b { color: var(--accent); }
.logo-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-size: 13px; color: #04120f; font-weight: 900; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-2); }

/* 언어별 글꼴: 해당 언어 글꼴을 먼저 사용해야 자간·글자 모양이 자연스러움 */
html:lang(ja) body { font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif; word-break: normal; line-break: strict; }
html:lang(zh-CN) body { font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif; word-break: normal; }
html:lang(en) body, html:lang(es) body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; word-break: normal; }

.lang-select { flex: none; padding: 6px 8px; font-size: 13px; border-radius: 8px; cursor: pointer; }
/* 번역 적용 전 한국어 원문이 잠깐 보이는 것을 방지 */
.i18n-pending body { visibility: hidden; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(24px, 4.5vw, 38px); margin: 0 0 8px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--muted); margin: 0; max-width: 760px; }

/* ---------- Status bar ---------- */
.status {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: 20px 0 14px;
}
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 600; }

.notice {
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px;
  border: 1px solid; font-size: 14px;
}
.notice.warn { background: rgba(255, 181, 71, .08); border-color: rgba(255, 181, 71, .35); }
.notice.good { background: rgba(61, 220, 132, .08); border-color: rgba(61, 220, 132, .35); }
.notice.info { background: rgba(91, 140, 255, .08); border-color: rgba(91, 140, 255, .35); }
.notice strong { color: var(--text); }
.hidden { display: none !important; }

/* ---------- Compare ---------- */
.compare-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.compare-card:fullscreen { padding: 16px; display: flex; flex-direction: column; background: var(--bg); }
.compare-card:fullscreen .compare { flex: 1; }
.compare-card:fullscreen .panel canvas { height: 100%; }

.controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.control { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.control label { white-space: nowrap; }
select, input[type="search"], input[type="text"] {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; font-size: 14px; font-family: inherit;
}
input[type="range"] { accent-color: var(--accent); width: 130px; }
.btn {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #04120f; border-color: var(--accent); font-weight: 700; }
.seg { flex-wrap: wrap; }
.seg button, .btn, .tabs button, .control label { white-space: nowrap; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { background: none; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; font-family: inherit; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--line); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { position: relative; background: #05070b; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel canvas { display: block; width: 100%; height: 300px; }
.panel-head {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  pointer-events: none;
}
.badge, .real { white-space: nowrap; }
.badge { font-weight: 800; font-size: 15px; padding: 4px 10px; border-radius: 8px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.12); }
.badge.l { color: #ffb547; }
.badge.r { color: var(--accent); }
.real { font-size: 12px; color: var(--muted); background: rgba(0,0,0,.55); padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.panel-head select { pointer-events: auto; padding: 4px 8px; font-size: 13px; }

/* 겹쳐서 보기: 두 캔버스를 같은 자리에 쌓고 위쪽 캔버스는 투명 배경 */
.compare.overlay { grid-template-columns: 1fr; }
.compare.overlay .panel { grid-area: 1 / 1; }
.compare.overlay .panel.top { background: transparent; border-color: transparent; pointer-events: none; }
.compare.overlay .panel.top .panel-head { top: auto; bottom: 10px; }
.compare.overlay .panel canvas { height: 360px; }
.compare.swapped:not(.overlay) .panel:first-child { order: 2; }
.compare.rhythm .panel canvas { height: 400px; }
.panel canvas.playable { cursor: pointer; touch-action: manipulation; }

.tip { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }

/* ---------- Frame game ---------- */
.game-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 18px; }
.game-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.game-hz { font-size: 13px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-variant-numeric: tabular-nums; }
.game-intro { text-align: center; padding: 26px 10px 18px; }
.game-intro p { max-width: 620px; margin: 0 auto 10px; }
.btn.big { font-size: 17px; padding: 12px 34px; border-radius: 12px; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.game-status { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.game-status strong { font-size: 18px; }
.game-status span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.game-stage .panel canvas { height: 280px; }
.game-stage.compare .panel canvas { height: 240px; }
.panel.pickable { cursor: pointer; transition: border-color .15s; }
.panel.pickable:hover { border-color: var(--accent); }
.game-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 14px; }
.btn.choice { font-size: 17px; font-weight: 700; padding: 14px 10px; font-variant-numeric: tabular-nums; }
.btn.choice.right { background: rgba(61, 220, 132, .18); border-color: var(--good); color: var(--good); opacity: 1; }
.btn.choice.wrong { background: rgba(255, 93, 108, .15); border-color: var(--bad); color: var(--bad); opacity: 1; }
.game-feedback { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 15px; }
.game-feedback.ok { background: rgba(61, 220, 132, .08); border-color: rgba(61, 220, 132, .4); }
.game-feedback.ng { background: rgba(255, 93, 108, .08); border-color: rgba(255, 93, 108, .4); }
.game-result { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 16px; }
.game-result b { font-size: 20px; }
.game-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.game-actions .btn { padding: 10px 18px; }
.game-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
section.block { margin: 34px 0; }
section.block > h2 { font-size: 22px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.verdict { display: flex; gap: 14px; align-items: flex-start; }
.verdict .icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--bg-2); }
.verdict h3 { margin: 0 0 4px; font-size: 18px; }
.verdict p { margin: 0; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin-top: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

ol.steps { margin: 8px 0 0; padding-left: 22px; }
ol.steps li { margin: 4px 0; }
.path { display: inline-block; background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px; font-size: 14px; }

/* ---------- Device search ---------- */
.search-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search-row input { flex: 1; min-width: 200px; }
table.devices { width: 100%; border-collapse: collapse; font-size: 14px; }
table.devices th, table.devices td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.devices th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--card); }
.table-scroll { max-height: 460px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.hz { font-weight: 800; font-variant-numeric: tabular-nums; }
.hz.h60 { color: var(--muted); }
.hz.h90 { color: var(--warn); }
.hz.h120 { color: var(--accent); }
.hz.h144 { color: var(--accent-2); }
.empty { color: var(--muted); padding: 16px; text-align: center; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { background: var(--bg-2); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 14px; font-family: inherit; }
.tabs button.on { color: #04120f; background: var(--accent); border-color: var(--accent); font-weight: 700; }

/* ---------- Article / FAQ ---------- */
.article h2 { font-size: 21px; margin: 30px 0 10px; }
.article h3 { font-size: 17px; margin: 20px 0 6px; }
.article p, .article li { color: #cdd5e3; }
details.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
details.faq summary { cursor: pointer; font-weight: 700; }
details.faq p { margin: 8px 0 2px; color: #cdd5e3; }

/* ---------- Ads ---------- */
.ad-slot { margin: 26px 0; min-height: 100px; text-align: center; }
.ad-slot .adsbygoogle { display: block; }
.ad-label { font-size: 11px; color: #5d6880; text-align: center; margin-bottom: 4px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 50px; padding: 26px 0 40px; color: var(--muted); font-size: 13px; }
.site-footer .links { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .status { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .compare { grid-template-columns: 1fr; }
  .panel canvas { height: 200px; }
  .compare.overlay .panel canvas { height: 300px; }
  .compare.rhythm .panel canvas { height: 300px; }
  .compare.rhythm.overlay .panel canvas { height: 420px; }
  .game-stage .panel canvas { height: 220px; }
  .game-stage.compare .panel canvas { height: 170px; }
  .game-choices { grid-template-columns: 1fr 1fr; }
  .panel-head { top: 8px; left: 8px; right: 8px; }
  .badge { font-size: 13px; padding: 3px 8px; }
  .real { font-size: 11px; padding: 2px 6px; }
  .panel-head select { max-width: 112px; font-size: 12px; padding: 3px 4px; }
  .site-header .wrap { height: auto; padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; gap: 4px 8px; }
  .site-header .nav { order: 3; width: 100%; }
  .lang-select { margin-left: auto; }
  .nav { justify-content: flex-start; }
  .stat .v { font-size: 19px; }
  input[type="range"] { width: 100px; }
}
