/* ─── Custom Properties ─── */
:root {
  --bg:           #0d0d1a;
  --surface:      #131325;
  --card:         #191930;
  --elevated:     #1e1e3a;
  --border:       #2a2a4a;
  --border-light: #3d3d65;
  --accent:       #7c5cbf;
  --accent-h:     #9b7de0;
  --accent-dim:   rgba(124,92,191,0.12);
  --text:         #e2e2f0;
  --text-2:       #8a8aaa;
  --text-3:       #4a4a6a;
  --success:      #4ecca3;
  --warning:      #f7b731;
  --danger:       #e05c6e;
  --shadow:       0 2px 16px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.65);
  --r:   10px;
  --r-s:  6px;
  --r-l: 16px;
}

/* ─── Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Typography ─── */
h1 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1rem;     font-weight: 600; }
h4 { font-size: 0.875rem; font-weight: 600; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ─── Inputs ─── */
input {
  font-size: 14px;
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--r-s);
  outline: none;
  transition: border-color 0.2s;
}
input:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-3); }
input[type=number] { width: 88px; text-align: center; }

/* ─── Buttons ─── */
button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-s);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  white-space: nowrap;
  line-height: 1;
}
button:hover {
  background: var(--accent-h);
  box-shadow: 0 0 18px rgba(124,92,191,0.4);
}
button:active  { transform: scale(0.97); }
button:disabled {
  background: var(--text-3);
  cursor: default;
  box-shadow: none;
  transform: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--elevated); box-shadow: none; color: var(--text); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c9445a; box-shadow: 0 0 18px rgba(224,92,110,0.4); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ─── App Nav ─── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-nav__brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-h);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.app-nav__brand::before {
  content: '♠';
  color: var(--accent);
  font-size: 1.25rem;
}
.app-nav__right { display: flex; align-items: center; gap: 8px; }

/* ─── Page wrapper ─── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ─── Section ─── */
.section { margin-bottom: 28px; }
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-2);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Card ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ─── Message styles (game.html + room.html chat) ─── */
.message { margin-bottom: 10px; font-size: 13px; line-height: 1.4; }
.message__name { font-weight: 700; color: var(--accent-h); margin-right: 6px; }
.message__meta { color: var(--text-3); font-size: 11px; }
.message a { color: var(--accent-h); }

/* ─── List header / sidebar titles (game.html room panel + room.html sidebar) ─── */
.room-title {
  padding: 18px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.list-title {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
}
.users { list-style: none; padding: 0 20px; }
.users li {
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.users li:last-child { border-bottom: none; }

/* ─── Light theme ─── */
html[data-theme="light"] {
  --bg:           #f0f0f8;
  --surface:      #ffffff;
  --card:         #fafafa;
  --elevated:     #eaeaf5;
  --border:       #d8d8ec;
  --border-light: #bbbbd8;
  --accent:       #7c5cbf;
  --accent-h:     #6044b0;
  --accent-dim:   rgba(124,92,191,0.08);
  --text:         #1a1a2e;
  --text-2:       #5a5a80;
  --text-3:       #9a9abc;
  --shadow:       0 2px 16px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.15);
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .page { padding: 16px 12px; }
  .app-nav { padding: 0 12px; }
}
