:root {
  --bg: #eef7ff;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #6b7385;
  --line: #e2e8f0;
  --accent: #ff5a5f;
  --accent-ink: #ffffff;
  --gold: #f5b70a;
  --blue: #2f9fe0;
  --ok: #17a34a;
  --err: #e5484d;
  --todo: #a6aebf;
  --chip: #f1f5fb;
  --shadow: 0 6px 0 rgba(31, 36, 48, .08), 0 12px 28px rgba(31, 36, 48, .08);
  /* 둥근 계열: Nunito(라틴) + 나눔스퀘어라운드(한) + M PLUS Rounded 1c(일) + ZCOOL KuaiLe(중 제목), Noto 는 빠진 글자 대체 */
  --fallback: "Noto Sans KR", "Noto Sans JP", "Noto Sans SC", "Apple SD Gothic Neo", "Hiragino Maru Gothic ProN", "Hiragino Sans", "PingFang SC", "Malgun Gothic", "Yu Gothic", "Microsoft YaHei", system-ui, sans-serif;
  --text: "Nunito", "NanumSquareRound", "M PLUS Rounded 1c", var(--fallback);
  --display: var(--text);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151f; --card: #1b2130; --ink: #eef1f7; --muted: #9aa3b8; --line: #2b3346;
    --chip: #242b3c; --todo: #5f6a82; --ok: #4ade80; --err: #ff6b6f;
    --shadow: 0 6px 0 rgba(0, 0, 0, .25), 0 12px 28px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
  overflow-x: hidden;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font-family: var(--text); font-size: .72em; padding: .1em .45em; border-radius: 6px;
  border: 1px solid currentColor; opacity: .75; margin-left: .3em; vertical-align: .1em;
}
/* 나눔스퀘어라운드: 네이버 CDN 파일을 굵기별로 한 이름에 묶는다 */
@font-face { font-family: "NanumSquareRound"; font-weight: 400; font-display: swap; src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundR.woff2) format("woff2"); unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7A3; }
@font-face { font-family: "NanumSquareRound"; font-weight: 700; font-display: swap; src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundB.woff2) format("woff2"); unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7A3; }
@font-face { font-family: "NanumSquareRound"; font-weight: 800 900; font-display: swap; src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquareRound/NanumSquareRoundEB.woff2) format("woff2"); unicode-range: U+1100-11FF, U+3130-318F, U+AC00-D7A3; }
[hidden] { display: none !important; }
/* 한중일 한자 모양이 글꼴마다 달라서 문서·문장 언어에 맞춰 순서를 바꾼다 */
:lang(ko) { --text: "Nunito", "NanumSquareRound", "Noto Sans KR", "M PLUS Rounded 1c", var(--fallback); --display: var(--text); font-family: var(--text); }
:lang(ja) { --text: "Nunito", "M PLUS Rounded 1c", "Noto Sans JP", "NanumSquareRound", var(--fallback); --display: var(--text); font-family: var(--text); }
:lang(zh) { --text: "Nunito", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "NanumSquareRound", var(--fallback); --display: "Nunito", "ZCOOL KuaiLe", "Noto Sans SC", "NanumSquareRound", var(--fallback); font-family: var(--text); font-synthesis-weight: none; }
.muted { color: var(--muted); }

/* 상단 */
.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  max-width: 1200px; margin: 0 auto;
}
.brand { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -.5px; white-space: nowrap; }
.brand b { color: var(--accent); }
.brand { display: inline-flex; align-items: center; gap: 0; }
.brand b { margin-left: .2em; }
:lang(ja) .brand b, :lang(zh) .brand b { margin-left: 0; }
.racers { position: relative; display: inline-block; width: 128px; height: 30px; margin-left: 12px; flex: none; }
.racers::after { content: ""; position: absolute; left: 0; right: 0; bottom: 1px; border-bottom: 2px dashed color-mix(in srgb, var(--muted) 40%, transparent); }
.racer { position: absolute; left: 0; image-rendering: pixelated; animation: dash 2.3s ease-in-out infinite alternate; }
.racer.lane1 { bottom: 9px; height: 16px; width: auto; z-index: 1; animation-duration: 2.6s; animation-delay: -1.1s; }
.racer.lane2 { bottom: 5px; height: 18px; width: auto; z-index: 2; animation-duration: 2.2s; animation-delay: -1.7s; }
.racer.lane3 { bottom: 1px; height: 20px; width: auto; z-index: 3; animation-duration: 3s; }
.racer .f2 { visibility: hidden; }
.racer .f1 { animation: frameA .18s steps(1) infinite; }
.racer .f2 { animation: frameB .18s steps(1) infinite; }
.racer.lane2 .f1, .racer.lane2 .f2 { animation-duration: .15s; }
.racer.lane1 .f1, .racer.lane1 .f2 { animation-duration: .2s; }
.racer .dust { animation: frameA .18s steps(1) infinite; }
.racer .dust.d2 { animation-name: frameB; }
@keyframes frameA { 0% { visibility: visible; } 50% { visibility: hidden; } }
@keyframes frameB { 0% { visibility: hidden; } 50% { visibility: visible; } }
@keyframes dash { 0% { transform: translateX(0); } 100% { transform: translateX(92px); } }
@media (prefers-reduced-motion: reduce) {
  .racer, .racer .f1, .racer .f2, .racer .dust { animation: none; }
  .racer.lane2 { transform: translateX(40px); }
  .racer.lane3 { transform: translateX(80px); }
}
.brand { color: inherit; text-decoration: none; }
.top { justify-content: space-between; }
.top-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  color: inherit; text-decoration: none; font-family: var(--display); font-weight: 800; font-size: 16px; padding: 9px 14px; border-radius: 12px;
  background: var(--card); box-shadow: 0 3px 0 var(--line); white-space: nowrap;
}
.nav-link.on { box-shadow: 0 3px 0 var(--accent); }
.ui-lang { position: relative; }
.ui-lang-btn { border: 0; background: var(--card); border-radius: 12px; padding: 9px 12px; font-family: var(--display); font-weight: 800; font-size: 16px; box-shadow: 0 3px 0 var(--line); white-space: nowrap; }
.ui-lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; list-style: none; margin: 0; padding: 6px; min-width: 150px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
}
.ui-lang-menu a { display: block; padding: 9px 12px; border-radius: 9px; color: inherit; text-decoration: none; font-weight: 600; }
.ui-lang-menu a:hover, .ui-lang-menu a[aria-current] { background: var(--chip); }
.ui-lang-menu a[aria-current]::after { content: " ✓"; color: var(--accent); }
.flag { display: inline-block; width: 20px; height: 15px; object-fit: cover; border-radius: 3px; vertical-align: -2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.typelangs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.typelangs a {
  color: inherit; text-decoration: none;
  border: 2px solid var(--line); background: var(--chip); border-radius: 12px; padding: 8px 4px; font-family: var(--display); font-weight: 800; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; white-space: nowrap; min-width: 0;
}
.typelangs a .flag { width: 26px; height: 19px; }
.typelangs a[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.typelangs a[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.durs button:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: var(--card); border-radius: 12px; width: 42px; height: 42px; font-size: 18px; box-shadow: 0 3px 0 var(--line); flex: none; }

main { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* 3D 스테이지 */
.stage {
  position: relative; height: clamp(240px, 44vh, 470px); border-radius: 22px; overflow: hidden;
  box-shadow: var(--shadow); background: #8fd8ff;
}
#race { width: 100%; height: 100%; display: block; }
.minimap { position: absolute; left: 16px; right: 16px; top: 12px; pointer-events: none; }
.mm-bar {
  position: relative; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .55);
  margin: 14px 26px 0 14px; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .15);
}
.mm-flag { position: absolute; right: -24px; top: -10px; font-size: 20px; }
.mm-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%); font-size: 20px; line-height: 1;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .2));
}
.mm-dot::after {
  content: attr(data-tag); position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  font: 700 11px/1.3 var(--display); color: #fff; background: rgba(20, 24, 33, .7); border-radius: 6px; padding: 0 5px; white-space: nowrap; margin-top: 3px;
}
.mm-dot.me { z-index: 3; font-size: 24px; }
.hud {
  position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  pointer-events: none;
}
.hud-item {
  background: rgba(20, 24, 33, .78); color: #fff; border-radius: 14px; padding: 6px 14px; min-width: 92px; text-align: center;
  backdrop-filter: blur(4px);
}
.hud-k { display: block; font-size: 11px; opacity: .7; }
.hud-item b { font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.hud-item small { font-size: 12px; margin-left: 2px; opacity: .8; }
.hud-item.combo.hot b { color: #ffd93d; }
.hud-item.combo.fire b { color: #ff8a3d; text-shadow: 0 0 10px rgba(255, 138, 61, .8); }
.countdown {
  position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 800;
  font-size: clamp(80px, 16vw, 170px); color: #fff; text-shadow: 0 6px 0 rgba(0, 0, 0, .25); pointer-events: none;
}
.countdown.pop { animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .2; } }
.toast {
  position: absolute; left: 50%; top: 58px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  font-family: var(--display); font-weight: 800; font-size: 22px; padding: 8px 18px; border-radius: 999px; white-space: nowrap;
  animation: toast 1.6s ease-out forwards; pointer-events: none;
}
@keyframes toast { 0% { transform: translate(-50%, -10px) scale(.8); opacity: 0; } 15% { transform: translate(-50%, 0) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* 패널 */
.panel { padding: 16px 0 8px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.card { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.durs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.durs button {
  border: 2px solid var(--line); background: var(--chip); border-radius: 14px; padding: 12px 8px;
  font-family: var(--display); font-weight: 800; font-size: 18px;
}
.durs button[aria-checked="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.me-pick { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.me-emoji { font-size: 44px; line-height: 1; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .15)); }
.me-emoji.spin { animation: spin .5s ease-out; }
@keyframes spin { 0% { transform: scale(.4) rotate(-180deg); } 100% { transform: scale(1) rotate(0); } }
.me-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.me-text .muted { font-size: 12px; }
.me-text b { font-family: var(--display); font-weight: 800; font-size: 22px; }
.ghost-btn { border: 2px solid var(--line); background: transparent; border-radius: 12px; padding: 8px 12px; font-family: var(--display); font-weight: 800; font-size: 15px; white-space: nowrap; }
.lineup { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.lineup li { min-width: 0; display: flex; align-items: center; gap: 10px; background: var(--chip); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.lineup .lane { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lineup .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lineup .val { font-family: var(--display); font-weight: 800; font-size: 16px; white-space: nowrap; }
.cta {
  width: 100%; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 14px;
  font-family: var(--display); font-weight: 800; font-size: 24px; box-shadow: 0 5px 0 #c9383d; transition: transform .06s;
}
.cta:active { transform: translateY(3px); box-shadow: 0 2px 0 #c9383d; }
.cta.small { width: auto; font-size: 18px; padding: 10px 16px; white-space: nowrap; }
.cta:disabled { opacity: .6; cursor: default; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; line-height: 1.5; }
.hint.center { text-align: center; }
.mobile-note { display: none; }
@media (pointer: coarse) { .mobile-note { display: block; } }

/* 순위표 */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.board-head h2 { font-family: var(--display); font-weight: 800; font-size: 21px; margin: 0; }
.tabs { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.tabs button { border: 0; background: transparent; border-radius: 9px; padding: 6px 12px; font-size: 14px; }
.tabs button[aria-selected="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); font-weight: 700; }
.board-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.board-list li {
  display: grid; grid-template-columns: 34px 28px minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.board-list li.me { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; }
.board-list .rk { font-family: var(--display); font-weight: 800; font-size: 17px; text-align: center; }
.board-list .an { font-size: 20px; }
.board-list .nk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board-list .sc { font-family: var(--display); font-weight: 800; font-size: 17px; white-space: nowrap; }
.board-list .ac { color: var(--muted); font-size: 12px; white-space: nowrap; min-width: 44px; text-align: right; }
.board-list .empty { display: block; text-align: center; color: var(--muted); border: 0; padding: 30px 0; }

/* 타자 영역 */
.type-box {
  background: var(--card); border-radius: 20px; padding: 22px 24px; box-shadow: var(--shadow);
  min-height: 150px; display: flex; flex-direction: column; justify-content: center; gap: 8px;
}
.type-box.shake { animation: shake .18s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.line-main { font-size: clamp(22px, 3.2vw, 34px); line-height: 1.5; letter-spacing: .01em; }
.line-sub { font-size: clamp(18px, 2.4vw, 26px); line-height: 1.5; }
.line-guide { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: clamp(16px, 2vw, 22px); color: var(--todo); letter-spacing: .04em; }
.line-next { color: var(--muted); padding: 12px 24px 0; font-size: 16px; }
.line-next::before { content: attr(data-label) " "; font-size: 12px; opacity: .7; }
.cjk { word-break: normal; }
.c { color: var(--todo); transition: color .05s; }
.c.done { color: var(--ink); }
.c.cur { color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 4px; box-shadow: 0 3px 0 var(--accent); }
.c.cur.err { background: color-mix(in srgb, var(--err) 30%, transparent); box-shadow: 0 3px 0 var(--err); }
.c.sp.cur::before { content: "␣"; color: var(--accent); opacity: .7; }
.c.sp.cur { padding: 0 .1em; }
.typed { color: var(--ok); }
.comp { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.caret { display: inline-block; width: 2px; height: 1.1em; background: var(--accent); vertical-align: -.15em; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.g-typed { color: var(--ok); }
.g-next { color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 3px; }
ruby { ruby-position: over; }
rt { font-size: .42em; color: var(--todo); font-family: ui-monospace, Menlo, monospace; letter-spacing: 0; }
.c.done rt { color: var(--ok); }
.c.cur rt { color: var(--accent); }

/* 결과 */
.result-card { text-align: center; }
.place { font-family: var(--display); font-weight: 800; font-size: 40px; }
.r-sub { color: var(--muted); margin: 4px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--chip); border-radius: 14px; padding: 10px 6px; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-family: var(--display); font-weight: 800; font-size: 24px; }
.stat b small { font-size: 12px; margin-left: 2px; }
.pb { display: inline-block; background: var(--gold); color: #3b2a00; border-radius: 999px; padding: 2px 10px; font-family: var(--display); font-weight: 800; font-size: 15px; margin-left: 6px; animation: pop2 .6s; }
@keyframes pop2 { 0% { transform: scale(0); } 70% { transform: scale(1.2); } }
.save { text-align: left; }
.save label { font-size: 14px; font-weight: 700; display: block; margin-bottom: 6px; }
.save-row { display: flex; gap: 8px; }
.save input {
  flex: 1; min-width: 0; border: 2px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 14px; padding: 10px 14px;
  font: 600 17px var(--text);
}
.save input:focus { outline: none; border-color: var(--accent); }
.save-msg { min-height: 1.2em; font-size: 13px; color: var(--err); margin: 6px 0 0; }
.ranks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 14px; }
.rank-pill { background: var(--ink); color: var(--bg); border-radius: 14px; padding: 10px; }
.rank-pill span { display: block; font-size: 12px; opacity: .75; }
.rank-pill b { font-family: var(--display); font-weight: 800; font-size: 28px; }
.rank-pill small { font-size: 13px; opacity: .8; margin-left: 4px; }
.r-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }

.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

@media (max-width: 820px) {
  .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .hud-item { min-width: 70px; padding: 4px 10px; }
  .hud-item b { font-size: 19px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 국적 선택 */
.save { position: relative; }
.flag-btn {
  flex: none; display: flex; align-items: center; gap: 4px; border: 2px solid var(--line); background: var(--chip); border-radius: 14px;
  padding: 0 10px; font-size: 11px; color: var(--muted);
}
.flag-btn .flag { width: 28px; height: 21px; }
.flag-btn:focus-visible, .flag-btn[aria-expanded="true"] { border-color: var(--accent); outline: none; }
.country-pop {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin-top: 4px; background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow), 0 0 0 1px var(--line); padding: 10px;
}
.cp-head { font-weight: 700; font-size: 14px; margin: 2px 4px 8px; }
.country-pop input {
  width: 100%; border: 2px solid var(--line); background: var(--chip); color: var(--ink); border-radius: 12px; padding: 9px 12px; font: 600 15px var(--text);
}
.country-pop input:focus { outline: none; border-color: var(--accent); }
#country-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 240px; overflow-y: auto; }
#country-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 15px; }
#country-list li small { color: var(--muted); margin-left: auto; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#country-list li:hover, #country-list li.hl { background: var(--chip); }
#country-list li[aria-selected="true"] { font-weight: 700; color: var(--accent); }
#country-list li.none { cursor: default; color: var(--muted); justify-content: center; }

/* 검색엔진용 소개 본문 */
.seo { margin: 16px 0 0; line-height: 1.7; padding: 0; }
.seo > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
.seo > summary::-webkit-details-marker { display: none; }
.seo > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.seo[open] > summary::after { transform: rotate(180deg); }
.seo > summary h1 { font-size: 16px !important; margin: 0 !important; }
.seo-more { color: var(--muted); font-size: 13px; }
.seo-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.seo h1 { font-family: var(--display); font-weight: 800; font-size: 26px; margin: 0 0 8px; }
.seo h2 { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 20px 0 6px; }
.seo p, .seo li, .seo dd { color: var(--muted); font-size: 15px; }
.seo dt { font-weight: 700; margin-top: 10px; }
.seo dd { margin: 2px 0 0; }
.foot p { margin: 4px 0; }
.foot-nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; margin-bottom: 8px; font-size: 13px; }
.foot-nav a { color: var(--muted); text-decoration: none; }
.foot-nav a:hover { color: var(--ink); text-decoration: underline; }
.foot-nav span { opacity: .4; }
.made { font-size: 13px; color: var(--ink); opacity: .8; }
.heart { display: inline-block; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } }
.foot-note, .credits { font-size: 11px; opacity: .7; }
/* 문서 페이지 */
.doc { max-width: 820px; margin: 0 auto; line-height: 1.75; padding: 24px 28px; }
.doc h1 { font-size: 28px; margin: 0 0 12px; font-weight: 800; }
.doc h2 { font-size: 19px; margin: 26px 0 6px; font-weight: 800; }
.doc p, .doc li, .doc dd { color: var(--muted); font-size: 15px; }
.doc dt { font-weight: 700; margin-top: 10px; }
.doc dd { margin: 2px 0 0; }
.doc a { color: var(--accent); }
.doc .doc-back { margin-top: 28px; }
.doc .doc-back a { color: var(--accent-ink); text-decoration: none; display: inline-block; }
.table-wrap { overflow-x: auto; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: nowrap; }
.doc th { color: var(--ink); background: var(--chip); }
.credits { opacity: .75; }

/* 순위 페이지 */
.rank-hero { margin: 0 0 16px; }
.rank-hero h1 { font-family: var(--display); font-weight: 800; font-size: 30px; margin: 0 0 4px; }
.rank-hero p { color: var(--muted); margin: 0; }
.rank-sec h2 { font-family: var(--display); font-weight: 800; font-size: 22px; margin: 18px 0 10px; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); gap: 14px; }
.rank-grid h3 { font-family: var(--display); font-weight: 800; font-size: 20px; margin: 0; display: flex; align-items: center; gap: 8px; }
.rank-grid h3 .flag { width: 26px; height: 19px; }
.rank-grid h4 { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.rank-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.rank-cols .board-list li { grid-template-columns: 28px 22px minmax(0, 1fr) auto; font-size: 13px; }
.rank-cols .board-list .ac { display: none; }
.rank-cols .empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
.ghost-btn.small { font-size: 13px; padding: 5px 10px; text-decoration: none; color: inherit; }

@media (max-width: 820px) {
  .typelangs a {
  color: inherit; text-decoration: none; font-size: 12px; }
  .nav-link span { display: none; }
  .top { gap: 8px; }
  .brand { font-size: 19px; white-space: normal; line-height: 1.15; min-width: 0; flex: 1 1 auto; }
  .racers { width: 84px; margin-left: 6px; transform: scale(.85); transform-origin: left center; }
  @keyframes dash { 0% { transform: translateX(0); } 100% { transform: translateX(52px); } }
  .top-nav { flex: none; gap: 6px; }
  .ui-lang-btn span { display: none; }
  .nav-link, .ui-lang-btn { padding: 9px 11px; }
  .rank-cols { grid-template-columns: minmax(0, 1fr); }
}

/* 화면 키보드 입력칸: 보이지 않지만 포커스는 받는다 (16px 이상이어야 iOS 가 확대하지 않음) */
.ime { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; border: 0; padding: 0; resize: none; pointer-events: none; }
.tap-type { display: block; margin: 10px auto 0; border: 2px dashed var(--accent); background: var(--card); color: var(--accent); border-radius: 14px; padding: 10px 16px; font-family: var(--display); font-weight: 800; }
/* 터치 기기 경주 중: 화면 키보드가 아래를 덮으므로 위쪽에 몰아 둔다 */
.touch body.racing .stage { height: 30vh; min-height: 170px; }
.touch body.racing .panel { padding-top: 8px; }
.touch body.racing .type-box { padding: 12px 14px; min-height: 0; }
.touch body.racing .line-main { font-size: 21px; }
.touch body.racing .line-sub { font-size: 17px; }
.touch body.racing .hint, .touch body.racing .foot, .touch body.racing .top-nav { display: none; }
.touch body.racing .hud-item { min-width: 0; padding: 3px 8px; }
.touch body.racing .hud-item b { font-size: 16px; }
.touch body.racing .hud-k { font-size: 9px; }
.touch body.racing .minimap { top: 4px; }

/* 결과 공유 */
.goal { grid-column: 1 / -1; margin: 2px 0 0; font-weight: 800; color: var(--accent); }
.share { margin: 4px 0 12px; text-align: left; }
.share-head { font-weight: 800; margin-bottom: 8px; }
.share-card { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); margin-bottom: 10px; }
.share-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sb { border: 0; border-radius: 12px; padding: 9px 13px; font-family: var(--display); font-weight: 800; font-size: 14px; background: var(--chip); color: var(--ink); }
.sb-native { background: var(--accent); color: #fff; }
.sb-x { background: #000; color: #fff; }
.sb-facebook { background: #1877f2; color: #fff; }
.sb-line { background: #06c755; color: #fff; }
.sb-whatsapp { background: #25d366; color: #fff; }
.sb-weibo { background: #e6162d; color: #fff; }
.sb-kakao { background: #fee500; color: #191919; }
.share-msg { font-size: 13px; color: var(--muted); margin: 6px 0 0; min-height: 1em; }
.share-view { max-width: 860px; margin: 0 auto; text-align: center; }
.share-view h1 { font-size: 30px; margin: 4px 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.share-view h1 .flag { width: 36px; height: 27px; }
.share-sum { color: var(--muted); margin: 0 0 14px; }
.share-card.story { width: auto; max-width: 100%; height: min(460px, 70vh); margin: 0 auto 10px; }
.share-card.big { margin: 0 auto 16px; max-width: 100%; }
.share-view .cta { display: inline-block; width: auto; padding: 14px 28px; text-decoration: none; }
.share-view .ghost-btn { display: inline-block; text-decoration: none; color: inherit; }

/* ── 가이드 페이지: 키보드 배열·로마자 표·속도 표 */
.guide h3 { font-size: 16px; margin: 18px 0 6px; font-weight: 800; }
.guide code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--chip); padding: 1px 6px; border-radius: 6px; color: var(--ink); font-size: 13px; }
.guide .tip { background: var(--chip); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 8px; color: var(--ink); }
.guide .see a, .guide-links a, .lang-links a { font-weight: 700; }
.guide .unit-note { font-size: 13px; margin-top: 2px; }
.guide-links, .lang-links { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.guide-links a, .lang-links a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--chip); color: var(--ink); text-decoration: none; font-size: 14px; }
.guide-links a:hover, .lang-links a:hover { background: var(--accent); color: var(--accent-ink); }
.guide-hub { margin: 4px 0 18px; }
.seo .guide-links a { color: var(--ink); }
.kb-fig { margin: 12px 0 16px; }
.kb { display: flex; flex-direction: column; gap: 5px; padding: 12px; background: var(--chip); border-radius: 14px; overflow-x: auto; }
.kb-row { display: flex; gap: 5px; }
.kb-row.r1 { padding-left: 4%; } .kb-row.r2 { padding-left: 7%; } .kb-row.r3 { padding-left: 11%; }
.key { flex: 0 0 auto; min-width: 34px; height: 38px; display: grid; place-items: center; border-radius: 7px; background: var(--card); box-shadow: 0 2px 0 rgba(31, 36, 48, .15); font-weight: 800; font-size: 14px; position: relative; }
.key.bump::after { content: ""; position: absolute; bottom: 5px; left: 50%; width: 10px; height: 2px; margin-left: -5px; border-radius: 2px; background: currentColor; opacity: .5; }
.key.home { outline: 2px solid var(--ink); outline-offset: -2px; }
.key.space { min-width: 0; flex: 1; max-width: 60%; margin-left: 20%; font-size: 12px; font-weight: 700; color: var(--muted); }
.key.f0, .key.f7, .sw.f0, .sw.f7 { background: #ffd6e0; } .key.f1, .key.f6, .sw.f1, .sw.f6 { background: #ffe6bf; }
.key.f2, .key.f5, .sw.f2, .sw.f5 { background: #d9f5c9; } .key.f3, .key.f4, .sw.f3, .sw.f4 { background: #cfe8ff; }
.key[class*=" f"] { color: #1f2430; }
.key.ko { min-width: 46px; height: 50px; grid-template-rows: auto; }
.key.ko i { position: absolute; top: 3px; left: 6px; font-style: normal; font-size: 10px; color: var(--muted); }
.key.ko s { position: absolute; top: 3px; right: 6px; text-decoration: none; font-size: 11px; color: var(--accent); }
.key.ko b { font-size: 20px; }
.key.cons, .sw.cons { background: #cfe8ff; color: #1f2430; } .key.vow, .sw.vow { background: #ffd6e0; color: #1f2430; }
.key.cons i, .key.vow i { color: #5b6476; }
.kb-legend { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.kb-legend li { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.kb-legend s.sh { text-decoration: none; color: var(--accent); font-weight: 800; }
.doc table.kana-grid td, .doc table.kana-grid th { text-align: center; white-space: normal; padding: 6px 4px; min-width: 64px; }
.kana-grid td.nil { background: transparent; }
.kana { display: block; font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.kana small { font-size: 12px; color: var(--muted); margin-left: 4px; font-weight: 700; }
.kana-grid code { display: inline-block; margin-top: 2px; }
.kana-grid em { display: block; font-style: normal; font-size: 11px; color: var(--muted); }
.doc table.acc .big { font-size: 20px; }
.doc table.tiers td small { color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .key { box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
}
@media (max-width: 560px) {
  .kb { overflow-x: visible; }
  .key, .key.ko { min-width: 0; flex: 0 0 calc((100% - 3px * (var(--n) - 1)) / var(--n)); height: 34px; font-size: 12px; }
  .key.ko { height: 44px; }
  .key.space { flex: 1; }
  .key.ko b { font-size: 16px; }
  .key.ko i { font-size: 9px; left: 3px; }
  .key.ko s { font-size: 9px; right: 3px; }
  .kb { gap: 4px; padding: 8px; }
  .kb-row { gap: 3px; }
  .doc table.kana-grid td, .doc table.kana-grid th { min-width: 0; padding: 5px 2px; }
  .kana { font-size: 17px; }
  .kana small { margin-left: 2px; font-size: 10px; }
  .kana-grid code { font-size: 12px; padding: 1px 4px; }
  .kana-grid em { font-size: 10px; }
}
