/* ── Pixel Plaza – Styles ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #1a1c2c;
  --bg2: #29366f;
  --fg: #f4f4f4;
  --accent: #41a6f6;
  --accent2: #a7f070;
  --warn: #b13e53;
  --panel-bg: rgba(26,28,44,0.95);
  --radius: 6px;
}
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  height: 100vh; width: 100vw;
}
.screen { display: none; position: absolute; inset: 0; }
.screen.active { display: flex; align-items: center; justify-content: center; }

/* ── Login ── */
.login-box { text-align: center; max-width: 360px; width: 100%; }
.login-box h1 { font-size: 2.5rem; margin-bottom: 0.25rem; color: var(--accent); }
.subtitle { color: var(--accent2); margin-bottom: 2rem; font-size: 0.95rem; }
input[type="email"], input[type="text"] {
  width: 100%; padding: 10px 14px; border-radius: var(--radius);
  border: 2px solid var(--bg2); background: #222; color: var(--fg);
  font-size: 1rem; outline: none; margin-bottom: 0.75rem;
}
input:focus { border-color: var(--accent); }
button {
  padding: 10px 20px; border-radius: var(--radius); border: none;
  background: var(--accent); color: var(--bg); font-weight: 600;
  cursor: pointer; font-size: 0.95rem; transition: background 0.15s;
}
button:hover { background: #73eff7; }
.status-msg { margin-top: 0.75rem; font-size: 0.85rem; min-height: 1.2em; }
.status-msg.error { color: var(--warn); }
.status-msg.ok { color: var(--accent2); }

/* ── Character Creator ── */
.creator-box { text-align: center; max-width: 480px; width: 100%; }
.creator-box h2 { margin-bottom: 1rem; color: var(--accent); }
.creator-layout { display: flex; gap: 1.5rem; align-items: flex-start; justify-content: center; margin-bottom: 1rem; }
#avatar-preview { border: 2px solid var(--bg2); border-radius: var(--radius); image-rendering: pixelated; background: #333; }
.creator-options { text-align: left; display: flex; flex-direction: column; gap: 0.5rem; }
.creator-options label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: #94b0c2; }
.color-row, .btn-row { display: flex; gap: 4px; flex-wrap: wrap; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 4px; border: 2px solid transparent;
  cursor: pointer; transition: border-color 0.1s;
}
.color-swatch:hover, .color-swatch.selected { border-color: #fff; }
.style-btn {
  padding: 4px 10px; border-radius: 4px; border: 2px solid var(--bg2);
  background: #222; color: var(--fg); cursor: pointer; font-size: 0.8rem;
}
.style-btn:hover, .style-btn.selected { border-color: var(--accent); background: var(--bg2); }

/* ── Game screen ── */
#screen-game { flex-direction: column; width: 100%; height: 100%; }
#game-canvas-wrap { flex: 1; position: relative; overflow: hidden; width: 100%; min-height: 0; }
#game-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

/* HUD */
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--panel-bg); z-index: 10;
}
#hud-location { font-weight: 600; font-size: 0.95rem; }
#hud-buttons { display: flex; gap: 6px; }
#hud-buttons button { padding: 6px 12px; font-size: 0.8rem; }
#btn-undock { background: var(--warn); }
.voice-off { opacity: 0.5; }
.voice-on { background: var(--accent2) !important; color: var(--bg) !important; opacity: 1; }

/* Panels */
.panel {
  position: absolute; z-index: 20;
  background: var(--panel-bg); border-radius: var(--radius);
  padding: 14px; max-height: 80vh; overflow-y: auto;
  border: 1px solid var(--bg2);
}
.hidden { display: none !important; }

/* Editor */
#editor-panel { left: 10px; top: 50px; width: 180px; }
#editor-panel h3 { margin-bottom: 8px; font-size: 0.9rem; }
#palette { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
#palette .color-swatch { width: 32px; height: 32px; }
.tool-btn { width: 100%; margin-bottom: 6px; background: var(--bg2); color: var(--fg); }
.tool-btn.active { background: var(--accent); color: var(--bg); }
#editor-close { width: 100%; }

/* Friends */
#friends-panel { right: 10px; top: 50px; width: 280px; }
#friends-panel h3, #friends-panel h4 { margin-bottom: 6px; font-size: 0.9rem; }
#friends-list { max-height: 200px; overflow-y: auto; margin-bottom: 8px; }
.friend-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid #29366f33;
}
.friend-row .name { font-size: 0.85rem; }
.friend-row button { padding: 4px 8px; font-size: 0.75rem; }
.friend-row .visit-btn { background: var(--accent2); }
#friend-requests { margin-top: 8px; }
.req-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.req-row button { padding: 3px 8px; font-size: 0.75rem; margin-left: 4px; }
#friends-close { width: 100%; margin-top: 8px; }

/* Chat */
#chat-panel { right: 10px; bottom: 10px; width: 320px; height: 360px; display: flex; flex-direction: column; }
#chat-panel.hidden { display: none !important; }
#chat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
#chat-channel { flex: 1; background: var(--bg2); color: var(--fg); border: none; border-radius: 4px; padding: 4px; }
#chat-close { padding: 4px 8px; font-size: 0.8rem; background: transparent; color: var(--fg); }
#chat-messages { flex: 1; overflow-y: auto; font-size: 0.82rem; padding: 4px; background: rgba(0,0,0,0.2); border-radius: 4px; margin-bottom: 6px; }
.chat-msg { padding: 3px 0; }
.chat-msg .sender { color: var(--accent); font-weight: 600; }
#chat-input-row { display: flex; gap: 4px; }
#chat-input { flex: 1; padding: 6px 8px; font-size: 0.85rem; }
#chat-send { padding: 6px 12px; font-size: 0.85rem; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6);
}
.modal-content {
  background: var(--panel-bg); border: 1px solid var(--bg2);
  border-radius: var(--radius); padding: 24px; text-align: center; min-width: 280px;
}
.modal-content p { margin-bottom: 16px; }
.modal-content button { margin: 0 6px; }
#dock-decline { background: var(--warn); }
