:root {
  /* 왼쪽 아래 탑 버튼이 차지하는 세로 자리(버튼 높이 + 바닥 여백 + 최소 틈).
     왼쪽 메뉴가 이 선 아래로 못 내려오게 막는 데 쓴다. 버튼 크기를 바꾸는
     미디어쿼리마다 이 값도 같이 바꿔야 한다. */
  --tower-space: 250px;   /* 152 + 74 + 24 */
  --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: "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%;
  /* 기본 스킨 하늘(렌더러가 투명이라 비쳐 보인다). 잘림은 cover 가 화면마다 알아서 한다.
     어둠을 한 겹 덮는 건 붉은 전기선이 밝은 구름에 묻히지 않게, 그리고 눈이 배경보다
     무대로 가게 하려는 것이다 — 배경이 튀면 0.5 를 올린다. 그림 파일에는 흐림을
     미리 구워 뒀다(CSS filter 는 캔버스까지 흐리고, 따로 층을 두면 폰이 매 프레임
     번짐을 다시 합성한다). 그림이 없을 땐 예전 하늘 가운데 색이 대신 깔린다. */
  background:
    linear-gradient(rgba(5, 6, 15, 0.5), rgba(5, 6, 15, 0.5)),
    #1b2c3a url("img/ingame-bg.webp") center / cover no-repeat;
}
/* 폰은 회선 때문에 절반 폭(1/3 무게)을 준다. 기준은 타이틀 배경과 같다. */
@media (max-width: 900px) {
  #stage {
    background-image:
      linear-gradient(rgba(5, 6, 15, 0.5), rgba(5, 6, 15, 0.5)),
      url("img/ingame-bg-sm.webp");
  }
}
/* 설원·은하수 스킨 하늘. main.js applyArena 가 루트에 data-arena 를 적는다.
   설원은 그림이 밝아 흰 무대와 붙어 버리니 푸른빛으로 누르고, 은하수는 성운이
   밝게 튀어 기본과 비슷하게 누른다. 흐림은 기본 하늘처럼 파일에 구워 뒀다. */
:root[data-arena="snow"] #stage {
  background-image:
    linear-gradient(rgba(10, 24, 48, 0.42), rgba(10, 24, 48, 0.42)),
    url("img/snow-bg.webp");
}
:root[data-arena="galaxy"] #stage {
  background-image:
    linear-gradient(rgba(5, 6, 15, 0.45), rgba(5, 6, 15, 0.45)),
    url("img/galaxy-bg.webp");
}
@media (max-width: 900px) {
  :root[data-arena="snow"] #stage {
    background-image:
      linear-gradient(rgba(10, 24, 48, 0.42), rgba(10, 24, 48, 0.42)),
      url("img/snow-bg-sm.webp");
  }
  :root[data-arena="galaxy"] #stage {
    background-image:
      linear-gradient(rgba(5, 6, 15, 0.45), rgba(5, 6, 15, 0.45)),
      url("img/galaxy-bg-sm.webp");
  }
}

.hidden { display: none !important; }

/* 세로로 열린 폰(특히 아이폰 PWA)에서 화면 전체를 가로로 돌린다.
   iOS 는 매니페스트의 가로 잠금을 무시하므로, body 를 90도 돌려 가로처럼
   꽉 채운다. width/height 를 vh/vw 로 맞바꿔 회전 후 화면에 딱 맞게 한다.
   좌표계 역변환은 js/orientation.js 의 toLocal() 이 맡는다 — 함께 고쳐야 한다. */
:root.force-landscape body {
  position: fixed;
  top: 0;
  left: 0;
  /* '큰 뷰포트(lvh/lvw)'로 화면을 무조건 꽉 채운다. 주소창이 잠깐 보일 때는
     그 아래로 살짝 넘칠 뿐(검은 여백이 생기는 것보다 낫다), 주소창이 사라지면
     정확히 딱 맞는다. 구형 브라우저용 vh/vw 를 먼저 둔다(지원하면 lvh 가 이김). */
  width: 100vh;
  height: 100vw;
  width: 100lvh;
  height: 100lvw;
  transform-origin: 0 0;
  transform: rotate(-90deg) translate(-100%, 0);
  overflow: hidden;
}

/* ---------- 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;
}

/* 모은 코인 — 우측 상단, 소리 버튼 왼쪽의 금빛 알약. 상단 버튼과 키를 맞춘다. */
#coin-wallet {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 46px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 800;
  color: #ffe6a0;
  background: rgba(255, 176, 60, 0.14);
  border: 1px solid rgba(255, 176, 60, 0.4);
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(255, 176, 60, 0.4);
  user-select: none;
}
/* 코인 아이콘.
   이모지 🪙(U+1FA99)는 2019년(Emoji 12.0)에 생긴 문자다. 그전에 나온
   기기·글꼴에는 없어서 네모(두부)로 뜬다 — 실제로 그렇게 보인다는 제보가
   왔다. 프로젝트에서 이것만 유독 새 문자였다(나머지는 전부 2010년 이전).
   글꼴에 기대지 않게 직접 그린다. 색은 게임 안 코인(0xffe25a)에 맞췄다. */
.coin-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.13em;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(circle at 34% 28%,
    #fff6c8 0%, #ffe25a 40%, #f2b435 76%, #c98a1c 100%);
  /* 안쪽 테두리는 두께감, 바깥 어두운 선은 노란 배경(50코인 칸 등) 위에서도
     동전이 묻히지 않게 한다. */
  box-shadow: inset 0 0 0 0.08em rgba(140, 88, 10, 0.55),
              0 0 0 0.045em rgba(52, 32, 4, 0.55);
}

#coin-wallet .coin-ico { font-size: 15px; }
@media (max-width: 480px) {
  #coin-wallet { height: 40px; padding: 0 10px; font-size: 14px; }
}

/* 가로로 든 폰: 화면이 위아래로 납작해서 큰 타이머가 무대 한가운데를 가린다.
   높이 기준으로 작게 줄이고 상단 바 바로 아래로 바짝 올린다. (세로·PC 는 그대로.)
   이 규칙은 위 #timer 기본값보다 뒤에 와야 덮어쓴다. */
@media (orientation: landscape) and (max-height: 560px) {
  #hud { top: calc(52px + env(safe-area-inset-top)); }
  #timer {
    font-size: clamp(26px, 6vh, 44px);
    text-shadow: 0 0 14px rgba(79, 214, 255, 0.5), 0 2px 10px rgba(0, 0, 0, 0.7);
  }
  #stage-label { margin-top: 1px; font-size: 11px; letter-spacing: 0.18em; }
  #best-inline { margin-top: 1px; font-size: 11px; }
}

/* 강제 가로회전(주로 세로로 든 아이폰) — 기기는 물리적으로 세로라 위
   landscape 미디어쿼리가 안 먹는다. 그래서 :root.force-landscape 로 직접 잡아,
   타이머를 작게 줄이고 회전 프레임 위쪽(=맵에서 먼 쪽)으로 바짝 올려 무대를
   가리지 않게 한다. 어느 아이폰이든 강제가로면 똑같이 적용된다. */
:root.force-landscape #hud { top: 16px; }
:root.force-landscape #timer {
  font-size: clamp(24px, 6vh, 40px);
  text-shadow: 0 0 14px rgba(79, 214, 255, 0.5), 0 2px 10px rgba(0, 0, 0, 0.7);
}
:root.force-landscape #stage-label { margin-top: 1px; font-size: 11px; letter-spacing: 0.18em; }
:root.force-landscape #best-inline { margin-top: 1px; font-size: 11px; }

/* 강제 가로에선 화면이 90° 돌아 세로·가로 축이 뒤바뀐다. vh(높이) 로 잡은
   크기는 회전 뒤엔 '긴 쪽'을 재게 돼 카드가 화면 밖으로 넘쳐 잘린다.
   회전 화면의 '세로 높이' 는 원래 세로폭(=100vw)이므로 vh 를 vw 로 바꾼다. */
:root.force-landscape .modal { padding: 14px; }
:root.force-landscape .modal-card { max-height: 86vw; }
:root.force-landscape #board-modal .modal-card { max-height: 90vw; }
:root.force-landscape .board-list { max-height: 58vw; }

/* 감전 순간 화면 플래시 */
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; }
}

/* ---------- 상단 바 ---------- */

/* 게임 중에는 상단 버튼 줄을 감춘다. 좁은 화면에서 타이머를 가리고,
   달리는 중엔 안 쓰는 버튼들이다. 감춘 만큼 HUD 를 위로 바짝 올린다. */
body.playing #top-bar { display: none; }
body.playing #hud { top: calc(10px + env(safe-area-inset-top)); }

/* 화면(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; }

/* 랭킹·캐릭터·커뮤니티·프로필은 왼쪽 메뉴로 옮겼다. 상단바에는 소리만
   남긴다(폰 전체화면·관리자 공지 버튼은 유틸이라 그대로 둔다). */
#rank-btn, #char-btn, #board-btn, #profile-btn { display: none; }

@media (max-width: 480px) {
  #top-bar { height: 52px; }
  .brand { font-size: 16px; }
  #corner-buttons button { width: 40px; height: 40px; font-size: 18px; }
}

/* ---------- 왼쪽 메뉴 ---------- */
/* 타이틀 화면 왼쪽에 세로로 세운 메뉴. #title-screen 의 자식이라 게임이
   시작되면 타이틀과 함께 사라진다. 위치는 화면 기준(fixed)으로 고정. */
#side-menu {
  position: fixed;
  left: max(120px, env(safe-area-inset-left));
  /* 아래끝을 기준으로 세운다.
     가운데 정렬(top:54% + translateY(-50%))로 두면 메뉴 아래끝이 화면 높이를
     따라 내려오는데, 왼쪽 아래 탑 버튼은 바닥에서 고정 거리라 세로가 짧을수록
     둘이 가까워진다. 세로 861px 아래에서는 전부 겹쳤다 — 1366×768 같은 흔한
     노트북이 다 여기 걸린다(제보가 그거였다). 가로만 보는 미디어쿼리로는
     못 잡는다. 세로 문제라서.
     아래끝을 --tower-space 위로 못 박으면 화면이 아무리 짧아도 안 부딪히고,
     메뉴 항목이 늘어도 위로 자라서 안전하다('상점'을 넣었을 때처럼).
     넉넉한 화면에서는 29% 가 이겨서 예전 자리 그대로다. */
  bottom: max(29%, var(--tower-space));
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 20px;   /* 왼쪽 빨간 선 자리 */
}
/* 메뉴 왼쪽을 따라 흐르는 붉은 전기선(게임 테마). 위아래로 부드럽게 사라진다. */
#side-menu::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg,
    transparent 0%, #ff3a4e 14%, #ff5566 50%, #ff3a4e 86%, transparent 100%);
  box-shadow: 0 0 14px rgba(255, 58, 78, 0.55);
}
#side-menu button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: auto;
  margin: 0;
  padding: 12px 20px 12px 14px;
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 12px;
  text-align: left;
  transition: background 0.14s ease, transform 0.14s ease;
}
#side-menu button:hover {
  background: rgba(255, 58, 78, 0.14);
  transform: translateX(3px);
}
#side-menu .sm-ico {
  font-size: 22px;
  width: 26px;
  text-align: center;
  filter: drop-shadow(0 0 8px rgba(255, 58, 78, 0.35));
}
#side-menu .sm-label { letter-spacing: -0.01em; }

/* 화면이 좁으면 아이콘만. 가운데 카드와 겹치지 않게 폭을 줄인다. */
@media (max-width: 820px) {
  #side-menu { left: max(10px, env(safe-area-inset-left)); gap: 4px; }
  #side-menu button { padding: 11px; gap: 0; }
  #side-menu .sm-label { display: none; }
}
/* 폰을 가로로 강제로 돌린 상태에서도 왼쪽 가장자리에 아이콘만 */
/* 강제가로에선 화면을 90° 돌리느라 물리 세로의 '위 노치'가 화면 왼쪽으로 온다.
   env(safe-area-inset-top)(세로의 노치 높이) 만큼 안쪽으로 들여 노치·가장자리에
   메뉴가 안 잘리게 한다. 자리가 넉넉하니 라벨도 다시 보여 준다. */
:root.force-landscape #side-menu {
  left: max(14px, calc(env(safe-area-inset-top) + 12px));
  top: 50%; bottom: auto; transform: translateY(-50%);
  gap: 6px;
}
:root.force-landscape #side-menu button { padding: 9px 12px; gap: 11px; font-size: 16px; }
:root.force-landscape #side-menu .sm-label { display: inline; }

/* ---------- 랭킹 창 ---------- */

.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-replay-btn {
  width: auto; margin: 0; padding: 6px 12px;
  font-size: 12.5px; font-weight: 800; color: #fff;
  background: var(--accent); border: 1px solid transparent; border-radius: 999px;
  white-space: nowrap; cursor: pointer;
}
.profile-replay-btn:hover { filter: brightness(1.1); }

/* 음성 점프 볼륨 바(게임 화면 왼쪽). 지금 목소리 크기(채워짐)와 점프 기준선
   (빨간 가로줄)을 보여 준다. 기준을 넘기면 노랗게, 점프 순간 반짝인다. */
#voice-meter {
  position: fixed; left: 64px; top: 50%; transform: translateY(-50%);
  z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
#voice-meter .vm-track {
  position: relative; width: 22px; height: 42vh; max-height: 380px;
  background: rgba(0, 0, 0, 0.38); border: 1px solid var(--stroke);
  border-radius: 999px; overflow: hidden;
  transition: box-shadow 0.1s ease;
}
#voice-meter .vm-fill {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 0%;
  background: linear-gradient(to top, #57d18a, #9be27f);
  transition: height 0.05s linear, background 0.1s ease;
}
#voice-meter.over .vm-fill { background: linear-gradient(to top, #ffd54a, #fff3b0); }
#voice-meter.hit .vm-track { box-shadow: 0 0 18px 4px rgba(255, 235, 120, 0.85); }
#voice-meter .vm-threshold {
  position: absolute; left: -3px; right: -3px; height: 3px; bottom: 45%;  /* 고정 */
  background: #ff5566; box-shadow: 0 0 6px rgba(255, 85, 102, 0.85);
}
#voice-meter .vm-cap { font-size: 16px; opacity: 0.9; }
:root.force-landscape #voice-meter { left: 28px; }
:root.force-landscape #voice-meter .vm-track { width: 16px; height: 46vw; }

/* 다시보기 재생 중 하단 바 — 정보 한 줄 + 탐색바(원하는 초로 점프). */
#replay-bar {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 60; width: min(680px, calc(100vw - 28px));
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px;
  background: rgba(8, 12, 24, 0.86); border: 1px solid var(--stroke);
  border-radius: 16px; backdrop-filter: blur(6px);
  font-size: 13px; color: var(--text);
}
#replay-bar .replay-row { display: flex; align-items: center; gap: 10px; }
#replay-bar .replay-tag { font-weight: 800; color: var(--accent); white-space: nowrap; }
#replay-bar #replay-who { color: var(--muted); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#replay-bar .replay-time {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text);
  white-space: nowrap;
}
#replay-bar #replay-exit {
  width: auto; margin: 0; padding: 5px 14px;
  font-size: 12px; font-weight: 700; color: var(--text);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--stroke); border-radius: 999px;
}
#replay-bar #replay-exit:hover { color: #fff; background: var(--volt); border-color: transparent; }

/* 탐색바(범위 슬라이더). 클릭·드래그로 그 초로 바로 간다. */
.replay-seek {
  -webkit-appearance: none; appearance: none; width: 100%; height: 8px; margin: 2px 0;
  background: rgba(255, 255, 255, 0.14); border-radius: 999px; cursor: pointer; outline: none;
}
.replay-seek::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; cursor: pointer;
}
.replay-seek::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff; cursor: pointer;
}


.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;
}

/* 111초 커피 클럽 뱃지 */
.profile-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #ffd9a0;
  background: rgba(255, 176, 90, 0.14);
  border: 1px solid rgba(255, 176, 90, 0.4);
  border-radius: 999px;
}

/* ---------- 관리 창 ---------- */

/* 프로필(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; }

/* 전체화면 버튼. 기본은 숨김. 폰(터치)에서만, 그리고 전체화면을 지원할 때만
   보인다. 지원 여부는 JS 가 <html> 에 붙이는 .can-fullscreen 으로 판단한다. */
#fullscreen-btn { display: none; }
@media (hover: none) and (pointer: coarse) {
  /* inline-flex 로 SVG 를 가운데 정렬한다 */
  :root.can-fullscreen #fullscreen-btn { display: inline-flex; align-items: center; justify-content: center; }
}
#fullscreen-btn { color: #d3ddf5; }        /* 이모지 버튼만큼 또렷하게 */
#fullscreen-btn svg { width: 23px; height: 23px; display: block; }
#fullscreen-btn.on { color: var(--accent); border-color: var(--accent); }

/* 설정 톱니. 전체화면 버튼과 같은 결로 맞춘다 — 크기를 안 주면 SVG 가
   버튼을 꽉 채워 테두리에 닿고, 색을 안 주면 까맣게 나온다. */
#settings-btn { display: inline-flex; align-items: center; justify-content: center;
  color: #d3ddf5; }
#settings-btn svg { width: 21px; height: 21px; display: block; }
#settings-btn:hover { color: #fff; }

/* 홈 화면에 추가 버튼. 설치 가능할 때만 뜬다. */
.install-btn {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(79, 214, 255, 0.1);
  border: 1px solid rgba(79, 214, 255, 0.4);
  border-radius: 12px;
}
.install-btn:hover { background: rgba(79, 214, 255, 0.18); }

/* 설치 버튼 아래 안내: 앱·PC 로 하면 더 편하다 */
.install-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
}

/* 설치 창을 못 쓸 때 나오는 직접 추가 방법 안내 */
.install-help {
  margin-top: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

/* ---------- 패치노트 ---------- */
.patch-list { list-style: none; margin-top: 10px; max-height: 62vh; overflow-y: auto; }
:root.force-landscape .patch-list { max-height: 60vw; }
.patch-entry { padding: 12px 2px; border-bottom: 1px solid rgba(120, 170, 255, 0.12); }
.patch-entry:last-child { border-bottom: none; }
.patch-date {
  display: inline-block;
  font-size: 13px; font-weight: 800; letter-spacing: 0.02em;
  color: var(--accent); margin-bottom: 8px;
  padding: 2px 10px; border-radius: 999px;
  background: rgba(79, 214, 255, 0.12); border: 1px solid rgba(79, 214, 255, 0.3);
}
.patch-items { list-style: none; margin: 0; padding: 0; }
.patch-items li {
  position: relative; padding-left: 16px; margin-top: 6px;
  font-size: 14px; line-height: 1.55; color: #d3ddf5;
}
.patch-items li::before {
  content: '•'; position: absolute; left: 3px; color: var(--accent);
}
.patch-input {
  width: 100%; margin-top: 10px; resize: vertical; min-height: 170px;
  padding: 12px 14px; font: inherit; font-size: 14px; line-height: 1.6;
  color: var(--text); background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke); border-radius: 10px;
}
/* 색 팔레트 */
.patch-colors { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.patch-swatch {
  width: 26px; height: 26px; margin: 0; padding: 0; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.35); cursor: pointer;
}
.patch-swatch:hover { transform: scale(1.1); }
.patch-swatch.clear {
  width: auto; padding: 0 10px; font-size: 12px; font-weight: 700;
  color: var(--muted); background: rgba(255, 255, 255, 0.06);
}
/* 굵게 토글 버튼 — '가' 를 굵게 보여 준다 */
.patch-swatch.bold {
  font-size: 14px; font-weight: 900; color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}
/* 편집 미리보기 */
.patch-preview-label {
  margin-top: 16px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  color: var(--muted);
}
.patch-preview {
  margin-top: 8px; max-height: 30vh; overflow-y: auto;
  padding: 10px 14px; background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--stroke); border-radius: 10px;
}

/* ---------- 코인 지급(관리자) ---------- */
#admin-coins-search {
  width: 100%; margin-top: 12px; padding: 10px 13px; font-size: 15px;
  color: var(--text); background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke); border-radius: 10px;
}
.acgrant-list { list-style: none; margin-top: 10px; max-height: 52vh; overflow-y: auto; }
:root.force-landscape .acgrant-list { max-height: 50vw; }
.acgrant {
  display: flex; align-items: center; gap: 10px; padding: 11px 10px; cursor: pointer;
  border-radius: 8px; border-bottom: 1px solid rgba(120, 170, 255, 0.1);
}
.acgrant:hover { background: rgba(120, 170, 255, 0.08); }
.acgrant-name { flex: 1; font-weight: 700; color: var(--text); }
.acgrant-pending { font-size: 12px; font-weight: 700; color: #ffcf6a; }
.acgrant-revoke {
  width: auto; margin: 0; padding: 2px 9px; font-size: 11px; font-weight: 700;
  color: #ff9aa6; background: rgba(255,85,102,0.14);
  border: 1px solid rgba(255,85,102,0.5); border-radius: 999px;
}
.acgrant-revoke:hover { background: rgba(255,85,102,0.24); }
.acgrant-go { font-size: 12px; color: var(--muted); }
.ac-amt {
  width: 100%; margin-top: 12px; padding: 11px 13px; font-size: 17px; text-align: center;
  color: var(--text); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke); border-radius: 10px;
}
.ac-msg {
  width: 100%; margin-top: 8px; padding: 10px 13px; font-size: 14px;
  color: var(--text); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--stroke); border-radius: 10px;
}

/* ---------- 코인 룰렛 ---------- */
#roulette-modal .modal-card { width: min(430px, 100%); text-align: center; }
.roulette-wrap {
  --wheel: 300px;
  position: relative; width: var(--wheel); height: var(--wheel);
  margin: 20px auto 8px; flex: none;   /* 카드가 짧아도 세로로 안 눌리게(타원 방지) */
}
/* 강제가로(아이폰): 회전 화면은 높이가 짧아 휠을 줄이고 여백도 좁힌다. */
:root.force-landscape #roulette-modal .modal-card { padding: 14px 18px; }
:root.force-landscape .roulette-wrap { --wheel: 168px; margin: 6px auto 2px; }
:root.force-landscape #roulette-modal .board-hint { margin-top: 2px; font-size: 12px; }
:root.force-landscape .roulette-result { min-height: 18px; margin: 3px 0; font-size: 15px; }
:root.force-landscape .roul-buttons { margin-top: 4px; }
:root.force-landscape .roul-buttons button { padding: 10px; }
.roulette-wheel {
  position: absolute; inset: 6px; border-radius: 50%; overflow: hidden;
  border: 6px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  transform: rotate(0deg);
}
.roulette-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.roul-label {
  position: absolute; left: 50%; top: 50%;
  font-size: 18px; font-weight: 900; color: #10141f;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.35);
  pointer-events: none; white-space: nowrap;
}
/* 노래 칸은 글씨가 길어 조금 작게 세 줄로(그래도 읽히게). */
.roul-label-song {
  font-size: 11px; line-height: 1.15; font-weight: 800;
  text-align: center; color: #1a0f2e;
}
:root.force-landscape .roul-label-song { font-size: 8px; }
.roul-label-song small { font-size: 0.82em; font-weight: 700; opacity: 0.8; }
/* 가운데 원 — 누적 게임 시간과 남은 룰렛 횟수. 휠과 별개라 안 돌아간다. */
.roulette-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 2; width: calc(var(--wheel) * 0.46); height: calc(var(--wheel) * 0.46);
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: rgba(10, 14, 24, 0.92);
  border: 3px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 0 18px rgba(0, 0, 0, 0.45);
  text-align: center; pointer-events: none; color: #fff;
}
.roulette-hub .hub-secs { font-size: 12px; font-weight: 700; color: #cfe0ff; }
.roulette-hub .hub-spins { font-size: 24px; font-weight: 900; line-height: 1.05; color: var(--accent); }
.roulette-hub .hub-next { font-size: 10px; color: var(--muted); }
:root.force-landscape .roulette-hub .hub-secs { font-size: 10px; }
:root.force-landscape .roulette-hub .hub-spins { font-size: 17px; }
:root.force-landscape .roulette-hub .hub-next { font-size: 8px; }

/* 위쪽 포인터(아래를 가리킨다) */
.roulette-pointer {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%); z-index: 3;
  width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent;
  border-top: 24px solid #ff3a4e; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}
.roulette-result {
  min-height: 26px; margin: 8px 0 2px; font-size: 18px; font-weight: 800;
}
.roulette-result.win { color: #ffd76a; text-shadow: 0 0 16px rgba(255, 200, 90, 0.5); }
.roulette-result.jackpot { font-size: 22px; }
.roulette-result.lose { color: var(--muted); }
#roulette-spin:disabled { opacity: 0.5; }

/* 돌리기 버튼 두 개(1회 / 10회). 폭을 반씩 나눠 갖는다. */
.roul-buttons { display: flex; gap: 10px; margin-top: 8px; }
.roul-buttons button { flex: 1; margin-top: 0; min-width: 0; }
.roul-buttons button:disabled { opacity: 0.5; }

/* 황금 룰렛 배너 — 돌리기 버튼 두 개 아래에 가로로 눕는다.
   금빛으로 둘러 일반 버튼(붉은색)과 확실히 갈라 놓는다. 광고를 보는
   대가라 눌러야 할 이유(꽝 없음·초대박 배수)를 버튼 안에 적어 둔다. */
.roul-gold {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 100%; margin-top: 10px; padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 196, 77, 0.55);
  background: linear-gradient(140deg, rgba(255, 207, 106, 0.20), rgba(255, 140, 40, 0.14));
  color: #ffe6a0;
  font-family: inherit;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.roul-gold b { font-size: 15px; font-weight: 900; letter-spacing: -0.01em; }
.roul-gold b small { font-size: 12px; font-weight: 700; opacity: 0.85; }
.roul-gold span { font-size: 12px; color: rgba(255, 230, 160, 0.72); }
.roul-gold:hover:not(:disabled) { filter: brightness(1.12); }
.roul-gold:active:not(:disabled) { transform: translateY(1px); }
.roul-gold:disabled { opacity: 0.45; cursor: default; }

/* 황금으로 딴 결과는 결과 줄도 금빛으로. */
.roulette-result.gold { color: #ffd76a; text-shadow: 0 0 18px rgba(255, 190, 60, 0.45); }


/* 10회 결과 — 열 칸을 5×2 로 펼친다. 한 번에 다 보이는 게 요점이라
   스크롤이 생기지 않게 칸을 작게 잡는다. */
.roul10-card { width: min(560px, 94vw); }
.roul10-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 16px 0 4px;
  padding: 0;
  list-style: none;
}
.roul10-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  min-height: 74px; padding: 8px 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}
.roul10-ico { font-size: 20px; line-height: 1; }
/* 이름이 긴 보상('가나디라고라')도 칸을 넘기지 않게 줄여서 두 줄까지 쓴다. */
.roul10-text {
  font-size: 12px; font-weight: 800; line-height: 1.2; text-align: center;
  word-break: keep-all;
}
.roul10-cell.coin { border-color: rgba(255, 207, 106, 0.35); background: rgba(255, 207, 106, 0.10); }
.roul10-cell.coin .roul10-text { color: #ffe6a0; font-size: 15px; }
.roul10-cell.blank { opacity: 0.45; }
.roul10-cell.blank .roul10-text { color: var(--muted); }
/* 초대박은 한눈에 튀어야 한다 — 열 칸 중에 섞여 있으면 놓친다. */
.roul10-cell.rare {
  border-color: rgba(255, 90, 140, 0.55);
  background: linear-gradient(160deg, rgba(255, 90, 140, 0.20), rgba(140, 60, 200, 0.16));
  box-shadow: 0 0 16px rgba(255, 90, 140, 0.30);
}
.roul10-cell.rare .roul10-text { color: #ffd9e6; }

@media (max-width: 520px) {
  .roul10-grid { gap: 6px; }
  .roul10-cell { min-height: 62px; padding: 6px 2px; }
  .roul10-ico { font-size: 17px; }
  .roul10-text { font-size: 11px; }
  .roul10-cell.coin .roul10-text { font-size: 13px; }
}


/* 확률표 버튼(룰렛 머리 왼쪽) + 펼치는 팝오버 */
#roulette-modal .modal-card { position: relative; }
.roul-odds-btn {
  width: auto; margin: 0; padding: 5px 10px; white-space: nowrap;
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke); border-radius: 8px;
}
.roul-odds-btn:hover { color: var(--text); background: rgba(120, 170, 255, 0.1); }
.roul-odds {
  position: absolute; top: 52px; left: 16px; z-index: 6;
  width: min(240px, calc(100% - 32px)); padding: 10px 13px;
  background: rgba(12, 16, 26, 0.97); border: 1px solid var(--stroke);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55); text-align: left;
}
.roul-odds-title { font-size: 12px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.roul-odds ul { list-style: none; margin: 0; padding: 0; }
.roul-odds li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 5px 0; font-size: 13px; color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.roul-odds li:last-child { border-bottom: none; }
.roul-odds li b { font-variant-numeric: tabular-nums; color: var(--muted); }
.roul-odds li.song span { color: #c79bff; font-weight: 800; }
.roul-odds li.song b { color: #c79bff; }

/* ---------- 커뮤니티 ---------- */
.board-hint { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* 칸(카테고리) 탭 바. 한 줄로 두고 좁으면 가로로 민다. */
.board-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.board-tabs::-webkit-scrollbar { display: none; }
.board-tabs button {
  flex: 0 0 auto;
  width: auto; margin: 0;
  padding: 8px 15px;
  font-size: 13.5px; font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.board-tabs button:hover { color: var(--text); background: rgba(120, 170, 255, 0.1); }
.board-tabs button.current {
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}

/* 칸 색. 뱃지·카드 강조에 함께 쓴다. */
.cat-patch { --cat: #7c9bff; }
.cat-chat  { --cat: #9aa4bf; }
.cat-idea  { --cat: #ffd54a; }
.cat-bug   { --cat: #ff9f43; }
.cat-qna   { --cat: #57d18a; }

/* 카드에 붙는 칸 뱃지(작은 알약). */
.board-cat-badge {
  flex: 0 0 auto;
  padding: 2px 9px;
  font-size: 11px; font-weight: 800;
  color: var(--cat, #9aa4bf);
  background: color-mix(in srgb, var(--cat, #9aa4bf) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--cat, #9aa4bf) 45%, transparent);
  border-radius: 999px;
  white-space: nowrap;
}

/* 쓰기 칸 위의 '칸' 선택 드롭다운. */
.board-write-top { margin-bottom: 9px; }
.board-cat-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--muted);
}
.board-cat-select {
  font: inherit; font-size: 13px; font-weight: 700;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

.board-write {
  margin: 14px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: 12px;
}
.board-write textarea {
  width: 100%;
  /* 세로로 늘려 쓸 수 있게 두되, 처음부터 몇 줄은 보이게 한다.
     44px 은 두 줄이라 두어 문장만 써도 위가 잘려 답답했다. */
  resize: vertical;
  min-height: 116px;
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}
.board-write-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.board-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.primary.small { width: auto; margin: 0; padding: 8px 18px; font-size: 14px; }

/* 게시판은 답글까지 보여 줘야 해서 다른 창보다 넓고 높게 잡는다. */
/* 카드 자체는 스크롤하지 않는다(overflow hidden). 대신 헤더·탭·쓰기칸은
   위에 고정하고, 글 목록(또는 상세)만 남은 공간에서 스크롤한다. 이렇게
   해야 내용이 길어져도 위쪽 탭이 스크롤에 밀려 잘리지 않는다. */
#board-modal .modal-card { width: min(680px, 100%); max-height: 88vh; overflow: hidden; }
#board-modal .modal-head,
#board-modal .board-tabs,
#board-modal .board-write { flex: none; }
#board-modal .board-list,
#board-modal .board-detail { flex: 1 1 auto; min-height: 0; max-height: none; }

/* 좌우 안쪽 여백을 둬서, 카드 hover 하이라이트가 이 여백 안에서 양옆으로
   살짝 넓어질 수 있게 한다. 목록 밖으로 넘치지 않아 가로 스크롤이 안 생긴다. */
.board-list { list-style: none; margin-top: 6px; max-height: 60vh; overflow-y: auto; padding-inline: 8px; }
.board-empty { color: var(--muted); text-align: center; padding: 26px; font-size: 14px; }

.board-post {
  padding: 11px 2px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.12);
}
.board-post:last-child { border-bottom: none; }

/* 칸별 왼쪽 강조선. 패치노트(운영자 글)는 배경까지 살짝 띄워 눈에 띄게. */
.board-post.cat-patch,
.board-post.cat-idea,
.board-post.cat-bug,
.board-post.cat-qna {
  border-left: 3px solid var(--cat);
  padding-left: 11px;
  border-radius: 10px;
}
.board-post.cat-patch {
  background: color-mix(in srgb, var(--cat) 9%, transparent);
}
.board-detail-post.cat-patch,
.board-detail-post.cat-idea,
.board-detail-post.cat-bug,
.board-detail-post.cat-qna { border-left: 3px solid var(--cat); padding-left: 12px; }

/* 패치노트 카드: 뱃지·작성자·시간 줄 없이 '날짜(제목) + 내용'만 보인다.
   수정·삭제 버튼(관리자)은 우상단에 겹쳐 놓아 날짜 줄을 밀지 않는다. */
.patch-card { position: relative; }
.patch-card > .patch-date { margin-top: 2px; }
.patch-card > .board-tools { position: absolute; top: 10px; right: 4px; }
.board-detail-post.patch-card > .board-tools { top: 0; right: 0; }

.board-post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.board-name { font-weight: 700; font-size: 14px; color: var(--text); }
.board-name.member { color: var(--accent); }      /* 로그인 유저는 파란 이름 */
.board-time { font-size: 12px; color: var(--muted); }
/* 관리자 버튼 묶음(수정·삭제)은 머리 오른쪽 끝으로 민다. */
.board-tools { margin-left: auto; display: inline-flex; gap: 6px; flex: none; }
.board-edit,
.board-del {
  width: auto; margin: 0; padding: 3px 9px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke); border-radius: 6px;
}
.board-edit:hover { color: #fff; background: var(--accent); border-color: transparent; }
.board-del:hover { color: #fff; background: var(--volt); border-color: transparent; }

/* 입력칸 아래 버튼 묶음(취소·남기기/수정 저장) */
.board-write-btns { display: inline-flex; gap: 8px; }
.board-body { font-size: 14px; line-height: 1.6; color: #d3ddf5; word-break: break-word; }

/* 목록 카드: 통째로 눌러 상세로 들어간다. hover 하이라이트는 양옆으로만
   살짝 넓게(음수 margin 만큼 밖으로, 같은 만큼 padding 으로 글자는 제자리). */
.board-post-link {
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s ease;
  margin-inline: -8px;    /* 목록의 안쪽 여백(8px)만큼만 밖으로 — 넘치지 않는다 */
  padding-inline: 8px;
}
.board-post-link:hover { background: rgba(120, 170, 255, 0.06); }

/* 댓글 수(말풍선). '답글' 텍스트 버튼을 대신한다. */
.board-actions { margin-top: 7px; }
.board-cmt {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.board-cmt-ico { font-size: 14px; }

/* ── 상세 화면 ── */
.board-detail { margin-top: 16px; overflow-y: auto; padding-inline: 2px; }
.board-back {
  width: auto; margin: 0 0 18px; padding: 5px 12px;
  font-size: 13px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); border-radius: 8px;
}
.board-back:hover { color: var(--text); }

.board-detail-post {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(120, 170, 255, 0.14);
}
.board-detail-post .board-name { font-size: 15px; }
.board-detail-post .board-body { font-size: 15px; margin-top: 6px; }
.board-detail-actions { margin-top: 12px; }

.board-comments-sec { margin-top: 16px; }
.board-comments-title {
  font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 8px;
}
.board-comments { list-style: none; }
.board-comment { padding: 10px 2px; }
.board-comment + .board-comment { border-top: 1px solid rgba(120, 170, 255, 0.10); }
.board-comment .board-body { font-size: 13px; }

/* 댓글 입력칸(상세 하단, 항상 보임) */
.board-comment-form {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid rgba(120, 170, 255, 0.14);
}
.board-comment-form textarea {
  width: 100%; resize: vertical; min-height: 84px; padding: 9px 11px;
  font: inherit; font-size: 14px; color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); border-radius: 8px;
}
.board-comment-form .board-write-row { margin-top: 8px; }

/* 관리 창에서 전체 대시보드로 가는 링크 */
.admin-full-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.admin-full-link:hover { text-decoration: underline; }

/* 내 프로필에서만 보이는 닉네임 바꾸기 */
.profile-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--stroke);
}

.profile-actions button { width: auto; margin: 0; }
.profile-actions { gap: 8px; flex-wrap: wrap; }

/* 이름 + 장착 칭호 칩 (모달 헤더) */
.profile-headline {
  flex: 1; min-width: 0; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap;
}
.profile-headline h2 { flex: 0 0 auto; margin: 0; }
.profile-titles { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.title-chip {
  display: inline-flex; align-items: center; padding: 2px 9px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
  color: #ffe6a1; background: rgba(255, 193, 84, 0.16);
  border: 1px solid rgba(255, 193, 84, 0.45); border-radius: 999px;
}

/* 칭호 창 — 한 줄에 3개씩 카드로 */
.tt-hint { margin: 4px 0 12px; font-size: 12px; color: var(--muted); }
.tt-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.tt-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; width: 100%; min-height: 42px;
  margin: 0; padding: 7px 10px; text-align: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke); border-radius: 12px;
}
.tt-item.on {
  border-color: rgba(255, 193, 84, 0.7);
  background: rgba(255, 193, 84, 0.14);
}
.tt-item.locked { cursor: default; opacity: 0.5; border-style: dashed; }
.tt-item:hover.earned:not(.on) { background: rgba(255, 255, 255, 0.1); }
.tt-ico { font-size: 18px; }
.tt-name { font-weight: 800; font-size: 15px; color: var(--text); }
.tt-cond { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.25; }
.tt-item.on .tt-cond { color: #ffcf6a; }
@media (max-width: 760px) { .tt-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 440px) { .tt-list { grid-template-columns: repeat(2, 1fr); } }

/* 이용 현황 맨 위 요약 */
.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-modal .modal-card { width: min(960px, calc(100vw - 40px)); max-height: 90vh; }

.rank-tabs {
  display: flex;
  flex-wrap: wrap;        /* 탭이 많아(9개) 좁으면 다음 줄로 넘긴다 */
  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 1 auto;
  min-width: 68px;        /* 이보다 좁아지면 줄바꿈된다 */
  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;
}

/* 헤더에 늘 보이는 내 순위. 100위 밖으로 밀려도 여기서 확인된다. */
.rank-me {
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 999px;
  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);
}

/* '11,814초  3시간 16분' 처럼 단위 뒤에 다른 숫자가 붙는 경우.
   그냥 두면 초와 시간이 한 덩어리로 읽혀서, 사이를 띄우고 옅은 금을 긋는다. */
.secs .dim.apart {
  margin-left: 9px;
  padding-left: 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

/* ---------- 화면(시작 / 게임오버) ---------- */

.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);
}

/* 시작 화면 배경: 은은한 전기 노선도. 카드보다 뒤(z:0), 카드 뒤 가운데는 어둡게. */
#title-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
/* 흐리게 하는 건 SVG 무드에만. 사진까지 같이 흐려지면 안 된다. */
#title-backdrop svg { width: 100%; height: 100%; display: block; opacity: 0.6; }

/* 배경 사진. 아래에 깔리고 그 위로 SVG 무드 → 비네트 순서로 덮인다.
   가운데는 타이틀 카드가 가리므로, 잘릴 때 좌우가 아니라 위아래가
   잘리도록 cover + 가운데 정렬로 둔다. */
.tb-photo { position: absolute; inset: 0; }
.tb-photo img {
  width: 100%; height: 100%; display: block;
  object-fit: cover; object-position: center;
}
/* 사진이 깔리면 붉은 아크는 한참 죽인다 — 안 그러면 두 그림이 싸운다. */
#title-backdrop:has(.tb-photo) svg { opacity: 0.22; }
#title-backdrop polyline { opacity: 0.5; }
/* 가운데(카드 뒤)와 위/아래를 어둡게 덮어 글자를 방해하지 않게 한다 */
#title-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(58% 54% at 50% 47%, rgba(5,6,15,0.94) 0%, rgba(5,6,15,0.6) 42%, transparent 74%),
    linear-gradient(to bottom, rgba(5,6,15,0.55), transparent 22%, transparent 78%, rgba(5,6,15,0.65));
}
/* 사진 위에서는 더 눌러 준다. 화려한 그림 위에 흰 글씨를 그냥 얹으면
   읽히지 않는다 — 카드 뒤와 상단 바 자리를 확실히 어둡게. */
#title-backdrop:has(.tb-photo)::after {
  background:
    radial-gradient(62% 58% at 50% 47%, rgba(5,6,15,0.96) 0%, rgba(5,6,15,0.74) 40%, rgba(5,6,15,0.25) 78%),
    linear-gradient(to bottom, rgba(5,6,15,0.78), rgba(5,6,15,0.2) 26%, rgba(5,6,15,0.2) 72%, rgba(5,6,15,0.8));
}
/* 필라멘트 한 줄이 은은하게 밝아졌다 잦아든다 (숨쉬듯) */
.tb-live { animation: tbPulse 6s ease-in-out infinite; }
@keyframes tbPulse { 0%, 100% { opacity: 0.14; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .tb-live { animation: none; } }
/* 카드는 배경 위로 */
#title-screen .panel { position: relative; z-index: 1; }

/* 캐릭터 해금 연출 — 게임오버 창이 뜨기 직전에 잠깐 가운데에 크게 보여 준다 */
.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 42;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%,
    rgba(255,58,78,0.18) 0%, rgba(5,6,15,0.84) 40%, rgba(5,6,15,0.96) 100%);
  opacity: 0;
  transition: opacity 0.26s ease;
  cursor: pointer;
}
.unlock-overlay.show { opacity: 1; }
.unlock-card {
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 26px 34px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 58, 78, 0.12);
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.2, 1.3, 0.4, 1);
}
.unlock-overlay.show .unlock-card { transform: scale(1); }
.unlock-kicker {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(79, 214, 255, 0.6);
  margin-bottom: 12px;
}
.unlock-face {
  width: 200px;
  height: 200px;
  object-fit: contain;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 44%, rgba(255,255,255,0.16) 0%, transparent 66%);
  filter: drop-shadow(0 10px 34px rgba(0, 0, 0, 0.6));
}

.unlock-name {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 0 0 26px rgba(255, 58, 78, 0.45);
}
.unlock-lockface {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 44%, rgba(255,255,255,0.10) 0%, transparent 66%);
  filter: drop-shadow(0 10px 34px rgba(0, 0, 0, 0.6));
  animation: unlockPop 0.5s ease-out;
}
.unlock-hint { margin-top: 14px; font-size: 12px; color: var(--muted); }
/* 게스트에게 뜨는 '로그인하면 받을 수 있어요' 안내의 로그인 단추 */
.unlock-login {
  margin-top: 12px;
  padding: 9px 20px;
  border: 1px solid rgba(120, 160, 255, 0.55);
  border-radius: 999px;
  background: rgba(80, 120, 255, 0.18);
  color: #dce6ff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.unlock-login:hover { background: rgba(80, 120, 255, 0.32); transform: translateY(-1px); }
.unlock-hint.dim-hint { margin-top: 10px; font-size: 11px; opacity: 0.6; }
/* 코인 선물에 관리자가 붙인 한 줄 멘트 */
.coin-gift-msg {
  margin-top: 12px; padding: 8px 14px; font-size: 15px; font-weight: 600;
  color: #ffe6a1; background: rgba(255, 193, 84, 0.14);
  border: 1px solid rgba(255, 193, 84, 0.4); border-radius: 12px;
  max-width: 320px; word-break: break-word;
}
@keyframes unlockPop {
  0% { transform: scale(0.55); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
@media (max-width: 480px) {
  .unlock-face { width: 150px; height: 150px; }
  .unlock-lockface { width: 150px; height: 150px; font-size: 72px; }
  .unlock-name { font-size: 24px; }
}

/* 111초 커피 이벤트 창 */
.coffee-card { max-width: 340px; }
.coffee-emoji { font-size: 58px; line-height: 1; }
.coffee-kicker {
  margin-top: 8px; font-size: 15px; font-weight: 800; letter-spacing: 0.2em; color: #ffc06a;
  text-shadow: 0 0 18px rgba(255, 192, 106, 0.5);
}
.coffee-title { margin-top: 6px; font-size: 22px; font-weight: 900; letter-spacing: -0.02em; }
.coffee-body { margin-top: 14px; font-size: 14px; color: var(--muted); line-height: 1.75; }
.coffee-body b { color: var(--text); }
.coffee-ok {
  display: block; width: 100%; margin-top: 20px; padding: 12px;
  background: linear-gradient(135deg, #ff5a1e, #ff3a4e); color: #fff;
  font-weight: 800; font-size: 15px; border: none; border-radius: 12px;
  cursor: pointer; font-family: inherit;
}
.coffee-ok:hover { filter: brightness(1.06); }

.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;
}

/* 가로로 든 폰: 화면이 납작해서 세로로 쌓으면 스크롤해야 다 보인다.
   가로는 넓으니 시작 패널을 2단으로 흘려 높이를 반으로 줄인다.
   (세로·PC 는 그대로 한 단.) */
@media (orientation: landscape) and (max-height: 560px) {
  .screen { padding: 58px 16px 10px; gap: 10px; align-items: flex-start; }

  /* 시작 화면 패널만 2단. (일시정지·결과·닉네임 창은 건드리지 않는다.) */
  #title-screen .panel {
    width: min(760px, 100%);
    padding: 14px 18px;
    border-radius: 14px;
    column-count: 2;
    column-gap: 20px;
  }
  /* 버튼·줄이 두 단에 걸쳐 잘리지 않게 한다. */
  #title-screen .panel > * { break-inside: avoid; }
  /* 로고는 왼쪽 단 맨 위 한 줄을 통째로 차지한다. */
  #title-screen .logo { font-size: 30px; column-span: all; }
  #title-screen .tagline { margin-top: 5px; font-size: 12px; line-height: 1.4; }

  #title-screen button { margin-top: 8px; padding: 10px; font-size: 14px; border-radius: 10px; }
  #title-screen .field { margin-top: 10px; }
  #title-screen .account-row { margin-top: 4px; }
  #title-screen .bottom-row { margin-top: 10px; padding-top: 10px; gap: 8px; flex-direction: column; }
  #title-screen .controls div { font-size: 11px; }
  #title-screen .voice-panel { width: 100%; padding: 8px; }
  #title-screen .install-btn { margin-top: 8px; padding: 9px; font-size: 13px; }
  #title-screen .legal-links { margin-top: 8px; }
}

/* 강제가로(세로로 든 아이폰): 위 landscape 미디어쿼리는 기기가 물리적으로
   세로라 안 먹는다. 그래서 회전 뒤 실제로는 납작한 가로인데 타이틀이 1단으로
   길게 늘어져 잘린다. 같은 2단 컴팩트 레이아웃을 강제가로에도 그대로 준다. */
/* 왼쪽 패딩으로 사이드 메뉴(+노치) 자리를 비워, 내용을 오른쪽으로 민다. */
:root.force-landscape .screen {
  padding: 76px 16px 10px max(132px, calc(env(safe-area-inset-top) + 124px));
  gap: 10px; align-items: flex-start;
}
/* 강제가로에선 공지 배너를 가로(긴 쪽=90vh) 기준으로 넓혀 한 줄로 만들고 위에
   바짝 붙인다. 위 .screen 패딩을 늘려 패널이 배너와 안 겹치게 내려 준다. */
:root.force-landscape #notice-banner {
  top: calc(60px + env(safe-area-inset-top));
  max-width: min(780px, 90vh);
  padding: 7px 20px;
  font-size: 13px;
}
:root.force-landscape #title-screen .panel {
  width: min(760px, 100%);
  padding: 14px 18px;
  border-radius: 14px;
  column-count: 2;
  column-gap: 20px;
}
:root.force-landscape #title-screen .panel > * { break-inside: avoid; }
:root.force-landscape #title-screen .logo { font-size: 30px; column-span: all; }
:root.force-landscape #title-screen .tagline { margin-top: 5px; font-size: 12px; line-height: 1.4; }
:root.force-landscape #title-screen button { margin-top: 8px; padding: 10px; font-size: 14px; border-radius: 10px; }
:root.force-landscape #title-screen .field { margin-top: 10px; }
:root.force-landscape #title-screen .account-row { margin-top: 4px; }
:root.force-landscape #title-screen .bottom-row { margin-top: 10px; padding-top: 10px; gap: 8px; flex-direction: column; }
:root.force-landscape #title-screen .controls div { font-size: 11px; }
:root.force-landscape #title-screen .voice-panel { width: 100%; padding: 8px; }
:root.force-landscape #title-screen .install-btn { margin-top: 8px; padding: 9px; font-size: 13px; }
:root.force-landscape #title-screen .legal-links { margin-top: 8px; }

.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);
}

/* 캐릭터 창을 랭킹 창과 같은 크기로 넓혀 한 줄에 5개씩 보이게 한다. */
#char-modal .modal-card { width: min(960px, calc(100vw - 40px)); max-height: 90vh; }

.char-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 16px;
}

/* 좁은 화면에선 5개가 눌리니 칸 수를 줄인다. */
@media (max-width: 720px) { .char-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .char-grid { grid-template-columns: repeat(2, 1fr); } }

/* 강제 가로(아이폰)에선 화면이 90° 돌아 있다. 미디어쿼리의 max-width 도,
   위의 width:min(...,100vw) 도 폰의 '짧은 쪽'을 재기 때문에 실제로는 넓은데도
   창이 눌리고 한 줄에 2개만 들어갔다. 회전 뒤의 '가로 폭' 은 100vh 이므로
   그걸로 다시 잡는다. 미디어쿼리보다 선택자가 더 구체적이라 이 규칙이 이긴다.

   높이(max-height)도 같은 함정이 있다. 위의 90vh 는 회전 뒤엔 폰의 '긴 쪽'을
   재서, 393px 짜리 화면에 767px 카드가 들어가 위아래가 통째로 잘렸다 —
   머리글(닫기 ✕)이 화면 밖으로 밀려 나가 캐릭터를 고르고도 못 나갔고,
   카드가 제 안에서 넘치질 않으니 스크롤도 할 게 없었다.
   회전 뒤의 '세로 높이' 는 100vw 다. 그걸로 잡아야 카드 안에서 스크롤이 산다.
   ID 선택자끼리 부딪히므로(#char-modal .modal-card) 여기도 ID 를 같이 쓴다. */
:root.force-landscape #char-modal .modal-card {
  width: min(760px, calc(100vh - 56px));
  max-height: 78vw;
  padding: 12px 16px 14px;
}
:root.force-landscape .char-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
/* 목록을 내려도 닫기 버튼은 늘 손 닿는 곳에 있게 머리글을 붙여 둔다. */
:root.force-landscape #char-modal .modal-head {
  position: sticky; top: 0; z-index: 2;
  flex: none;                 /* 세로로 눌려 닫기 버튼이 찌그러지지 않게 */
  padding-bottom: 8px; background: var(--panel);
}
:root.force-landscape #char-modal .modal-head h2 { font-size: 17px; }
/* 창이 낮아진 만큼 카드도 낮춘다 — 한 화면에 두 줄 넘게 보이게. */
:root.force-landscape .char-card { padding: 8px 5px 9px; }
:root.force-landscape .char-card img { width: 58px; height: 58px; }
:root.force-landscape .char-name { font-size: 12px; }

/* 아직 다듬는 중이라 안 보여 주는 캐릭터 자리.
   두 칸을 차지해 남은 줄을 채운다 — 칸을 비워 두면 화면이 깨진 것처럼 보인다. */
.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 { cursor: default; border-style: dashed; background: rgba(255, 255, 255, 0.03); }
.char-mystery {
  width: 74px; height: 74px;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 900; color: var(--muted);
  background: radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.08) 0%, transparent 68%);
  border-radius: 12px;
}
.char-name.mystery { color: var(--muted); letter-spacing: 2px; }
.char-note.goal { color: #ffc06a; font-weight: 700; }

/* 코인 구매 확인창 (캐릭터 창 위에 뜬다) */
.modal.buy-confirm { z-index: 60; }
.buy-confirm .modal-card { width: min(330px, 100%); text-align: center; padding: 26px 26px 22px; }
.buy-ico { font-size: 44px; line-height: 1; filter: drop-shadow(0 0 14px rgba(255, 176, 60, 0.5)); }
.buy-msg { margin-top: 12px; font-size: 16px; line-height: 1.6; color: var(--text); }
.buy-msg .buy-cost { color: #ffcf6a; }
.buy-row { display: flex; gap: 10px; margin-top: 20px; }
.buy-row button { flex: 1; margin: 0; }

/* 코인 상점 카드 — 모습을 공개하고 금빛 가격표를 붙인다. 코인이 충분하면
   눌러서 산다(활성), 모자라면 살짝 흐리게(비활성). */
.char-card.shop { border-color: rgba(255, 176, 60, 0.5); background: rgba(255, 176, 60, 0.07); }
.char-card.shop:hover:not(:disabled) { background: rgba(255, 176, 60, 0.16); }
.char-card.shop:disabled { opacity: 0.6; cursor: default; }
.char-note.price { color: #ffcf6a; font-weight: 800; }

.char-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  /* 캐릭터 뒤 은은한 원형 스포트라이트. 어두운 소품(권총·선글라스)이 어두운
     카드 배경에 묻히지 않게 가운데만 살짝 밝힌다. 밝은 캐릭터엔 영향이 적다. */
  background: radial-gradient(circle at 50% 44%,
    rgba(255, 255, 255, 0.17) 0%, rgba(255, 255, 255, 0.06) 42%, transparent 70%);
  border-radius: 12px;
  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;
}

/* 폰에서만 뜨는 안내. 거슬리지 않게 작고 흐리되, 배경을 살짝 줘서
   그냥 지나치지 않을 정도로만. .touch-only 가 표시 여부를 맡으므로
   여기서는 display 를 건드리지 않는다. */
.mobile-note {
  margin-top: 14px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  color: var(--volt-soft);
  background: rgba(255, 58, 78, 0.08);
  border: 1px solid rgba(255, 58, 78, 0.2);
  border-radius: 9px;
}

/* 시작 화면 맨 아래 약관 링크. 눈에 띄면 안 되지만 찾을 수는 있어야 한다. */
.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: 0 0 160px;
  width: 160px;
  max-width: 40vw;         /* 좁은 화면에서는 이름 칸이 화면을 너무 먹지 않게 */
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 게스트(비로그인)는 회색으로 — 로그인 유저와 구분. */
.board .who.guest { color: var(--muted); font-weight: 500; }
.board li.me .who.guest { color: var(--muted); }

/* 기록 막대 — 1위 대비 비율. 이름과 기록 사이의 빈 공간을 채운다. */
.board .rbar {
  flex: 1;
  min-width: 30px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.board .rbar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(79, 139, 255, 0.55), var(--accent));
}
/* 1~3위 막대는 메달색(금·은·동)으로 강조. 어느 쪽이든 그 메달이 있는 줄만. */
.board li:has(.medal-1) .rbar-fill { background: linear-gradient(90deg, #f0b429, #ffe08a); }
.board li:has(.medal-2) .rbar-fill { background: linear-gradient(90deg, #b3bfd1, #e6ecf5); }
.board li:has(.medal-3) .rbar-fill { background: linear-gradient(90deg, #cf8b4e, #f0c08a); }
.board .me .rbar-fill { background: linear-gradient(90deg, var(--accent), #8fd0ff); }

.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%; }

/* 고정 조이스틱 — 늘 왼쪽 아래(JUMP 와 같은 높이)에 있다. JS 가 위치를
   옮기지 않는다. bottom 23px + 반지름 59 = 중심 82px 로 JUMP 중심과 맞춘다. */
#stick-base {
  position: absolute;
  left: max(58px, env(safe-area-inset-left));
  bottom: max(49px, env(safe-area-inset-bottom));
  width: 118px;
  height: 118px;
  border: 2px solid rgba(120, 170, 255, 0.32);
  border-radius: 50%;
  background: rgba(10, 14, 30, 0.32);
  opacity: 0.85;
  transition: opacity 0.15s, border-color 0.15s;
}

#stick-base.on { opacity: 1; border-color: rgba(120, 170, 255, 0.6); }

#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(54px, env(safe-area-inset-right));
  bottom: max(60px, 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; }
}

/* ── 하드코어 모드 토글 (타이틀) ─────────────────────────────── */
/* ---------- 도전모드(탑) ---------- */
/* 타이틀 왼쪽 아래 동그란 버튼 */
/* 탑 오르기 버튼 — 식어 가는 용암 줄기로 두른 고리.
   배경이 이미 화려해서 형태는 단순하게 두되, 고리 자체의 결은 살린다.
   매끈한 한 줄이면 「그려 넣은 원」 이고, 결이 있어야 「타고 있는 것」 이다. */
#tower-btn {
  position: fixed; left: 150px; bottom: 74px; z-index: 12;
  width: 152px; height: 152px; margin: 0; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 0; cursor: pointer;
  /* closest-side 라야 원으로 잘리는 자리에서 이미 투명하다. 기본값
     (farthest-corner)이면 잘린 자리에 색이 남아 테두리처럼 보인다.
     가운데는 거의 검게 — 글씨가 앉을 자리이자, 고리를 더 뜨겁게 보이게 한다. */
  background: radial-gradient(circle closest-side at 50% 50%,
    rgba(10, 4, 5, 0.72) 0%,
    rgba(16, 5, 5, 0.6) 46%,
    rgba(120, 34, 8, 0.26) 74%,
    rgba(60, 16, 6, 0.1) 86%,
    transparent 96%);
  box-shadow: 0 0 52px rgba(255, 62, 14, 0.32), 0 0 20px rgba(255, 110, 40, 0.22);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
#tower-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 74px rgba(255, 72, 20, 0.52), 0 0 26px rgba(255, 130, 55, 0.38);
}

/* 주행 기능부터 시험하는 만드라이더 입구. 탑 버튼 옆자리만 빌린다. */
#mandrider-btn {
  position: fixed; left: 320px; bottom: 92px; z-index: 12;
  width: 132px; height: 116px; border-radius: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: #e9ffd2; text-decoration: none; font-weight: 900;
  background: radial-gradient(circle at 50% 35%, rgba(100, 194, 72, 0.55), rgba(20, 52, 25, 0.78) 68%, rgba(8, 18, 12, 0.28));
  border: 1px solid rgba(165, 236, 123, 0.42);
  box-shadow: 0 0 32px rgba(91, 196, 81, 0.24), inset 0 0 18px rgba(196, 255, 151, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#mandrider-btn:hover { transform: scale(1.04); box-shadow: 0 0 46px rgba(91, 220, 81, 0.38); }
.mandrider-icon { font-size: 43px; line-height: 1; filter: drop-shadow(0 4px 5px rgba(0,0,0,.5)); }
/* 만드라고라 그림은 글자 크기를 따라간다 — 화면이 좁아지면 아이콘도 같이 준다. */
.mandrider-icon img { display: block; width: 1.15em; height: 1.15em; object-fit: contain; }
.mandrider-label { font-size: 15px; text-shadow: 0 2px 6px #000; white-space: nowrap; }
.mandrider-label i { color: #b9ff86; font-style: normal; }

.tower-ring {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
}

/* 1) 번진 열기 — 고리 둘레 공기가 달아오른 것 */
.tr-heat {
  fill: none; stroke: #ff3808; stroke-width: 5.6;
  opacity: 0.46; filter: blur(4.5px);
}
/* 2) 몸통 — 붉게 달아오른 줄기 */
.tr-body {
  fill: none; stroke: url(#towerRing); stroke-width: 2.4;
  filter: drop-shadow(0 0 2px rgba(255, 90, 30, 0.9));
}
/* 3) 검게 식은 껍질 — 몸통 위에 어두운 조각을 덮어 균일한 선을 깬다.
      둘레가 약 283. 길고 짧은 조각을 섞어 불규칙하게. */
.tr-crust {
  /* 새까맣게 두면 검은 구슬을 꿴 것처럼 보인다. 붉은 기가 남은 어두운
     색으로, 옅게 덮어야 「식어 가는 자리」 로 읽힌다. */
  fill: none; stroke: #4a1205; stroke-width: 2.3; stroke-linecap: round;
  stroke-dasharray: 5 24 3 38 8 31 4 17 6 45 4 22;
  opacity: 0.62;
}
/* 4) 갈라진 틈으로 보이는 속불 — 껍질 사이사이가 제일 뜨겁다 */
.tr-core {
  fill: none; stroke: #ffcf8a; stroke-width: 1.1; stroke-linecap: round;
  stroke-dasharray: 3 34 6 22 2 47 5 29 3 38;
  stroke-dashoffset: 14;
  opacity: 0.9;
  animation: towerBreathe 4.2s ease-in-out infinite;
}
@keyframes towerBreathe { 0%, 100% { opacity: 0.72; } 50% { opacity: 1; } }
/* 5) 흩어진 불티 */
.tr-spark { fill: #ff8a2e; filter: drop-shadow(0 0 1.6px rgba(255, 110, 40, 0.95)); }
.tr-spark circle:nth-child(3n) { fill: #ffd7a0; }
.tr-spark circle:nth-child(4n) { fill: #ff5a12; }
/* 6) 네 방향의 별 */
.tr-star { fill: #ffc078; filter: drop-shadow(0 0 3px rgba(255, 90, 30, 1)); }

#tower-btn:hover .tr-body { filter: drop-shadow(0 0 4px rgba(255, 130, 60, 1)); }
#tower-btn:hover .tr-heat { opacity: 0.58; }

/* 이름 한 줄. 화살표는 이름 옆에 붙여 「간다」 가 한 번에 읽히게. */
.tower-label {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 17px; font-weight: 800; white-space: nowrap;
  letter-spacing: 0.01em; color: #ffd9b0;
  text-shadow:
    0 1px 3px rgba(0, 0, 0, 0.95), 0 0 10px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(255, 74, 20, 0.85);
}
.tl-go { font-style: normal; font-size: 15px; color: #ff9a48; }

/* 움직임을 줄여 달라고 한 사람에게는 숨쉬기를 멈춘다. */
@media (prefers-reduced-motion: reduce) {
  .tr-core { animation: none; opacity: 0.9; }
}

@media (max-width: 1100px) { :root { --tower-space: 180px; }   /* 116 + 40 + 24 */ #tower-btn { left: 24px; bottom: 40px; width: 116px; height: 116px; }
  #mandrider-btn { left: 154px; bottom: 49px; width: 106px; height: 98px; border-radius: 30px; }
  .mandrider-icon { font-size: 36px; }
  .mandrider-label { font-size: 13px; }
  .tower-emblem { width: 23px; height: 23px; }
  .tower-label { font-size: 15px; }
  .tower-arrow { font-size: 11px; } }
/* 여기서부터는 문장과 화살표를 뺀다. 셋 다 넣으면 이름이 읽히지 않는다. */
@media (max-width: 820px) { :root { --tower-space: 128px; }   /* 88 + 16 + 24 */ #tower-btn { left: 14px; bottom: 16px; width: 88px; height: 88px; }
  #mandrider-btn { left: 108px; bottom: 21px; width: 82px; height: 78px; border-radius: 24px; }
  .mandrider-icon { font-size: 28px; }
  .mandrider-label { font-size: 10.5px; }
  .tower-emblem { width: 17px; height: 17px; }
  .tower-arrow { display: none; }
  .tower-face { gap: 3px; }
  .tower-label { font-size: 11.5px; } }

/* 세로가 짧은 PC 화면(1366×768 같은 노트북, 창을 반만 띄운 경우).
   메뉴는 아래끝이 고정이라 위로 자라는데, 그대로 두면 화면 위로 넘친다.
   메뉴와 탑 버튼을 같이 줄여서 둘 다 화면 안에 들어오게 한다.
   가로가 아니라 세로로 재는 게 핵심이다 — 겹침은 세로 문제였다. */
@media (min-width: 821px) and (max-height: 760px) {
  :root { --tower-space: 180px; }   /* 116 + 40 + 24 */
  #side-menu { gap: 5px; }
  #side-menu button { padding: 8px 16px 8px 12px; font-size: 16px; }
  #side-menu .sm-ico { font-size: 19px; }
  #tower-btn { width: 116px; height: 116px; bottom: 40px; }
  #mandrider-btn { left: 278px; bottom: 49px; width: 106px; height: 98px; }
  .tower-label { font-size: 15px; }
}
/* 더 짧으면(세로 640 아래) 한 번 더 줄인다. */
@media (min-width: 821px) and (max-height: 640px) {
  :root { --tower-space: 128px; }   /* 88 + 16 + 24 */
  #side-menu button { padding: 6px 14px 6px 10px; font-size: 14px; }
  #side-menu .sm-ico { font-size: 16px; }
  #tower-btn { width: 88px; height: 88px; bottom: 16px; }
  #mandrider-btn { left: 252px; bottom: 21px; width: 82px; height: 78px; }
  .tower-label { font-size: 11.5px; }
}
@media (max-width: 1100px) and (max-height: 760px) { #mandrider-btn { left: 154px; } }
@media (max-width: 820px) and (max-height: 760px) { #mandrider-btn { left: 108px; } }

/* ---------- 누적 판수 카드 (타이틀 오른쪽 빈 자리) ---------- */
/* 가운데 패널과 마주 보게 오른쪽에 둔다. 세로 가운데 정렬. */
#play-count {
  position: fixed; right: 96px; top: 50%; transform: translateY(-50%); z-index: 12;
  width: 300px; padding: 22px 26px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 70, 90, 0.10), rgba(20, 12, 20, 0.55));
  border: 1px solid rgba(255, 90, 110, 0.28);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  pointer-events: none;          /* 장식이라 클릭을 가로채지 않는다 */
}
.pc-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.22em;
  color: rgba(255, 140, 155, 0.9);
}
.pc-kicker::before {
  content: ''; display: inline-block; vertical-align: middle;
  width: 6px; height: 6px; margin-right: 8px; border-radius: 50%;
  background: #ff5f78; box-shadow: 0 0 8px #ff5f78;
}
.pc-num {
  margin-top: 10px;
  font-size: 44px; font-weight: 900; line-height: 1;
  color: #fff; font-variant-numeric: tabular-nums;
}
.pc-unit { margin-left: 6px; font-size: 20px; font-weight: 800; color: var(--muted); }
/* 언제부터 센 숫자인지. 날짜만 또렷하게 해서 '개근한 기간' 처럼 읽히게. */
.pc-sub {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; color: var(--muted);
}
#play-count-since {
  color: #ffb3c0; font-weight: 800; letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}


/* 투표 상자 — 누적 판수 카드 바로 위. 같은 폭·같은 결로 맞춰 한 덩어리로 읽히게.
   판수 카드가 화면 오른쪽 가운데 고정이라, 이건 그 위에 붙여 둔다. */
#poll-box {
  position: fixed; right: 96px; z-index: 12;
  /* 아래를 화면 한가운데보다 88px 위에 못 박는다. 판수 카드가 한가운데를
     기준으로 서 있으므로(높이 약 152px → 윗변이 76px 위), 이렇게 두면 이
     상자의 높이가 얼마든 겹치지 않는다. 처음엔 자기 높이를 어림해서
     밀었더니 내용이 늘자 11px 겹쳤다. */
  bottom: calc(50% + 88px);
  width: 300px; padding: 16px 18px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(79, 214, 255, 0.10), rgba(12, 16, 26, 0.55));
  border: 1px solid rgba(79, 214, 255, 0.26);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}
#poll-box.hidden { display: none; }
.poll-kicker {
  font-size: 12px; font-weight: 900; letter-spacing: 0.06em;
  color: #cfe9ff;
}
.poll-sub { margin-top: 3px; font-size: 11px; color: var(--muted); line-height: 1.4; }

/* 선택지. 막대가 뒤에 깔리고 이름·비율이 그 위에 얹힌다. */
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 8px;
  width: 100%; margin-top: 8px; padding: 9px 11px;
  border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.poll-opt:hover { border-color: rgba(79, 214, 255, 0.5); }
.poll-opt.on { border-color: rgba(79, 214, 255, 0.85); background: rgba(79, 214, 255, 0.12); }
.poll-bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(79, 214, 255, 0.22);
  transition: width 0.35s ease;
}
.poll-name { position: relative; flex: 1; }
.poll-pct { position: relative; color: #9fd8ff; font-variant-numeric: tabular-nums; }
.poll-foot { margin-top: 9px; font-size: 11px; color: var(--muted); }

/* 좁아지면 판수 카드와 같이 치운다(가운데 패널과 겹친다). */
@media (max-width: 1240px) { #poll-box { display: none; } }
:root.force-landscape #poll-box { display: none; }

/* 화면이 좁아지면 가운데 패널과 겹친다. 그 전에 치운다. */
@media (max-width: 1240px) { #play-count { display: none; } }
:root.force-landscape #play-count { display: none; }

/* 탑 화면 — 둥둥 뜬 땅이 아래(1층)부터 위로 이어지고, 그 위를 올라간다 */

/* ---------- 설정 창 ---------- */
.settings-card { width: min(460px, 94vw); max-height: 88vh; }
/* 제목이 첫 항목에 붙어 있으면 「설정 소리」 가 한 덩어리로 읽힌다. */
.settings-card .modal-head { margin-bottom: 18px; }
.settings-body { overflow-y: auto; max-height: calc(88vh - 108px); padding-right: 4px; }

.set-sec { margin-bottom: 22px; }
.set-sec h3 {
  font-size: 13px; font-weight: 900; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: 10px;
}
.set-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; font-size: 14px; font-weight: 700;
}
.set-row > span:first-child { width: 66px; flex: none; }
.set-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.set-row > b { width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
/* 배경음악을 꺼 둔 동안의 배경음 칸. 흐리게 두면 「지금은 안 쓰는 값」
   이라는 게 보인다 — 값 자체는 남아 있어 다시 켜면 그대로 돌아온다. */
.set-row.off { opacity: 0.45; }
.set-row input[type="range"]:disabled { cursor: not-allowed; }

.set-check { cursor: pointer; }
.set-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.set-check span { font-weight: 700; }
.set-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.set-warn { color: #ffb454; }

/* 배경음 고르기 — 세 칸이 폭을 나눠 갖는다 */
/* 전역 button 이 width:100% · margin-top:12px 이라, 설정 창의 작은 버튼들은
   따로 풀어 준다. 안 풀면 점프 키가 한 줄에 하나씩 세로로 쌓인다. */
.settings-body button { width: auto; margin-top: 0; padding: 8px 12px; font-size: 13px; }

.set-picks { display: flex; gap: 8px; margin-bottom: 10px; }
.set-picks .set-pick { flex: 1; }
.set-pick {
  flex: 1; padding: 9px 6px; border-radius: 10px;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.04);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer;
}
.set-pick:hover { border-color: rgba(79, 214, 255, 0.5); }
.set-pick.on { border-color: var(--accent); background: rgba(79, 214, 255, 0.14); color: #cfe9ff; }

.set-music { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-file, .set-clear {
  padding: 7px 12px; border-radius: 9px;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.05);
  color: var(--text); font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.set-clear { color: #ff8a9a; border-color: rgba(255, 90, 110, 0.35); }
/* 파일 이름이 길어도 줄을 밀어내지 않게 잘라 준다 */
.set-note {
  flex: 1; min-width: 0; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 점프 키 */
.set-keys { display: flex; gap: 8px; flex-wrap: wrap; }
/* 「아무 키나…」 가 들어가도 글자가 칸에 꽉 차지 않게 넉넉히 잡는다. */
.set-key {
  min-width: 156px; padding: 9px 12px; border-radius: 9px;
  white-space: nowrap;
  border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.06);
  color: var(--text); font-family: inherit; font-size: 13px; font-weight: 800;
  cursor: pointer;
}
.set-key:hover { border-color: rgba(79, 214, 255, 0.5); }
.set-key.waiting {
  border-color: var(--accent); background: rgba(79, 214, 255, 0.16);
  color: #eaf7ff; animation: setBlink 1.1s ease-in-out infinite;
}
/* 글자가 아니라 테두리만 숨 쉬게 한다. 글자를 흐리게 하면 정작 읽어야 할
   안내가 안 보인다. */
@keyframes setBlink {
  50% { border-color: rgba(79, 214, 255, 0.35); background: rgba(79, 214, 255, 0.07); }
}

#set-reset { width: 100%; margin-top: 4px; padding: 11px; font-size: 14px; }

/* ---------- 탑 오르기 — 고압 송전탑 ---------- */
/* 철탑 하나가 위로 이어지고, 깬 층까지 전류가 흐른다.
   층은 철탑에서 뻗은 가로대 끝의 명판이고 10층마다 구간 표지판이 붙는다.
   색은 강철(회청)과 통전(주황) 둘만 쓴다 — 게임의 붉은 전기선과 같은 계열. */

.tower-card { width: min(980px, 96vw); max-width: none; max-height: 94vh; }
.tower-meter {
  margin-left: auto; margin-right: 12px;
  font-size: 14px; font-weight: 900; letter-spacing: 0.08em; color: #ffb066;
}
.tower-hint { margin-top: 2px; }

.pylon-scroll {
  position: relative; margin-top: 14px;
  /* 카드(94vh) 에서 제목·안내·안쪽 여백(약 140px)을 뺀 만큼. 그냥 72vh 로
     두면 카드가 넘쳐 카드 자체에 스크롤이 하나 더 생기고, 그 바람에 맨
     아래 기초가 잘려 보이지 않았다. */
  height: min(calc(94vh - 150px), 760px); overflow-y: auto; overflow-x: hidden;
  border-radius: 14px;
  background:
    radial-gradient(130% 55% at 16% 0%, rgba(74, 100, 156, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(6, 8, 16, 0.92), rgba(10, 13, 24, 0.72));
  border: 1px solid rgba(120, 150, 200, 0.14);
  scroll-behavior: smooth;
}
/* 머리(완금·애자련·피뢰침)와 기초가 들어갈 자리를 위아래로 넉넉히 둔다 */
.pylon { position: relative; padding: 168px 22px 92px 206px; }

/* 철탑 그림 — pylon-art.js 가 명판 위치를 재서 그린다. 명판 뒤에 깔린다. */
.pylon-art { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }

/* 통전된 주각을 타고 오르는 전류. 대시 한 칸(3+56)만큼 밀어야 끊김 없이 이어진다. */
.py-flow { animation: pyFlow 0.9s linear infinite; }
@keyframes pyFlow { to { stroke-dashoffset: -59; } }
/* 통전 경계와 피뢰침 끝에서 깜박이는 불꽃 */
.py-spark { animation: pySpark 2.4s ease-in-out infinite; }
@keyframes pySpark { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .py-flow, .py-spark { animation: none; } }

/* 구간 표지판 — 10층마다. 왼쪽에 노랑·검정 빗금(실제 경고 명판처럼). */
.pz {
  position: relative; margin: 24px 0 24px -120px; padding: 10px 16px 10px 66px;
  border-radius: 8px; border: 1px solid rgba(150, 172, 210, 0.22);
  background: linear-gradient(90deg, rgba(24, 28, 42, 0.95), rgba(16, 20, 32, 0.7));
  display: flex; align-items: baseline; gap: 10px;
}
.pz::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 56px;
  border-radius: 7px 0 0 7px; opacity: 0.55;
  background: repeating-linear-gradient(-45deg, #f0b429 0 7px, #16181f 7px 14px);
}
.pz.lit::before { opacity: 1; }
.pz-range { font-size: 12.5px; font-weight: 900; letter-spacing: 0.1em; color: #ffb066; }
.pz-name { font-size: 16px; font-weight: 900; color: var(--text); }

/* 한 층 */
.pf { position: relative; height: 74px; display: flex; align-items: center; }

.pf-hit {
  position: relative; width: auto; margin: 0; padding: 0; border: 0;
  background: none; cursor: pointer; display: block; flex: 1;
}
.pf-hit:disabled { cursor: default; }

.pf-plate {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 13px 20px; border-radius: 10px;
  border: 1px solid rgba(150, 172, 210, 0.2);
  background: linear-gradient(140deg, rgba(30, 36, 52, 0.9), rgba(18, 22, 34, 0.75));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}
.pf-num {
  font-size: 22px; font-weight: 900; color: var(--text);
  min-width: 66px; text-align: left; letter-spacing: -0.02em;
}
.pf-num i { font-size: 13px; font-style: normal; opacity: 0.55; margin-left: 2px; }
.pf-goal { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--muted); text-align: left; line-height: 1.35; }

/* 오른쪽 끝 상태 배지 */
.pf-state {
  flex: none;
  font-size: 11.5px; font-weight: 900; letter-spacing: 0.04em;
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid rgba(150, 172, 210, 0.24); color: var(--muted);
}

/* 깬 층 — 전류가 흐른다 */
.pf.done .pf-plate { border-color: rgba(255, 150, 80, 0.32); background: linear-gradient(140deg, rgba(48, 34, 26, 0.85), rgba(22, 18, 26, 0.7)); }
.pf.done .pf-num { color: #ffc490; }
.pf.done .pf-goal { color: #d09a6a; }
.pf.done .pf-state { color: #ffb066; border-color: rgba(255, 150, 80, 0.4); }

/* 잠긴 층 — 전기가 안 들어온 강철 */
.pf.lock { opacity: 0.4; }
.pf.lock .pf-plate { background: rgba(16, 19, 28, 0.6); }

/* 아직 안 내놓은 층 — 목록에는 보이되 들어갈 수 없다. 잠긴 층과 헷갈리지
   않게 점선을 쓴다. 잠김은 "언젠가 내가 열 수 있는 것", 준비 중은
   "아직 만드는 중인 것" 이라 성격이 다르다. */
.pf.soon { opacity: 0.32; }
.pf.soon .pf-plate { background: rgba(16, 19, 28, 0.5); border-style: dashed; }
.pf.soon .pf-state { border-style: dashed; }
.pz.soon { opacity: 0.5; }
.pz-soon {
  margin-left: auto; font-size: 11px; font-weight: 800;
  letter-spacing: 0.04em; color: var(--muted);
}

/* 지금 도전할 층 */
.pf.here .pf-plate {
  border-color: rgba(255, 200, 120, 0.6);
  background: linear-gradient(140deg, rgba(62, 44, 26, 0.95), rgba(28, 22, 30, 0.8));
  box-shadow: 0 0 0 1px rgba(255, 190, 110, 0.25), 0 10px 30px rgba(255, 130, 50, 0.16);
}
.pf.here .pf-num { color: #ffd9a1; }
.pf.here .pf-goal { color: #ffc07a; }
.pf.here .pf-state { color: #12151f; background: #ffc07a; border-color: transparent; }
.pf-hit:not(:disabled):hover .pf-plate { transform: translateX(4px); border-color: rgba(255, 190, 110, 0.5); }

/* 지금 층 명판에 서 있는 내 캐릭터. 겹쳐 놓으면 상태 배지를 가려서
   목록의 한 칸으로 끼워 넣는다. */
.pf-me {
  flex: none; width: 44px; height: 44px; margin: -8px 2px -8px 0;
  pointer-events: none; filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.6));
}

/* 좁은 화면 — 철탑이 가로를 많이 먹어 글씨가 잘게 쪼개진다. 철탑 자리를
   줄인다. 그림은 이 폭에 맞춰 가늘게 그려지고 애자는 빠진다. '아래부터
   통전된다'는 핵심은 가는 철탑으로도 그대로 읽힌다. */
@media (max-width: 720px) {
  .pylon { padding: 104px 12px 58px 68px; }
  .pf { height: 58px; }
  .pf-plate { padding: 8px 10px; gap: 8px; border-radius: 8px; }
  .pf-num { font-size: 16px; min-width: 42px; }
  .pf-num i { font-size: 10px; }
  .pf-goal { font-size: 11px; line-height: 1.3; }
  .pf-state { font-size: 10px; padding: 3px 7px; }
  .pf-me { width: 28px; height: 28px; margin: -4px 0; }
  .pz { margin: 14px 0 14px -48px; padding: 7px 10px 7px 38px; gap: 7px; flex-wrap: wrap; }
  .pz::before { width: 30px; }
  .pz-range { font-size: 10.5px; }
  .pz-name { font-size: 13px; }
}
/* 더 좁으면(회전한 폰) 상태 배지까지 뺀다 — 색만으로도 구분된다 */
@media (max-width: 480px) {
  .pylon { padding-left: 58px; }
  .pf.lock .pf-state, .pf.done .pf-state { display: none; }
  .pf-goal { font-size: 10.5px; }
}


/* ---------- 새 소식 알림 ---------- */
/* 접속하면 한 번 뜨는 창. 평소 카드보다 넉넉히 잡아 「새로 생겼다」 가
   한눈에 들어오게 한다. 대신 바깥을 누르면 바로 닫힌다. */
.promo-card {
  width: min(820px, 94vw); max-width: none;
  text-align: center; padding: 34px 38px 26px;
  border-color: rgba(255, 170, 90, 0.4);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 140, 60, 0.16), transparent 62%),
    var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 170, 90, 0.14);
}
/* 카드가 세로 flex 라 inline-block 만으로는 가로로 늘어난다. */
.promo-badge {
  align-self: center;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 900; letter-spacing: 0.18em;
  color: #12151f; background: linear-gradient(135deg, #ffd9a1, #ff9d4d);
}
.promo-title {
  margin: 14px 0 0; font-size: 34px; font-weight: 900; letter-spacing: -0.02em;
  color: #fff; text-shadow: 0 0 26px rgba(255, 150, 70, 0.45);
}
.promo-lead { margin: 12px 0 0; font-size: 14px; font-weight: 700; line-height: 1.7; color: var(--muted); }

/* 철탑 한 컷. 탑 오르기 창에 쓰는 것과 같은 격자·머리·기초를 그대로 쓴다
   — 알림에서 본 그림이 창을 열었을 때 또 나와야 같은 것이라고 읽힌다.
   전류가 아래에서 위로 차오르는 것이 이 모드가 하는 일 그 자체다. */
.promo-art {
  position: relative; margin: 24px auto 0;
  width: 100%; max-width: 440px; height: 178px;
}

/* 만드라이더 알림 그림 — 멀어지는 노면과 그 위의 화분 카트. 탑 그림과 같은
   자리를 쓰되, 이쪽은 「달린다」 는 것만 읽히면 된다. */
.promo-road {
  position: absolute; inset: 10px 0 8px; margin: 0 auto; width: 100%; max-width: 330px;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,.9) 0 16px, transparent 16px 40px) center / 5px 100% no-repeat,
    linear-gradient(#333a3f, #14181b);
  clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}
.promo-kart { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: 78px; height: 78px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)); }

/* 기둥 — 칸마다 X 브레이스, 칸 경계마다 가로 브레이스, 좌우 주각.
   무늬는 아래를 기준으로 쌓아야 차오르는 전류와 격자가 안 어긋난다. */
.promo-tower {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: 58px; bottom: 18px; width: 104px;
  --panel: 30px;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1.2px),
      rgba(150, 174, 214, 0.5) calc(50% - 1.2px) calc(50% + 1.2px), transparent calc(50% + 1.2px)),
    linear-gradient(to bottom left, transparent calc(50% - 1.2px),
      rgba(150, 174, 214, 0.5) calc(50% - 1.2px) calc(50% + 1.2px), transparent calc(50% + 1.2px)),
    linear-gradient(180deg, rgba(150, 174, 214, 0.3) 0 2px, transparent 2px),
    linear-gradient(90deg,
      rgba(198, 218, 248, 0.8) 0 3px, rgba(86, 104, 138, 0.6) 3px 5px,
      rgba(10, 13, 22, 0.25) 5px calc(100% - 5px),
      rgba(86, 104, 138, 0.6) calc(100% - 5px) calc(100% - 3px),
      rgba(198, 218, 248, 0.8) calc(100% - 3px) 100%);
  background-size: 100% var(--panel), 100% var(--panel), 100% var(--panel), 100% 100%;
  background-position: 0 100%;
  background-repeat: repeat, repeat, repeat, no-repeat;
}

/* 아래에서 차오르는 전류. 같은 격자를 주황으로 다시 그린다. */
.promo-rise {
  position: absolute; left: 0; right: 0; bottom: 0; height: 0;
  --panel: 30px;
  background:
    linear-gradient(180deg, rgba(255, 140, 60, 0) 0%, rgba(255, 115, 45, 0.28) 100%),
    linear-gradient(to bottom right, transparent calc(50% - 1.4px),
      rgba(255, 190, 126, 0.85) calc(50% - 1.4px) calc(50% + 1.4px), transparent calc(50% + 1.4px)),
    linear-gradient(to bottom left, transparent calc(50% - 1.4px),
      rgba(255, 190, 126, 0.85) calc(50% - 1.4px) calc(50% + 1.4px), transparent calc(50% + 1.4px)),
    linear-gradient(180deg, rgba(255, 190, 126, 0.5) 0 2px, transparent 2px),
    linear-gradient(90deg, rgba(255, 212, 158, 0.95) 0 3px, transparent 3px calc(100% - 3px),
      rgba(255, 212, 158, 0.95) calc(100% - 3px) 100%);
  background-size: 100% 100%, 100% var(--panel), 100% var(--panel), 100% var(--panel), 100% 100%;
  background-position: 0 100%;
  background-repeat: no-repeat, repeat, repeat, repeat, no-repeat;
  border-top: 2px solid rgba(255, 210, 160, 0.95);
  box-shadow: 0 0 26px rgba(255, 120, 50, 0.5);
  animation: promoRise 3.4s cubic-bezier(0.5, 0, 0.4, 1) infinite;
}
/* 끝까지 차오르면 잠깐 머물렀다가, 안 보이는 사이에 바닥으로 돌아간다. */
@keyframes promoRise {
  0%   { height: 0; opacity: 1; }
  62%  { height: 100%; opacity: 1; }
  86%  { height: 100%; opacity: 1; }
  100% { height: 100%; opacity: 0; }
}

/* 머리 — 피뢰침과 가로대 둘. 위가 짧고 아래가 길다(실제 송전탑 순서). */
.promo-tip {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 3px; height: 26px;
  background: linear-gradient(180deg, rgba(214, 232, 255, 0.95), rgba(150, 174, 214, 0.35));
}
.promo-tip::after {
  content: ''; position: absolute; left: 50%; top: -5px; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: #ffd9a1; box-shadow: 0 0 12px 3px rgba(255, 170, 90, 0.75);
  animation: promoBlink 3.4s ease-in-out infinite;
}
@keyframes promoBlink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.promo-arm {
  position: absolute; left: 50%; transform: translateX(-50%);
  height: 4px; border-radius: 2px;
  background: linear-gradient(180deg, rgba(206, 226, 255, 0.9), rgba(118, 140, 180, 0.7));
}
/* 가로대 양 끝에 매달린 애자 */
.promo-arm::before, .promo-arm::after {
  content: ''; position: absolute; top: 4px; width: 5px; height: 11px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(180deg, rgba(180, 200, 232, 0.8), rgba(96, 116, 150, 0.45));
}
.promo-arm::before { left: 7px; }
.promo-arm::after { right: 7px; }
.promo-arm.a1 { top: 24px; width: 148px; }
.promo-arm.a2 { top: 42px; width: 196px; }

/* 기초 — 기둥이 허공에서 잘리지 않게 받쳐 준다. */
.promo-base {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 4px; width: 142px; height: 14px;
  border-radius: 3px; border: 1px solid rgba(150, 168, 200, 0.35);
  background: linear-gradient(180deg, #717a90 0%, #4b5367 45%, #2b3140 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

/* 움직임을 줄여 달라고 한 사람에게는 끝까지 차오른 모습만 보여 준다. */
@media (prefers-reduced-motion: reduce) {
  .promo-rise { animation: none; height: 100%; }
  .promo-tip::after { animation: none; opacity: 1; }
}
.promo-foot { margin: 22px 0 0; font-size: 13px; font-weight: 700; color: #ffc07a; }
.promo-card .promo-go { margin-top: 20px; }
.promo-acts { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.promo-acts button { width: auto; margin: 0; padding: 8px 14px; font-size: 12px; }

@media (max-width: 640px) {
  .promo-card { padding: 26px 20px 20px; }
  .promo-title { font-size: 25px; }
  .promo-lead { font-size: 12.5px; }
  .promo-art { height: 132px; max-width: 300px; }
  .promo-tower { top: 34px; width: 84px; --panel: 28px; }
  .promo-rise { --panel: 28px; }
  .promo-arm.a1 { top: 22px; width: 116px; }
  .promo-arm.a2 { top: 38px; width: 154px; }
  .promo-tip { height: 22px; }
  .promo-base { width: 116px; height: 12px; }
  .promo-acts { flex-wrap: wrap; }
}


/* 봇전 | 온라인 1v1 을 반반 나눠 놓는 줄 */
.split-row { display: flex; gap: 10px; margin-top: 10px; }
.split-row > button { flex: 1 1 0; margin: 0; min-width: 0; }

/* 봇전 난이도 고르기 */
.bot-tier-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.bot-tier {
  width: 100%; margin: 0; padding: 12px 14px; font-weight: 800; font-size: 15px;
  color: var(--text); background: rgba(120, 170, 255, 0.1);
  border: 1px solid rgba(120, 170, 255, 0.4); border-radius: 12px; cursor: pointer;
}
.bot-tier:hover { background: rgba(120, 170, 255, 0.2); }

/* 봇전 결과 */
.bot-result-face { font-size: 48px; margin: 6px 0; }
.bot-result-row { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.bot-result-row button { margin: 0; }

.hc-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 12px; width: 100%; padding: 9px 14px;
  border: 1px solid rgba(255, 90, 110, 0.32); border-radius: 12px;
  background: rgba(255, 60, 80, 0.06); color: #ffb1bc;
  font: inherit; font-weight: 700; letter-spacing: 0.2px;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.hc-toggle:hover { background: rgba(255, 60, 80, 0.12); }
.hc-toggle .hc-state {
  font-size: 0.78em; opacity: 0.8; padding: 1px 7px;
  border: 1px solid currentColor; border-radius: 7px;
}
.hc-toggle.on {
  border-color: #ff4d5e; color: #fff;
  background: linear-gradient(180deg, rgba(255,70,90,0.28), rgba(255,50,70,0.16));
  box-shadow: 0 0 18px rgba(255, 60, 80, 0.4), inset 0 0 12px rgba(255,80,100,0.18);
}
.hc-toggle.on .hc-state { opacity: 1; background: rgba(255,255,255,0.14); }
.hc-hint {
  margin: 6px 2px 0; text-align: center;
  font-size: 12px; line-height: 1.4; color: #d79aa3;
}
.hc-hint .dim { opacity: 0.7; }

/* ── 공지 배너 (타이틀 상단, 관리자가 쓴 한 줄 공지) ───────────────── */
#notice-banner {
  position: fixed;
  top: calc(80px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  max-width: min(1200px, 94vw);
  padding: 10px 26px;
  border: 1px solid rgba(255, 120, 140, 0.6);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 74, 94, 0.24), rgba(210, 40, 60, 0.18));
  color: #ffe6ea;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  z-index: 34;
  box-shadow: 0 6px 22px rgba(255, 60, 80, 0.22), 0 6px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
}
#notice-banner::before { content: "📢 "; opacity: 0.9; }

/* 공지 안의 @아이디 링크(인스타). 밑줄 없이 파란 글씨로 — 배너가 붉은 계열이라
   파랑이 그대로 튀어 눌러야 할 곳으로 읽힌다. 색은 게임이 쓰는 파랑(플레이어
   라벨·후광과 같은 값)을 그대로 쓴다.
   배너가 반투명이라 뒤 배경에 따라 묻힐 수 있어 옅은 그림자를 깔아 둔다.
   손가락으로 누를 자리를 넓히려고 여백을 조금 준다. */
#notice-banner a.notice-link {
  color: #4fd6ff;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  padding: 2px 1px;
  border-radius: 4px;
}
#notice-banner a.notice-link:hover,
#notice-banner a.notice-link:focus-visible {
  color: #8ce6ff;
  background: rgba(79, 214, 255, 0.16);
}
/* 공지 작성 모달의 버튼 묶음 오른쪽 정렬 */
#notice-modal .board-write-row > div { display: flex; gap: 8px; }

/* 공지 입력칸(공지 1~4) */
.notice-fields { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.notice-field { display: flex; align-items: center; gap: 10px; }
.notice-field > span { flex: none; width: 44px; font-size: 12px; font-weight: 800; color: var(--muted); }
.notice-field input {
  flex: 1; width: auto; margin: 0; padding: 9px 11px;
  font: inherit; font-size: 14px; color: var(--text);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--stroke); border-radius: 8px;
}
.notice-field input:focus { border-color: var(--accent); outline: none; }

/* ---------- 상점 (코인으로 사는 꾸미기) ---------- */
.shop-card { width: min(880px, calc(100vw - 40px)); max-height: 88vh; }
:root.force-landscape #shop-modal .modal-card,
:root.force-landscape .shop-card { width: min(760px, calc(100vh - 56px)); max-height: 78vw; }

.shop-coins {
  margin-left: auto; margin-right: 6px;
  font-size: 15px; color: #ffd76a; white-space: nowrap;
}

.shop-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-top: 14px;
}
@media (max-width: 760px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 460px) { .shop-grid { grid-template-columns: repeat(2, 1fr); } }
:root.force-landscape .shop-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }

.shop-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  margin: 0; padding: 13px 9px 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke); border-radius: 14px;
  color: var(--text); font: inherit; text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.shop-item:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-2px); }
/* 켠 것은 테두리를 밝혀 한눈에 보이게 */
.shop-item.on { border-color: var(--accent); background: rgba(90, 200, 255, 0.12); }
.shop-item.locked { opacity: 0.82; }

/* 효과 색 미리보기 막대. 그 효과가 무슨 색인지 사기 전에 보여 준다. */
.shop-swatch {
  width: 100%; height: 34px; border-radius: 9px;
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.28);
}
.shop-swatch.none {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.06); color: var(--muted); font-size: 16px;
  box-shadow: none;
}

.shop-name { font-size: 14px; font-weight: 800; }
.shop-desc { font-size: 11px; line-height: 1.35; color: var(--muted); min-height: 30px; }
.shop-state { font-size: 12px; font-weight: 700; color: var(--accent); }
.shop-state.dim { color: var(--muted); font-weight: 600; }
.shop-cost { font-size: 13px; font-weight: 800; color: #ffd76a; }
.shop-cost.short { color: #ff7a8a; }

/* 구매 결과 알림 — 화면 아래에 잠깐 떴다 사라진다 */
.shop-toast {
  position: fixed; left: 50%; bottom: 42px; z-index: 90;
  padding: 11px 20px; border-radius: 999px;
  background: rgba(16, 18, 32, 0.94); border: 1px solid var(--stroke);
  color: var(--text); font-size: 14px; font-weight: 700;
  transform: translate(-50%, 14px); opacity: 0;
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
}
.shop-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* 준비 중 안내는 화면 한가운데에 크게. 아래쪽 토스트는 놓치기 쉽다. */
.shop-toast.center {
  top: 50%; bottom: auto;
  padding: 18px 34px;
  font-size: 18px; letter-spacing: 0.01em;
  background: rgba(14, 16, 28, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  /* 아래에서 살짝 떠오르며 나타난다 */
  transform: translate(-50%, calc(-50% + 12px));
}
.shop-toast.center.show { transform: translate(-50%, -50%); }

/* 상점 항목 탭 — 랭킹 탭과 같은 생김새로 맞춘다(같은 역할이니 같아 보여야 한다) */
.shop-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
}
.shop-tabs button {
  /* 전역 button 은 width:100% 라 그대로 두면 탭이 한 줄씩 꽉 차게 늘어난다 */
  width: auto; flex: 0 0 auto;
  margin: 0; padding: 7px 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke); border-radius: 999px;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.shop-tabs button:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.shop-tabs button.current {
  background: rgba(90, 200, 255, 0.16);
  border-color: var(--accent); color: var(--text);
}
.shop-hint { margin-top: 10px; }
:root.force-landscape .shop-tabs { gap: 6px; margin-top: 10px; }
:root.force-landscape .shop-tabs button { padding: 6px 12px; font-size: 12px; }

/* ---------- 세로가 짧은 가로 화면 (안드로이드 폰을 눕혔을 때) ---------- */
/*
   PC 배치(왼쪽 메뉴 · 가운데 패널 · 왼쪽 아래 탑)는 그대로 두고 크기만 줄인다.
   문제는 높이다 — 갤럭시를 눕히면 CSS 로 약 915×412 인데, 타이틀 패널이 한 줄로
   서면 570px 이 넘어 화면 밖으로 넘치고, 그 바람에 메뉴·공지·탑 버튼이 죄다
   패널 위로 겹쳐 보인다.

   아이폰용 압축 규칙(:root.force-landscape)이 이미 있지만 그건 '화면을 돌린'
   상태 전용이다. 안드로이드는 진짜 가로라 그 클래스가 안 붙는다. 그래서 화면
   생김새(가로 + 낮은 높이)로만 판정하는 규칙을 따로 둔다. 데스크톱은 보통
   520px 보다 높아 안 걸리고, 아이폰 강제가로는 뷰포트가 세로라 안 걸린다. */
@media (orientation: landscape) and (max-height: 520px) {
  /* 왼쪽에 메뉴 자리를 비워 두고, 위아래 여백을 줄인다 */
  .screen { padding: 44px 14px 10px 150px; gap: 10px; }

  /* 메뉴는 위에서부터 자란다. 가운데 정렬(top:54%)로 두면 항목이 늘 때마다
     아래로 밀려 내려와 탑 버튼과 부딪힌다 — 실제로 '상점'이 늘면서 겹쳤다.
     line-height 를 못 박는 게 중요하다. 안 정하면 브라우저마다 버튼 줄높이가
     달라져(1.2~1.6) 메뉴 높이가 6항목 기준 100px 넘게 벌어진다. */
  #side-menu {
    top: 46px; bottom: auto; transform: none;
    left: 10px; padding-left: 14px; gap: 3px;
  }
  #side-menu button {
    padding: 5px 9px; gap: 8px;
    font-size: 12.5px; line-height: 1.25;
  }
  #side-menu .sm-ico { font-size: 14px; line-height: 1.25; }

  /* 공지는 위에 바짝, 한 줄로 */
  #notice-banner {
    top: calc(6px + env(safe-area-inset-top));
    max-width: 62vw; padding: 5px 14px; font-size: 11px;
  }

  /* 패널을 두 칸으로 접어 높이를 반으로 줄인다. 한 칸으로 두면 어떤 크기를
     써도 412px 안에 안 들어간다. */
  #title-screen .panel {
    width: min(600px, 100%);
    padding: 12px 16px; border-radius: 14px;
    column-count: 2; column-gap: 18px;
  }
  #title-screen .panel > * { break-inside: avoid; }
  #title-screen .logo { font-size: 26px; column-span: all; }
  #title-screen .tagline { margin-top: 4px; font-size: 11px; line-height: 1.35; }
  #title-screen button { margin-top: 7px; padding: 9px; font-size: 13px; border-radius: 10px; }
  #title-screen .field { margin-top: 8px; }
  #title-screen .account-row { margin-top: 4px; }
  #title-screen .bottom-row { margin-top: 8px; padding-top: 8px; gap: 6px; flex-direction: column; }
  #title-screen .controls div { font-size: 10px; }
  #title-screen .voice-panel { width: 100%; padding: 7px; }
  #title-screen .install-btn { margin-top: 7px; padding: 8px; font-size: 12px; }
  #title-screen .legal-links { margin-top: 7px; font-size: 11px; }

  /* 탑 버튼은 메뉴 아래 구석으로. 작게 줄여야 패널과 안 부딪힌다. */
  #tower-btn { left: 8px; bottom: 6px; width: 66px; height: 66px; }
  .tower-label { font-size: 10px; }

  /* --- 세로가 짧은 가로 화면의 창(모달) --- */
  /* 게시판 카드는 스스로 스크롤하지 않는다(overflow:hidden). 머리글·탭·쓰기칸을
     위에 고정하고 목록만 남은 자리에서 굴리는 구조라, 세로가 412px 밖에 안 되면
     고정 부분이 카드를 다 먹어 목록 높이가 0 으로 눌린다. 그러면 굴릴 게 없어
     '아래로 스크롤이 안 되는' 상태가 된다. 카드를 키우고 고정 부분을 줄인다. */
  .modal { padding: 10px; }
  /* dvh 를 쓴다. 안드로이드 크롬에서 vh 는 '주소창이 숨겨진' 큰 화면을 재기
     때문에, vh 로 잡으면 카드가 실제로 보이는 높이보다 커져 아래쪽이 화면
     밖으로 잘린다. 잘린 자리에 목록 아랫부분과 스크롤 여지가 통째로 들어가
     '아래로 안 내려가는' 상태가 된다. dvh 는 지금 보이는 높이를 잰다.
     구형 브라우저용으로 vh 를 먼저 두고, 지원하면 dvh 가 이긴다. */
  .modal-card { max-height: 94vh; max-height: 94dvh; }
  #board-modal .modal-card { max-height: 94vh; max-height: 94dvh; }
  #board-modal .modal-head h2 { font-size: 17px; }
  .board-tabs { margin-top: 8px; padding-bottom: 4px; gap: 6px; }
  .board-write { margin: 8px 0; padding: 8px; }
  .board-write textarea { min-height: 62px; font-size: 13px; }
  .board-comment-form textarea { min-height: 52px; }
  /* 목록에 최소 높이를 준다. 고정 부분이 예상보다 커져도 목록이 통째로
     사라지지 않고, 그 안에서 굴릴 수 있게 남는다. */
  #board-modal .board-list,
  #board-modal .board-detail { min-height: 96px; }
  /* vh 로 잡힌 안쪽 목록들은 flex 가 높이를 정하게 풀어 준다 */
  .board-list, .patch-list { max-height: none; }
}

/* ---------- 강제 가로(아이폰)도 갤럭시와 같은 정리 ---------- */
/*
   아이폰은 화면을 90도 돌려 쓴다(:root.force-landscape). 그래서 바로 위의
   '세로가 짧은 가로 화면' 미디어쿼리가 안 걸린다 — 뷰포트는 여전히 세로라
   orientation:landscape 가 거짓이기 때문이다. 같은 처방을 여기 한 번 더 쓴다.

   돌린 화면에서는 세로·가로 축이 바뀐다. '세로 높이'는 100vw 다.
   아이폰 14 기준 돌린 무대는 약 844×390 이라 갤럭시(915×412)와 거의 같다. */

/* 메뉴는 위에서부터 자란다. 가운데 정렬로 두면 항목이 늘 때마다 아래로 밀려
   내려와 왼쪽 아래 탑 버튼과 겹친다('상점'이 늘면서 실제로 겹쳤다). */
:root.force-landscape #side-menu {
  top: 44px; bottom: auto; transform: none;
  left: max(10px, env(safe-area-inset-top));
  padding-left: 13px; gap: 3px;
}
:root.force-landscape #side-menu button {
  padding: 5px 9px; gap: 8px;
  font-size: 12.5px; line-height: 1.25;
}
:root.force-landscape #side-menu .sm-ico { font-size: 14px; line-height: 1.25; }

/* 탑 버튼은 왼쪽 아래 구석에 작게 */
:root.force-landscape #tower-btn { left: 8px; bottom: 6px; width: 66px; height: 66px; }
:root.force-landscape .tower-label { font-size: 10px; }

/* 공지는 위에 바짝 붙이고 한 줄로. 패널이 그 아래에서 시작하게 위 여백을 맞춘다. */
:root.force-landscape #notice-banner {
  top: 6px;
  max-width: min(560px, 66vh);
  padding: 5px 14px;
  font-size: 11px;
}
:root.force-landscape .screen {
  padding: 42px 14px 10px max(152px, calc(env(safe-area-inset-top) + 140px));
  gap: 10px;
}

/* 창(모달) — 돌린 화면의 '세로 높이'는 100vw 다. dvw 는 지금 실제로 보이는
   폭을 재므로, 주소창이 걸쳐 있어도 창이 화면 밖으로 넘치지 않는다. */
:root.force-landscape .modal { padding: 10px; }
:root.force-landscape .modal-card { max-height: 92vw; max-height: 92dvw; }
:root.force-landscape #board-modal .modal-card { max-height: 92vw; max-height: 92dvw; }
:root.force-landscape #board-modal .modal-head h2 { font-size: 17px; }
:root.force-landscape .board-tabs { margin-top: 8px; padding-bottom: 4px; gap: 6px; }
:root.force-landscape .board-write { margin: 8px 0; padding: 8px; }
:root.force-landscape .board-write textarea { min-height: 62px; font-size: 13px; }
:root.force-landscape .board-comment-form textarea { min-height: 52px; }
/* 목록이 0 으로 눌려 굴릴 게 없어지는 걸 막는다 */
:root.force-landscape #board-modal .board-list,
:root.force-landscape #board-modal .board-detail { min-height: 96px; }
:root.force-landscape .board-list,
:root.force-landscape .patch-list { max-height: none; }

/* 경기장 스킨 카드 — 미리보기가 작은 무대 그림이라 크게 보여 준다.
   설명 글이 빠진 자리를 그림이 대신 채운다. */
.shop-item.tall .shop-swatch { height: 74px; box-shadow: none; }
.shop-item.tall { gap: 7px; }
/* 좁은 화면에선 조금 낮춘다 */
@media (max-width: 460px) { .shop-item.tall .shop-swatch { height: 60px; } }

/* ---------- 밝은 무대(설원)에서의 HUD ---------- */
/* 눈밭과 흰 하늘 위에서는 흐린 회색 글씨가 그대로 묻힌다. 색을 어둡게
   뒤집고, 흰 테두리를 둘러 어느 밝기 위에서도 읽히게 한다.
   (테두리는 그림자 네 방향 — text-stroke 는 사파리에서 글자가 얇아진다.) */
:root.light-arena #best-inline {
  color: #1b2430;
  font-weight: 700;
  text-shadow:
     1px 0 2px rgba(255, 255, 255, 0.9), -1px 0 2px rgba(255, 255, 255, 0.9),
     0 1px 2px rgba(255, 255, 255, 0.9),  0 -1px 2px rgba(255, 255, 255, 0.9);
}
:root.light-arena #timer {
  color: #16202c;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.95), 0 2px 10px rgba(255, 255, 255, 0.8);
}
:root.light-arena #stage-label {
  color: #0d4256;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.95);
}

/* ---------- 랭킹 창: 아이폰 강제 가로 ---------- */
/*
   #rank-modal .modal-card 의 width:100vw / max-height:90vh 는 ID 선택자라
   회전용 규칙(:root.force-landscape .modal-card)을 이긴다. 화면을 90도 돌린
   상태에서 100vw 는 폰의 '짧은 쪽', 90vh 는 '긴 쪽' 이라, 카드가 좁고 지나치게
   길어져 위쪽(제목·버티기/하드코어 탭)이 화면 밖으로 잘려 나갔다.
   갤럭시가 멀쩡했던 건 진짜 가로여서 90vh 가 그대로 맞아떨어졌기 때문이다.

   회전 뒤의 가로 폭은 100vh, 세로 높이는 100vw 다. dvw 는 주소창까지 반영한다.
*/
:root.force-landscape #rank-modal .modal-card {
  width: min(960px, calc(100vh - 56px));
  max-height: 92vw;
  max-height: 92dvw;
  padding: 12px 16px 14px;
}
/* 목록을 내려도 탭과 닫기 버튼은 늘 손 닿는 곳에 있어야 한다 */
:root.force-landscape #rank-modal .modal-head,
:root.force-landscape #rank-modal .rank-tabs {
  position: sticky;
  z-index: 2;
  flex: none;
  background: var(--panel);
}
:root.force-landscape #rank-modal .modal-head { top: 0; padding-bottom: 6px; }
:root.force-landscape #rank-modal .rank-tabs { top: 38px; padding-bottom: 6px; }
:root.force-landscape #rank-modal .modal-head h2 { font-size: 17px; }
:root.force-landscape .rank-tabs button { padding: 6px 12px; font-size: 12.5px; }
:root.force-landscape #rank-note { margin-top: 6px; font-size: 11px; }

/* 룰렛으로만 얻는 항목 — 값 대신 이걸 띄운다 */
.shop-cost.roul { color: #c9b6ff; }

/* 발자국 효과 카드의 단계 표시 */
.shop-lv {
  font-size: 11.5px; font-weight: 800; color: #ffd76a;
}
.shop-lv em { font-style: normal; font-weight: 600; color: var(--muted); }

/* 발자국 효과 단계 고르는 창 */
.lv-card { width: min(360px, calc(100vw - 40px)); }
.lv-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.lv-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 0; padding: 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke); border-radius: 12px;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: background 0.14s, border-color 0.14s;
}
.lv-row:hover:not([disabled]) { background: rgba(255, 255, 255, 0.09); }
.lv-row.on { border-color: var(--accent); background: rgba(90, 200, 255, 0.14); }
.lv-row.locked { opacity: 0.5; cursor: default; }
.lv-num { font-size: 15px; font-weight: 800; white-space: nowrap; }
.lv-note { flex: 1; font-size: 12px; color: var(--muted); }
.lv-state { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.lv-row.locked .lv-state { color: var(--muted); }

/* 누적 판수 카드의 '지금 접속자'. 살아 있는 숫자라 초록으로, 점은 깜빡인다. */
/* 카드 맨 윗줄: 왼쪽에 제목, 오른쪽에 지금 접속자 */
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pc-online {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.14em;
  color: #3fe08a; white-space: nowrap;
}
.pc-online::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #3fe08a; box-shadow: 0 0 8px #3fe08a;
  animation: onlinePulse 2s ease-in-out infinite;
}
@keyframes onlinePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.8); }
}

/* 다시보기가 실제 판과 다르게 흘러가는 옛 기록을 표시한다.
   (이동 입력을 float32 로 깎기 전에 저장된 것들 — 되살릴 방법이 없다.) */
.replay-warn {
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #ffcf8a;
  background: rgba(255, 170, 60, 0.14);
  border: 1px solid rgba(255, 170, 60, 0.3);
}

/* ---------- 도전모드 진행 줄 ---------- */
/* 타이머 아래에 한 줄로. 지금 몇 층이고 뭘 얼마나 했는지만 담는다.
   판 중에 읽어야 하는 정보라 눈이 덜 가게 작고 차분하게 둔다. */
#challenge-hud {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
  pointer-events: none;
}
#challenge-hud b { color: #ffd9a1; font-weight: 900; }   /* 층수는 탑 버튼과 같은 주황 */
#challenge-hud i { font-style: normal; color: var(--text); }
#challenge-hud i.low { color: var(--volt); }             /* 점프가 얼마 안 남았을 때 */
#challenge-hud .sep { margin: 0 7px; opacity: 0.45; }

@media (max-width: 820px) {
  #challenge-hud { font-size: 11.5px; }
  #challenge-hud .sep { margin: 0 5px; }
}
