:root {
  --bg: #05060f;
  --volt: #ff3a4e;
  --volt-soft: #ff8a96;
  --accent: #4fd6ff;
  --panel: rgba(10, 14, 30, 0.82);
  --stroke: rgba(120, 170, 255, 0.22);
  --text: #e8eeff;
  --muted: #8ea0c8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}

/* canvas 는 치환 요소라서 inset:0 만으로는 늘어나지 않는다.
   width/height 를 명시하지 않으면 자기 버퍼 크기(= 화면크기 × dpr)를
   그대로 CSS 크기로 삼아서, dpr 이 1이 아닌 화면에서 어긋난다. */
#stage {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hidden { display: none !important; }

/* ---------- HUD ---------- */

/* 상단 바(58px) 아래에서 시작한다 */
#hud {
  position: fixed;
  top: calc(70px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}

@media (max-width: 480px) {
  #hud { top: calc(60px + env(safe-area-inset-top)); }
}

#timer {
  font-size: clamp(44px, 9vw, 78px);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 0 28px rgba(79, 214, 255, 0.55), 0 4px 18px rgba(0, 0, 0, 0.7);
}

#stage-label {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(79, 214, 255, 0.6);
}

#best-inline {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 감전 순간 화면 플래시 */
body.zapped::after {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--volt);
  opacity: 0.55;
  pointer-events: none;
  z-index: 20;
  animation: flash 0.4s ease-out forwards;
}

@keyframes flash {
  to { opacity: 0; }
}

/* ---------- 상단 바 ---------- */

/* 화면(z 10)과 일시정지(z 28) 위에 떠서 항상 손이 닿게 한다.
   랭킹 창(z 40) 만 이 위로 올라온다. */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 35;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: env(safe-area-inset-top);
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  background: rgba(7, 10, 20, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--stroke);
}

.brand {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text);
  user-select: none;
}

.brand span { color: var(--volt); }

#corner-buttons {
  display: flex;
  gap: 10px;
}

#corner-buttons button {
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  font-size: 21px;
  line-height: 1;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
}

#corner-buttons button:hover { background: rgba(255, 255, 255, 0.14); }

/* 캐릭터 버튼에는 지금 쓰는 캐릭터를 얹는다 */
#char-btn.has-face {
  font-size: 0;                    /* 이모지 자리를 없앤다 */
  background-repeat: no-repeat;
  background-position: center 58%; /* 얼굴이 가운데 오게 살짝 내린다 */
  background-size: 120%;
}
#mute-btn.off { opacity: 0.45; }

@media (max-width: 480px) {
  #top-bar { height: 52px; }
  .brand { font-size: 16px; }
  #corner-buttons button { width: 40px; height: 40px; font-size: 18px; }
}

/* ---------- 랭킹 창 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 5, 12, 0.72);
  backdrop-filter: blur(5px);
  animation: fade 0.2s ease-out;
}

.modal-card {
  width: min(480px, 100%);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-head h2 { flex: 1; margin-bottom: 0; }

.icon-btn {
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--stroke);
  border-radius: 8px;
}

.icon-btn:hover { color: var(--text); }

/* .modal-card 는 세로 flex 다. 자식은 기본으로 눌려서(flex-shrink:1)
   내용이 길어지면 탭·검색칸·쪽번호가 얇은 띠로 찌그러진다.
   높이를 그대로 써야 하는 것들은 전부 여기서 눌리지 않게 못 박는다. */
.modal-card ol,
.modal-card .rank-tabs,
.modal-card .rank-note,
.modal-card .admin-tools,
.modal-card .pager,
.modal-card .my-rank { flex: none; }

.modal-card ol { margin-top: 16px; }

/* ---------- 프로필 ---------- */

/* 랭킹(z 40) 위에 뜬다. 같은 층에 두면 나중에 그려지는 랭킹이 덮어서,
   이름을 눌러도 아무 일도 안 일어난 것처럼 보인다.
   닫으면 아래의 랭킹이 그대로 남아 있어 목록으로 돌아온다. */
#profile-modal { z-index: 45; }


.profile-section {
  margin-top: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.profile-section:first-child { margin-top: 14px; }

.stat-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.stat {
  flex: 1;
  min-width: 0;
  padding: 12px 8px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-value em {
  font-size: 0.6em;
  font-style: normal;
  font-weight: 700;
  color: var(--muted);
  margin-left: 1px;
}

.stat-label {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

.stat-sub {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--accent);
}

.profile-empty,
.profile-total,
.profile-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.profile-note {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
}

/* ---------- 관리 창 ---------- */

/* 프로필(45)보다도 위. 관리 중에 다른 창이 덮으면 곤란하다. */
#admin-modal { z-index: 46; }

/* 관리 창은 다른 창보다 넓다. 한 줄에 이름·기록·횟수·버튼이 다 들어가야
   훑어보기 쉽고, 사람이 늘수록 좁은 창에서는 못 찾는다. */
#admin-modal .modal-card { width: min(780px, 100%); }

/* 쪽으로 나누므로 안쪽 스크롤은 두지 않는다. 스크롤과 쪽 넘김이 같이
   있으면 지금 어디를 보고 있는지가 흐려진다. */
.admin-body { margin-top: 4px; }

.admin-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.admin-tools input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-size: 13px;
}

/* 검색칸이 flex:1 로 늘어나므로, 버튼은 줄어들지 않게 못 박는다. */
.admin-tools .admin-act { flex: none; }

/* 이용 현황 맨 위 요약 */
.admin-usage-sum { margin-bottom: 14px; }
.admin-usage-sum .stat-value em { font-size: 0.55em; font-style: normal; margin-left: 2px; }

.admin-count {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-list { list-style: none; }

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.admin-rank {
  width: 22px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 이름이 길어도 다른 칸을 밀어내지 않게 이 칸만 줄어든다 */
.admin-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 숫자 칸은 폭을 고정한다. 값에 따라 들쭉날쭉하면 눈으로 훑기 어렵다. */
.admin-value {
  width: 92px;
  text-align: right;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-sub {
  width: 130px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.admin-act {
  width: auto;
  margin: 0;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  white-space: nowrap;
}

.admin-act.danger:hover {
  color: #fff;
  background: var(--volt);
  border-color: transparent;
}

#admin-pager { margin-top: 14px; }

/* ---- 대전 기록 들여다보기 ---- */

.admin-inspect-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}

.admin-inspect-head .admin-name { font-size: 14px; }

/* 수상한 값은 붉게 물들인다. 숫자만 늘어놓으면 눈에 안 들어온다. */
.admin-flags { margin-bottom: 8px; }

.admin-flags .stat.warn {
  background: rgba(255, 58, 78, 0.12);
  border-color: rgba(255, 58, 78, 0.45);
}

.admin-flags .stat.warn .stat-value { color: var(--volt-soft); }
.admin-flags .stat .stat-value { font-size: 17px; }

.result-win { color: var(--accent); font-weight: 700; }
.result-lose { color: var(--muted); }
.result-draw { color: var(--muted); }

@media (max-width: 560px) {
  .admin-sub { display: none; }
  .admin-value { width: auto; }
}

/* ---------- 랭킹 탭 ---------- */

.rank-tabs {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 11px;
}

.rank-tabs button {
  /* width 를 되돌려야 한다. 기본 button 규칙이 width:100% 라,
     flex-basis 를 auto 로 두면 버튼 하나가 줄 전체를 차지하고
     나머지 탭이 통째로 밖으로 밀려난다. */
  flex: 1;
  width: auto;
  margin: 0;
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
}

.rank-tabs button:hover { color: var(--text); }

.rank-tabs button.current {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.rank-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.rank-note:empty { display: none; }

/* 이름을 누르면 그 사람 프로필이 열린다.
   기본 button 규칙(width:100%, padding 15px)이 그대로 먹으면
   줄이 통째로 밀려나므로 여기서 되돌린다. */
.board .who {
  width: auto;
  margin: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.board .who:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* 탭이 다섯 개다. 이름을 짧게 줘서 한 줄에 들어가게 했다.
   줄바꿈시키면 좁은 화면에서 다섯 줄이 돼 목록보다 커지고,
   가로 스크롤로 두면 지금 어느 탭인지가 화면 밖으로 밀려 안 보인다. */
.rank-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}

.rank-tabs::-webkit-scrollbar { display: none; }

.season-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* 명예의 전당의 시즌 머리글 */
.board li.hall-head {
  display: block;
  margin-top: 14px;
  padding: 0 0 6px;
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.board li.hall-head:first-child { margin-top: 0; }

/* 승수 옆의 패, 승률 옆의 판수처럼 곁들이는 숫자 */
.secs .dim {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- 화면(시작 / 게임오버) ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  padding: 78px 24px 24px;      /* 위쪽은 상단 바를 피한다 */
  background: radial-gradient(ellipse at center, rgba(5, 6, 15, 0.55) 0%, rgba(5, 6, 15, 0.92) 70%);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  animation: fade 0.35s ease-out;
}

@keyframes fade {
  from { opacity: 0; }
}

.panel {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.logo {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  text-shadow: 0 0 34px rgba(79, 214, 255, 0.4);
}

.logo span { color: var(--volt); text-shadow: 0 0 34px rgba(255, 58, 78, 0.7); }

.tagline {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.field { display: block; margin-top: 22px; }

.field span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 13px 15px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--stroke);
  border-radius: 11px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus { border-color: var(--accent); }

button {
  width: 100%;
  margin-top: 12px;
  padding: 15px;
  font-size: 16px;
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s;
}

button:active { transform: scale(0.98); }

.primary {
  background: linear-gradient(135deg, var(--volt) 0%, #ff6a3a 100%);
  color: #fff;
  box-shadow: 0 8px 26px rgba(255, 58, 78, 0.35);
}

.primary:hover { filter: brightness(1.1); }

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--stroke);
}

.ghost:hover { color: var(--text); }

/* 줄 안에 끼워 넣는 작은 버튼. 기본 button 은 폭 100% 라서
   이걸 안 걸면 옆 글자를 밀어내고 칸 밖으로 삐져나간다. */
button.small {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  font-size: 12px;
  border-radius: 8px;
}

.field-error {
  display: block;
  margin-top: 8px;
  min-height: 16px;
  font-size: 12px;
  font-style: normal;
  color: var(--volt-soft);
}

input[type="text"].invalid { border-color: var(--volt); }

.controls {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke);
  font-size: 13px;
  color: var(--muted);
  line-height: 2.1;
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  margin-right: 3px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--stroke);
  border-bottom-width: 2px;
  border-radius: 5px;
}

.controls .alt { opacity: 0.6; font-size: 12px; }

.touch-only { display: none; }

/* ---------- 게임오버 ---------- */

.dead {
  font-size: 34px;
  font-weight: 900;
  color: var(--volt);
  letter-spacing: 0.06em;
  text-shadow: 0 0 30px rgba(255, 58, 78, 0.6);
}

.score-row { margin: 20px 0 6px; }

.score-main {
  font-size: 68px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.score-main em {
  font-size: 22px;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  margin-left: 8px;
}

.score-sub { margin-top: 10px; font-size: 14px; color: var(--muted); }

.submit-state {
  min-height: 20px;
  margin: 14px 0 4px;
  font-size: 13px;
  color: var(--accent);
}

.submit-state.error { color: var(--volt-soft); }

/* ---------- 캐릭터 고르기 ---------- */

.char-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

/* 아직 다듬는 중이라 안 보여 주는 캐릭터 자리.
   두 칸을 차지해 남은 줄을 채운다 — 칸을 비워 두면 화면이 깨진 것처럼 보인다. */
.char-soon {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--stroke);
  border-radius: 14px;
}

.char-soon-mark { font-size: 26px; opacity: 0.75; }
.char-soon-text { font-size: 14px; font-weight: 700; color: var(--text); }
.char-soon-sub { font-size: 11px; color: var(--muted); }

@media (max-width: 480px) {
  .char-soon { padding: 14px 8px; }
  .char-soon-mark { font-size: 22px; }
}

.char-card {
  position: relative;
  width: auto;
  margin: 0;
  padding: 10px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  cursor: pointer;
}

.char-card:hover:not(:disabled) { background: rgba(255, 255, 255, 0.11); }

.char-card.chosen {
  border-color: var(--accent);
  background: rgba(79, 214, 255, 0.14);
}

.char-card.locked { opacity: 0.45; cursor: default; }
.char-card.locked img { filter: grayscale(1) brightness(0.6); }

.char-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  pointer-events: none;
}

.char-name { font-size: 13px; font-weight: 700; color: var(--text); }

.char-note {
  font-size: 10px;
  color: var(--muted);
  min-height: 13px;
}

.char-card.chosen .char-note { color: var(--accent); font-weight: 700; }

.char-lock {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 13px;
}

@media (max-width: 420px) {
  .char-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 목소리 녹음 ---------- */

/* 조작키 안내와 녹음 칸을 나란히 놓는다.
   구분선은 둘을 한꺼번에 덮게 여기로 옮긴다. .controls 에 두면
   왼쪽 절반에만 선이 그어져 잘린 것처럼 보인다. */
.bottom-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--stroke);
}

.bottom-row .controls {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* 시작 화면 맨 아래 약관 링크. 눈에 띄면 안 되지만 찾을 수는 있어야 한다. */
.legal-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 16px;
  font-size: 12px;
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
  opacity: 0.75;
}

.legal-links a:hover {
  color: var(--accent);
  opacity: 1;
}

.voice-panel {
  flex: 0 0 auto;
  width: 132px;
  padding: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
}

.voice-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.voice-mic {
  width: 100%;
  margin-top: 7px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  cursor: pointer;
}

.voice-mic:hover { background: rgba(255, 255, 255, 0.13); }

/* 녹음 중에는 버튼이 뛴다. 마이크가 켜져 있다는 걸 놓치면 안 된다. */
.voice-mic.recording {
  color: #fff;
  background: var(--volt);
  border-color: transparent;
  animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
  50% { opacity: 0.55; }
}

.voice-links {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.voice-links button {
  flex: 1;
  padding: 3px 2px;
  font-size: 10px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}

.voice-links button:hover { color: var(--ink); }

.voice-state {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
  color: var(--muted);
}

.voice-state.error { color: var(--volt-soft); }

/* 좁은 화면에서는 위아래로 쌓는다 */
@media (max-width: 460px) {
  .bottom-row { flex-direction: column; }
  .voice-panel { width: 100%; }
}

/* ---------- 로그인 ---------- */

#provider-buttons { margin-top: 18px; }

.provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #1f2430;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.provider-btn:hover { filter: brightness(0.94); }
.provider-btn.apple { background: #000; color: #fff; border-color: rgba(255, 255, 255, 0.3); }

.provider-btn .mark {
  display: flex;
  align-items: center;
  flex: none;
}

.provider-btn .mark svg { width: 18px; height: 18px; display: block; }

#auth-error:empty { display: none; }
#auth-error { margin: 0 0 12px; }

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
}

.account-name {
  flex: 1;
  min-width: 0;              /* 이게 없으면 긴 닉네임이 칸을 밀어 넓힌다 */
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-record {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.account-row button { flex: none; }

/* ---------- 온라인 1v1 ---------- */

.panel-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

#result-title.win { color: #7dffb0; text-shadow: 0 0 30px rgba(125, 255, 176, 0.5); }
#result-title.lose { color: var(--volt); text-shadow: 0 0 30px rgba(255, 58, 78, 0.5); }
#result-title.draw { color: var(--warn, #ffc44d); }

.versus-status {
  min-height: 0;
  font-size: 13px;
  color: var(--accent);
  line-height: 1.6;
}

.versus-status:not(:empty) { min-height: 20px; margin: 14px 0 4px; }
.versus-status.error { color: var(--volt-soft); }

#versus-menu > button:first-child { margin-top: 18px; }

.join-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.join-row input {
  flex: 1;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.join-row button { width: auto; margin: 0; padding: 0 20px; }

.room-code {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  border: 1px dashed var(--stroke);
  border-radius: 12px;
}

.room-code-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.room-code strong {
  flex: 1;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.room-code button { width: auto; margin: 0; padding: 7px 13px; font-size: 12px; }

.spinner {
  width: 26px;
  height: 26px;
  margin: 20px auto;
  border: 3px solid var(--stroke);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.result-players {
  list-style: none;
  margin: 18px 0 4px;
  border-top: 1px solid var(--stroke);
}

.result-players li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  font-size: 14px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.09);
}

.result-players .who { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-players .secs { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.result-players .tag { font-size: 11px; color: var(--muted); }
.result-players li.me .who { color: var(--volt-soft); font-weight: 700; }

/* 대전 중 HUD */

#versus-hud {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

#opponent-state.down { color: var(--volt-soft); font-weight: 700; }

/* 일시정지 — HUD(z 5)와 카운트다운(z 25) 위에 떠야 한다 */

#pause-screen { z-index: 28; }
#pause-screen .tagline:empty { display: none; }

/* 카운트다운 */

#countdown {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  pointer-events: none;
}

#countdown span {
  font-size: clamp(80px, 18vw, 180px);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 50px rgba(79, 214, 255, 0.7), 0 6px 30px rgba(0, 0, 0, 0.8);
  animation: pop 0.45s cubic-bezier(.2, .9, .3, 1);
}

@keyframes pop {
  from { transform: scale(1.8); opacity: 0; }
}

/* ---------- 랭킹 ---------- */

.board h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 16px;
}

.board ol { list-style: none; }

.board li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.09);
  font-size: 16px;
}

.board li:last-child { border-bottom: none; }

.board li.empty {
  justify-content: center;
  color: var(--muted);
  border: none;
  padding: 30px 0;
  font-size: 14px;
}

/* 순위 뱃지 — 동그란 칩. 1~3위만 색을 준다. */
.board .rank {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-variant-numeric: tabular-nums;
}

.board .rank.medal { color: #2a2010; }
.board .rank.medal-1 { background: linear-gradient(150deg, #ffe08a, #f0b429); }
.board .rank.medal-2 { background: linear-gradient(150deg, #e6ecf5, #b3bfd1); }
.board .rank.medal-3 { background: linear-gradient(150deg, #f0c08a, #cf8b4e); }

.board .who {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board .secs {
  flex: none;
  font-size: 17px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.board .secs em {
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
  margin-left: 3px;
}

.board li.me { background: rgba(255, 58, 78, 0.12); border-radius: 9px; }
.board li.me .who { color: var(--volt-soft); font-weight: 800; }

/* ---------- 쪽 넘기기 ---------- */

.pager {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pager button {
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
}

.pager button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.pager button.current { color: var(--text); background: rgba(79, 214, 255, 0.16); border-color: var(--stroke); }
.pager button:disabled { opacity: 0.25; cursor: default; }

.my-rank {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.my-rank:empty { display: none; }

/* ---------- 모바일 조작 ---------- */

#touch-ui {
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

#stick-zone, #jump-zone {
  position: absolute;
  bottom: 0;
  top: 30%;
  pointer-events: auto;
}

#stick-zone { left: 0; width: 50%; }
#jump-zone { right: 0; width: 50%; }

#stick-base {
  position: absolute;
  width: 118px;
  height: 118px;
  margin: -59px 0 0 -59px;
  border: 2px solid rgba(120, 170, 255, 0.3);
  border-radius: 50%;
  background: rgba(10, 14, 30, 0.35);
  opacity: 0;
  transition: opacity 0.15s;
}

#stick-base.on { opacity: 1; }

#stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(79, 214, 255, 0.55);
  box-shadow: 0 0 20px rgba(79, 214, 255, 0.5);
}

#jump-btn {
  position: absolute;
  right: max(28px, env(safe-area-inset-right));
  bottom: max(34px, env(safe-area-inset-bottom));
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 58, 78, 0.5);
  border-radius: 50%;
  background: rgba(255, 58, 78, 0.16);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--volt-soft);
}

#jump-btn.on { background: rgba(255, 58, 78, 0.42); }

/* ---------- 반응형 ---------- */

@media (hover: none) and (pointer: coarse) {
  .touch-only { display: block; }
  .controls div:not(.touch-only) { display: none; }
}

@media (max-width: 860px) {
  .screen { align-content: flex-start; }
  .logo { font-size: 42px; }
}
