/* WINDWEAVE — UI 스타일 */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1220; }
body { font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; color: #dfe9f2; }
#gl { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }

/* ---------- 로비 ---------- */
.screen {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(28, 52, 84, 0.92), rgba(8, 12, 24, 0.96));
  overflow-y: auto;
}
.lobby-box {
  width: min(560px, 92vw); padding: 34px 38px; margin: 20px 0;
  background: rgba(10, 18, 34, 0.85);
  border: 1px solid rgba(120, 200, 255, 0.25);
  border-radius: 18px;
  box-shadow: 0 0 60px rgba(80, 180, 255, 0.12);
  text-align: center;
}
.logo-top { font-size: 11px; letter-spacing: 4px; color: #6fa8c8; }
.logo { font-size: 52px; letter-spacing: 6px; margin: 4px 0 2px; color: #eaf6ff; text-shadow: 0 0 26px rgba(110, 210, 255, 0.55); }
.logo span { color: #7fdcff; }
.logo-sub { font-size: 13px; color: #9db8cc; margin-bottom: 16px; }
.pitch {
  text-align: left; font-size: 13px; line-height: 1.9; color: #c2d6e4;
  background: rgba(80, 160, 220, 0.08); border: 1px solid rgba(120, 200, 255, 0.15);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 18px;
}
.pitch b { color: #8fe2ff; }
.field { margin: 10px 0; text-align: left; }
.field label { display: block; font-size: 12px; color: #8fa8bc; margin-bottom: 5px; }
.field input, .code-row input {
  width: 100%; padding: 10px 12px; font-size: 15px;
  background: rgba(16, 28, 48, 0.9); color: #eaf6ff;
  border: 1px solid rgba(120, 200, 255, 0.3); border-radius: 8px; outline: none;
}
.field input:focus { border-color: #7fdcff; }
#colors { display: flex; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.sel { border-color: #fff; box-shadow: 0 0 12px rgba(255, 255, 255, 0.6); }
.lobby-btns { display: flex; flex-direction: column; gap: 10px; margin: 18px 0 10px; }
button.big {
  padding: 14px; font-size: 17px; font-weight: bold; border: none; border-radius: 10px;
  cursor: pointer; color: #06121e; transition: transform 0.08s, box-shadow 0.2s;
}
button.big:hover { transform: translateY(-2px); }
button.big.cyan { background: linear-gradient(135deg, #66d9ff, #3fa8e8); box-shadow: 0 4px 22px rgba(80, 190, 255, 0.35); }
button.big.green { background: linear-gradient(135deg, #8fe8a8, #4fc07a); box-shadow: 0 4px 22px rgba(90, 220, 140, 0.3); }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; text-transform: uppercase; letter-spacing: 3px; }
.code-row button {
  padding: 10px 16px; border: 1px solid rgba(120, 200, 255, 0.4); background: rgba(60, 120, 180, 0.25);
  color: #bfe4ff; border-radius: 8px; cursor: pointer; font-size: 14px; white-space: nowrap;
}
.code-row button:hover { background: rgba(80, 150, 210, 0.4); }
.err { min-height: 18px; color: #ff9d8a; font-size: 13px; margin-top: 8px; }
.lobby-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.mini {
  padding: 6px 12px; font-size: 12px; background: rgba(70, 100, 140, 0.25);
  border: 1px solid rgba(140, 180, 220, 0.3); color: #b8cede; border-radius: 6px; cursor: pointer;
}
.mini:hover { background: rgba(90, 130, 180, 0.4); }
.conn { margin-left: auto; font-size: 12px; color: #7fa8c0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud-top-left {
  position: absolute; top: 14px; left: 16px;
  background: rgba(8, 16, 30, 0.55); border: 1px solid rgba(120, 200, 255, 0.18);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.7;
}
#seed-label { color: #8fe2ff; font-weight: bold; }
#seed-pips { display: flex; gap: 4px; margin: 4px 0 6px; flex-wrap: wrap; max-width: 180px; }
.pip { width: 11px; height: 11px; border-radius: 50%; background: rgba(120, 160, 190, 0.25); border: 1px solid rgba(150, 200, 240, 0.3); }
.pip.on { background: #7fdcff; box-shadow: 0 0 7px rgba(127, 220, 255, 0.8); }
#spire-count { color: #ffd98a; }
#player-count { color: #a8c8de; font-size: 12px; }
#room-code { color: #8fa8bc; font-size: 11px; cursor: pointer; pointer-events: auto; text-decoration: underline dotted; }
#compass {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(8, 16, 30, 0.45); border: 1px solid rgba(120, 200, 255, 0.15);
  border-radius: 24px; max-width: 60vw;
}
#reticle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: rgba(220, 240, 255, 0.75); font-size: 18px; text-shadow: 0 0 4px #000;
}
#prompt {
  position: absolute; bottom: 17%; left: 50%; transform: translateX(-50%);
  background: rgba(8, 16, 30, 0.6); border: 1px solid rgba(120, 200, 255, 0.25);
  padding: 8px 18px; border-radius: 20px; font-size: 14px; color: #cfe8f8; display: none;
  white-space: nowrap;
}
#key-hint {
  position: absolute; bottom: 12px; right: 16px;
  font-size: 11px; color: rgba(170, 200, 220, 0.55);
}
#toasts { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast {
  background: rgba(12, 24, 44, 0.85); border: 1px solid rgba(120, 200, 255, 0.35);
  color: #d8ecfa; padding: 8px 20px; border-radius: 18px; font-size: 14px;
  animation: toast-in 0.25s ease-out; transition: opacity 0.8s; white-space: nowrap;
}
.toast.gold { border-color: rgba(255, 215, 130, 0.6); color: #ffe9b8; box-shadow: 0 0 18px rgba(255, 200, 100, 0.25); }
.toast.warn { border-color: rgba(255, 140, 110, 0.5); color: #ffc4b5; }
.toast.out { opacity: 0; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 채팅 */
#chat-box { position: absolute; bottom: 14px; left: 16px; width: min(360px, 44vw); }
#chat-log { max-height: 180px; overflow-y: auto; font-size: 13px; line-height: 1.55; transition: opacity 1.2s; }
#chat-log.faded { opacity: 0.35; }
.chat-line { text-shadow: 0 1px 3px #000; margin-top: 2px; word-break: break-all; }
.chat-line.sys { color: #8fb8d0; font-style: italic; font-size: 12px; }
#chat-input {
  width: 100%; margin-top: 6px; padding: 7px 12px; font-size: 13px;
  background: rgba(10, 20, 38, 0.85); color: #eaf6ff;
  border: 1px solid rgba(120, 200, 255, 0.35); border-radius: 8px; outline: none;
  display: none; pointer-events: auto;
}
#chat-box.open #chat-input { display: block; }

/* 세계 각성 배너 */
#wake-banner {
  position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; transition: opacity 2s;
}
#wake-banner h2 {
  font-size: 44px; letter-spacing: 10px; color: #eaf8ff;
  text-shadow: 0 0 30px rgba(140, 230, 255, 0.9), 0 0 80px rgba(120, 220, 255, 0.5);
  animation: wake-in 2.5s ease-out;
}
#wake-banner p { margin-top: 12px; font-size: 15px; color: #c8e2f2; line-height: 1.8; text-shadow: 0 1px 4px #000; }
#wake-banner.fade { opacity: 0; }
@keyframes wake-in { from { letter-spacing: 30px; opacity: 0; } to { letter-spacing: 10px; opacity: 1; } }

/* ---------- 조작법 ---------- */
#help {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 16, 0.75);
}
.help-box {
  width: min(620px, 92vw); max-height: 88vh; overflow-y: auto;
  background: rgba(12, 22, 40, 0.96); border: 1px solid rgba(120, 200, 255, 0.3);
  border-radius: 14px; padding: 26px 30px;
}
.help-box h2 { color: #8fe2ff; font-size: 20px; margin-bottom: 14px; }
.help-box table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 14px; }
.help-box td { padding: 5px 8px; border-bottom: 1px solid rgba(120, 180, 230, 0.12); }
.help-box td:first-child { color: #ffd98a; font-weight: bold; width: 110px; white-space: nowrap; }
.help-rules p { font-size: 13px; color: #b8d0e2; line-height: 1.7; margin-bottom: 10px; }
.help-rules b { color: #8fe2ff; }
