:root {
  --bg: #0A0A0A;
  --bg-elev: #141414;
  --bg-card: #1C1C1C;
  --border: #2A2A2A;
  --text: #EAEAEA;
  --text-muted: #888;
  --accent: #FF5A00;
  --accent-hover: #FF7A33;
  --green: #00E676;
  --danger: #FF3366;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg) url('/bg.jpg') center/cover fixed;
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}
body::before {
  content: '';
  position: fixed; inset: 0;
  background: rgba(10,10,10,0.88);
  z-index: -1;
}

#auth-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
}
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  width: 400px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.logo-wrap img { height: 90px; margin-bottom: 12px; }
.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tabs button { flex: 1; padding: 10px; border: none; border-radius: 8px; background: var(--bg-card); color: var(--text-muted); cursor: pointer; font-weight: 600; }
.tabs button.active { background: var(--accent); color: #fff; }
input, textarea, select {
  width: 100%; padding: 14px 16px; margin-bottom: 12px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 15px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
.btn {
  width: 100%; padding: 14px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card); color: var(--text); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

#app { display: none; height: 100vh; flex-direction: column; }
#app.active { display: flex; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--bg-elev); border-bottom: 1px solid var(--border);
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand img { height: 36px; }
nav.main-nav { display: flex; gap: 6px; }
nav.main-nav button {
  padding: 8px 16px; border: none; background: transparent; color: var(--text-muted);
  border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
}
nav.main-nav button.active { background: var(--accent); color: #fff; }
.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px;
}

.view { display: none; flex: 1; overflow: hidden; }
.view.active { display: flex; }

/* Chat layout */
.chat-layout { display: flex; flex: 1; }
.sidebar {
  width: 280px; background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.room-list { flex: 1; overflow-y: auto; }
.room-item {
  padding: 12px 14px; cursor: pointer; border-bottom: 1px solid #222;
  display: flex; align-items: center; gap: 10px;
}
.room-item:hover, .room-item.active { background: #1F1F1F; }
.room-item.active { border-left: 3px solid var(--accent); }
.room-icon { width: 40px; height: 40px; border-radius: 10px; background: #222; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.chat-area { flex: 1; display: flex; flex-direction: column; background: #0E0E0E; }
.chat-header { padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--bg-elev); }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { display: flex; gap: 8px; max-width: 72%; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.msg-bubble { background: var(--bg-card); padding: 8px 12px; border-radius: 14px; border-top-left-radius: 4px; }
.msg.me .msg-bubble { background: #2A1A12; border-top-right-radius: 4px; border-top-left-radius: 14px; }
.msg-user { font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.msg-time { font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 2px; }
.input-area { padding: 10px 14px; background: var(--bg-elev); border-top: 1px solid var(--border); display: flex; gap: 8px; }
.input-area input { flex: 1; margin: 0; border-radius: 20px; }
.input-area .btn { width: auto; padding: 0 18px; border-radius: 20px; }

/* Shop */
.shop-layout { flex-direction: column; padding: 16px; overflow-y: auto; }
.shop-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters button { padding: 6px 14px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); border-radius: 20px; cursor: pointer; font-size: 13px; }
.filters button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  transition: 0.15s;
}
.product-card:hover { transform: translateY(-2px); border-color: #444; }
.product-emoji { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 56px; background: #111; }
.product-info { padding: 14px; }
.product-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.product-price { color: var(--accent); font-weight: 700; font-size: 18px; }
.product-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Profile */
.profile-layout { padding: 24px; overflow-y: auto; max-width: 800px; margin: 0 auto; width: 100%; }
.profile-header { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.profile-avatar { width: 90px; height: 90px; border-radius: 50%; font-size: 36px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.profile-stats { display: flex; gap: 20px; margin-top: 8px; }
.profile-stats div { text-align: center; }
.profile-stats strong { display: block; font-size: 18px; color: var(--accent); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }

/* Home */
.home-layout { padding: 20px; overflow-y: auto; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.card h3 { margin-bottom: 10px; font-size: 16px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

@media (max-width: 800px) {
  .sidebar { width: 220px; }
  .home-grid { grid-template-columns: 1fr; }
  nav.main-nav button { padding: 8px 10px; font-size: 13px; }
}
