/* 난리부르스 — 운동회 날 스티커 같은 화면 */
:root {
  --ink: #14213d;
  --chalk: #fffdf6;
  --track: #e8503a;
  --sun: #ffc93c;
  --field: #2f9e62;
  --sky: #8fd3ff;
  --font: 'Jua', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', sans-serif;
  --gl: max(16px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
  --gt: max(12px, env(safe-area-inset-top, 0px));
  --gb: max(14px, env(safe-area-inset-bottom, 0px));
}

html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: #8fd3ff;
  color: #14213d;
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  position: relative;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
  color: var(--ink);
  background: var(--sky);
}
#app *,
#app *::before,
#app *::after {
  box-sizing: border-box;
}
#app [hidden] {
  display: none !important;
}
:where(#app) button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

#gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 사진기 렌즈처럼 화면 가장자리가 살짝 어둡다 (움직이지 않는 한 장이라 가볍다) */
#vig {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(18, 24, 46, 0) 52%, rgba(18, 24, 46, 0.3) 100%);
}

/* 조이스틱 */
#joy {
  position: absolute;
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  border: 3px solid rgba(20, 33, 61, 0.55);
  background: rgba(255, 253, 246, 0.28);
  pointer-events: none;
  z-index: 3;
}
#joyKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--sun);
  border: 3px solid var(--ink);
  transform: translate(-50%, -50%);
}

/* 공통 조각 */
.card {
  background: var(--chalk);
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink);
  padding: 16px;
}
.btn {
  display: block;
  width: 100%;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--sun);
  box-shadow: 0 5px 0 var(--ink);
  font-size: 22px;
  line-height: 1;
  padding: 15px 14px;
  transition: transform 0.06s, box-shadow 0.06s;
}
.btn:active,
.btn.on {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn.red {
  background: var(--track);
  color: var(--chalk);
}
.btn.plain {
  background: var(--chalk);
}
.btn.small {
  width: auto;
  font-size: 17px;
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--ink);
}

/* 겹쳐 놓는 화면 */
.layer {
  position: absolute;
  inset: 0;
  padding: var(--gt) var(--gr) var(--gb) var(--gl);
  z-index: 5;
}
.hud {
  pointer-events: none;
}
.hud > * {
  pointer-events: auto;
}

/* 첫 화면 */
#scrTitle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow-y: auto;
  touch-action: pan-y;
  background: linear-gradient(180deg, rgba(143, 211, 255, 0.55) 0%, rgba(143, 211, 255, 0) 34%, rgba(20, 33, 61, 0) 55%, rgba(20, 33, 61, 0.35) 100%);
}
.bunting {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 30px;
  display: flex;
  border-top: 3px solid var(--ink);
  pointer-events: none;
}
.bunting i {
  flex: 1;
  height: 26px;
  clip-path: polygon(6% 0, 94% 0, 50% 100%);
}
.titleHead {
  text-align: center;
  margin-top: 34px;
}
.logo {
  margin: 0;
  font-weight: 400;
  font-size: clamp(44px, 15vw, 68px);
  line-height: 1.02;
  letter-spacing: -1px;
  color: var(--chalk);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
}
.logo b {
  font-weight: 400;
  color: var(--sun);
}
.tagline {
  display: inline-block;
  margin: 10px 0 0;
  padding: 6px 12px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--track);
  color: var(--chalk);
  font-size: 15px;
  transform: rotate(-2deg);
}
.titleCard {
  width: 100%;
  max-width: 440px;
  flex: none;
}
.fieldName {
  font-size: 15px;
  margin: 0 0 6px 2px;
}
#charName {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#nick {
  width: 100%;
  font-family: inherit;
  font-size: 20px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 11px 12px;
  margin-bottom: 12px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
#nick:focus {
  border-color: var(--track);
}
#nick::placeholder {
  color: #9aa3b5;
}
.chargrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.charBtn {
  padding: 0 0 4px;
  background: #fff1c9;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.2;
  transition: transform 0.08s;
}
.charBtn img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 6;
  object-fit: cover;
  pointer-events: none;
}
.charBtn.sel {
  background: var(--sun);
  transform: translateY(-4px);
  box-shadow: 0 5px 0 var(--track);
  border-color: var(--track);
}

/* 광장 */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 62%;
  padding: 4px 14px 4px 4px;
  background: var(--chalk);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 18px;
}
.chip img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  object-fit: cover;
  object-position: 50% 18%;
  background: #fff1c9;
}
.chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gb) + 14px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.78);
  color: var(--chalk);
  font-size: 15px;
  pointer-events: none;
  transition: opacity 0.4s;
}
.hint.off {
  opacity: 0;
}
.prompt {
  position: absolute;
  left: var(--gl);
  right: var(--gr);
  bottom: calc(var(--gb) + 10px);
  margin: 0 auto;
  max-width: 420px;
  width: auto;
  animation: pop 0.22s ease-out;
}
.prompt small {
  display: block;
  font-size: 14px;
  margin-top: 6px;
  opacity: 0.85;
}
.prompt.wait {
  background: var(--chalk);
}

/* 가운데 뜨는 창 */
.overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 33, 61, 0.45);
  z-index: 8;
}
/* 결과 창 위에서 순위를 열 수 있게 순위 창은 한 칸 위 */
#panelRank {
  z-index: 9;
}
.overlay .card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: pop 0.22s ease-out;
}
.overlay h2 {
  margin: 2px 0 12px;
  font-weight: 400;
  font-size: 26px;
}
.recList {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  text-align: left;
}
.recList li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 2px dashed rgba(20, 33, 61, 0.2);
  font-size: 18px;
}
.recList .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  flex: none;
}
.recList .val {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.recList .val.none {
  opacity: 0.45;
  font-size: 15px;
}
.note {
  margin: 0 0 14px;
  font-size: 14px;
  opacity: 0.65;
}

/* 달리기 */
.sprintTop {
  display: flex;
  align-items: center;
  gap: 10px;
}
.round {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--chalk);
  box-shadow: 0 4px 0 var(--ink);
  font-size: 22px;
  line-height: 1;
  padding: 0;
}
.timer {
  min-width: 118px;
  padding: 6px 12px;
  background: var(--ink);
  color: var(--sun);
  border-radius: 14px;
  font-size: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.prog {
  position: relative;
  flex: 1;
  height: 18px;
  background: var(--chalk);
  border: 3px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}
#spBar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: var(--track);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.count {
  position: absolute;
  left: 0;
  right: 0;
  top: 26%;
  text-align: center;
  font-size: 110px;
  line-height: 1;
  color: var(--sun);
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--ink);
  pointer-events: none;
}
.count.go {
  animation: pop 0.3s ease-out;
}
.tip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gb) + 136px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.78);
  color: var(--chalk);
  font-size: 15px;
  pointer-events: none;
}
.tip.warn {
  background: var(--track);
  animation: shake 0.25s;
}
.feet {
  position: absolute;
  left: var(--gl);
  right: var(--gr);
  bottom: var(--gb);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-bottom: 6px;
}
.foot {
  height: 116px;
  border: 3px solid var(--ink);
  border-radius: 24px;
  box-shadow: 0 6px 0 var(--ink);
  font-size: 30px;
  background: var(--sun);
  touch-action: none !important;
}
.foot.right {
  background: var(--track);
  color: var(--chalk) !important;
}
.foot.on {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--ink);
}
.foot.next {
  outline: 4px solid var(--chalk);
  outline-offset: -10px;
}

/* 결과 */
.medal {
  display: inline-block;
  padding: 8px 22px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  font-size: 30px;
  transform: rotate(-3deg);
}
.medal.r2 {
  background: #dfe6ee;
}
.medal.r3 {
  background: #e7a66b;
}
.medal.r4 {
  background: var(--chalk);
}
.bigTime {
  margin: 12px 0 2px;
  font-size: 58px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.newRec {
  display: inline-block;
  margin: 8px 0 0;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--track);
  color: var(--chalk);
  font-size: 18px;
  animation: pop 0.4s ease-out;
}
.bestLine {
  margin: 10px 0 16px;
  font-size: 17px;
  opacity: 0.75;
}
.overlay .btn + .btn {
  margin-top: 12px;
}

/* 잠깐 뜨는 알림 */
#toast {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  padding: 10px 18px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  font-size: 18px;
  white-space: nowrap;
  z-index: 12;
  pointer-events: none;
  animation: pop 0.2s ease-out;
}

/* 가로로 눕힌 폰 · 낮은 화면 */
@media (max-height: 520px) {
  .titleHead {
    margin-top: 26px;
  }
  .logo {
    font-size: 40px;
  }
  .tagline {
    display: none;
  }
  .chargrid {
    grid-template-columns: repeat(8, 1fr);
  }
  .titleCard {
    max-width: 640px;
  }
  .foot {
    height: 84px;
  }
  .tip {
    bottom: calc(var(--gb) + 100px);
  }
  .count {
    top: 16%;
    font-size: 84px;
  }
}

@keyframes pop {
  0% {
    transform: scale(0.7);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shake {
  0%,
  100% {
    margin-left: 0;
  }
  30% {
    margin-left: -8px;
  }
  70% {
    margin-left: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #app * {
    animation: none !important;
  }
}

/* 광장 위쪽 단추들 */
.topbar .chip {
  min-width: 0;
  max-width: none;
  flex: 0 1 auto;
}
.topBtns {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex: none;
}
.topBtns .btn.small {
  padding: 10px 11px;
  white-space: nowrap;
}
#btnSound.off {
  color: rgba(20, 33, 61, 0.35);
  text-decoration: line-through;
}

/* 멀리뛰기 · 창던지기 · 양궁 · 사격 */
#hudField .sprintTop {
  pointer-events: none;
}
#hudField .sprintTop > .round {
  pointer-events: auto;
}
.timer.fdInfo {
  min-width: 0;
  font-size: 20px;
  padding: 9px 14px;
  white-space: nowrap;
}
.fdBest {
  margin-left: auto;
  padding: 7px 12px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  font-size: 15px;
  white-space: nowrap;
}
.count.msg {
  top: 17%;
  font-size: 62px;
  -webkit-text-stroke: 4px var(--ink);
  text-shadow: 0 5px 0 var(--ink);
}
#fdTip {
  bottom: calc(var(--gb) + 22px);
}
#hudField.actOn #fdTip {
  bottom: calc(var(--gb) + 98px);
}
#hudField.feetOn.actOn #fdTip {
  bottom: calc(var(--gb) + 228px);
}
.act {
  grid-column: 1 / -1;
  height: 76px;
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink);
  background: var(--field);
  color: var(--chalk) !important;
  font-size: 30px;
  touch-action: none !important;
}
.act.on {
  transform: translateY(5px);
  box-shadow: 0 1px 0 var(--ink);
}
.gauge {
  position: absolute;
  right: calc(var(--gr) + 4px);
  top: 26%;
  width: 26px;
  height: 34%;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  box-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
}
.gauge i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 50%;
  height: 20%;
  background: var(--field);
}
.gauge b {
  position: absolute;
  left: -9px;
  right: -9px;
  height: 8px;
  margin-bottom: -4px;
  border-radius: 4px;
  background: var(--track);
  border: 2px solid var(--ink);
}

/* 순위 창 */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.tab {
  padding: 6px 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  font-size: 13px;
  white-space: nowrap;
}
.tab.sel {
  background: var(--ink);
  color: var(--sun) !important;
}
.rankList {
  list-style: none;
  margin: 12px 0 8px;
  padding: 0 2px;
  max-height: 42vh;
  overflow-y: auto;
  touch-action: pan-y;
  text-align: left;
}
.rankList li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 17px;
}
.rankList li.me {
  background: #ffe9a8;
  box-shadow: inset 0 0 0 2px var(--ink);
}
.rankList .no {
  width: 26px;
  height: 26px;
  line-height: 26px;
  flex: none;
  border-radius: 50%;
  text-align: center;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.rankList .no.top1 {
  background: var(--sun);
}
.rankList .no.top2 {
  background: #dfe6ee;
}
.rankList .no.top3 {
  background: #e7a66b;
}
.rankList img {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--ink);
  object-fit: cover;
  object-position: 50% 18%;
  background: #fff1c9;
}
.rankList .nm {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rankList .val {
  font-variant-numeric: tabular-nums;
}
.tabs.scope,
.tabs.pager {
  margin-top: 8px;
}
.tabs.scope[hidden],
.tabs.pager:empty {
  display: none;
}
.tabs.pager .tab {
  padding: 6px 12px;
  font-size: 14px;
}
.rankList li.gap {
  justify-content: center;
  padding: 0;
  color: #8a8a8a;
  line-height: 1;
}
#rankNote:empty,
#recNote:empty {
  display: none;
}
.rankList:empty {
  margin: 8px 0 4px;
}
.worldLine {
  display: inline-block;
  cursor: pointer;
  margin: -6px 0 16px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #ffe9a8;
  font-size: 16px;
}

@media (max-height: 520px) {
  .act {
    height: 56px;
    font-size: 24px;
  }
  #hudField.actOn #fdTip {
    bottom: calc(var(--gb) + 76px);
  }
  #hudField.feetOn.actOn #fdTip {
    bottom: calc(var(--gb) + 172px);
  }
  .count.msg {
    top: 20%;
    font-size: 48px;
  }
  .gauge {
    top: 20%;
    height: 28%;
  }
  .rankList {
    max-height: 30vh;
  }
}

/* 하는 맛 — 가운데 큰 글자 · 메달 · 아깝다 줄 */
.flash {
  position: absolute;
  left: 0;
  right: 0;
  top: 41%;
  text-align: center;
  font-size: 34px;
  line-height: 1.1;
  color: var(--chalk);
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--ink);
  pointer-events: none;
  animation: flash 1.25s ease-out forwards;
}
.flash.perfect {
  color: var(--sun);
  font-size: 38px;
}
.flash.record {
  top: 36%;
  font-size: 60px;
  color: #ff6a4d;
  -webkit-text-stroke: 5px var(--ink);
  text-shadow: 0 6px 0 var(--ink);
}
.flash.warn {
  color: #ffd2c7;
  font-size: 28px;
}
@keyframes flash {
  0% {
    transform: scale(0.55);
    opacity: 0;
  }
  14% {
    transform: scale(1.14);
    opacity: 1;
  }
  28% {
    transform: scale(1);
  }
  78% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-16px);
    opacity: 0;
  }
}
.medalDot {
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  vertical-align: -4px;
  box-shadow: inset -3px -3px 0 rgba(20, 33, 61, 0.16), inset 3px 3px 0 rgba(255, 255, 255, 0.55);
}
.medalDot.none {
  border-style: dashed;
  opacity: 0.3;
  box-shadow: none;
}
.resMedal {
  margin-top: 8px;
  font-size: 19px;
}
.resMedal.up {
  animation: pop 0.5s ease-out;
  color: var(--track);
}
.nearLine {
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 2px dashed rgba(20, 33, 61, 0.35);
  border-radius: 14px;
  background: #fff3cf;
  font-size: 16px;
  line-height: 1.5;
}
.recMedals {
  margin: -4px 0 6px;
  font-size: 16px;
  opacity: 0.75;
}
.recList .nm small {
  display: block;
  font-size: 12px;
  opacity: 0.6;
}
@media (max-height: 520px) {
  .flash {
    font-size: 28px;
  }
  .flash.record {
    font-size: 44px;
  }
}

/* 지역 고르기 — 지도와 이름 단추 */
.regionRow {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  text-align: left;
}
.regionRow i,
.regionChip i,
.regDot {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink);
}
.regionRow span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.regionRow small {
  flex: none;
  font-size: 13px;
  opacity: 0.6;
}
.regionCard {
  margin-top: auto;
  padding-top: 12px;
}
.regionHead {
  text-align: center;
  font-size: 21px;
  margin-bottom: 8px;
}
.regionPick {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mapBox {
  flex: none;
  width: 124px;
}
.mapSvg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.mapShape {
  stroke: #fffdf6;
  stroke-width: 2.4;
  stroke-linejoin: round;
  cursor: pointer;
  opacity: 0.82;
}
.mapShape.sel {
  stroke: var(--ink);
  stroke-width: 3.4;
  opacity: 1;
}
.mapName {
  font-family: var(--font);
  font-size: 8.5px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}
.regionChips {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.regionChip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 4px 8px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  white-space: nowrap;
}
.regionChip:last-child {
  grid-column: 1 / -1;
}
.regionChip.sel {
  background: var(--sun);
  box-shadow: 0 3px 0 var(--ink);
}
.regionBtns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.regionBtns .btn {
  margin: 0;
}
.regionBtns .btn.plain {
  flex: none;
  width: 84px;
}
.regionBtns .btn.red {
  flex: 1;
}
.btn:disabled {
  opacity: 0.55;
}

/* 광장 — 내 지역 딱지 · 함께 있는 사람 수 · 같이 하기 */
.chip i {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.here {
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.9);
  font-size: 13px;
  pointer-events: none;
}
.invite {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--gt) + 136px);
  width: fit-content;
  margin: 0 auto;
  max-width: calc(100% - 32px);
  padding: 9px 16px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 6;
  animation: pop 0.22s ease-out;
}

/* 상대 찾는 중 */
.seekBar {
  height: 10px;
  margin: 12px 0 4px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.seekBar i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: var(--track);
  animation: seek 1.1s ease-in-out infinite alternate;
}
@keyframes seek {
  from {
    transform: translateX(-20%);
  }
  to {
    transform: translateX(170%);
  }
}

/* 결과 창 — 이번 판 순위 */
.matchList {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  text-align: left;
}
.matchList li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 16px;
}
.matchList li.me {
  background: #ffe9a8;
  box-shadow: inset 0 0 0 2px var(--ink);
}
.matchList .no {
  flex: none;
  width: 22px;
  height: 22px;
  line-height: 22px;
  border-radius: 50%;
  text-align: center;
  font-size: 13px;
}
.matchList .no.top1 {
  background: var(--sun);
}
.matchList .no.top2 {
  background: #dfe6ee;
}
.matchList .no.top3 {
  background: #e7a66b;
}
.matchList img {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  object-fit: cover;
  object-position: 50% 18%;
  background: #fff1c9;
}
.matchList .nm {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.matchList .val {
  font-variant-numeric: tabular-nums;
}
.matchList .val.dim {
  opacity: 0.55;
  font-size: 14px;
}
.regDot {
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-left: 6px;
  vertical-align: middle;
}
.regDot.big {
  width: 18px;
  height: 18px;
  margin: 0 2px;
}
.rankList .nm small {
  margin-left: 6px;
  font-size: 13px;
  opacity: 0.6;
}
.tab.team {
  box-shadow: inset 0 -3px 0 var(--track);
}
.overlay .card {
  max-height: calc(100% - 16px);
  overflow-y: auto;
}

@media (max-height: 520px) {
  .regionCard {
    max-width: 640px;
    padding-top: 8px;
  }
  .regionHead {
    font-size: 18px;
    margin-bottom: 4px;
  }
  .mapBox {
    width: 84px;
  }
  .regionChips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .regionChip:last-child {
    grid-column: auto;
  }
  .matchList li {
    padding: 1px 8px;
    font-size: 14px;
  }
  .matchList img {
    width: 20px;
    height: 20px;
  }
}
/* 가로 화면 — 지역 줄과 입장 단추를 나란히 두어 한 화면에 다 보이게 */
@media (max-height: 520px) {
  #cardWho {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
    align-items: stretch;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  #cardWho > * {
    flex: 1 1 100%;
  }
  #cardWho > .regionRow,
  #cardWho > #btnEnter {
    flex: 1 1 40%;
    width: auto;
    margin-top: 8px;
  }
}

/* 확대 · 축소 단추 */
.zoomBtns {
  position: absolute;
  right: var(--gr);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.zoomBtns .round {
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  opacity: 0.92;
}

/* 칭호 딱지 */
#chipTitle,
.ttl {
  flex: none;
  padding: 1px 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
}
.ttl {
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
  vertical-align: 1px;
}

/* 바람 표시 */
.fdWind {
  width: max-content;
  margin: 10px auto 0;
  padding: 5px 14px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  box-shadow: 0 3px 0 var(--ink);
  font-size: 18px;
  white-space: nowrap;
  pointer-events: none;
}
.fdWind.mid {
  background: #ffc93c;
}
.fdWind.strong {
  background: #ff8a5c;
}

/* 별명을 못 쓸 때 */
#nick.bad {
  border-color: #e8503a;
  background: #ffe3dc;
}

/* 가로로 눕힌 폰 — 왼발 · 던지기 · 오른발을 한 줄에 두어 경기장이 넓게 보이게 */
@media (max-height: 520px) and (orientation: landscape) {
  #fdFeet {
    grid-template-columns: 1fr 1.15fr 1fr;
  }
  #fdFeet .act {
    grid-column: auto;
    order: 2;
    height: 76px;
  }
  #fdFeet .foot {
    height: 76px;
  }
  #fdFeet .foot.left {
    order: 1;
  }
  #fdFeet .foot.right {
    order: 3;
  }
  #hudField .tip {
    bottom: calc(var(--gb) + 92px);
  }
}
/* 아주 낮은 화면(가로 폰) — 첫 화면이 한 번에 다 보이게 */
@media (max-height: 420px) {
  .titleHead {
    margin-top: 12px;
  }
  .logo {
    font-size: 32px;
  }
  #cardWho .fieldName {
    display: none;
  }
  #cardWho #nick {
    margin-bottom: 8px;
  }
  #cardWho .chargrid {
    margin-bottom: 4px;
  }
  .charBtn img {
    aspect-ratio: 1 / 1;
  }
}
/* 가로 폰 결과 창 — 왼쪽은 기록 · 단추, 오른쪽은 등수 · 순위 줄 (내리지 않고 한 번에) */
@media (max-height: 520px) and (orientation: landscape) {
  #panelResult .card {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    grid-auto-flow: row dense;
    column-gap: 18px;
    align-items: center;
    max-width: 700px;
    width: calc(100% - 24px);
  }
  #panelResult .card > * {
    grid-column: 1;
    margin-top: 4px;
    margin-bottom: 4px;
  }
  #panelResult .card > .medal {
    justify-self: center;
  }
  #panelResult .card > #resMatch,
  #panelResult .card > #resBest,
  #panelResult .card > #resWorld,
  #panelResult .card > #resNear {
    grid-column: 2;
  }
  #panelResult .bigTime {
    font-size: 44px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  #panelResult .card > #btnAgain,
  #panelResult .card > #btnBack {
    grid-row: 9; /* 맨 아래 한 줄에 나란히 */
    margin-top: 10px;
  }
  #panelResult .card > #btnBack {
    grid-column: 2;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  #panelResult .card {
    padding-top: 10px;
    padding-bottom: 12px;
  }
  #panelResult .card > .medal {
    font-size: 22px;
    padding: 4px 16px;
  }
  #panelResult .bigTime {
    font-size: 38px;
    line-height: 1.1;
  }
  #panelResult .card > #btnAgain,
  #panelResult .card > #btnBack {
    height: 50px;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  #panelResult .card > #resMatch {
    grid-row: span 2; /* 등수 표는 왼쪽 두 줄(등수 · 기록) 높이에 */
  }
}

/* ===== 레벨 · 칭호 · 기록 소식 (11-22) ===== */
.subbar {
  position: absolute;
  left: var(--gl);
  right: var(--gr);
  top: calc(var(--gt) + 58px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.subbar > * {
  pointer-events: auto;
}
.subbar .here {
  pointer-events: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.pill b {
  font-weight: 400;
}
#pillTtl b {
  color: #7a4ad8;
}
.xpBar {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #e9e3d0;
  overflow: hidden;
}
.xpBar > i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #5ac86a, #ffc93c);
}

/* 칭호 희귀도 — 흔함 하양 · 드묾 파랑 · 귀함 보라 · 전설 금빛 반짝 */
#chipTitle.ru,
.ttl.ru,
#chipTitle.rr,
.ttl.rr {
  color: #fff;
  text-shadow: 0 1px 0 rgba(20, 33, 61, 0.55);
}
#chipTitle.rl,
.ttl.rl {
  background: linear-gradient(100deg, #ffc93c 0%, #ffe9a0 35%, #ffc93c 55%, #f2a020 100%) !important;
  background-size: 220% 100% !important;
  animation: shine 2.4s linear infinite;
  box-shadow: 0 0 8px rgba(255, 201, 60, 0.85);
}
.ttl.rx {
  color: #8a8472;
  border-style: dashed;
}
@keyframes shine {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* 기록 소식 띠 */
.ticker {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--gt) + 96px);
  height: 34px;
  overflow: hidden;
  background: linear-gradient(180deg, #1d2b55, #14213d);
  border-top: 2px solid var(--sun);
  border-bottom: 3px solid var(--sun);
  z-index: 7;
  pointer-events: none;
}
.ticker.t {
  top: 0;
  height: calc(var(--gt) + 32px);
  border-top: 0;
}
.ticker .run {
  position: absolute;
  left: 0;
  bottom: 6px;
  white-space: nowrap;
  color: var(--sun);
  font-size: 16px;
  will-change: transform;
}
.ticker .run i {
  font-style: normal;
  color: var(--chalk);
}
.ticker .run s {
  text-decoration: none;
  color: #ff8a70;
}
@keyframes tick {
  from {
    transform: translateX(var(--tw, 400px));
  }
  to {
    transform: translateX(-100%);
  }
}

/* 순위 — 전체 기록 · 지역 기록, 누르면 그 사람 칭호 */
#rankMode .tab {
  flex: 1;
  font-size: 15px;
}
.rankList li.tap {
  cursor: pointer;
}
.rankList li.tap:active {
  background: rgba(255, 201, 60, 0.35);
}

/* 결과 창 경험치 */
.xpLine {
  margin: 8px auto 4px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff6d8;
  font-size: 14px;
}
.xpLine .xpTop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
}
.xpLine .xpTop b {
  font-weight: 400;
  color: #2f9e62;
}
.xpLine .xpBar {
  width: 90px;
}
.xpLine small {
  display: block;
  margin-top: 2px;
  color: #6b6455;
  font-size: 12px;
}
.xpNew {
  margin-top: 4px;
  color: #7a4ad8;
}

/* 내 창들 */
#panelPlayer {
  z-index: 10;
}
#panelLevel {
  z-index: 11;
}
#panelWard,
#panelTitles {
  z-index: 9;
}
.pcImg {
  display: block;
  width: 84px;
  height: 100px;
  margin: 0 auto 4px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff1c9;
  object-fit: cover;
}
#panelPlayer h2 {
  margin: 4px 0 0;
}
.pcLine {
  margin: 2px 0 6px;
  color: #6b6455;
  font-size: 14px;
}
#pcWear {
  margin-bottom: 8px;
}
#pcWear .ttl {
  font-size: 15px;
  margin: 0;
}
.tList {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  max-height: 38vh;
  overflow-y: auto;
  text-align: left;
}
.tList li {
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(20, 33, 61, 0.2);
}
.tList li small {
  display: block;
  margin-top: 2px;
  color: #6b6455;
  font-size: 12px;
}
.tList li.none {
  text-align: center;
  color: #6b6455;
}
.lvHead {
  font-size: 30px;
  color: var(--track);
  text-shadow: 0 3px 0 var(--ink);
}
.lvBig {
  margin: 2px 0 6px;
  font-size: 20px;
}
.lvImg {
  display: block;
  width: 120px;
  height: 144px;
  margin: 0 auto;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff1c9;
  animation: lvPop 0.6s ease-out;
}
@keyframes lvPop {
  0% {
    transform: scale(0.5) rotate(-8deg);
  }
  70% {
    transform: scale(1.08) rotate(2deg);
  }
  100% {
    transform: scale(1);
  }
}
.lvText {
  margin: 8px 0;
  font-size: 15px;
}
.wdLv {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}
.wdLv b {
  font-weight: 400;
  font-size: 18px;
}
.wdLv .xpBar {
  width: 110px;
}
.wdLv small {
  color: #6b6455;
}
.wdGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: 34vh;
  overflow-y: auto;
}
.wdItem {
  padding: 3px 2px 4px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--chalk);
  font: inherit;
  font-size: 11px;
  color: var(--ink);
  cursor: pointer;
}
.wdItem img {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 6;
  border-radius: 7px;
  background: #fff1c9;
  object-fit: cover;
}
.wdItem span {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wdItem.sel {
  background: var(--sun);
}
.wdItem {
  position: relative;
}
.wdItem.lock img {
  filter: saturate(0.55) brightness(0.5); /* 잠겨도 화려함이 살짝 보이게 — 갖고 싶게 */
}
.wdItem em {
  position: absolute;
  left: 50%;
  top: 34%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(20, 33, 61, 0.85);
  color: #fffdf6;
  font-style: normal;
  font-size: 11px;
  white-space: nowrap;
}
/* 옷 희귀도 — 칭호와 같은 색 */
.wdItem.ru {
  border-color: #5aa9ff;
  box-shadow: inset 0 0 0 2px #5aa9ff;
}
.wdItem.rr {
  border-color: #b07cff;
  box-shadow: inset 0 0 0 2px #b07cff;
}
.wdItem.rl {
  border-color: #f2a020;
  box-shadow: 0 0 8px rgba(255, 201, 60, 0.9), inset 0 0 0 2px #ffc93c;
}
.wdItem.rl span {
  color: #b5740a;
}
.wdItem.rl.sel span {
  color: var(--ink);
}
.wdSub {
  margin: 10px 0 4px;
  font-size: 15px;
}
.petRow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}
.petChip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 3px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--chalk);
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.petChip i {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.petChip.sel {
  background: var(--sun);
}
.petChip.lock {
  opacity: 0.55;
}
.tsBox {
  max-height: 52vh;
  overflow-y: auto;
  text-align: left;
}
.tsSet {
  margin-bottom: 10px;
  padding: 6px;
  border: 2px solid rgba(20, 33, 61, 0.25);
  border-radius: 12px;
}
.tsSet.done {
  border-color: var(--sun);
  background: #fff6d8;
}
.tsHead {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.tsHead i {
  width: 12px;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.tsHead b {
  font-weight: 400;
}
.tsHead small {
  margin-left: auto;
  color: #6b6455;
  font-size: 11px;
  text-align: right;
}
.tChip {
  position: relative;
  display: block;
  width: 100%;
  margin: 3px 0;
  padding: 5px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.tChip:active {
  background: rgba(255, 201, 60, 0.3);
}
.tChip.sel {
  background: rgba(255, 201, 60, 0.4);
}
.tChip small {
  display: block;
  margin-top: 2px;
  color: #6b6455;
  font-size: 11px;
}
.tChip .wearMark {
  position: absolute;
  right: 6px;
  top: 6px;
  font-weight: 400;
  font-size: 11px;
  color: var(--track);
}

/* 광장 기술 단추 (11-22) — 캐릭터마다 하나, 누르면 남들 화면에도 효과가 보인다 */
.skillBtn {
  position: absolute;
  right: var(--gr);
  bottom: calc(var(--gb) + 92px);
  width: 78px;
  height: 78px;
  padding: 0;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c8, var(--sun) 70%);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  z-index: 4;
  -webkit-tap-highlight-color: transparent;
}
.skillBtn i {
  display: block;
  font-style: normal;
  font-size: 30px;
  line-height: 1.1;
  margin-top: 6px;
}
.skillBtn span {
  display: block;
  font-size: 11px;
  white-space: nowrap;
  letter-spacing: -0.5px;
}
.skillBtn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}
.skillBtn.cool {
  filter: grayscale(0.6) brightness(0.92);
}
.skillBtn.cool::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(20, 33, 61, 0.35);
  transform-origin: bottom;
  animation: skCool var(--cool, 1.6s) linear forwards;
}
@keyframes skCool {
  from {
    transform: scaleY(1);
  }
  to {
    transform: scaleY(0);
  }
}

/* 서버판에만 있는 것 — 카카오 · 네이버 단추 */
.btn.kakao {
  background: #fee500;
  color: #191600;
}
.btn.naver {
  background: #03c75a;
  color: #fff;
}
#accTitle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
#accTitle .btn {
  flex: 1 1 auto;
  font-size: 18px;
  padding: 12px 14px;
}
#recAcc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
#recAcc .btn {
  font-size: 18px;
  padding: 12px 14px;
}

/* 이어하기 번호 창 */
.btn.code {
  background: #ffc93c;
  color: #14213d;
}
#recAcc .note {
  margin: 0;
  font-size: 14px;
}
#codeBox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 33, 61, 0.6);
}
#codeBox .cbCard {
  width: 100%;
  max-width: 340px;
  padding: 16px;
  border: 3px solid #14213d;
  border-radius: 18px;
  background: #fffaf0;
  color: #14213d;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#codeBox h3 {
  margin: 0;
  font-size: 22px;
}
#codeBox p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}
#codeBox .cbIn {
  font: inherit;
  font-size: 26px;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  padding: 10px;
  border: 3px solid #14213d;
  border-radius: 12px;
}
#codeBox .cbMsg {
  min-height: 1em;
  color: #c8402e;
}
#codeBox .cbCode {
  font-size: 34px;
  letter-spacing: 4px;
  padding: 12px;
  border: 3px dashed #14213d;
  border-radius: 12px;
  background: #fff1c9;
  user-select: all;
}
