:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --danger: #ef4444;
  --border: rgba(255,255,255,0.08);
  --room-bg: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Arial, sans-serif; }
button, input { font: inherit; }
button {
  background: var(--accent);
  color: #082f49;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
input {
  width: 100%;
  background: #fff;
  color: #111827;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  padding: 12px;
}
label span { display:block; margin-bottom:6px; color: var(--muted); font-size: 14px; }
.stack { display:flex; flex-direction:column; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.top-gap { margin-top: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: #fca5a5; min-height: 20px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
}
.demo-box {
  margin-top: 14px;
  font-size: 14px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 14px;
  padding: 14px;
}
.sidebar, .center-panel {
  min-height: calc(100vh - 28px);
}
.sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  overflow: auto;
}
.center-panel {
  display:flex;
  flex-direction:column;
  gap: 12px;
}
.topbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  gap: 12px;
}
.topbar-actions { display:flex; gap: 10px; flex-wrap: wrap; }
.panel-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel-title { font-weight: 700; margin-bottom: 8px; }
.profile-box { display:flex; align-items:center; gap: 12px; }
.avatar-large {
  width: 56px; height: 56px; border-radius: 50%;
  display:grid; place-items:center; font-size: 26px;
  background: #334155;
}
.profile-name { font-size: 18px; font-weight: 700; }
.room-name { font-weight: 700; font-size: 16px; }
.room-container {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  min-height: 560px;
}
.room-canvas {
  position: relative;
  width: 100%;
  min-height: 520px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--room-bg);
  border: 1px solid rgba(0,0,0,0.08);
}
.room-item, .user-avatar, .room-exit {
  position: absolute;
  transform: translate(-50%, -50%);
  user-select: none;
}
.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 28px;
  color: #111827;
  border: 3px solid rgba(255,255,255,0.8);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}
.user-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(15,23,42,0.85);
  color: white;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
}
.room-item {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255,255,255,0.85);
  display:grid;
  place-items:center;
  font-size: 24px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  cursor: pointer;
}
.room-item-image {
  position: absolute;
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  width: auto;
  height: auto;
  display: block;
}
.room-exit {
  background: rgba(17,24,39,0.82);
  color: white;
  padding: 8px 10px;
  border-radius: 12px;
  text-align:center;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.25);
  cursor:pointer;
}
.chat-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  min-height: 220px;
}
.chat-log {
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  padding: 10px;
  flex: 1;
  min-height: 140px;
  max-height: 260px;
  overflow: auto;
}
.chat-line { margin-bottom: 8px; line-height: 1.4; }
.chat-line strong { color: #f8fafc; }
.chat-form {
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.user-list, .inventory-list, .exit-list {
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.user-chip, .inventory-item, .exit-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.inventory-item { display:flex; justify-content:space-between; gap: 10px; align-items:center; }
.inventory-actions { display:flex; gap: 8px; }
.inventory-actions button { padding: 8px 10px; }
.empty-state { color: var(--muted); font-size: 14px; }

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      'center'
      'left'
      'right';
  }
  .left-panel { grid-area: left; min-height: auto; }
  .center-panel { grid-area: center; min-height: auto; }
  .right-panel { grid-area: right; min-height: auto; }
}

@media (max-width: 700px) {
  .app-shell { padding: 8px; gap: 8px; }
  .sidebar, .topbar, .room-container, .chat-section { border-radius: 14px; }
  .room-container { padding: 6px; }
  .room-canvas { min-height: 420px; }
  .topbar { align-items:flex-start; flex-direction:column; }
  .chat-form { grid-template-columns: 1fr; }
  button { min-height: 44px; }
}
