:root {
  --bg: #0f1420;
  --panel: rgba(17, 22, 34, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --text-dim: #9aa7b8;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --danger: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; }
.hidden { display: none !important; }

/* ---- auth ---- */
.auth-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #16223a 0%, var(--bg) 60%); }
.auth-card { width: 340px; max-width: 92vw; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.auth-card h1 { margin: 0; font-size: 34px; letter-spacing: 1px; }
.auth-sub { margin: 4px 0 20px; color: var(--text-dim); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.auth-form input { background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); border-radius: 9px; color: var(--text); padding: 10px 12px; font-size: 14px; }
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-divider { height: 1px; background: var(--panel-border); margin: 20px 0; }
.auth-error { margin: 0; color: #fca5a5; font-size: 13px; min-height: 16px; }

/* ---- shell ---- */
.shell { display: flex; flex-direction: column; height: 100%; }
.don-nav { display: flex; align-items: center; gap: 18px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--panel-border); }
.don-brand { font-weight: 700; font-size: 18px; letter-spacing: 1px; }
.don-rooms { display: flex; gap: 6px; flex: 1; }
.don-user { display: flex; align-items: center; gap: 10px; }
.nav-user-name { font-size: 13px; color: var(--text-dim); }

.room-btn { appearance: none; border: 1px solid transparent; background: transparent; color: var(--text-dim); font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer; }
.room-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.room-btn.active { background: rgba(59,130,246,0.18); border-color: rgba(59,130,246,0.45); color: var(--text); }

.don-body { display: flex; flex: 1; min-height: 0; }
.room { flex: 1; min-width: 0; padding: 24px; overflow: auto; }
.room-photos { padding: 0; overflow: hidden; }
.photos-frame { width: 100%; height: 100%; border: none; display: block; background: #000; }
.room-placeholder { max-width: 560px; }
.room-placeholder h2 { margin: 0 0 8px; }
.room-placeholder p { color: var(--text-dim); line-height: 1.5; }

/* ---- chat sidebar ---- */
.chat-sidebar { width: 320px; flex: 0 0 auto; display: flex; flex-direction: column; border-left: 1px solid var(--panel-border); background: var(--panel); }
.chat-head { padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--panel-border); display: flex; align-items: center; justify-content: space-between; }
.bubu-btn { appearance: none; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.06); color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.bubu-btn:hover { color: var(--text); background: rgba(255,255,255,0.14); }
.bubu-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.presence-bar { padding: 6px 14px; border-bottom: 1px solid var(--panel-border); display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; min-height: 6px; }
.presence-bar:empty { display: none; }
.presence-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--text-dim); }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 5px rgba(52,211,153,0.6); }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-msg-who { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px; }
.chat-msg.mine .chat-msg-who { text-align: right; }
.chat-msg-text { background: rgba(255,255,255,0.08); border-radius: 12px 12px 12px 3px; padding: 7px 11px; font-size: 13px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-msg.mine .chat-msg-text { background: rgba(59,130,246,0.28); border-radius: 12px 12px 3px 12px; }
.chat-msg.ai .chat-msg-text { background: rgba(147,197,253,0.14); border: 1px solid rgba(147,197,253,0.35); }
.chat-msg.ai .chat-msg-who { color: #93c5fd; }
.chat-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--panel-border); }
.chat-input input { flex: 1; background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); border-radius: 8px; color: var(--text); padding: 9px 11px; font-size: 13px; }
.chat-input input:focus { outline: none; border-color: var(--accent); }

.btn { appearance: none; border: 1px solid var(--panel-border); background: rgba(255,255,255,0.06); color: var(--text); font-size: 13px; font-weight: 600; padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,0.14); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn.danger { background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.5); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,0.35); }
.btn.ghost { padding: 7px 11px; }

/* ---- call ---- */
.call-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.call-item { appearance: none; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); color: var(--text); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 14px; }
.call-item:hover { border-color: var(--accent); background: rgba(255,255,255,0.1); }
.call-dot { width: 10px; height: 10px; border-radius: 50%; background: #55606e; flex: 0 0 auto; }
.call-dot.online { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.7); }
.call-name { font-weight: 600; flex: 1; }
.call-hint { font-size: 12px; color: var(--text-dim); }

.call-panel { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); z-index: 300; }
.call-status { font-size: 14px; font-weight: 600; min-width: 140px; }
.call-actions { display: flex; gap: 8px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px); background: var(--panel); border: 1px solid var(--panel-border); color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 400; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- invite modal ---- */
.invite-modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); z-index: 200; }
.invite-card { width: 340px; max-width: 92vw; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.invite-card h3 { margin: 0 0 4px; }
.invite-sub { margin: 0 0 16px; color: var(--text-dim); font-size: 13px; }
.invite-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.invite-code { font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: 2px; background: rgba(255,255,255,0.06); border: 1px solid var(--panel-border); color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.invite-code:hover { border-color: var(--accent); }
.invite-empty { color: var(--text-dim); font-size: 13px; }
.invite-actions { display: flex; gap: 8px; }

@media (max-width: 720px) {
  .don-body { flex-direction: column; }
  .chat-sidebar { width: 100%; flex: 1; border-left: none; border-top: 1px solid var(--panel-border); }
  .don-nav { flex-wrap: wrap; gap: 10px; }
}
