:root {
  --ink: #1d2433;
  --muted: #6b7385;
  --glass: rgba(255, 255, 255, 0.9);
  --line: rgba(29, 36, 51, 0.1);
  --accent: #ff7a45;
  --accent-ink: #fff;
  --shadow: 0 10px 30px rgba(20, 30, 50, 0.18);
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: var(--font); color: var(--ink); background: #2e4a35; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; image-rendering: auto; }

/* ---- 입장 화면 ---- */
.gate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(20, 30, 40, 0.15), rgba(20, 30, 40, 0.55)); backdrop-filter: blur(3px); }
.gate-card { width: 100%; max-width: 400px; background: var(--glass); border-radius: 24px; padding: 28px 26px 22px; box-shadow: 0 30px 80px rgba(10, 20, 30, 0.35); text-align: center; }
.gate-sub { margin: 0; color: var(--accent); font-weight: 900; letter-spacing: 0.3em; font-size: 12px; }
.gate-title { margin: 6px 0 8px; font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
.gate-desc { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.6; white-space: pre-line; }
.gate-avatar { display: grid; place-items: center; margin: 0 auto 10px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, #cfeac4, #9fd48f); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.06); }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.field-label em { font-style: normal; font-weight: 500; opacity: 0.75; }
.field input { width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #f6f7f9; padding: 0 14px; outline: none; }
.field input:focus { border-color: var(--accent); background: #fff; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); background: var(--c); transition: transform 0.12s; }
.swatch:hover { transform: scale(1.08); }
.swatch.is-on { box-shadow: 0 0 0 2px var(--ink); }
.gate-error { min-height: 18px; margin: 0 0 6px; color: #dc2626; font-size: 13px; }
.btn-enter { width: 100%; height: 52px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 900;
  box-shadow: 0 8px 20px rgba(255, 122, 69, 0.35); transition: filter 0.15s, transform 0.1s; }
.btn-enter:hover { filter: brightness(1.05); }
.btn-enter:active { transform: scale(0.99); }
.btn-enter:disabled { opacity: 0.6; cursor: wait; }
.gate-online { margin: 12px 0 0; font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 7px; }
.gate-online b { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); flex: none; }

/* ---- HUD ---- */
.hud { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--glass);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 700; border: 0; white-space: nowrap; }
.loc { height: 44px; padding: 0 16px 0 12px; }
.loc-icon { font-size: 20px; }
.loc-name { font-weight: 900; font-size: 15px; }
.loc-count { font-size: 12px; color: var(--muted); font-weight: 700; padding: 3px 8px; background: #eef0f4; border-radius: 999px; }
.online b { color: var(--ink); }
.me::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--me, #3b82f6); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }
.btn-leave { color: var(--muted); }
.btn-leave:hover { color: var(--ink); }

.help { position: absolute; top: 64px; left: 12px; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 12px;
  background: rgba(20, 28, 40, 0.62); color: #fff; font-size: 12px; transition: opacity 0.4s; pointer-events: none; }
.help.is-hide { opacity: 0; }
kbd { font-family: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.2); }

.chat { position: absolute; left: 12px; bottom: 12px; width: min(360px, calc(100vw - 24px)); background: var(--glass); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.chat-toggle { width: 100%; height: 36px; border: 0; background: transparent; display: flex; align-items: center; gap: 8px; padding: 0 14px; font-size: 13px; font-weight: 800; color: var(--muted); border-bottom: 1px solid var(--line); }
.chat-toggle::after { content: "▾"; margin-left: auto; transition: transform 0.2s; }
.chat.is-closed .chat-toggle::after { transform: rotate(180deg); }
.chat.is-closed .chat-log { display: none; }
.chat-unread { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.chat-log { list-style: none; margin: 0; padding: 8px 12px; height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.5; }
.chat-log li { word-break: break-word; }
.chat-log .c-nick { font-weight: 800; margin-right: 6px; }
.chat-log .c-sys { color: var(--muted); font-size: 12px; }
.chat-log .c-empty { color: var(--muted); text-align: center; margin: auto 0; font-size: 12px; }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: #f6f7f9; padding: 0 12px; outline: none; }
.chat-form input:focus { border-color: var(--accent); background: #fff; }
.chat-form button { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; }

.minimap { position: absolute; right: 12px; bottom: 12px; border-radius: 12px; box-shadow: var(--shadow); border: 3px solid #fff; background: #6fbf5f; cursor: pointer; }

.fade { position: fixed; inset: 0; z-index: 20; background: #10151f; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 900; letter-spacing: 0.02em; }
.fade.is-on { opacity: 1; }

.toast { position: fixed; left: 50%; top: 70px; transform: translate(-50%, -10px); z-index: 30; padding: 10px 16px; border-radius: 12px; background: #1d2433; color: #fff;
  font-size: 14px; font-weight: 700; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .online, .help { display: none; }
  .chip { height: 34px; padding: 0 11px; font-size: 13px; }
  .loc { height: 38px; }
  .chat-log { height: 120px; }
  .minimap { width: 120px !important; height: auto !important; bottom: auto; top: 60px; }
}
