/* 미친 폭염 그늘 쟁탈전 — 캔버스 밖 UI 전부.
   전장은 전부 캔버스가 그린다. 여기는 로비·설정·상태 표시뿐이다. */

:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ink: #10202F;
  --paper: rgba(255, 255, 255, 0.92);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  background: #FFF3DC;
  font-family: "Gothic A1", "Pretendard", "Malgun Gothic", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  /* 당겨서 새로고침으로 판이 날아가는 사고를 막는다 */
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* ── 로비 ── */

#lobby {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(24, 32, 44, 0.42);
  backdrop-filter: blur(2px);
  z-index: 20;
}
#lobby.gone { display: none; }

.card {
  width: min(92vw, 420px);
  background: var(--paper);
  border-radius: 20px;
  padding: 26px 22px 18px;
  text-align: center;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}
.card h1 {
  margin: 0 0 8px;
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.tag { margin: 0 0 12px; font-size: 15px; line-height: 1.5; opacity: 0.72; }

/* 규칙 세 줄 — 시작 버튼을 누르기 전에 뭘 하는 게임인지 알아야 한다.
   "만든 사람조차 뭘 해야 할지 모르겠다"는 신고를 받고 넣었다. */
.rules {
  margin: 0 0 18px;
  padding: 12px 14px;
  list-style: none;
  text-align: left;
  background: rgba(16, 32, 47, 0.06);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.65;
}
.rules li { display: flex; align-items: center; gap: 10px; }
.rules li + li { margin-top: 8px; }
.rules b { font-weight: 800; }

/* 자리 세 가지를 화면과 같은 색으로 보여준다 —
   로비에서 본 색을 게임 안에서 그대로 만나야 규칙이 이어진다 */
.z {
  flex: none;
  min-width: 74px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}
.z.cold  { background: #CDEFF9; color: #12556B; }
.z.shade { background: #5E6F92; color: #EAF0FF; }
.z.sun   { background: #FFE2B0; color: #7A4B12; }

.lead { margin: 0 0 10px; font-size: 14px; font-weight: 700; opacity: 0.8; }
.rules-more { margin: 10px 0 18px; font-size: 13px; line-height: 1.6; opacity: 0.72; }

.row { display: flex; gap: 8px; margin-bottom: 12px; }
#nick {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 2px solid rgba(16, 32, 47, 0.16);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  background: #fff;
  color: inherit;
}
#nick:focus { outline: 3px solid #3D7BFF; outline-offset: 1px; }

button { font: inherit; cursor: pointer; }
.ghost {
  height: 52px;
  padding: 0 14px;
  border: 2px solid rgba(16, 32, 47, 0.16);
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
}
.go {
  width: 100%;
  height: 58px;
  border: 0;
  border-radius: 14px;
  background: #1E6E82;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.go:active { transform: translateY(1px); }

.how { margin: 16px 0 0; font-size: 13px; line-height: 1.6; opacity: 0.62; }
.ver { margin: 10px 0 0; font-size: 12px; opacity: 0.42; }

/* ── 설정 ──
   탭 타깃 52px. 게임은 급하게 누르는 화면이라 앱 기준(44)보다 한 단계 위를 쓴다. */

#gear {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top, 0px));
  right: 8px;
  width: 52px; height: 52px;
  border: 0; border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 21px; line-height: 1;
  color: var(--ink);
  z-index: 15;
}

#sheet {
  position: fixed;
  left: 12px; right: 12px;
  top: calc(66px + env(safe-area-inset-top, 0px));
  max-width: 420px;
  margin-inline: auto;
  background: var(--paper);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.6;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  z-index: 16;
}
#sheet.gone { display: none; }
#sheet label { display: flex; align-items: center; gap: 10px; min-height: 52px; }
#sheet input[type=checkbox] { width: 22px; height: 22px; }
#sheet .perf .dim { opacity: 0.62; font-size: 12px; }
#sheet .perf b { font-size: 15px; }
#sheet .perf {
  margin: 6px 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(16, 32, 47, 0.07);
  font-size: 13px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}
#sheet .note { margin: 4px 0 12px; font-size: 13px; opacity: 0.72; }
#sheet a { color: #1E6E82; font-weight: 700; }

/* ── 상태 ── */

#status {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(24px + var(--safe-bottom));
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(16, 32, 47, 0.86);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  z-index: 18;
}
#status.gone { display: none; }

/* 연출은 줄이되 **상태 신호는 절대 안 끈다** — 그 규칙은 캔버스 쪽(iceart/render)에 있다.
   여기서는 UI 전환만 죽인다. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
