:root {
  --ocean: #0b4f6c;
  --ink: #12323f;
  --card: #fffdf7;
  --accent: #ff8a5b;
  --accent-ink: #ffffff;
  --muted: #5d7480;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ocean);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
#world { display: block; width: 100vw; height: 100vh; touch-action: none; }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 40, 56, .55); backdrop-filter: blur(3px); padding: 16px;
}
.card {
  background: var(--card); border-radius: 20px; padding: 28px 24px;
  width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.card h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: 2px; }
.card .sub { margin: 0 0 8px; color: var(--muted); }
.card .hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
#preview { width: 160px; height: 160px; }

form { display: flex; gap: 8px; }
input {
  flex: 1; min-width: 0; width: 0; font: inherit; font-size: 16px;
  padding: 10px 14px; border-radius: 999px; border: 2px solid #cfe3ea; outline: none;
  background: #fff; color: var(--ink);
}
input:focus { border-color: var(--accent); }
button {
  font: inherit; font-size: 16px; border: 0; border-radius: 999px; padding: 10px 18px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; white-space: nowrap;
}
button:active { transform: translateY(1px); }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud[hidden] { display: none; }
#topbar {
  position: absolute; top: 12px; left: 16px; right: 16px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
#me {
  background: rgba(255,253,247,.92); padding: 6px 14px; border-radius: 999px; font-weight: 700;
}
#online {
  background: rgba(11,79,108,.85); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px;
}
#chatLog {
  position: absolute; left: 16px; bottom: 70px; width: min(420px, calc(100% - 32px));
  max-height: 30vh; overflow-y: auto; pointer-events: auto;
  background: rgba(255,253,247,.82); border-radius: 14px; padding: 8px 12px;
  font-size: 14px; line-height: 1.5;
}
#chatLog:empty { display: none; }
#chatLog .sys { color: var(--muted); font-size: 12px; }
#chatLog .mine b { color: var(--accent); }
#chatLog .quote b { color: #1e7fa8; }
#chatLog .quote a { color: var(--muted); font-size: 12px; margin-left: 4px; }
#topbar .help {
  background: rgba(255,253,247,.75); padding: 6px 12px; border-radius: 999px;
  font-size: 13px; color: var(--muted);
}
#chatForm {
  position: absolute; left: 16px; right: 16px; bottom: 16px;
  max-width: 560px; margin: 0 auto; pointer-events: auto;
}
#chatForm input { background: rgba(255,255,255,.95); }

@media (max-width: 520px) {
  #online {
  background: rgba(11,79,108,.85); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px;
}
#chatLog {
  position: absolute; left: 16px; bottom: 70px; width: min(420px, calc(100% - 32px));
  max-height: 30vh; overflow-y: auto; pointer-events: auto;
  background: rgba(255,253,247,.82); border-radius: 14px; padding: 8px 12px;
  font-size: 14px; line-height: 1.5;
}
#chatLog:empty { display: none; }
#chatLog .sys { color: var(--muted); font-size: 12px; }
#chatLog .mine b { color: var(--accent); }
#chatLog .quote b { color: #1e7fa8; }
#chatLog .quote a { color: var(--muted); font-size: 12px; margin-left: 4px; }
#topbar .help { display: none; }
}
