/* ============================================================
   RoyalSportLaos Chat App — Complete CSS Theme
   Black + Green + Gold brand colors
   Mobile-first, max-width 480px, centered
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --bg: #0a0e17;
  --bg-dark: #060a12;
  --primary-green: #004000;
  --bright-green: #008000;
  --gold: #c08020;
  --light-gold: #e0c080;
  --white: #ffffff;
  --muted: #8b9bb4;
  --card-bg: #111827;
  --border: #1f2937;

  --gradient-green: linear-gradient(135deg, #004000 0%, #008000 100%);
  --gradient-gold: linear-gradient(135deg, #c08020 0%, #e0c080 100%);
  --gradient-dark: linear-gradient(180deg, #0a0e17 0%, #111827 100%);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --nav-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", "Fira Code", "Consolas", monospace;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-glow-green: 0 0 24px rgba(0, 128, 0, 0.35);
  --shadow-glow-gold: 0 0 24px rgba(192, 128, 32, 0.3);

  --transition: 0.2s ease;
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--white);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App container — mobile-first, max 480px, centered */
#app,
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }

a {
  color: var(--light-gold);
  text-decoration: none;
}

a:active {
  opacity: 0.7;
}

.muted {
  color: var(--muted);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--gradient-dark);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px 28px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.login-logo {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--light-gold);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  box-shadow: var(--shadow-glow-green);
}

.login-title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.02em;
}

.input,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 13px 16px;
  font-size: 16px; /* 16px prevents iOS zoom */
  font-family: var(--font);
  color: var(--white);
  background: var(--bg-dark);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder,
textarea::placeholder {
  color: #4a5568;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--bright-green);
  box-shadow: 0 0 0 3px rgba(0, 128, 0, 0.15);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition), opacity var(--transition),
    box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
  text-align: center;
  width: 100%;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-green {
  background: var(--gradient-green);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(0, 64, 0, 0.4);
}

.btn-green:active {
  box-shadow: 0 2px 6px rgba(0, 64, 0, 0.4);
}

.btn-gold {
  background: var(--gradient-gold);
  color: #1a1108;
  box-shadow: 0 4px 12px rgba(192, 128, 32, 0.3);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1.5px solid var(--border);
}

.btn-outline:active {
  border-color: var(--bright-green);
}

.btn-block {
  width: 100%;
}

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

.login-btn {
  margin-top: 8px;
}

.login-footer {
  margin-top: 24px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.login-error {
  background: rgba(180, 30, 30, 0.12);
  border: 1px solid rgba(180, 30, 30, 0.4);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #ff6b6b;
  margin-bottom: 16px;
  text-align: center;
  display: none;
}

.login-error.show {
  display: block;
}

/* ============================================================
   HOME PAGE
   ============================================================ */
.home-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.home-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-header .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--light-gold);
}

.home-header .brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}

.home-header .header-icon {
  font-size: 1.25rem;
  color: var(--muted);
}

/* ---------- Credit Card ---------- */
.credit-card {
  background: linear-gradient(135deg, #0d1a0d 0%, #001a00 50%, #0d1a0d 100%);
  border: 1px solid rgba(0, 128, 0, 0.3);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.credit-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -30%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(192, 128, 32, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.credit-card-label {
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.credit-card-balance {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--light-gold);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.credit-card-balance .currency {
  font-size: 1rem;
  color: var(--gold);
}

.credit-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 128, 0, 0.15);
}

.credit-card-footer .user-name {
  font-size: 0.875rem;
  color: var(--white);
  font-weight: 600;
}

.credit-card-footer .card-tag {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ---------- Big Game Button ---------- */
.game-button-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  gap: 16px;
}

.game-button {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: 4px solid var(--gold);
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-glow-green), 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition);
  position: relative;
  animation: pulse-green 2.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.game-button:active {
  transform: scale(0.94);
}

.game-button .game-icon {
  font-size: 3rem;
  line-height: 1;
}

.game-button .game-label {
  font-size: 1.125rem;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.game-button::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(192, 128, 32, 0.3);
  animation: pulse-ring 2.5s ease-out infinite;
  pointer-events: none;
}

@keyframes pulse-green {
  0%, 100% {
    box-shadow: var(--shadow-glow-green), 0 8px 24px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow: 0 0 40px rgba(0, 128, 0, 0.6), 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

.game-button-tagline {
  font-size: 0.9375rem;
  color: var(--muted);
  text-align: center;
  max-width: 260px;
}

/* ---------- Home Quick Actions ---------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 8px;
}

.quick-action {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.quick-action:active {
  transform: scale(0.95);
  border-color: var(--bright-green);
}

.quick-action .qa-icon {
  font-size: 1.75rem;
  margin-bottom: 6px;
}

.quick-action .qa-label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
}

/* ============================================================
   CHAT PAGE
   ============================================================ */

/* chat-wrap uses position:fixed (not 100dvh) to avoid mobile keyboard issues */
.chat-wrap {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: 100vh; /* fallback */
  height: 100dvh; /* modern browsers */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: 100;
}

/* Chat Header */
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.chat-header .back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.chat-header .back-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.chat-header .chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-header .chat-info {
  flex: 1;
  min-width: 0;
}

.chat-header .chat-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header .chat-status {
  font-size: 0.75rem;
  color: var(--bright-green);
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-header .chat-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bright-green);
}

.chat-header .chat-status.offline {
  color: var(--muted);
}

.chat-header .chat-status.offline .dot {
  background: var(--muted);
}

.chat-header .chat-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-header .chat-action:active {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Messages Area (scrollable) ---------- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Date separator */
.chat-date-sep {
  text-align: center;
  margin: 8px 0;
}

.chat-date-sep span {
  display: inline-block;
  padding: 4px 14px;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
}

/* Message bubble */
.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.45;
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
  animation: msg-in 0.25s ease;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-time {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
  opacity: 0.8;
}

/* Incoming message (left, dark card) */
.message.in {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  color: var(--white);
}

/* Outgoing message (right, green gradient) */
.message.out {
  align-self: flex-end;
  background: var(--gradient-green);
  border-bottom-right-radius: 4px;
  color: var(--white);
}

.message.out .message-time {
  color: rgba(255, 255, 255, 0.65);
}

/* System message */
.message.system {
  align-self: center;
  max-width: 90%;
  background: rgba(192, 128, 32, 0.08);
  border: 1px solid rgba(192, 128, 32, 0.2);
  border-radius: var(--radius-sm);
  color: var(--light-gold);
  font-size: 0.8125rem;
  text-align: center;
  padding: 8px 16px;
}

.message.system .message-time {
  text-align: center;
}

/* Image message */
.message img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 6px;
  display: block;
}

/* Typing indicator */
.typing-indicator {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  display: none;
}

.typing-indicator.show {
  display: flex;
  gap: 4px;
}

.typing-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: scale(1); opacity: 0.4; }
  30% { transform: scale(1.3); opacity: 1; }
}

/* ---------- Chat Input Bar (fixed at bottom) ---------- */
.chat-input-bar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

.chat-input-bar .input-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.chat-input-bar .input-icon:active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--light-gold);
}

.chat-input-bar textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--white);
  background: var(--bg-dark);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  resize: none;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.chat-input-bar textarea:focus {
  border-color: var(--bright-green);
}

.chat-input-bar textarea::placeholder {
  color: #4a5568;
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: none;
  color: var(--white);
  font-size: 1.125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform var(--transition), opacity var(--transition);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 64, 0, 0.3);
}

.chat-send-btn:active {
  transform: scale(0.90);
}

.chat-send-btn:disabled {
  opacity: 0.4;
}

/* ============================================================
   BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.6875rem;
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--transition);
  text-decoration: none;
}

.nav-item .nav-icon {
  font-size: 1.375rem;
  line-height: 1;
}

.nav-item .nav-label {
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
}

.nav-item.active {
  color: var(--bright-green);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 6px rgba(0, 128, 0, 0.5));
}

.nav-item:active {
  color: var(--light-gold);
}

/* Nav badge */
.nav-item .nav-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  margin-right: -20px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--gold);
  color: #1a1108;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.nav-item {
  position: relative;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-page {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
}

.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-green);
  border: 3px solid var(--gold);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--light-gold);
  box-shadow: var(--shadow-glow-green);
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
}

.profile-id {
  font-size: 0.8125rem;
  color: var(--muted);
}

.profile-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.profile-section-title {
  padding: 14px 16px 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition);
}

.profile-item:first-of-type {
  border-top: none;
}

.profile-item:active {
  background: rgba(255, 255, 255, 0.03);
}

.profile-item .pi-label {
  font-size: 0.9375rem;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-item .pi-icon {
  font-size: 1.125rem;
  width: 24px;
  text-align: center;
}

.profile-item .pi-value {
  font-size: 0.875rem;
  color: var(--muted);
}

.profile-item .pi-arrow {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ============================================================
   DOWNLOAD PAGE
   ============================================================ */
.download-page {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.download-page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.download-page-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 24px;
  text-align: center;
}

.download-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 16px;
}

.download-card .dl-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.download-card .dl-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
}

.download-card .dl-desc {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================================================
   UTILITIES & SHARED COMPONENTS
   ============================================================ */

/* Generic Card */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

/* Section title */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .st-icon {
  color: var(--gold);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 16px 0;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-green {
  background: rgba(0, 128, 0, 0.15);
  color: var(--bright-green);
  border: 1px solid rgba(0, 128, 0, 0.3);
}

.badge-gold {
  background: rgba(192, 128, 32, 0.12);
  color: var(--light-gold);
  border: 1px solid rgba(192, 128, 32, 0.3);
}

/* Spinner */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--bright-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.loading-overlay.show {
  display: flex;
}

.loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.875rem;
  color: var(--white);
  box-shadow: var(--shadow-card);
  z-index: 300;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 90%;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--bright-green);
}

.toast.error {
  border-color: #b41e1e;
  color: #ff6b6b;
}

/* Empty state */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
}

.empty-state .es-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.empty-state .es-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}

.empty-state .es-desc {
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 240px;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Text helpers */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-green { color: var(--bright-green); }
.text-muted { color: var(--muted); }
.text-light-gold { color: var(--light-gold); }

/* Margin helpers */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ============================================================
   RESPONSIVE — Tablet / larger phones
   ============================================================ */
@media (min-width: 481px) {
  .app-container,
  .chat-wrap,
  .bottom-nav {
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }

  body {
    background: #050810;
  }
}

/* Larger screens — add side gutters */
@media (min-width: 768px) {
  .game-button {
    width: 220px;
    height: 220px;
    font-size: 1.625rem;
  }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .game-button {
    animation: none;
  }

  .game-button::after {
    display: none;
  }
}

/* Focus visible for keyboard navigation */
.btn:focus-visible,
.nav-item:focus-visible,
.chat-send-btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--light-gold);
  outline-offset: 2px;
}

/* ============================================================
   END — RoyalSportLaos Chat App CSS
   ============================================================
