/* ─────────────────────────────────────────
   JMRAI PLAYGROUND — style.css
   Clean dark theme with subtle cyber accents
   ───────────────────────────────────────── */

/* ── TOKENS ── */
:root {
  --bg:           #0c0c10;
  --bg-surface:   #13131a;
  --bg-raised:    #1a1a24;
  --bg-hover:     #20202e;

  --border:       #252535;
  --border-focus: #5b4fff;

  --accent:       #5b4fff;
  --accent-hover: #7b6fff;
  --accent-dim:   rgba(91,79,255,.15);

  --green:  #22c55e;
  --yellow: #eab308;
  --red:    #ef4444;
  --cyan:   #06b6d4;

  --text-1: #f0f0f8;
  --text-2: #8888aa;
  --text-3: #444460;

  --font-ui:   'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow: 0 2px 12px rgba(0,0,0,.4);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; font-size: inherit; }
img { display: block; max-width: 100%; }

/* ── TYPOGRAPHY UTILS ── */
.text-dim  { color: var(--text-2); }
.optional  { color: var(--text-3); font-size: .85em; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  outline: none;
}
.btn:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-1);
  border-color: var(--text-3);
}
.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
}
.btn-sm   { padding: 5px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── INPUT ── */
.input-field {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input-field::placeholder { color: var(--text-3); }

.form-group  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label  { font-size: 13px; font-weight: 500; color: var(--text-2); }

/* ─────────────────────────────────────────
   AUTH PAGES  (login / setup)
   ───────────────────────────────────────── */
.auth-page  { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }

.auth-wrap  { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Logo */
.auth-logo  { display: flex; align-items: center; gap: 8px; }
.logo-mark  { font-size: 20px; color: var(--accent); }
.logo-name  { font-family: var(--font-mono); font-weight: 600; font-size: 16px; letter-spacing: 2px; }
.logo-tag   { font-size: 10px; color: var(--text-3); letter-spacing: 3px; text-transform: uppercase; background: var(--bg-raised); padding: 2px 6px; border-radius: 3px; }

.auth-desc  { font-size: 13px; color: var(--text-2); line-height: 1.7; }
.auth-desc strong { color: var(--text-1); }

/* QR */
.qr-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: var(--r-md);
  padding: 12px;
  min-height: 180px;
}
.qr-img { width: 156px; height: 156px; object-fit: contain; }
.qr-error::after {
  content: '二维码加载失败';
  display: block;
  color: #999;
  font-size: 12px;
  text-align: center;
}

/* Code input */
.code-input-wrap { display: flex; flex-direction: column; gap: 10px; }
.code-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-1);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 8px;
  text-align: center;
  padding: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.code-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.code-input::placeholder { font-size: 14px; letter-spacing: 1px; color: var(--text-3); }

/* Hints */
.auth-hint        { font-size: 12px; text-align: center; min-height: 18px; color: var(--text-2); }
.auth-hint.error  { color: var(--red); }
.auth-hint.ok     { color: var(--green); }

.auth-footer { font-size: 11px; color: var(--text-3); text-align: center; }

/* ── SETUP: ID display ── */
.setup-id-display {
  text-align: center;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 16px;
}
.setup-id-label  { display: block; font-size: 11px; color: var(--text-3); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
.setup-id-number { display: block; font-family: var(--font-mono); font-size: 40px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.setup-id-note   { display: block; font-size: 11px; color: var(--text-2); margin-top: 6px; }

.setup-form { display: flex; flex-direction: column; }

/* ─────────────────────────────────────────
   USER MAIN PAGE
   ───────────────────────────────────────── */

/* Top Nav */
.topnav {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topnav-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-logo { display: flex; align-items: center; gap: 8px; }
.logo-sep  { color: var(--text-3); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* WS badge */
.ws-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-2);
  background: var(--bg-raised);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}
.ws-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background .3s, box-shadow .3s;
}
.ws-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
.ws-dot.error { background: var(--red); }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* User pill */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px 4px 6px;
}
.user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
}
.user-avatar-placeholder {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.user-name { font-size: 13px; font-weight: 500; }
.user-id   { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

/* Three-column layout */
.main-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  align-items: start;
  gap: 16px;
}
@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr 1fr; }
  #section-events { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .main-layout { grid-template-columns: 1fr; }
}

/* Panel */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Chat panel: fixed height, messages scroll inside */
.panel--chat {
  height: calc(100vh - 52px - 40px);
  position: sticky;
  top: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 13px; font-weight: 600; }
.panel-count { font-size: 11px; color: var(--text-2); background: var(--bg-raised); padding: 2px 8px; border-radius: 10px; }

/* Events */
.events-list { display: flex; flex-direction: column; gap: 0; overflow-y: auto; flex: 1; }
.event-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.event-item:last-child { border-bottom: none; }
.event-item:hover { background: var(--bg-hover); }
.event-item--soon { opacity: .55; }

.event-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.event-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}
.badge-live { background: rgba(34,197,94,.15); color: var(--green); }
.badge-soon { background: rgba(234,179,8,.12);  color: var(--yellow); }
.badge-ended { background: rgba(239,68,68,.12); color: var(--red); }

.event-date { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.event-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.event-desc { font-size: 12px; color: var(--text-2); margin-bottom: 12px; }
.event-actions { display: flex; justify-content: space-between; align-items: center; }
.event-participants { font-size: 11px; color: var(--text-3); }

/* Chat */
.chat-messages {
  flex: 1;
  min-height: 0;          /* critical: allows flex child to shrink and scroll */
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-raised) transparent;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.chat-msg { display: flex; gap: 8px; align-items: baseline; font-size: 13px; animation: fadein .15s; }
@keyframes fadein { from { opacity:0; transform: translateY(4px); } to { opacity:1; transform:none; } }

.chat-msg.system .msg-body { color: var(--text-3); font-style: italic; font-size: 11px; }
.msg-user  { font-family: var(--font-mono); font-size: 11px; font-weight: 600; flex-shrink: 0; }
.msg-body  { color: var(--text-1); word-break: break-word; }
.msg-ts    { margin-left: auto; font-size: 10px; color: var(--text-3); flex-shrink: 0; }

.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-raised);
}

/* Lottery */
.lottery-stage {
  padding: 24px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.lottery-idle { color: var(--text-3); }
.lottery-icon {
  display: block;
  font-size: 32px;
  color: var(--accent);
  margin-bottom: 8px;
  animation: spin 8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lottery-winner-label { font-size: 11px; color: var(--text-2); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 6px; }
.lottery-winner-name  { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--yellow); }

.lottery-chips {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
}
.entry-chip {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-dim);
  border: 1px solid rgba(91,79,255,.3);
  color: var(--text-1);
  animation: chipin .2s;
}
@keyframes chipin { from { opacity:0; transform: scale(.7); } to { opacity:1; transform: scale(1); } }

.lottery-footer { padding: 12px 14px; }

/* ─────────────────────────────────────────
   ADMIN LAYOUT
   ───────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.admin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.admin-logo .logo-mark { font-size: 22px; color: var(--accent); }
.admin-logo .logo-name { font-family: var(--font-mono); font-size: 14px; font-weight: 600; letter-spacing: 2px; }
.admin-logo .logo-tag  { font-size: 9px; color: var(--text-3); letter-spacing: 2px; }

.admin-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
}
.admin-nav-item:hover { background: var(--bg-hover); color: var(--text-1); }
.admin-nav-item.active { background: var(--accent-dim); color: var(--text-1); }
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

.admin-sidebar-footer { padding: 12px 10px 0; border-top: 1px solid var(--border); margin-top: 12px; }

.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}
.admin-page-title { font-size: 15px; font-weight: 600; }
.admin-user-info  { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }

.admin-content { padding: 24px; flex: 1; overflow-y: auto; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
}
.stat-label { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.stat-value { font-family: var(--font-mono); font-size: 32px; font-weight: 700; color: var(--text-1); }

/* Admin panels */
.admin-panels-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .admin-panels-row { grid-template-columns: 1fr; } }

.admin-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.admin-panel-head {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.admin-chat-log {
  height: 260px;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Table */
.admin-toolbar { margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

.id-badge { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--accent); }
.table-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 8px; }

.role-badge { font-size: 10px; padding: 2px 7px; border-radius: 3px; font-weight: 600; }
.role-admin { background: rgba(91,79,255,.15); color: var(--accent); }
.role-user  { background: var(--bg-raised); color: var(--text-2); }
.badge-live { background: rgba(34,197,94,.15); color: var(--green); }

/* Lottery control page */
.lottery-control { max-width: 600px; }
.lottery-stage-large {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 40px;
  text-align: center;
  margin-bottom: 16px;
}
.lottery-control-row { display: flex; gap: 12px; margin-top: 16px; }

/* ─────────────────────────────────────────
   MODALS
   ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 28px 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.modal-head {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─────────────────────────────────────────
   EXTRA BUTTON VARIANTS
   ───────────────────────────────────────── */
.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--red);
}
.btn-danger-ghost:hover:not(:disabled) {
  background: rgba(239,68,68,.1);
  border-color: var(--red);
}

/* ─────────────────────────────────────────
   ADMIN MISC
   ───────────────────────────────────────── */
.admin-section-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.badge-soon { background: rgba(234,179,8,.12); color: var(--yellow); }
.badge-ended { background: rgba(239,68,68,.12); color: var(--red); }

/* ─────────────────────────────────────────
   INBOX BUTTON & TOAST
   ───────────────────────────────────────── */
.inbox-btn {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2);
  cursor: pointer;
  padding: 5px 10px;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.inbox-btn:hover { background: var(--bg-hover); color: var(--text-1); }

.inbox-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badge-pop .3s ease;
}
@keyframes badge-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* Inbox modal */
.inbox-modal-box {
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.inbox-modal-box .modal-head { padding: 20px 24px 16px; margin-bottom: 0; }
.inbox-list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.inbox-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.inbox-item:hover { background: var(--bg-hover); }
.inbox-item--unread { border-left: 3px solid var(--accent); }
.inbox-item--unread .inbox-item-subject { color: var(--text-1); font-weight: 600; }

.inbox-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.inbox-item-from  { font-size: 12px; font-weight: 600; color: var(--text-2); }
.inbox-item-ts    { font-size: 11px; color: var(--text-3); margin-left: auto; }
.inbox-item-tag   { font-size: 11px; }
.inbox-item-subject { font-size: 13px; color: var(--text-2); }
.inbox-item-body  {
  font-size: 13px;
  color: var(--text-1);
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-raised);
  border-radius: var(--r-sm);
  white-space: pre-wrap;
  line-height: 1.7;
}

/* Message toast */
.msg-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  animation: toast-in .3s ease;
}
@keyframes toast-in { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }
.msg-toast-icon { font-size: 20px; }

/* ─────────────────────────────────────────
   LOTTERY — NEW STYLES
   ───────────────────────────────────────── */
.lottery-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 2px;
}
.lottery-prizes {
  padding: 8px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lottery-prize-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.prize-tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
}
.prize-tier-badge.tier-1 { background: rgba(234,179,8,.15); color: var(--yellow); }
.prize-tier-badge.tier-2 { background: rgba(6,182,212,.12);  color: var(--cyan); }
.prize-tier-badge.tier-3 { background: rgba(34,197,94,.12);  color: var(--green); }

.lottery-winner-tier {
  font-size: 12px;
  color: var(--text-2);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ─────────────────────────────────────────
   ADMIN — LOTTERY EDIT PAGE
   ───────────────────────────────────────── */
.lottery-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 20px;
}
.admin-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 960px) { .admin-edit-grid { grid-template-columns: 1fr; } }

.prize-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.prize-row:last-child { border-bottom: none; }

/* ─────────────────────────────────────────
   ADMIN ALERTS
   ───────────────────────────────────────── */
.alert-error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-ok {
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.3);
  color: var(--green);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Nav section label */
.nav-section-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 12px 4px;
  margin-top: 4px;
}

/* ─────────────────────────────────────────
   LOTTERY — ENRICHED UI
   ───────────────────────────────────────── */

/* Status strip */
.lottery-status-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}

.lottery-status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  white-space: nowrap;
}
.lottery-status-badge.status-open    { background: rgba(34,197,94,.15); color: var(--green); }
.lottery-status-badge.status-drawing { background: rgba(91,79,255,.2);  color: var(--accent); animation: pulse 1s infinite; }
.lottery-status-badge.status-closed  { background: rgba(239,68,68,.1);  color: var(--red); }
.lottery-status-badge.status-draft   { background: var(--bg-hover);     color: var(--text-3); }

/* Countdown */
.lottery-countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.countdown-label {
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: .5px;
}
.countdown-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--yellow);
  letter-spacing: 1px;
  min-width: 62px;
  text-align: right;
}

/* Lottery header block */
.lottery-header-block {
  padding: 16px 16px 8px;
}
.lottery-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}
.lottery-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
}

/* Prize list */
.lottery-prizes {
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}
.lottery-prize-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  transition: background .12s;
}
.lottery-prize-row:hover { background: var(--bg-hover); }

.prize-tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}
.prize-tier-badge.tier-1 { background: rgba(234,179,8,.15);  color: var(--yellow); }
.prize-tier-badge.tier-2 { background: rgba(6,182,212,.12);  color: var(--cyan); }
.prize-tier-badge.tier-3 { background: rgba(34,197,94,.12);  color: var(--green); }

.prize-icon { font-size: 13px; flex-shrink: 0; }
.prize-desc {
  color: var(--text-2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prize-qty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
  margin-left: auto;
}

/* Entry progress bar */
.lottery-entry-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.entry-bar-track {
  flex: 1;
  height: 4px;
  background: var(--bg-raised);
  border-radius: 2px;
  overflow: hidden;
}
.entry-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  border-radius: 2px;
  transition: width .6s ease;
  width: 0%;
}
.entry-bar-label {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* Drawing animation */
.lottery-drawing-anim {
  padding: 32px 16px;
  text-align: center;
}
.drawing-spinner {
  font-size: 40px;
  color: var(--accent);
  display: inline-block;
  animation: spin .6s linear infinite;
  margin-bottom: 12px;
}
.drawing-label {
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: 2px;
  animation: pulse 1s infinite;
}

/* Join button — entered state */
.btn-entered {
  background: rgba(34,197,94,.12) !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
}
.btn-entered:hover { background: rgba(34,197,94,.2) !important; }

/* History messages — slightly dimmed */
.chat-msg.history {
  opacity: 0.65;
}

/* ── Emoji quick-bar ── */
.emoji-bar {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.emoji-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  transition: background .15s;
  line-height: 1.4;
}
.emoji-btn:hover { background: var(--accent-tint); }

/* ── @mention highlight ── */
.mention {
  font-weight: 600;
  border-radius: 3px;
  padding: 0 2px;
}
.mention-me {
  background: rgba(91,79,255,.18);
  outline: 1px solid rgba(91,79,255,.4);
}

/* ── Emoji-only big display ── */
.msg-emoji-big {
  font-size: 26px;
  line-height: 1.2;
}

/* ── Own message subtle highlight ── */
.chat-msg.mine .msg-user { font-weight: 700; }

/* Event participant count */
.event-count {
  font-size: 11px;
  color: var(--text-2);
  font-family: var(--mono);
  margin-left: 6px;
}

/* ── Lottery results panel ── */
.lottery-results-panel {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--yellow);
  text-align: center;
  letter-spacing: 2px;
}
.results-subtitle {
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}
.results-list { display: flex; flex-direction: column; gap: 6px; }
.result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 13px;
  flex-wrap: wrap;
}
.result-row--me {
  border-color: var(--yellow);
  background: rgba(234,179,8,.08);
}
.result-tier {
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow);
  background: rgba(234,179,8,.15);
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}
.result-name { font-weight: 600; }
.result-id   { color: var(--text-2); font-size: 11px; font-family: var(--font-mono); }
.result-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  background: rgba(6,182,212,.1);
  border: 1px solid rgba(6,182,212,.3);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: auto;
  word-break: break-all;
}
.result-me-tag {
  font-size: 12px;
  color: var(--yellow);
  font-weight: 700;
  margin-left: auto;
}
.results-hint {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

/* ── User moderation badges ── */
.badge-banned {
  font-size: 11px; font-weight: 700;
  color: var(--red);
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 4px; padding: 1px 6px;
}
.badge-muted {
  font-size: 11px; font-weight: 700;
  color: var(--yellow);
  background: rgba(234,179,8,.12);
  border: 1px solid rgba(234,179,8,.3);
  border-radius: 4px; padding: 1px 6px;
}
.row-banned td { opacity: .45; }
.btn-danger-ghost {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn-danger-ghost:hover:not(:disabled) { background: rgba(239,68,68,.1); }
