/* VerbaX - Cream/Black/Grey Theme
 * Modern AI-era software interface
 * Minimal, precise, engineered
 */

/* ==================== CSS VARIABLES ==================== */
:root {
  /* Base - Cream Foundation */
  --bg-primary: #F3EDE4;
  --bg-surface: #E9E2D8;
  --bg-elevated: #DDD4C8;
  --bg-hover: #D5CCC0;
  
  /* Text */
  --text-primary: #0E0E0E;
  --text-secondary: #2E2E2E;
  --text-muted: #6A6A6A;
  
  /* Accents - Black & Grey Only */
  --accent-primary: #000000;
  --accent-secondary: #5C5C5C;
  --accent-border: #BEBEBE;
  --accent-border-hover: #8A8A8A;
  
  /* Functional */
  --success: #2D5A2D;
  --error: #8B3030;
  --warning: #6B5A2D;
  
  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 0 1px var(--accent-primary);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 60px;
  --input-height: 60px;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.5;
}

/* Click/press effect */
button:active {
  transform: scale(0.98);
  transition: transform var(--transition-fast);
}

/* Focus states */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ==================== ASCII REACTIVE BACKGROUND ==================== */
.ascii-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.04;
}

.ascii-char {
  position: absolute;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 14px;
  color: var(--text-primary);
  transition: transform 0.3s ease, opacity 0.3s ease;
  user-select: none;
  font-weight: 300;
}

.ascii-char.near-cursor {
  opacity: 0.6;
  transform: scale(1.2);
}

/* ==================== APP LAYOUT ==================== */
.app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 1;
  background: transparent;
}

/* ==================== PASSWORD SCREEN ==================== */
.password-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.password-screen.hidden {
  display: none;
}

.password-box {
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  padding: 48px;
  text-align: center;
  width: 320px;
}

.password-logo {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.password-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 32px;
  letter-spacing: 1px;
}

.password-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 24px;
  letter-spacing: 12px;
  text-align: center;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 16px;
}

.password-input:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.password-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.password-submit:hover {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.password-error {
  margin-top: 16px;
  font-size: 12px;
  color: var(--error);
  min-height: 18px;
}

/* ==================== STARTUP SCREEN ==================== */
.startup-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

.startup-screen.active {
  opacity: 1;
  visibility: visible;
}

.startup-ascii {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0.06;
}

.startup-ascii .ascii-char {
  position: absolute;
  font-size: 11px;
}

.startup-content {
  text-align: center;
  transform: translateY(40px);
  opacity: 0;
  transition: all 1s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
}

.startup-screen.active .startup-content {
  transform: translateY(0);
  opacity: 1;
}

.startup-logo {
  margin-bottom: 48px;
}

.startup-logo-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.8);
  animation: logoReveal 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.3s;
}

@keyframes logoReveal {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.startup-logo-text {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: 16px;
  color: var(--text-primary);
  margin-top: 24px;
}

.startup-tagline {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 6px;
  text-transform: uppercase;
  margin-top: 12px;
}

.startup-prompt {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  opacity: 0;
  transition: opacity 0.5s ease;
  margin-top: 64px;
}

.startup-screen.ready .startup-prompt {
  opacity: 1;
}

.startup-cursor {
  animation: blink 1s step-end infinite;
  color: var(--accent-primary);
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ==================== ANNOUNCEMENT BANNERS ==================== */
.announcement-banner,
.event-announcement-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 10px 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.announcement-close,
.event-announcement-close {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--bg-primary);
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
}

.announcement-close:hover,
.event-announcement-close:hover {
  opacity: 1;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--accent-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* User Section */
.user-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
}

/* Pinned Section */
.pinned-section {
  padding: 16px 12px;
  border-bottom: 1px solid var(--accent-border);
}

.pinned-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 4px;
}

.pinned-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--text-primary);
}

.pinned-icon {
  font-size: 16px;
}

/* Leaderboard */
.leaderboard-section {
  padding: 12px;
  border-bottom: 1px solid var(--accent-border);
}

.leaderboard-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.leaderboard-toggle:hover {
  color: var(--text-primary);
}

.leaderboard-arrow {
  margin-left: auto;
  font-size: 10px;
  transition: transform var(--transition-fast);
}

.leaderboard-toggle.open .leaderboard-arrow {
  transform: rotate(180deg);
}

.leaderboard-dropdown {
  display: none;
  padding: 8px 0;
}

.leaderboard-dropdown.open {
  display: block;
}

.leaderboard-loading,
.leaderboard-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.leaderboard-rank {
  font-weight: 600;
  width: 20px;
  color: var(--text-primary);
}

.leaderboard-name {
  flex: 1;
}

.leaderboard-amount {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-muted);
}

/* Channels Section */
.channels-section {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.toggle-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-primary);
}

.toggle-btn:hover:not(.active) {
  border-color: var(--accent-secondary);
  color: var(--text-primary);
}

.channels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  margin-bottom: 8px;
}

.channels-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.add-channel-btn,
.channel-action-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-channel-btn:hover,
.channel-action-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* Channel Item */
.channel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  margin-bottom: 2px;
}

.channel:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.channel.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

.channel-icon {
  font-size: 14px;
  opacity: 0.7;
}

.channel-name {
  flex: 1;
}

.channel-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--accent-primary);
  color: var(--bg-primary);
  font-weight: 600;
}

/* DM Section */
.dm-list {
  margin-top: 12px;
}

.dm-header {
  padding: 8px 4px;
  margin-bottom: 8px;
}

.dm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dm-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.dm-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.dm-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-left: auto;
}

/* Settings Button */
.settings-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--accent-border);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.settings-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.settings-btn-icon {
  font-size: 16px;
}

/* ==================== MAIN CHAT AREA ==================== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-surface);
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.chat-channel-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-channel-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent-secondary);
}

/* Messages Area */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.message {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  transition: background var(--transition-fast);
}

.message:hover {
  background: var(--bg-surface);
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.message-content {
  flex: 1;
  min-width: 0;
}

.message-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.message-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.message-username.admin {
  color: var(--accent-primary);
}

.message-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.message-text {
  font-size: 14px;
  color: var(--text-secondary);
  word-wrap: break-word;
}

.message-image {
  max-width: 400px;
  border-radius: 4px;
  margin-top: 8px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== INPUT AREA ==================== */
.input-area {
  background: var(--bg-surface);
  border-top: 1px solid var(--accent-border);
}

.input-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--accent-border);
}

.toolbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--accent-border);
}

.input-container {
  display: flex;
  gap: 8px;
  padding: 12px;
  align-items: flex-end;
}

.message-input-wrapper {
  flex: 1;
  position: relative;
}

.message-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  font-family: inherit;
}

.message-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.message-input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.send-btn:hover:not(:disabled) {
  background: var(--text-primary);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Emoji Picker */
.emoji-picker,
.gif-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  display: none;
  z-index: 100;
}

.emoji-picker.open,
.gif-picker.open {
  display: block;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.emoji-btn:hover {
  background: var(--bg-elevated);
}

/* GIF Picker */
.gif-picker {
  width: 300px;
  right: 0;
  left: auto;
}

.gif-search {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: none;
  border-bottom: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 13px;
}

.gif-search:focus {
  outline: none;
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.gif-item {
  aspect-ratio: 1;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.gif-item:hover {
  border-color: var(--accent-primary);
}

.giphy-attribution {
  padding: 6px;
  text-align: center;
  font-size: 9px;
  color: var(--text-muted);
  border-top: 1px solid var(--accent-border);
}

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
}

.modal-overlay.active {
  display: block;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  z-index: 9999;
  display: none;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.modal.active {
  display: flex;
  flex-direction: column;
}

.modal-large {
  width: 600px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

/* Stats Modal */
.stats-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
}

.stats-overlay.active {
  display: block;
}

.stats-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  z-index: 9999;
  display: none;
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
}

.stats-modal.active {
  display: flex;
  flex-direction: column;
}

.stats-modal-large {
  width: 600px;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
}

.stats-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.stats-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}

.stats-close:hover {
  color: var(--text-primary);
}

.stats-body {
  padding: 20px;
  color: var(--text-primary);
}

/* Currency Section */
.stats-currency-section {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
}

.stats-currency-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.stats-currency-icon {
  font-size: 28px;
}

.stats-currency-info {
  text-align: left;
}

.stats-currency-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stats-currency-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.stats-claim-btn {
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  padding: 12px 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.stats-claim-btn:hover {
  background: var(--text-primary);
}

.stats-claim-btn:disabled {
  background: var(--bg-hover);
  border-color: var(--accent-border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.stats-claim-timer {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Section Titles */
.stats-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Inventory */
.stats-inventory-section {
  margin-top: 20px;
}

.stats-inventory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
}

.stats-empty-inventory {
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
  width: 100%;
  font-size: 13px;
}

.inventory-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  font-size: 12px;
}

.inventory-item.equipped {
  border-color: var(--accent-primary);
}

.item-emoji {
  font-size: 18px;
}

.item-name {
  color: var(--text-primary);
}

.equip-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
}

.equip-btn.equipped {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-primary);
}

/* Gambling Section */
.stats-gambling-section {
  margin-top: 20px;
}

.stats-gambling-games {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-game-btn {
  flex: 1;
  min-width: 140px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.stats-game-btn:hover {
  border-color: var(--accent-secondary);
  background: var(--bg-hover);
}

.game-icon {
  font-size: 24px;
}

.game-name {
  font-size: 12px;
  font-weight: 500;
}

/* ==================== CASE MODAL ==================== */
.case-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}

.case-overlay.active {
  display: block;
}

.case-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  width: 400px;
  z-index: 9999;
  display: none;
}

.case-modal.active {
  display: block;
}

.case-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
}

.case-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.case-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.case-close:hover {
  color: var(--text-primary);
}

.case-body {
  padding: 24px;
  text-align: center;
}

/* Slot Machine */
.slot-machine {
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  padding: 16px;
  margin-bottom: 20px;
  overflow: hidden;
}

.slot-reel {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.slot-item {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  font-size: 28px;
}

.case-result {
  margin: 20px 0;
}

.result-item {
  text-align: center;
}

.result-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.result-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-rarity {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.case-open-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.case-open-btn:hover {
  background: var(--text-primary);
}

/* Case Preview */
.case-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}

.case-preview-overlay.active {
  display: block;
}

.case-preview-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  z-index: 9999;
  display: none;
}

.case-preview-modal.active {
  display: block;
}

.case-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
}

.case-preview-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.case-preview-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.case-preview-legend {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--accent-border);
  flex-wrap: wrap;
}

.case-preview-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.case-preview-legend-dot {
  width: 8px;
  height: 8px;
}

.case-preview-legend-dot.legendary { background: #B8860B; }
.case-preview-legend-dot.epic { background: #8B008B; }
.case-preview-legend-dot.rare { background: #0077FF; }
.case-preview-legend-dot.uncommon { background: #2E8B57; }
.case-preview-legend-dot.common { background: #6A6A6A; }

/* ==================== CASES GRID ==================== */
.cases-intro {
  text-align: center;
  margin-bottom: 20px;
}

.cases-intro p {
  color: var(--text-muted);
  margin-bottom: 12px;
  font-size: 13px;
}

.cases-balance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
}

.cases-balance-label {
  color: var(--text-muted);
}

.cases-balance-amount {
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.cases-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.case-card {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.case-card:hover {
  border-color: var(--accent-secondary);
  background: var(--bg-hover);
}

.case-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.case-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.case-price {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.case-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.case-preview-btn {
  margin-top: 12px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.case-preview-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Case Opening Animation */
.case-opening {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.case-opening.active {
  display: flex;
}

.case-opening-container {
  text-align: center;
}

.case-opening-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--bg-primary);
  margin-bottom: 24px;
  letter-spacing: 4px;
}

.case-ticker {
  background: var(--bg-primary);
  border: 2px solid var(--accent-border);
  padding: 20px;
  width: 500px;
  max-width: 90vw;
  overflow: hidden;
}

.case-ticker-track {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.case-ticker-item {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  font-size: 36px;
}

.case-center-line {
  width: 2px;
  height: 80px;
  background: var(--accent-primary);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.case-close-btn {
  margin-top: 24px;
  padding: 14px 32px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
}

/* ==================== GAMBLING MODALS ==================== */
.gambling-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  display: none;
}

.gambling-overlay.active {
  display: block;
}

.gambling-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  width: 400px;
  z-index: 9999;
  display: none;
}

.gambling-modal.active {
  display: block;
}

.gambling-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
}

.gambling-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.gambling-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.gambling-body {
  padding: 24px;
}

/* Blackjack */
.blackjack-balance {
  text-align: center;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
}

.balance-label {
  color: var(--text-muted);
  font-size: 12px;
}

.balance-amount {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

.balance-currency {
  font-size: 18px;
}

.blackjack-mode-select {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.mode-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-primary);
}

.blackjack-table {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  padding: 20px;
  margin-bottom: 16px;
}

.blackjack-dealer,
.blackjack-player {
  margin-bottom: 16px;
}

.blackjack-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.blackjack-cards {
  display: flex;
  gap: 8px;
  min-height: 60px;
}

.blackjack-card {
  width: 40px;
  height: 56px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.blackjack-score {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.blackjack-divider {
  height: 1px;
  background: var(--accent-border);
  margin: 16px 0;
}

.blackjack-controls {
  margin-bottom: 16px;
}

.blackjack-bet-section {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.blackjack-bet {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 14px;
}

.blackjack-bet:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.blackjack-btn {
  padding: 10px 16px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.blackjack-btn:hover:not(:disabled) {
  background: var(--text-primary);
}

.blackjack-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.blackjack-actions {
  display: flex;
  gap: 8px;
}

.blackjack-result {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
}

/* Multiplayer */
.blackjack-multi-menu,
.blackjack-multi-game {
  margin-bottom: 16px;
}

.multi-menu-section {
  margin-bottom: 16px;
}

.multi-menu-section h3 {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.multi-bet-input {
  display: flex;
  gap: 8px;
}

.multi-menu-btn {
  padding: 10px 16px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 12px;
  cursor: pointer;
}

.multi-waiting-list {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  padding: 12px;
  max-height: 150px;
  overflow-y: auto;
}

.multi-empty-state {
  color: var(--text-muted);
  text-align: center;
  font-size: 12px;
  padding: 20px;
}

.multi-game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.multi-game-status {
  font-size: 12px;
  color: var(--text-muted);
}

.multi-leave-btn {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.multi-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.multi-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  font-size: 12px;
}

/* Coinflip */
.coinflip-display {
  text-align: center;
  margin-bottom: 24px;
}

.coinflip-coin {
  width: 100px;
  height: 100px;
  background: var(--bg-elevated);
  border: 2px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin: 0 auto;
}

.coinflip-controls {
  text-align: center;
}

.coinflip-choice {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.coinflip-select {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.coinflip-select.selected {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--bg-primary);
}

.coinflip-bet {
  width: 100%;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--accent-border);
  color: var(--text-primary);
  font-size: 14px;
  margin-bottom: 12px;
}

.coinflip-bet:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.coinflip-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
}

.coinflip-btn:hover {
  background: var(--text-primary);
}

.coinflip-result {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
}

/* ==================== WIN/LOSS MODAL ==================== */
.winloss-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}

.winloss-overlay.active {
  display: block;
}

.winloss-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-surface);
  border: 1px solid var(--accent-border);
  width: 360px;
  z-index: 9999;
  display: none;
}

.winloss-modal.active {
  display: block;
}

.winloss-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--accent-border);
  background: var(--bg-elevated);
}

.winloss-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.winloss-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

.winloss-body {
  padding: 20px;
}

.winloss-item {
  text-align: center;
  font-size: 48px;
  margin-bottom: 16px;
}

.winloss-details {
  margin-bottom: 20px;
}

.winloss-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--accent-border);
}

.winloss-label {
  color: var(--text-muted);
}

.winloss-value {
  color: var(--text-primary);
  font-weight: 500;
}

.winloss-divider {
  height: 1px;
  background: var(--accent-border);
  margin: 8px 0;
}

.winloss-profit {
  font-size: 15px;
}

.winloss-profit .winloss-label,
.winloss-profit .winloss-value {
  font-weight: 700;
  color: var(--text-primary);
}

.winloss-buttons {
  display: flex;
  gap: 8px;
}

.winloss-btn {
  flex: 1;
  padding: 12px;
  background: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: var(--bg-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.winloss-btn.sell {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  color: var(--text-primary);
}

.winloss-btn.sell:hover {
  background: var(--bg-hover);
}

/* ==================== SCREEN EFFECTS ==================== */
.screen-flash {
  position: fixed;
  inset: 0;
  background: white;
  pointer-events: none;
  opacity: 0;
  z-index: 9997;
}

.screen-flash.active {
  animation: flash 0.3s ease;
}

@keyframes flash {
  0% { opacity: 0.8; }
  100% { opacity: 0; }
}

.corner-flash {
  position: fixed;
  width: 200px;
  height: 200px;
  pointer-events: none;
  opacity: 0;
  z-index: 9997;
}

.corner-flash.active {
  animation: cornerFlash 0.5s ease;
}

.corner-flash-top-left {
  top: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(255,215,0,0.8) 0%, transparent 70%);
}

.corner-flash-top-right {
  top: 0;
  right: 0;
  background: linear-gradient(-135deg, rgba(255,215,0,0.8) 0%, transparent 70%);
}

.corner-flash-bottom-left {
  bottom: 0;
  left: 0;
  background: linear-gradient(45deg, rgba(255,215,0,0.8) 0%, transparent 70%);
}

.corner-flash-bottom-right {
  bottom: 0;
  right: 0;
  background: linear-gradient(-45deg, rgba(255,215,0,0.8) 0%, transparent 70%);
}

@keyframes cornerFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 100;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .cases-grid {
    grid-template-columns: 1fr;
  }
  
  .case-ticker {
    width: 100%;
  }
}
