/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* VIDEO FULLSCREEN FIX v2 - MUST BE AT TOP */
.custom-video-wrapper:fullscreen,
.custom-video-wrapper:-webkit-full-screen,
.custom-video-wrapper:-moz-full-screen,
.custom-video-wrapper:-ms-fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  background: #000 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
}

.custom-video-wrapper:fullscreen video,
.custom-video-wrapper:-webkit-full-screen video,
.custom-video-wrapper:-moz-full-screen video,
.custom-video-wrapper:-ms-fullscreen video {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  position: relative !important;
}

/* MOBILE VIEWPORT FIX - Prevent zoom on page load */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  width: 100%;
}

body {
  width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* Ensure all containers respect viewport width */
.home-container,
.chat-container,
.navbar-container,
.game-container,
.games-container {
  max-width: 100%;
}

/* Ensure all media and content respect viewport */
img,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

/* Prevent text from overflowing */
.post-content,
.message-content,
.comment-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* BASE STYLES & CSS VARIABLES */
:root {
  --primary-color: #667eea;
  --primary-hover: #5568d3;
  --bg-gradient-start: #667eea;
  --bg-gradient-end: #764ba2;
  --chat-bg: #f8f9fa;
  --message-sent-bg: #667eea;
  --message-received-bg: white;
  --sidebar-bg: #f8f9fa;
  --header-bg: white;
}

/* THEME COLORS */
.theme-love {
  --primary-color: #ff6b9d;
  --primary-hover: #ff5a8f;
  --bg-gradient-start: #ff6b9d;
  --bg-gradient-end: #c06c84;
  --chat-bg: #ffe5ec;
  --message-sent-bg: #ff6b9d;
  --message-received-bg: #fff0f5;
}

.theme-ocean {
  --primary-color: #00b4d8;
  --primary-hover: #0096c7;
  --bg-gradient-start: #00b4d8;
  --bg-gradient-end: #0077b6;
  --chat-bg: #caf0f8;
  --message-sent-bg: #00b4d8;
  --message-received-bg: #e3f6fc;
}

.theme-sunset {
  --primary-color: #ff6f3c;
  --primary-hover: #ff5722;
  --bg-gradient-start: #ff6f3c;
  --bg-gradient-end: #ff9a3c;
  --chat-bg: #fff4e6;
  --message-sent-bg: #ff6f3c;
  --message-received-bg: #fff9f0;
}

.theme-forest {
  --primary-color: #52b788;
  --primary-hover: #40916c;
  --bg-gradient-start: #52b788;
  --bg-gradient-end: #2d6a4f;
  --chat-bg: #d8f3dc;
  --message-sent-bg: #52b788;
  --message-received-bg: #e8f5e9;
}

.theme-dark {
  --primary-color: #4a5568;
  --primary-hover: #2d3748;
  --bg-gradient-start: #2d3748;
  --bg-gradient-end: #1a202c;
  --chat-bg: #2d3748;
  --message-sent-bg: #4a5568;
  --message-received-bg: #374151;
  color: #e2e8f0;
}

.theme-dark .chat-header,
.theme-dark .sidebar-header,
.theme-dark .sidebar {
  background: #1a202c;
  color: #e2e8f0;
}

.theme-dark .conversation-item:hover {
  background: #2d3748;
}

.theme-dark .conversation-name,
.theme-dark .chat-header h3 {
  color: #e2e8f0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  background-attachment: fixed;
  background-size: cover;
  color: #333;
  min-height: 100vh;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Optimize scrolling performance */
* {
  -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for body */
body::-webkit-scrollbar {
  width: 12px;
}

body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

body::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}

body::-webkit-scrollbar-thumb:hover {
  background: var(--primary-hover);
  border-radius: 6px;
  border: 3px solid transparent;
  background-clip: content-box;
}

/* LOGIN PAGE */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 450px;
}

.login-box {
  background: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.login-logo {
  width: 56px;
  height: 56px;
  display: block;
}

.login-title {
  margin: 0;
  color: #FF6B35;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 2em;
  line-height: 1;
}

.login-box h1 {
  text-align: center;
  color: var(--primary-color);
  font-size: 2.5em;
  margin-bottom: 10px;
}

.login-box h2 {
  text-align: center;
  color: #333;
  font-size: 1.5em;
  margin: 0 0 24px 0;
  font-weight: 600;
}

.login-box form {
  text-align: left;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
}

.switch-form {
  text-align: center;
  margin-top: 20px;
  color: #666;
  font-size: 14px;
}

.switch-form a {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
}

.switch-form a:hover {
  text-decoration: underline;
}

/* Special Invite Notice */
.special-invite-notice {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
}

.special-invite-notice h3 {
  margin: 0 0 6px 0;
  font-size: 18px;
  font-weight: 600;
}

.special-invite-notice p {
  margin: 0;
  font-size: 14px;
  opacity: 0.95;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
  text-align: left;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.3s, box-shadow 0.3s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-group input::placeholder {
  color: #aaa;
  font-size: 14px;
}

.form-group small {
  display: block;
  margin-top: 6px;
  color: #999;
  font-size: 12px;
  text-align: left;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-10px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  padding: 8px 16px;
  font-size: 14px;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.error-message, .success-message {
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.error-message {
  background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
  color: #c53030;
  border: 1px solid #fc8181;
}

.success-message {
  background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
  color: #276749;
  border: 1px solid #68d391;
}

.demo-accounts {
  margin-top: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 12px;
  border-left: 4px solid var(--primary-color);
}

.demo-accounts p {
  margin-bottom: 15px;
  color: #333;
  font-size: 16px;
}

.demo-accounts ul {
  list-style: none;
  margin-top: 10px;
}

.demo-accounts li {
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}

.accounts-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.accounts-table thead {
  background: var(--primary-color);
  color: white;
}

.accounts-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
}

.accounts-table td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
}

.accounts-table tbody tr:hover {
  background: #f5f7fa;
  cursor: pointer;
}

.accounts-table tbody tr:last-child td {
  border-bottom: none;
}

.accounts-table td:nth-child(2) {
  color: var(--primary-color);
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

/* CHAT PAGE */
.chat-page {
  padding-top: 60px;
  height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.chat-page .chat-container {
  display: flex;
  flex: 1;
  max-width: 100%;
  background: white;
  min-height: 0;
}

.chat-page:not(.has-navbar) .chat-container {
  flex: 1;
  margin-top: 0;
  min-height: 0;
}

.sidebar {
  width: 350px;
  background: var(--sidebar-bg);
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-header {
  padding: 20px;
  background: var(--header-bg);
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.sidebar-header h2 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.conversations-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.1);
}

.conversation-item {
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 15px;
}

.conversation-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.conversation-item.active {
  background: rgba(102, 126, 234, 0.1);
  border-left: 4px solid var(--primary-color);
}

.conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

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

.conversation-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.conversation-theme {
  font-size: 11px;
  color: var(--primary-color);
  margin-bottom: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

.conversation-last-message {
  font-size: 14px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-header {
  flex: 0 0 auto;
  padding: 20px;
  background: var(--header-bg);
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chat-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-bar {
  flex: 0 0 auto;
  padding: 10px 20px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
}

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

.search-bar .btn-icon {
  padding: 8px 12px;
}

.chat-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.chat-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-theme {
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 500;
}

/* THEME EDITOR */
.theme-editor {
  flex: 0 0 auto;
  padding: 20px;
  background: #f9f9f9;
  border-bottom: 1px solid #e0e0e0;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.theme-option {
  padding: 15px 10px;
  border: 3px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.theme-option:hover {
  transform: scale(1.05);
}

.theme-option.selected {
  border-color: #333;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Theme Previews - 6 Preset Themes */
.theme-option.default {
  background: linear-gradient(135deg, #ffffff, #e9ecef);
  color: #495057;
  border: 1px solid #dee2e6;
}
.theme-option.sakura {
  background: linear-gradient(135deg, #ffd6e7, #ffb6c1);
  color: #5a3d5c;
}
.theme-option.ocean {
  background: linear-gradient(135deg, #80deea, #00b4d8);
}
.theme-option.night {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.theme-option.sunset {
  background: linear-gradient(135deg, #fcb69f, #ff9a8b);
}
.theme-option.gaming {
  background: linear-gradient(135deg, #1a1a3a, #2d1b4e);
  color: #00ffff;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}
.theme-option.cat {
  background: url('/images/themes/cat-theme@16-9.jpg') center/cover;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  position: relative;
}
.theme-option.cat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: inherit;
}

.theme-editor-actions {
  display: flex;
  gap: 10px;
}

.theme-editor-actions button {
  flex: 1;
}

/* MESSAGES */
.chat-messages {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 20px;
  background: var(--chat-bg);
}

.no-conversation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  text-align: center;
}

.no-conversation-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.message {
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.sent {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* Game icon avatar for game results in chat */
.message-avatar.game-icon-avatar {
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 4px;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  object-fit: contain;
}

.message-content {
  max-width: 60%;
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--message-received-bg);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.message.sent .message-content {
  background: var(--message-sent-bg);
  color: white;
}

.message-sender {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 5px;
  color: var(--primary-color);
}

.message.sent .message-sender {
  color: rgba(255, 255, 255, 0.9);
}

.message-text {
  word-wrap: break-word;
  line-height: 1.4;
  white-space: pre-wrap; /* Preserve newlines and spaces */
}

.message-time {
  font-size: 11px;
  color: #999;
  margin-top: 5px;
}

.message.sent .message-time {
  color: rgba(255, 255, 255, 0.7);
}

/* ==================== CHAT THEMES (6 Preset Themes) ==================== */

/* ⬜ Default - Trắng sạch sẽ (MẶC ĐỊNH) */
.chat-theme-default .chat-messages {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%) !important;
}
.chat-theme-default .message-content {
  background: #f1f3f5;
  color: #495057;
}
.chat-theme-default .message.sent .message-content {
  background: #667eea;
  color: #fff;
}
.chat-theme-default .message-sender {
  color: #495057;
}
.chat-theme-default .message-time {
  color: #868e96;
}

/* 🌸 Sakura - Hồng pastel nhẹ nhàng */
.chat-theme-sakura .chat-messages {
  background: linear-gradient(135deg, #ffeef8 0%, #ffd6e7 50%, #ffb6c1 100%) !important;
}
.chat-theme-sakura .message-content {
  background: rgba(255, 255, 255, 0.95);
  color: #5a3d5c;
}
.chat-theme-sakura .message.sent .message-content {
  background: rgba(255, 182, 193, 0.85);
  color: #5a3d5c;
}

/* 🌊 Ocean - Xanh biển gradient (DEFAULT) */
.chat-theme-ocean .chat-messages {
  background: linear-gradient(135deg, #e0f7fa 0%, #80deea 50%, #00b4d8 100%) !important;
}
.chat-theme-ocean .message-content {
  background: rgba(255, 255, 255, 0.95);
  color: #0077b6;
}
.chat-theme-ocean .message.sent .message-content {
  background: rgba(0, 180, 216, 0.85);
  color: #fff;
}

/* 🌙 Night - Tối đen tím */
.chat-theme-night .chat-messages {
  background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 50%, #16213e 100%) !important;
}
.chat-theme-night .message-content {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #e0e0e0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.chat-theme-night .message.sent .message-content {
  background: rgba(138, 43, 226, 0.5);
  color: #fff;
}
.chat-theme-night .message-sender {
  color: rgba(255, 255, 255, 0.9);
}
.chat-theme-night .message-time {
  color: rgba(255, 255, 255, 0.6);
}

/* 🌅 Sunset - Cam hồng */
.chat-theme-sunset .chat-messages {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 50%, #ff9a8b 100%) !important;
}
.chat-theme-sunset .message-content {
  background: rgba(255, 255, 255, 0.95);
  color: #8b4513;
}
.chat-theme-sunset .message.sent .message-content {
  background: rgba(255, 154, 139, 0.85);
  color: #fff;
}

/* 🎮 Gaming - Neon xanh tím */
.chat-theme-gaming .chat-messages {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 50%, #2d1b4e 100%) !important;
}
.chat-theme-gaming .message-content {
  background: rgba(0, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #00ffff;
  border: 1px solid rgba(0, 255, 255, 0.3);
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
}
.chat-theme-gaming .message.sent .message-content {
  background: rgba(138, 43, 226, 0.6);
  color: #ff00ff;
  border: 1px solid rgba(255, 0, 255, 0.3);
  text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
}
.chat-theme-gaming .message-sender {
  color: #00ffff;
}
.chat-theme-gaming .message-time {
  color: rgba(0, 255, 255, 0.6);
}

/* 🐱 Cat - Chủ đề mèo với 3 ảnh theo tỉ lệ màn hình */
.chat-theme-cat .chat-messages {
  background-color: #f8e8ea !important;
  background-image: url('/images/themes/cat-theme@16-9.jpg') !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-attachment: scroll !important;
  background-size: cover !important;
}
/* Mobile: dùng ảnh 9:16 cho màn hình dọc */
@media (max-width: 768px) {
  .chat-theme-cat .chat-messages {
    background-image: url('/images/themes/cat-theme@9-16.jpg') !important;
  }
}
/* 4K: dùng ảnh độ phân giải cao */
@media (min-width: 2560px) {
  .chat-theme-cat .chat-messages {
    background-image: url('/images/themes/cat-theme-3840x2884.jpg') !important;
  }
}
.chat-theme-cat .message-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  color: #4a4a4a;
  border: 1px solid rgba(255, 182, 193, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.chat-theme-cat .message.sent .message-content {
  background: rgba(255, 182, 193, 0.9);
  color: #5a3d3d;
  border: 1px solid rgba(255, 140, 160, 0.6);
}
.chat-theme-cat .message-sender {
  color: #d56e7a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
.chat-theme-cat .message-time {
  color: rgba(100, 80, 80, 0.7);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}
/* Cat theme - game messages */
.chat-theme-cat .game-invite-content {
  background: linear-gradient(135deg, rgba(255, 182, 193, 0.95) 0%, rgba(255, 140, 160, 0.95) 100%);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(255, 140, 160, 0.3);
}
.chat-theme-cat .game-invite-content .btn {
  background: rgba(255, 255, 255, 0.95);
  color: #d56e7a;
}

/* ==================== END CHAT THEMES ==================== */

/* ===== GAME MESSAGES FOR EACH THEME ===== */

/* Default - Game messages trắng sạch (MẶC ĐỊNH) */
.chat-theme-default .game-invite-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.chat-theme-default .game-invite-content .btn {
  background: rgba(255, 255, 255, 0.95);
  color: #667eea;
}
.chat-theme-default .game-result-content {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}
.chat-theme-default .game-result-win {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
  border-color: rgba(46, 213, 115, 0.4);
}
.chat-theme-default .game-result-lose {
  background: rgba(255, 71, 87, 0.15);
  color: #ff4757;
  border-color: rgba(255, 71, 87, 0.4);
}
.chat-theme-default .game-result-draw {
  background: rgba(255, 168, 1, 0.15);
  color: #ffa801;
  border-color: rgba(255, 168, 1, 0.4);
}

/* Arrow Rush Result Card Styles */
.arrow-rush-result {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  color: #fff;
  font-size: 13px;
  min-width: 200px;
}

.ar-result-header {
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.ar-result-header.ar-win {
  background: linear-gradient(135deg, #2ed573 0%, #26de81 100%);
  color: #fff;
}

.ar-result-header.ar-lose {
  background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
  color: #fff;
}

.ar-result-header.ar-draw {
  background: linear-gradient(135deg, #ffa801 0%, #ffc048 100%);
  color: #1a1a2e;
}

.ar-players {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}

.ar-player {
  flex: 1;
  text-align: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ar-player.ar-winner {
  border-color: #2ed573;
  background: rgba(46, 213, 115, 0.1);
}

.ar-name {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

.ar-score {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  margin: 4px 0;
}

.ar-player.ar-winner .ar-score {
  color: #2ed573;
}

.ar-stats {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: 10px;
  margin-top: 4px;
}

.ar-perfect {
  color: #2ed573;
}

.ar-good {
  color: #ffa801;
}

.ar-miss {
  color: #ff4757;
}

.ar-vs {
  font-size: 14px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 4px;
}

.arrow-rush-result-cancelled {
  text-align: center;
  padding: 10px;
  color: #888;
  font-style: italic;
}

/* Sakura - Game messages nhẹ nhàng */
.chat-theme-sakura .game-invite-content {
  background: linear-gradient(135deg, #ffb6c1 0%, #ff69b4 100%);
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.3);
}
.chat-theme-sakura .game-result-content {
  background: linear-gradient(135deg, #dda0dd 0%, #da70d6 100%);
  box-shadow: 0 4px 12px rgba(218, 112, 214, 0.3);
}

/* Ocean - Game messages xanh biển */
.chat-theme-ocean .game-invite-content {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}
.chat-theme-ocean .game-result-content {
  background: linear-gradient(135deg, #48cae4 0%, #0096c7 100%);
  box-shadow: 0 4px 12px rgba(0, 150, 199, 0.3);
}

/* Night - Game messages tối */
.chat-theme-night .game-invite-content {
  background: linear-gradient(135deg, #4a4a6a 0%, #2d2d4a 100%);
  box-shadow: 0 4px 12px rgba(45, 45, 74, 0.5);
  border: 1px solid rgba(138, 43, 226, 0.3);
}
.chat-theme-night .game-result-content {
  background: linear-gradient(135deg, #3d3d5c 0%, #252540 100%);
  box-shadow: 0 4px 12px rgba(37, 37, 64, 0.5);
  border: 1px solid rgba(138, 43, 226, 0.3);
}
.chat-theme-night .game-result-win {
  background: rgba(46, 213, 115, 0.15);
  color: #5eff9e;
  border-color: rgba(46, 213, 115, 0.5);
}
.chat-theme-night .game-result-lose {
  background: rgba(255, 71, 87, 0.15);
  color: #ff6b7a;
  border-color: rgba(255, 71, 87, 0.5);
}
.chat-theme-night .game-result-draw {
  background: rgba(255, 168, 1, 0.15);
  color: #ffcc4d;
  border-color: rgba(255, 168, 1, 0.5);
}

/* Sunset - Game messages cam ấm */
.chat-theme-sunset .game-invite-content {
  background: linear-gradient(135deg, #ff9a8b 0%, #fecfef 100%);
  color: #8b4513;
  box-shadow: 0 4px 12px rgba(255, 154, 139, 0.3);
}
.chat-theme-sunset .game-invite-content .btn {
  color: #ff6b6b;
}
.chat-theme-sunset .game-result-content {
  background: linear-gradient(135deg, #ffa07a 0%, #ffb347 100%);
  color: #8b4513;
  box-shadow: 0 4px 12px rgba(255, 179, 71, 0.3);
}

/* Gaming - Game messages neon */
.chat-theme-gaming .game-invite-content {
  background: linear-gradient(135deg, #1a1a3a 0%, #2d1b4e 100%);
  border: 2px solid #00ffff;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.3), inset 0 0 20px rgba(0, 255, 255, 0.1);
  color: #00ffff;
}
.chat-theme-gaming .game-invite-content .btn {
  background: linear-gradient(135deg, #00ffff 0%, #ff00ff 100%);
  color: #0f0f23;
  text-shadow: none;
}
.chat-theme-gaming .game-result-content {
  background: linear-gradient(135deg, #1a1a3a 0%, #2d1b4e 100%);
  border: 2px solid #ff00ff;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.3), inset 0 0 20px rgba(255, 0, 255, 0.1);
  color: #ff00ff;
}
.chat-theme-gaming .game-result-win {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
  border-color: #00ff88;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}
.chat-theme-gaming .game-result-lose {
  background: rgba(255, 0, 68, 0.1);
  color: #ff0044;
  border-color: #ff0044;
  box-shadow: 0 0 10px rgba(255, 0, 68, 0.3);
}
.chat-theme-gaming .game-result-draw {
  background: rgba(255, 255, 0, 0.1);
  color: #ffff00;
  border-color: #ffff00;
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
}

/* ===== END GAME MESSAGES THEMES ===== */

.message-actions {
  display: none;
  gap: 8px;
  margin-top: 8px;
}

.message.active .message-actions {
  display: flex;
}

.btn-reply-message,
.btn-edit-message,
.btn-delete-message {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-reply-message:hover {
  background: rgba(100, 200, 255, 0.3);
  border-color: rgba(100, 200, 255, 0.5);
}

.btn-edit-message:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-delete-message:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.4);
  color: #ff4444;
}

.message:not(.sent) .btn-reply-message,
.message:not(.sent) .btn-edit-message,
.message:not(.sent) .btn-delete-message {
  background: #f0f0f0;
  color: #666;
  border-color: #ddd;
}

.message:not(.sent) .btn-reply-message:hover {
  background: #e3f2fd;
  border-color: #90caf9;
  color: #1976d2;
}

.message:not(.sent) .btn-edit-message:hover {
  background: #e0e0e0;
  border-color: #ccc;
}

.message:not(.sent) .btn-delete-message:hover {
  background: #ffe0e0;
  border-color: #ffcccc;
  color: #ff4444;
}

/* REPLY PREVIEW IN INPUT AREA */
.reply-preview-container {
  display: none;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.05);
  border-left: 3px solid var(--primary-color);
  margin-bottom: 10px;
}

.reply-preview-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reply-preview-icon {
  font-size: 18px;
  opacity: 0.7;
}

.reply-preview-text {
  flex: 1;
}

.reply-preview-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 2px;
}

.reply-preview-message {
  font-size: 13px;
  color: #666;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.reply-preview-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #666;
}

/* MESSAGE REPLY PREVIEW (QUOTED MESSAGE IN CHAT) */
.message-reply-preview {
  background: rgba(0, 0, 0, 0.1);
  border-left: 3px solid rgba(255, 255, 255, 0.5);
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.message.sent .message-reply-preview {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: rgba(255, 255, 255, 0.6);
}

.message:not(.sent) .message-reply-preview {
  background: rgba(0, 0, 0, 0.05);
  border-left-color: var(--primary-color);
}

.reply-preview-header {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
  opacity: 0.9;
}

.message.sent .reply-preview-header {
  color: rgba(255, 255, 255, 0.9);
}

.message:not(.sent) .reply-preview-header {
  color: var(--primary-color);
}

.reply-preview-content {
  font-size: 13px;
  opacity: 0.8;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message.sent .reply-preview-content {
  color: rgba(255, 255, 255, 0.8);
}

.message:not(.sent) .reply-preview-content {
  color: #666;
}

/* INPUT */
.chat-input-container {
  flex: 0 0 auto;
  padding: 25px 30px 30px 30px;
  background: white;
  border-top: 2px solid #e0e0e0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.chat-input-container.hidden {
  display: none !important;
}

#message-form {
  display: flex;
  gap: 15px;
  align-items: center;
  transition: all 0.3s ease;
}

/* Drag & Drop Highlight Effect */
#message-form.drag-highlight {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 15px;
  padding: 10px;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

#message-input {
  flex: 1;
  padding: 15px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 30px;
  font-size: 16px;
  min-height: 50px;
}

#message-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#message-form .btn {
  padding: 15px 35px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 30px;
  min-height: 50px;
  white-space: nowrap;
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-group .btn-icon {
  font-size: 24px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  transition: transform 0.2s;
}

.input-group .btn-icon:hover {
  transform: scale(1.2);
}

/* VOICE RECORDER */
.voice-recorder {
  padding: 20px;
  background: #fff3cd;
  border-radius: 15px;
  margin-bottom: 15px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.voice-recorder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.voice-recorder-timer {
  font-size: 32px;
  font-weight: bold;
  color: #d32f2f;
  font-family: 'Courier New', monospace;
}

.voice-recorder-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.voice-recorder-controls .btn-icon {
  font-size: 28px;
  padding: 12px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
}

.voice-recorder-controls .btn-icon:hover {
  transform: scale(1.1);
  border-color: var(--primary-color);
}

/* IMAGE PREVIEW */
.image-preview-container {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 15px;
  margin-bottom: 15px;
  animation: slideDown 0.3s ease;
}

.image-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-preview-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #ddd;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(211, 47, 47, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.image-preview-remove:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

/* MESSAGE VOICE PLAYER */
.message-voice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  max-width: 300px;
}

.message.sent .message-voice {
  background: rgba(255, 255, 255, 0.2);
}

.message-voice audio {
  flex: 1;
  height: 40px;
}

/* MESSAGE IMAGES */
.message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 400px;
}

.message-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s;
}

.message-image:hover {
  transform: scale(1.05);
}

.message-images.single .message-image {
  max-width: 300px;
  max-height: 300px;
}

.message-images.multiple .message-image {
  max-width: 150px;
  max-height: 150px;
}

/* MESSAGE GIF */
.message-gif {
  margin-top: 8px;
  max-width: 300px;
}

.message-gif-image {
  width: 100%;
  max-width: 300px;
  max-height: 300px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s;
  display: block;
}

.message-gif-image:hover {
  transform: scale(1.02);
}

#message-form .btn-primary {
  width: auto;
}

/* IMAGE LIGHTBOX */
.image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 50px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.2s;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

#lightbox-image {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* MOBILE RESPONSIVE - REDESIGNED */
@media (max-width: 768px) {
  /* Remove tap highlight */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Login page */
  .login-box {
    padding: 30px 20px;
  }

  /* Chat page layout - simple and stable */
  .chat-page {
    padding-top: 0 !important;
  }

  .navbar {
    height: 56px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }

  .chat-container {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    max-width: 100%;
    background: white;
  }

  /* Sidebar - full screen on mobile */
  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border: none;
    display: block;
  }

  .sidebar-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    padding: 15px;
    background: white;
    z-index: 10;
  }

  .conversations-list {
    position: absolute;
    top: 75px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: 15px;
  }

  .conversation-item {
    padding: 12px 15px;
  }

  .conversation-item:first-child {
    margin-top: 10px;
    padding-top: 15px;
  }

  .conversation-avatar {
    width: 45px;
    height: 45px;
  }

  /* Chat main - full screen on mobile */
  .chat-main {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
  }

  .chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 70px;
    padding: 15px;
    background: white;
    z-index: 10;
  }

  .search-bar {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    z-index: 9;
    border-bottom: 1px solid #e0e0e0;
  }

  .theme-editor {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    height: auto;
    max-height: 400px;
    background: #f9f9f9;
    z-index: 9;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-messages {
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    bottom: 75px;
    padding: 5px 15px 15px 15px;
    overflow-y: scroll;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  /* When theme editor is visible - push messages down */
  .chat-main.theme-editor-open .chat-messages {
    top: 280px;
  }

  /* Reduce theme editor size on mobile */
  .theme-editor h4 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .theme-options {
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
  }

  .theme-option {
    padding: 10px 5px;
    font-size: 11px;
  }

  .chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 12px 10px 20px 10px;
  }

  .chat-avatar {
    width: 40px;
    height: 40px;
  }

  .message-content {
    max-width: 75%;
  }

  .message-avatar {
    width: 35px;
    height: 35px;
  }

  .message-avatar.game-icon-avatar {
    padding: 3px;
  }

  /* Hide "no conversation" placeholder on mobile */
  .no-conversation {
    display: none !important;
  }

  /* Mobile conversation view toggle */
  .mobile-only {
    display: none;
  }

  /* When conversation is selected: hide sidebar, show chat */
  .chat-container.show-chat .sidebar {
    display: none !important;
  }

  .chat-container.show-chat .chat-main {
    display: block !important;
  }

  .chat-container.show-chat #back-to-list-btn {
    display: inline-flex;
    font-size: 24px;
    padding: 8px 12px;
  }

  /* Input adjustments */
  #message-form {
    gap: 8px;
  }

  .input-group {
    gap: 8px;
    flex-shrink: 0;
  }

  .input-group .btn-icon {
    font-size: 20px;
    padding: 6px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #message-input {
    font-size: 15px;
    padding: 10px 14px;
    min-height: 40px;
    border-radius: 20px;
    flex: 1;
  }

  #message-form .btn {
    padding: 10px 18px;
    font-size: 14px;
    min-height: 40px;
    border-radius: 20px;
    flex-shrink: 0;
  }

  .theme-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  /* Chat page - extra small screens */
  .message-content {
    max-width: 85%;
  }

  .login-box {
    padding: 25px 15px;
  }

  /* Extra small screens - optimize for very small devices */
  #message-form {
    gap: 6px;
  }

  .input-group {
    gap: 6px;
  }

  .input-group .btn-icon {
    font-size: 18px;
    padding: 5px;
    min-width: 32px;
  }

  #message-input {
    font-size: 14px;
    padding: 9px 12px;
    min-height: 38px;
    border-radius: 19px;
  }

  #message-form .btn {
    padding: 9px 14px;
    font-size: 13px;
    min-height: 38px;
    border-radius: 19px;
  }

  /* Home page - extra small screens */
  .navbar-brand h1 {
    font-size: 18px;
  }

  .nav-link {
    padding: 6px 8px;
    font-size: 14px;
  }

  .navbar {
    height: 52px;
  }

  .home-container {
    margin-top: 60px;
    padding: 0 4px;
  }

  .create-post-card,
  .post-card {
    padding: 10px;
    border-radius: 6px;
  }

  .post-author {
    font-size: 14px;
  }

  .post-content {
    font-size: 14px;
  }

  .btn-like,
  .btn-comment {
    font-size: 13px;
    padding: 6px 10px;
  }

  /* Reaction picker on small screens */
  .reaction-picker {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
  }

  .reaction-option {
    font-size: 20px;
    padding: 6px;
  }

  /* Modal improvements for small screens */
  .modal-content {
    width: 95%;
    padding: 15px;
    margin: 10px;
  }

  .modal-content h3 {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .modal-actions {
    gap: 8px;
  }

  .modal-actions .btn {
    padding: 10px;
    font-size: 14px;
  }

  /* Scroll to top button */
  .scroll-to-top {
    width: 44px;
    height: 44px;
    bottom: 20px;
    right: 20px;
    font-size: 20px;
  }

  /* General button improvements */
  .btn,
  .btn-primary,
  .btn-secondary {
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 6px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* Form inputs */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  textarea {
    font-size: 15px;
    padding: 10px 12px;
  }

  textarea {
    min-height: 80px;
  }

  /* Login page */
  .login-container {
    padding: 15px;
  }

  .login-box {
    padding: 20px;
  }

  .login-box h2 {
    font-size: 22px;
  }

  .form-group label {
    font-size: 14px;
  }

  .form-group input {
    font-size: 15px;
    padding: 12px;
  }
}

/* Very small screens - 460px and below */
@media (max-width: 460px) {
  /* Chat input container - optimize for very small screens */
  .chat-input-container {
    padding: 10px 6px;
  }

  #message-form {
    gap: 5px;
  }

  .input-group {
    gap: 5px;
  }

  .input-group .btn-icon {
    font-size: 18px;
    padding: 4px;
    min-width: 30px;
  }

  #message-input {
    font-size: 14px;
    padding: 8px 10px;
    min-height: 36px;
    border-radius: 18px;
  }

  #message-form .btn {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 36px;
    border-radius: 18px;
  }

  /* Hide send button on very small screens - user can press Enter to send */
  #message-form button.btn-primary,
  #message-form button[type="submit"],
  .input-group > button.btn-primary {
    display: none !important;
  }

  /* Expand input to fill space where send button was */
  #message-form {
    width: 100%;
  }

  .input-group {
    flex: 1;
    width: 100%;
  }

  #message-input {
    flex: 1;
    width: 100%;
  }

  /* Reduce bottom spacing for chat messages */
  .chat-messages {
    bottom: 75px;
  }
}

/* Mobile screens - 406px and below (hide submit button, use keyboard) */
@media (max-width: 406px) {
  /* Hide submit button - use keyboard send button instead */
  #message-form .btn[type="submit"],
  #message-form .btn-primary {
    display: none !important;
  }

  /* Make form and input group take full width */
  #message-form {
    display: flex !important;
    width: 100% !important;
  }

  .input-group {
    display: flex !important;
    width: 100% !important;
    flex: 1 !important;
  }

  /* Adjust input to take remaining width */
  #message-input {
    flex: 1 !important;
    min-width: 0 !important;
  }

  /* Keep icon buttons at fixed size */
  .input-group .btn-icon {
    flex-shrink: 0 !important;
  }
}

/* Ultra small screens - 320px and below (iPhone SE, Galaxy Fold) */
@media (max-width: 320px) {
  /* Chat input container - extreme optimization */
  .chat-input-container {
    padding: 8px 4px;
  }

  #message-form {
    gap: 3px;
  }

  .input-group {
    gap: 3px;
  }

  .input-group .btn-icon {
    font-size: 16px;
    padding: 3px;
    min-width: 28px;
  }

  #message-input {
    font-size: 13px;
    padding: 7px 8px;
    min-height: 34px;
    border-radius: 17px;
  }

  /* Adjust chat messages bottom - submit button already hidden at 375px */
  .chat-messages {
    bottom: 65px;
  }
}

/* Desktop - ensure normal layout */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }

  .sidebar {
    display: flex !important;
  }

  .chat-main {
    display: flex !important;
  }

  .chat-header {
    display: flex !important;
  }
}

/* Desktop: ẩn sidebar khi đã chọn conversation */
@media (min-width: 769px) {
  .chat-container.show-chat .sidebar {
    display: none !important;
  }

  .chat-container.show-chat .chat-main {
    width: 100%;
  }

  .chat-container.show-chat #back-to-list-btn {
    display: inline-flex !important;
  }

  /* Thu nhỏ giao diện chat khi full width trên desktop */
  .chat-container.show-chat .chat-header {
    padding: 12px 20px;
  }

  .chat-container.show-chat .chat-avatar {
    width: 38px;
    height: 38px;
  }

  .chat-container.show-chat .chat-header-info {
    gap: 10px;
  }

  .chat-container.show-chat .chat-header-info h3 {
    font-size: 15px;
  }

  .chat-container.show-chat .chat-theme {
    font-size: 11px;
  }

  .chat-container.show-chat .chat-messages {
    padding: 15px 20px;
  }

  .chat-container.show-chat .message {
    margin-bottom: 10px;
  }

  .chat-container.show-chat .message-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-container.show-chat .message-content {
    max-width: 50%;
    padding: 10px 14px;
    border-radius: 16px;
  }

  .chat-container.show-chat .message-text {
    font-size: 14px;
  }

  .chat-container.show-chat .message-time {
    font-size: 10px;
  }

  .chat-container.show-chat .chat-input-container {
    padding: 12px 20px;
  }

  .chat-container.show-chat #message-form {
    gap: 10px;
  }

  .chat-container.show-chat #message-input {
    padding: 10px 16px;
    font-size: 14px;
    min-height: 40px;
    border-radius: 20px;
  }

  .chat-container.show-chat #message-form .btn {
    padding: 10px 24px;
    font-size: 14px;
    min-height: 40px;
    border-radius: 20px;
  }

  .chat-container.show-chat .input-group .btn-icon {
    font-size: 20px;
    padding: 8px;
  }
}

/* Laptop: Thu nhỏ giao diện chat để hiển thị nhiều tin nhắn hơn (769px - 1600px) */
@media (min-width: 769px) and (max-width: 1600px) {
  .chat-container.show-chat .chat-header {
    padding: 8px 15px;
  }

  .chat-container.show-chat .chat-avatar {
    width: 32px;
    height: 32px;
  }

  .chat-container.show-chat .chat-header-info h3 {
    font-size: 14px;
  }

  .chat-container.show-chat .chat-messages {
    padding: 10px 15px;
  }

  .chat-container.show-chat .message {
    margin-bottom: 6px;
    gap: 8px;
  }

  .chat-container.show-chat .message-avatar {
    width: 28px;
    height: 28px;
  }

  .chat-container.show-chat .message-content {
    padding: 8px 12px;
    border-radius: 14px;
  }

  .chat-container.show-chat .message-text {
    font-size: 13px;
    line-height: 1.3;
  }

  .chat-container.show-chat .message-time {
    font-size: 9px;
    margin-top: 2px;
  }

  .chat-container.show-chat .chat-input-container {
    padding: 8px 15px;
  }

  .chat-container.show-chat #message-input {
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  .chat-container.show-chat #message-form .btn {
    padding: 8px 18px;
    font-size: 13px;
    min-height: 36px;
  }

  .chat-container.show-chat .input-group .btn-icon {
    font-size: 18px;
    padding: 6px;
  }

  /* Game modal */
  #game-selection-modal .modal-content {
    max-width: 260px;
    padding: 16px;
  }

  #game-selection-modal .modal-content h3 {
    font-size: 15px;
    margin-bottom: 10px;
  }

  #game-selection-modal .game-list {
    gap: 10px;
    margin: 12px 0;
  }

  /* Giữ layout dọc như 4K, chỉ thu nhỏ kích thước */
  #game-selection-modal .game-option {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    border-radius: 10px;
    border-width: 2px;
  }

  #game-selection-modal .game-icon {
    font-size: 24px;
    min-width: 36px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #game-selection-modal .game-icon img {
    width: 36px !important;
    height: 36px !important;
    object-fit: contain;
  }

  #game-selection-modal .game-name {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
  }

  #game-selection-modal .modal-actions {
    margin-top: 10px;
  }

  #game-selection-modal .modal-actions .btn {
    padding: 6px 16px;
    font-size: 12px;
  }

  /* HOME PAGE - Thu nhỏ siêu nhỏ cho laptop */
  .navbar {
    height: 32px;
  }

  .navbar-container {
    padding: 0 10px;
  }

  .navbar-logo {
    width: 20px;
    height: 20px;
  }

  .navbar-brand {
    gap: 6px;
  }

  .navbar-brand h1 {
    font-size: 13px;
  }

  .navbar-menu {
    gap: 8px;
  }

  .nav-link {
    padding: 4px 8px;
    font-size: 12px;
  }

  .nav-avatar {
    width: 20px;
    height: 20px;
  }

  .home-container {
    margin-top: 38px;
    gap: 6px;
    padding: 0 6px;
    grid-template-columns: 140px 1fr 140px;
  }

  .sidebar-left,
  .sidebar-right {
    top: 38px;
  }

  .profile-card {
    padding: 6px;
  }

  .profile-avatar {
    width: 40px;
    height: 40px;
    border-width: 2px;
  }

  .profile-avatar-container {
    margin-bottom: 6px;
  }

  .profile-card h3 {
    font-size: 10px;
    margin: 3px 0 2px;
  }

  .profile-card p {
    font-size: 9px;
  }

  .btn-change-avatar {
    padding: 2px 5px;
    font-size: 8px;
  }

  .quick-links {
    padding: 8px;
    margin-top: 8px;
  }

  .quick-links h4 {
    font-size: 11px;
    margin-bottom: 6px;
  }

  .quick-link {
    padding: 5px 8px;
    font-size: 11px;
  }

  .create-post-card,
  .post-card {
    padding: 6px;
    border-radius: 5px;
    margin-bottom: 6px;
  }

  .create-post-header {
    gap: 5px;
    margin-bottom: 6px;
  }

  .create-post-avatar {
    width: 24px;
    height: 24px;
  }

  .post-input {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 14px;
  }

  textarea.post-input {
    min-height: 30px;
    max-height: 100px;
    border-radius: 6px;
  }

  .create-post-media {
    margin-bottom: 6px;
    padding: 6px;
    border-radius: 5px;
  }

  .create-post-media video {
    max-height: 180px;
  }

  .btn-remove-media {
    width: 18px;
    height: 18px;
    font-size: 12px;
  }

  .create-post-actions {
    gap: 6px;
    padding-top: 5px;
  }

  .media-btn {
    gap: 2px;
    padding: 3px 5px;
    font-size: 8px;
    border-radius: 4px;
  }

  .media-btn .media-icon {
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .media-btn .media-icon img {
    width: 12px !important;
    height: 12px !important;
  }

  .btn-post,
  #post-submit-btn {
    padding: 3px 10px;
    font-size: 8px;
    border-radius: 4px;
    margin-left: auto;
    flex: none !important;
    width: auto !important;
  }

  .posts-container {
    gap: 6px;
  }

  .post-header {
    gap: 5px;
    margin-bottom: 6px;
  }

  .post-avatar {
    width: 24px;
    height: 24px;
  }

  .post-user-info h4 {
    font-size: 11px;
  }

  .post-time {
    font-size: 9px;
  }

  .post-content p {
    font-size: 11px;
    line-height: 1.3;
    margin-bottom: 5px;
  }

  .post-image,
  .post-video {
    max-height: 250px;
    border-radius: 5px;
  }

  .post-actions {
    padding: 3px 0;
    gap: 3px;
  }

  .btn-like,
  .btn-comment,
  .btn-share {
    font-size: 10px;
    padding: 3px 6px;
  }

  .post-comments {
    padding-top: 5px;
  }

  .comment {
    padding: 4px;
    margin-bottom: 3px;
  }

  .comment-avatar {
    width: 18px;
    height: 18px;
  }

  .comment-author {
    font-size: 10px;
  }

  .comment-text {
    font-size: 10px;
  }

  .comment-time {
    font-size: 8px;
  }

  .comment-input-container input {
    padding: 4px 6px;
    font-size: 10px;
  }

  /* Online Friends - Thu nhỏ siêu nhỏ */
  .sidebar-right .card {
    padding: 6px;
  }

  .sidebar-right h4 {
    font-size: 10px;
    margin-bottom: 5px;
  }

  .online-users-list {
    gap: 1px;
  }

  .online-user {
    padding: 3px 4px;
    gap: 4px;
    border-radius: 4px;
  }

  .online-avatar {
    width: 20px;
    height: 20px;
  }

  .online-name {
    font-size: 9px;
  }

  .online-status {
    width: 5px;
    height: 5px;
  }

  /* Music Player - Thu nhỏ cho laptop */
  .post-music {
    margin-top: 6px;
  }

  .custom-audio-player {
    margin-top: 8px;
  }

  .audio-player-wrapper {
    padding: 12px;
    border-radius: 12px;
  }

  .audio-player-visual {
    gap: 15px;
    margin-bottom: 10px;
  }

  .audio-icon-container {
    width: 45px;
    height: 45px;
  }

  .audio-icon {
    font-size: 20px;
  }

  .audio-equalizer {
    height: 35px;
    gap: 2px;
  }

  .audio-equalizer .bar {
    width: 2px;
    height: 12px;
  }

  .audio-player-controls {
    gap: 10px;
  }

  .audio-play-btn {
    width: 36px;
    height: 36px;
  }

  .audio-play-btn i {
    font-size: 14px;
    margin-left: 2px;
  }

  .audio-title {
    font-size: 11px;
    margin-bottom: 3px;
    gap: 5px;
  }

  .music-icon {
    width: 14px;
    height: 14px;
  }

  .audio-artist {
    font-size: 10px;
    margin-bottom: 6px;
    gap: 4px;
  }

  .artist-icon {
    width: 12px;
    height: 12px;
  }

  .audio-progress-bar {
    height: 5px;
    margin-bottom: 4px;
  }

  .audio-progress-bar:hover {
    height: 6px;
  }

  .audio-time {
    font-size: 9px;
  }

  .music-link {
    padding: 6px 12px;
    font-size: 10px;
    border-radius: 15px;
    gap: 5px;
    margin-top: 6px;
  }

  .music-link i {
    font-size: 11px;
  }
}

/* HOME PAGE / NEWSFEED */
.home-page {
  background: #f0f2f5;
}

.navbar {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 60px;
}

.navbar-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: opacity 0.3s;
}

.navbar-brand:hover {
  opacity: 0.8;
}

.navbar-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.navbar-brand h1 {
  color: #FF6B35;
  font-size: 24px;
  margin: 0;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  line-height: 1;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-link {
  text-decoration: none;
  color: #666;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-link:hover,
.nav-link.active {
  background: #f0f2f5;
  color: var(--primary-color);
}

.nav-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 4px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.home-container {
  max-width: 1200px;
  margin: 80px auto 20px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 20px;
}

.sidebar-left,
.sidebar-right {
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;

  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar {
  width: 6px;
}

.sidebar-left::-webkit-scrollbar-track,
.sidebar-right::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-left::-webkit-scrollbar-thumb,
.sidebar-right::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.sidebar-left::-webkit-scrollbar-thumb:hover,
.sidebar-right::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.profile-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-avatar-container {
  position: relative;
  display: inline-block;
  margin-bottom: 15px;
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
}

.btn-change-avatar {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.profile-card h3 {
  margin: 10px 0 5px;
  color: #333;
}

.profile-card p {
  color: #666;
  font-size: 14px;
  text-transform: capitalize;
}

.quick-links {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quick-links h4 {
  margin-bottom: 15px;
  color: #333;
}

.quick-link {
  display: block;
  padding: 12px 15px;
  color: #666;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.3s;
}

.quick-link:hover,
.quick-link.active {
  background: #f0f2f5;
  color: var(--primary-color);
}

.create-post-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

/* Drag & Drop Highlight Effect for Post Creation */
.create-post-card.drag-highlight {
  background: rgba(102, 126, 234, 0.1);
  border: 3px dashed rgba(102, 126, 234, 0.5);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.create-post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.create-post-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.post-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 25px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
}

/* Textarea specific styles */
textarea.post-input {
  border-radius: 12px;
  min-height: 60px;
  max-height: 200px;
  resize: vertical;
  line-height: 1.5;
}

.post-input:focus {
  border-color: var(--primary-color);
}

.create-post-media {
  margin-bottom: 15px;
  position: relative;
  background: #f0f2f5;
  border-radius: 12px;
  padding: 20px;
}

.create-post-media img {
  max-width: 100%;
  border-radius: 8px;
}

.create-post-media video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  outline: none;
}


.create-post-media audio {
  width: 100%;
}

.btn-remove-media {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.create-post-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.media-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
  font-weight: 500;
  position: relative;
}

.media-btn:hover {
  background: #f0f2f5;
}

.media-btn .media-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
}

.media-btn .media-icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.media-btn .media-text {
  font-size: 14px;
  white-space: nowrap;
}

/* Hide text on mobile, show on hover */
@media (max-width: 768px) {
  .media-btn .media-text {
    display: none;
  }

  .media-btn {
    padding: 8px 12px;
  }

  /* Show text on hover/active */
  .media-btn:hover .media-text,
  .media-btn:active .media-text {
    display: inline;
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    margin-left: 8px;
    font-size: 12px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
  }

  /* Tooltip arrow */
  .media-btn:hover .media-text::before,
  .media-btn:active .media-text::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: #333;
  }
}

.posts-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
  padding: 15px;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 10px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s ease;
  min-width: 42px;
  text-align: center;
}

.pagination-btn:hover:not(:disabled) {
  background: #f0f0f0;
  border-color: #ccc;
}

.pagination-btn.active {
  background: var(--primary-color, #ff6b6b);
  color: white;
  border-color: var(--primary-color, #ff6b6b);
}

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

.pagination-ellipsis {
  padding: 10px 8px;
  color: #666;
  font-weight: bold;
}

@media (max-width: 768px) {
  .pagination {
    gap: 5px;
    padding: 10px;
  }

  .pagination-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 36px;
  }
}

.post-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.post-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.post-user-info {
  flex: 1;
}

.post-user-info h4 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.post-time {
  font-size: 13px;
  color: #999;
}

.btn-edit-post {
  background: #e3f2fd;
  color: #1976d2;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
}

.btn-edit-post:hover {
  background: #bbdefb;
}

.btn-delete-post {
  background: #fee;
  color: #c33;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-delete-post:hover {
  background: #fdd;
}

.post-content {
  margin-bottom: 15px;
}

.post-content p {
  margin: 0 0 15px 0;
  line-height: 1.6;
  color: #333;
}

.post-image {
  width: 100%;
  border-radius: 12px;
  max-height: 500px;
  object-fit: cover;
}

.post-video {
  width: 100%;
  max-height: 500px;
  border-radius: 12px;
  background: #000;
  outline: none;
}

/* ==================== LAZY LOADING STYLES ==================== */

/* Lazy media before loading - show placeholder with gradient */
.lazy-media[data-src] {
  opacity: 0.6;
  filter: blur(5px);
  transition: opacity 0.5s ease, filter 0.5s ease;
  min-height: 200px;
  display: block;
}

/* Lazy media after loading - fade in smoothly */
.lazy-media:not([data-src]) {
  opacity: 1;
  filter: blur(0);
  animation: fadeInMedia 0.5s ease;
}

/* Wrapper for loading spinner */
.post-image[data-src],
.post-video[data-src],
.album-art-image[data-src] {
  position: relative;
}

/* Loading spinner overlay for lazy media */
.lazy-media[data-src]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spinLoader 1s linear infinite;
  z-index: 10;
}

@keyframes fadeInMedia {
  from {
    opacity: 0.6;
    filter: blur(5px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes spinLoader {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Responsive lazy loading on mobile */
@media (max-width: 768px) {
  .lazy-media[data-src] {
    min-height: 150px;
  }

  .lazy-media[data-src]::before {
    width: 30px;
    height: 30px;
    border-width: 3px;
  }
}

.post-music {
  width: 100%;
  margin-top: 10px;
}

/* Music link in profile posts */
.music-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-top: 10px;
}

.music-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  color: white;
}

.music-link i {
  font-size: 16px;
}

/* Highlight post effect when navigated from profile */
.highlight-post {
  animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 0 20px rgba(102, 126, 234, 0.6); }
}

/* Pulse effect for play button when autoplay blocked */
.pulse-play,
.audio-play-btn.pulse-play {
  animation: pulsePlay 0.5s ease-in-out infinite !important;
  box-shadow: 0 0 20px rgba(102, 126, 234, 1), 0 0 40px rgba(102, 126, 234, 0.6) !important;
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  border: 2px solid #fff !important;
}

@keyframes pulsePlay {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ==================== CUSTOM AUDIO PLAYER (HOÀNH TRÁNG) ==================== */

.custom-audio-player {
  margin-top: 15px;
  width: 100%;
}

.hidden-audio {
  display: none;
}

.audio-player-wrapper {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

.audio-player-wrapper:hover {
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
  transform: translateY(-2px);
}

/* Visual Section - Icon + Equalizer */
.audio-player-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.audio-icon-container {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.audio-icon {
  font-size: 36px;
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

.album-art-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

/* Only rotate album art when audio is playing */
.custom-audio-player.playing .album-art-image {
  animation: rotate-album 20s linear infinite;
  will-change: transform;
  /* Force hardware acceleration for smooth animation on mobile */
  transform: translateZ(0);
  backface-visibility: hidden;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes rotate-album {
  from {
    transform: rotate(0deg) translateZ(0);
  }
  to {
    transform: rotate(360deg) translateZ(0);
  }
}

/* Equalizer Bars */
.audio-equalizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 60px;
}

.audio-equalizer .bar {
  width: 3px;
  background: white;
  border-radius: 2px;
  height: 20px;
  transition: height 0.2s ease;
}

.audio-equalizer.playing .bar {
  animation: equalize 1s ease-in-out infinite;
}

.audio-equalizer .bar:nth-child(1) { animation-delay: 0s; }
.audio-equalizer .bar:nth-child(2) { animation-delay: 0.04s; }
.audio-equalizer .bar:nth-child(3) { animation-delay: 0.08s; }
.audio-equalizer .bar:nth-child(4) { animation-delay: 0.12s; }
.audio-equalizer .bar:nth-child(5) { animation-delay: 0.16s; }
.audio-equalizer .bar:nth-child(6) { animation-delay: 0.20s; }
.audio-equalizer .bar:nth-child(7) { animation-delay: 0.24s; }
.audio-equalizer .bar:nth-child(8) { animation-delay: 0.28s; }
.audio-equalizer .bar:nth-child(9) { animation-delay: 0.32s; }
.audio-equalizer .bar:nth-child(10) { animation-delay: 0.36s; }
.audio-equalizer .bar:nth-child(11) { animation-delay: 0.40s; }
.audio-equalizer .bar:nth-child(12) { animation-delay: 0.44s; }
.audio-equalizer .bar:nth-child(13) { animation-delay: 0.48s; }
.audio-equalizer .bar:nth-child(14) { animation-delay: 0.52s; }
.audio-equalizer .bar:nth-child(15) { animation-delay: 0.56s; }
.audio-equalizer .bar:nth-child(16) { animation-delay: 0.60s; }
.audio-equalizer .bar:nth-child(17) { animation-delay: 0.64s; }
.audio-equalizer .bar:nth-child(18) { animation-delay: 0.68s; }
.audio-equalizer .bar:nth-child(19) { animation-delay: 0.72s; }
.audio-equalizer .bar:nth-child(20) { animation-delay: 0.76s; }
.audio-equalizer .bar:nth-child(21) { animation-delay: 0.80s; }
.audio-equalizer .bar:nth-child(22) { animation-delay: 0.84s; }
.audio-equalizer .bar:nth-child(23) { animation-delay: 0.88s; }
.audio-equalizer .bar:nth-child(24) { animation-delay: 0.92s; }
.audio-equalizer .bar:nth-child(25) { animation-delay: 0.96s; }

@keyframes equalize {
  0%, 100% {
    height: 20px;
  }
  25% {
    height: 50px;
  }
  50% {
    height: 35px;
  }
  75% {
    height: 45px;
  }
}

/* Controls Section */
.audio-player-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Play Button */
.audio-play-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.audio-play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.audio-play-btn:active {
  transform: scale(0.95);
}

.audio-play-btn i {
  font-size: 24px;
  color: #667eea;
  margin-left: 3px;
}

.audio-play-btn i.fa-pause {
  margin-left: 0;
}

/* Audio Info Section */
.audio-info {
  flex: 1;
  min-width: 0;
}

.audio-title {
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.music-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.artist-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.audio-artist {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Progress Bar */
.audio-progress-container {
  width: 100%;
}

.audio-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
  transition: height 0.2s ease;
}

.audio-progress-bar:hover {
  height: 10px;
}

.audio-progress-fill {
  height: 100%;
  background: white;
  border-radius: 10px;
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.audio-progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.audio-progress-bar:hover .audio-progress-fill::after {
  opacity: 1;
}

/* Time Display */
.audio-time {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 500;
}

/* Volume Control */
.audio-volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.audio-volume-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.audio-volume-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.audio-volume-btn i {
  color: white;
  font-size: 18px;
}

/* Volume Slider */
.audio-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
}

.audio-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.audio-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.audio-volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.audio-volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Lyrics Display */
.lyrics-container {
  margin-top: 20px;
  position: relative;
  background: linear-gradient(135deg,
    rgba(139, 69, 255, 0.15) 0%,
    rgba(109, 40, 217, 0.12) 25%,
    rgba(72, 52, 212, 0.15) 50%,
    rgba(109, 40, 217, 0.12) 75%,
    rgba(139, 69, 255, 0.15) 100%
  );
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  border-radius: 20px;
  padding: 25px 20px;
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow:
    inset 0 2px 20px rgba(139, 69, 255, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.lyrics-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lyrics-line {
  color: rgba(255, 255, 255, 0.45);
  font-size: 15px;
  line-height: 1.8;
  padding: 10px 20px;
  border-radius: 12px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  font-weight: 400;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.lyrics-line::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.1) 50%,
    transparent 100%
  );
  transition: left 0.5s ease;
}

.lyrics-line.active {
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  background: linear-gradient(135deg,
    rgba(139, 69, 255, 0.4) 0%,
    rgba(109, 40, 217, 0.45) 50%,
    rgba(139, 69, 255, 0.4) 100%
  );
  background-size: 200% 200%;
  animation: activeGradient 3s ease infinite;
  transform: scale(1.08) translateZ(0);
  box-shadow:
    0 8px 32px rgba(139, 69, 255, 0.5),
    0 0 20px rgba(139, 69, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow:
    0 2px 10px rgba(139, 69, 255, 0.8),
    0 0 20px rgba(139, 69, 255, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes activeGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.lyrics-line.active::before {
  left: 100%;
  transition: left 1.5s ease;
}

.lyrics-line.active::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
    transparent 30%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 70%
  );
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.lyrics-line.past {
  color: rgba(255, 255, 255, 0.25);
  font-size: 14px;
  transform: scale(0.95);
  opacity: 0.6;
}

.lyrics-line:not(.active):not(.past) {
  color: rgba(255, 255, 255, 0.5);
}

/* Lyrics scrollbar */
.lyrics-container::-webkit-scrollbar {
  width: 8px;
}

.lyrics-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  margin: 10px 0;
}

.lyrics-container::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg,
    rgba(139, 69, 255, 0.6) 0%,
    rgba(109, 40, 217, 0.6) 100%
  );
  border-radius: 10px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.lyrics-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg,
    rgba(139, 69, 255, 0.8) 0%,
    rgba(109, 40, 217, 0.8) 100%
  );
  box-shadow: 0 0 10px rgba(139, 69, 255, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .audio-player-wrapper {
    padding: 20px;
  }

  .audio-player-visual {
    gap: 20px;
    margin-bottom: 15px;
  }

  .audio-icon-container {
    width: 60px;
    height: 60px;
  }

  .audio-icon {
    font-size: 28px;
  }

  .audio-equalizer {
    height: 50px;
  }

  .audio-equalizer .bar {
    width: 5px;
    gap: 5px;
  }

  /* Fix animation speed on mobile - match desktop speed */
  /* IMPORTANT: Only override duration to preserve animation-delay for wave effect */
  .audio-equalizer.playing .bar {
    animation-duration: 1s !important;
  }

  .custom-audio-player.playing .album-art-image {
    animation-duration: 20s !important;
  }

  .audio-player-controls {
    flex-wrap: wrap;
    gap: 15px;
  }

  .audio-play-btn {
    width: 50px;
    height: 50px;
  }

  .audio-play-btn i {
    font-size: 20px;
  }

  .audio-volume-control {
    width: 100%;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* Lyrics mobile responsive */
  .lyrics-container {
    margin-top: 15px;
    padding: 20px 15px;
    max-height: 280px;
    border-radius: 16px;
    /* Disable smooth scroll on mobile to prevent flickering */
    scroll-behavior: auto !important;
    /* Disable background animation on mobile to prevent flickering */
    animation: none !important;
    background: linear-gradient(135deg,
      rgba(139, 69, 255, 0.12) 0%,
      rgba(109, 40, 217, 0.10) 50%,
      rgba(139, 69, 255, 0.12) 100%
    ) !important;
    background-size: 100% 100% !important;
    /* Simplify shadows on mobile */
    box-shadow:
      inset 0 2px 10px rgba(139, 69, 255, 0.15),
      0 4px 16px rgba(0, 0, 0, 0.15) !important;
    backdrop-filter: blur(5px) !important;
  }

  .lyrics-container::before {
    font-size: 12px;
    padding: 6px 12px;
    top: -10px;
  }

  .lyrics-content {
    gap: 6px;
  }

  .lyrics-line {
    font-size: 14px;
    padding: 8px 15px;
    line-height: 1.7;
    /* Reduce transitions on mobile to prevent flickering */
    transition: all 0.2s ease !important;
  }

  .lyrics-line.active {
    font-size: 17px;
    font-weight: 600;
    /* Disable heavy animations on mobile to prevent flickering */
    animation: none !important;
    transform: scale(1.05) !important;
    box-shadow: 0 4px 16px rgba(139, 69, 255, 0.3) !important;
    text-shadow: 0 1px 5px rgba(139, 69, 255, 0.5) !important;
    will-change: auto !important;
    backface-visibility: visible !important;
  }

  /* Disable shine effects on mobile to prevent flickering */
  .lyrics-line::before,
  .lyrics-line.active::after {
    display: none !important;
  }

  .lyrics-line.past {
    font-size: 13px;
  }

  .audio-volume-slider {
    width: 120px;
  }

  .audio-title {
    font-size: 14px;
  }

  .music-icon {
    width: 18px;
    height: 18px;
  }

  .artist-icon {
    width: 16px;
    height: 16px;
  }

  .audio-artist {
    font-size: 12px;
  }

  .audio-time {
    font-size: 12px;
  }
}

.post-actions {
  display: flex;
  gap: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.btn-like,
.btn-comment {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  transition: background 0.3s;
}

.btn-like:hover,
.btn-comment:hover {
  background: #f0f2f5;
}

.btn-like.liked {
  color: #e74c3c;
}

/* REACTIONS */
.reactions-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: #65676b;
}

.reactions-icons {
  display: flex;
  gap: 2px;
}

.reaction-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 14px;
  background: white;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.reactions-count {
  font-weight: 500;
  color: #65676b;
}

.reaction-button-container {
  position: relative;
  display: inline-block;
}

.btn-reaction {
  background: none;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-reaction:hover {
  background: #f0f2f5;
}

.btn-reaction.reacted {
  color: #1877f2;
}

.reaction-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  background: white;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 8px;
  display: none;
  gap: 4px;
  z-index: 1000;
  animation: reactionPickerPop 0.2s ease-out;
}

@keyframes reactionPickerPop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.reaction-option {
  background: none;
  border: none;
  font-size: 24px;
  padding: 8px;
  cursor: pointer;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.reaction-option:hover {
  background: #f0f2f5;
  transform: scale(1.3);
}

.reaction-option.selected {
  background: #e3f2fd;
  border: 2px solid #1877f2;
  transform: scale(1.2);
}

.reaction-option.selected:hover {
  background: #bbdefb;
  transform: scale(1.4);
}

.post-comments {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.comments-list {
  margin-bottom: 15px;
}

.comment {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.comment-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
}

.comment-content {
  flex: 1;
  background: #f0f2f5;
  padding: 10px 15px;
  border-radius: 18px;
}

.comment-content strong {
  font-size: 14px;
  color: #333;
}

.comment-content p {
  margin: 5px 0;
  font-size: 14px;
  color: #333;
  white-space: pre-wrap;  /* Preserve line breaks and wrap text */
  word-wrap: break-word;   /* Break long words */
}

.comment-time {
  font-size: 12px;
  color: #999;
}

.comment-input-container {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

/* Textarea specific styles for comments */
textarea.comment-input {
  min-height: 38px;
  max-height: 150px;
  resize: vertical;
  line-height: 1.4;
  overflow-y: auto;
}

.comment-input:focus {
  border-color: var(--primary-color);
}

.btn-send-comment {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}

.online-friends {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.online-friends h4 {
  margin-bottom: 15px;
  color: #333;
}

.online-friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  position: relative;
  margin-bottom: 8px;
}

.online-friend:hover {
  background: #f0f2f5;
}

.online-friend img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.online-friend span {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

.status-indicator {
  width: 10px;
  height: 10px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2px solid white;
}

.no-posts {
  background: white;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  color: #999;
  font-size: 18px;
}

@media (max-width: 1024px) {
  .home-container {
    grid-template-columns: 1fr;
  }

  .sidebar-left,
  .sidebar-right {
    display: none;
  }
}

@media (max-width: 768px) {
  /* Navbar improvements */
  .navbar {
    height: 56px;
  }

  .navbar-container {
    padding: 0 12px;
  }

  .navbar-brand h1 {
    font-size: 20px;
  }

  .nav-link {
    padding: 8px 12px;
    font-size: 15px;
  }

  .nav-avatar {
    width: 36px;
    height: 36px;
  }

  .nav-user {
    gap: 8px;
  }

  .nav-user span {
    display: none; /* Hide username on small screens */
  }

  #nav-logout-btn {
    font-size: 13px;
    padding: 6px 10px;
    width: auto;
  }

  /* Home container improvements */
  .home-container {
    margin-top: 64px;
    padding: 0 8px;
  }

  /* Post cards improvements */
  .create-post-card,
  .post-card {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 8px;
  }

  .post-header {
    margin-bottom: 10px;
  }

  .post-avatar {
    width: 38px;
    height: 38px;
  }

  .post-author {
    font-size: 15px;
  }

  .post-time {
    font-size: 12px;
  }

  .post-content {
    font-size: 15px;
    line-height: 1.5;
  }

  .post-image,
  .post-video {
    border-radius: 8px;
    margin-top: 10px;
  }

  /* Post actions improvements */
  .post-actions {
    margin-top: 10px;
    padding-top: 10px;
  }

  .btn-like,
  .btn-comment {
    font-size: 14px;
    padding: 8px 12px;
  }

  /* Comments improvements */
  .comment-item {
    padding: 10px;
    margin-bottom: 8px;
  }

  .comment-avatar {
    width: 32px;
    height: 32px;
  }

  .comment-author {
    font-size: 14px;
  }

  .comment-content {
    font-size: 14px;
  }

  .comment-input-container {
    margin-top: 10px;
  }

  .comment-input {
    font-size: 14px;
    padding: 10px 12px;
  }

  /* Create post improvements */
  .create-post-avatar {
    width: 38px;
    height: 38px;
  }

  .post-input {
    font-size: 15px;
    padding: 10px 12px;
  }

  .create-post-actions {
    padding: 8px 0;
  }

  .media-btn {
    font-size: 14px;
    padding: 6px 10px;
  }
}

/* SCROLL TO TOP BUTTON */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.scroll-to-top:active {
  transform: translateY(-2px);
}

/* LOADING INDICATOR */
.loading-more {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 14px;
}

/* USER MENU DROPDOWN */
.user-menu-dropdown {
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.user-menu-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
  color: #333;
  white-space: nowrap;
}

.user-menu-item:hover {
  background: #f0f2f5;
}

/* PROFILE PAGE */
.profile-page {
  background: #f0f2f5;
  min-height: 100vh;
}

.profile-container {
  max-width: 1200px;
  margin: 80px auto 0;
  padding-bottom: 40px;
  overflow: visible; /* Allow avatar to extend above */
}

.profile-cover {
  position: relative;
  width: 100%;
  height: 400px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.cover-image.music-cover-animated {
  animation: musicPulse 4s ease-in-out infinite;
}

@keyframes musicPulse {
  0%, 100% {
    transform: scale(1);
    filter: brightness(1) saturate(1);
  }
  50% {
    transform: scale(1.03);
    filter: brightness(1.15) saturate(1.2);
  }
}

.default-cover-gradient {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  animation: gradientShift 10s ease infinite;
  background-size: 200% 200%;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.btn-change-cover {
  position: absolute;
  bottom: 20px;
  right: 20px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
}

.btn-change-cover:hover {
  background: white;
  transform: translateY(-2px);
}

.profile-header {
  background: white;
  margin: -80px 20px 20px;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-end;
  gap: 30px;
  position: relative;
}

.profile-avatar-large {
  position: relative;
  /* Removed margin-top: -100px to align with vinyl player on desktop */
}

.avatar-large {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 3px solid white;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-change-avatar-profile {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.btn-change-avatar-profile:hover {
  transform: scale(1.1);
}

.profile-info {
  flex: 1;
  padding-bottom: 10px;
}

.profile-info h1 {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: #333;
}

.profile-info p {
  margin: 0 0 15px 0;
  color: #666;
  font-size: 16px;
}

.profile-stats {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #666;
}

.profile-actions {
  display: flex;
  gap: 10px;
  padding-bottom: 10px;
}

.profile-tabs {
  background: white;
  margin: 0 20px;
  border-radius: 12px;
  padding: 0 20px;
  display: flex;
  gap: 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
  padding: 15px 30px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #666;
  transition: all 0.3s;
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-btn:hover {
  color: var(--primary-color);
}

.profile-content {
  margin: 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.about-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.about-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.about-card h3 {
  margin: 0 0 15px 0;
  font-size: 20px;
  color: #333;
}

.about-card p {
  margin: 10px 0;
  color: #666;
  line-height: 1.6;
}

.about-card button {
  margin-top: 15px;
}

/* MODAL */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin: 0 0 20px 0;
  font-size: 24px;
  color: #333;
}

.modal-content textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.modal-content textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* GIF Picker Styles */
.gif-picker-content {
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.gif-search-container {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.gif-search-container input {
  flex: 1;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
}

.gif-search-container input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.gif-categories {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.gif-category-btn {
  padding: 8px 16px;
  background: #f0f2f5;
  border: 2px solid transparent;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.gif-category-btn:hover {
  background: #e4e6eb;
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.gif-category-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
}

.gif-item {
  position: relative;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
  aspect-ratio: 1;
}

.gif-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.gif-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gif-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* Style for GIF button text */
#gif-btn {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #4CAF50;
}

#gif-btn:hover {
  background: rgba(76, 175, 80, 0.1);
  color: #388E3C;
}

/* Edit Post Media Styles */
.edit-current-media {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.current-media-item {
  margin-bottom: 10px;
}

.current-media-item p {
  margin: 0 0 10px 0;
  color: #666;
  font-size: 14px;
}

.edit-media-options {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.edit-media-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #f0f2f5;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #555;
  transition: all 0.3s ease;
}

.edit-media-btn:hover {
  background: #e4e6eb;
  border-color: var(--primary-color);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.edit-media-btn i {
  font-size: 16px;
}

.remove-media-btn {
  background: #fee;
  border-color: #fcc;
  color: #c33;
}

.remove-media-btn:hover {
  background: #fdd;
  border-color: #e74c3c;
  color: #e74c3c;
}

.edit-new-media-preview {
  margin: 15px 0;
  padding: 15px;
  background: #e8f5e9;
  border: 2px dashed #4caf50;
  border-radius: 8px;
  min-height: 50px;
}

.new-media-preview-item p {
  margin: 0 0 10px 0;
  color: #2e7d32;
  font-size: 14px;
  font-weight: 600;
}

/* Upload Progress Bar */
.edit-upload-progress {
  margin: 15px 0;
  padding: 20px;
  background: linear-gradient(135deg, #e8f0fe 0%, #f0f4ff 100%);
  border-radius: 12px;
  border: 2px solid #4285f4;
  box-shadow: 0 4px 15px rgba(66, 133, 244, 0.25);
  animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(66, 133, 244, 0.25); }
  50% { box-shadow: 0 4px 25px rgba(66, 133, 244, 0.45); }
}

.progress-bar-container {
  width: 100%;
  height: 30px;
  background: #e0e0e0;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4285f4 0%, #34a853 50%, #4285f4 100%);
  background-size: 200% 100%;
  border-radius: 15px;
  transition: width 0.3s ease;
  box-shadow: 0 2px 4px rgba(66, 133, 244, 0.3);
  animation: progressShine 1.5s ease-in-out infinite, progressMove 2s linear infinite;
}

@keyframes progressShine {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes progressMove {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.progress-text {
  display: block;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #1967d2;
  margin-top: 8px;
}

/* Disable button styles */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* RESPONSIVE PROFILE */
@media (max-width: 768px) {
  /* Profile page improvements */
  .profile-cover {
    height: 200px;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: -60px 8px 8px;
    padding: 0 8px;
  }

  .profile-avatar-large {
    margin-top: -70px;
  }

  .avatar-large {
    width: 110px;
    height: 110px;
    border: 4px solid white;
  }

  .profile-info h1 {
    font-size: 22px;
    margin-top: 8px;
  }

  .profile-info p {
    font-size: 14px;
  }

  .profile-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .profile-actions button {
    width: 100%;
    padding: 10px;
    font-size: 15px;
  }

  .profile-tabs {
    margin: 0 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 10px 16px;
    font-size: 14px;
    white-space: nowrap;
  }

  .profile-content {
    margin: 8px;
  }

  .about-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .about-item {
    padding: 12px;
  }

  .about-item strong {
    font-size: 14px;
  }

  .about-item span {
    font-size: 14px;
  }

  /* Edit buttons on profile */
  .btn-edit-cover,
  .btn-edit-bio,
  .btn-edit-music {
    font-size: 13px;
    padding: 6px 12px;
  }

  /* Bio section */
  .bio-section {
    padding: 12px;
  }

  .bio-text {
    font-size: 15px;
    line-height: 1.5;
  }

  /* Music section */
  .music-section {
    padding: 12px;
  }
}

/* VINYL DISC MUSIC PLAYER */
.profile-header-new {
  background: white;
  margin: 0 20px 20px;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-main-info {
  display: flex;
  gap: 50px;
  align-items: flex-start;
}

.profile-avatar-section {
  display: flex;
  gap: 30px;
  align-items: center;
}

.vinyl-player {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.vinyl-disc {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a1a1a 0%, #000 100%);
  box-shadow:
    0 0 0 3px #333,
    0 8px 24px rgba(0, 0, 0, 0.4),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  animation: vinylSpin 15s linear infinite paused;
  cursor: pointer;
  transition: all 0.3s ease;
}

.vinyl-disc:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 0 3px #444,
    0 12px 32px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.vinyl-disc.playing {
  animation-play-state: running;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes vinylSpin {
  from {
    transform: rotate(0deg) translateZ(0);
  }
  to {
    transform: rotate(360deg) translateZ(0);
  }
}

.vinyl-cover-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.vinyl-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, #888 0%, #333 50%, #000 100%);
  z-index: 3;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.5);
}

.vinyl-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  z-index: 1;
  background: repeating-radial-gradient(
    circle at center,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
}

.music-title-circle {
  position: absolute;
  top: 0;
  left: 0;
  width: 160px;
  height: 160px;
  z-index: 4;
  pointer-events: none;
  animation: vinylSpin 15s linear infinite paused;
}

.vinyl-disc.playing + .music-title-circle {
  animation-play-state: running;
}

.circular-text {
  width: 100%;
  height: 100%;
}

.circular-text-content {
  fill: var(--primary-color);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.profile-info-new {
  flex: 1;
}

.profile-info-new h1 {
  margin: 0 0 15px 0;
  font-size: 36px;
  color: #333;
}

.profile-info-new p {
  margin: 0 0 20px 0;
  color: #666;
  font-size: 16px;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .profile-header-new {
    padding: 16px;
    padding-top: 120px; /* Extra space for avatar */
    margin: 0 8px 12px;
    overflow: visible; /* Don't clip avatar */
  }

  .profile-main-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .profile-avatar-section {
    flex-direction: column;
    gap: 16px;
    margin-top: -100px; /* Pull avatar up to overlap header */
  }

  .profile-avatar-large {
    margin-top: 0; /* Remove negative margin on mobile */
  }

  .avatar-large {
    width: 120px;
    height: 120px;
    border: 4px solid white;
  }

  .vinyl-player {
    width: 100px;
    height: 100px;
  }

  .vinyl-disc {
    width: 100px;
    height: 100px;
  }

  .music-title-circle {
    width: 100px;
    height: 100px;
  }

  .vinyl-cover-image {
    width: 66px;
    height: 66px;
  }

  .vinyl-center {
    width: 10px;
    height: 10px;
  }

  /* Slow down vinyl on mobile to match visual speed of larger post album */
  .vinyl-disc.playing {
    animation-duration: 20s !important;
  }

  .vinyl-disc.playing + .music-title-circle {
    animation-duration: 20s !important;
  }

  .profile-avatar-new {
    width: 100px;
    height: 100px;
  }

  .profile-info-new h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .profile-info-new p {
    font-size: 14px;
  }

  .profile-stats {
    gap: 16px;
  }

  .stat-item {
    font-size: 14px;
  }

  .stat-value {
    font-size: 18px;
  }

  .profile-bio {
    font-size: 15px;
    padding: 12px;
  }

  .profile-actions-new {
    flex-direction: column;
    width: 100%;
  }

  .profile-actions-new button {
    width: 100%;
    padding: 10px;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .profile-header-new {
    padding: 12px;
    padding-top: 100px; /* Extra space for smaller avatar */
    margin: 0 4px 8px;
    overflow: visible; /* Don't clip avatar */
  }

  .profile-avatar-section {
    margin-top: -80px; /* Pull avatar up to overlap header */
  }

  .avatar-large {
    width: 100px;
    height: 100px;
    border: 3px solid white;
  }

  .vinyl-player {
    width: 80px;
    height: 80px;
  }

  .vinyl-disc {
    width: 80px;
    height: 80px;
  }

  .music-title-circle {
    width: 80px;
    height: 80px;
  }

  .vinyl-cover-image {
    width: 52px;
    height: 52px;
  }

  .vinyl-center {
    width: 8px;
    height: 8px;
  }

  .profile-avatar-new {
    width: 85px;
    height: 85px;
  }

  .profile-info-new h1 {
    font-size: 20px;
  }

  .profile-info-new p {
    font-size: 13px;
  }

  .profile-stats {
    gap: 12px;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-label {
    font-size: 12px;
  }

  .profile-bio {
    font-size: 14px;
    padding: 10px;
  }

  /* Profile cover on small screens */
  .profile-cover {
    height: 160px;
  }

  .avatar-large {
    width: 90px;
    height: 90px;
  }

  .profile-info h1 {
    font-size: 20px;
  }
}

/* Custom Video Player with Icons */
.custom-video-wrapper {
  position: relative;
  width: 100%;
  max-height: 500px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  margin-top: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.custom-video-wrapper video {
  width: 100%;
  max-height: 500px;
  display: block;
  background: #000;
}

.custom-video-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 50%, transparent 100%);
  padding: 20px 15px 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.custom-video-wrapper:hover .custom-video-controls,
.custom-video-wrapper.playing .custom-video-controls {
  opacity: 1;
}

.video-progress-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: height 0.2s ease;
}

.video-progress-container:hover {
  height: 8px;
}

.video-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  width: 0%;
  transition: width 0.1s ease;
  position: relative;
}

.video-progress-bar::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-progress-container:hover .video-progress-bar::after {
  opacity: 1;
}

.video-controls-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-play-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 2px solid rgba(255, 255, 255, 0.4);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.video-play-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.7);
  border-color: rgba(255, 255, 255, 0.7);
}

.video-play-btn:active {
  transform: scale(1.05);
}

.video-time {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  min-width: 90px;
}

.video-volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.video-volume-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-volume-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.video-volume-slider {
  width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  appearance: none;
  outline: none;
  cursor: pointer;
}

.video-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

.video-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.video-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.video-fullscreen-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-fullscreen-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

/* Big play button overlay */
.video-big-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
  opacity: 0.95;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.video-big-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 12px 40px rgba(102, 126, 234, 0.8);
  opacity: 1;
}

.custom-video-wrapper.playing .video-big-play-btn {
  opacity: 0;
  pointer-events: none;
}

/* Loading spinner */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: video-spin 0.8s linear infinite;
  display: none;
}

@keyframes video-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.custom-video-wrapper.loading .video-loading {
  display: block;
}

/* Fullscreen backdrop */
.custom-video-wrapper::backdrop,
.custom-video-wrapper::-webkit-backdrop {
  background: #000;
}

/* Controls always visible in fullscreen */
.custom-video-wrapper:fullscreen .custom-video-controls,
.custom-video-wrapper:-webkit-full-screen .custom-video-controls,
.custom-video-wrapper:-moz-full-screen .custom-video-controls,
.custom-video-wrapper:-ms-fullscreen .custom-video-controls {
  opacity: 1;
}

/* Hide big play button in fullscreen */
.custom-video-wrapper:fullscreen .video-big-play-btn,
.custom-video-wrapper:-webkit-full-screen .video-big-play-btn,
.custom-video-wrapper:-moz-full-screen .video-big-play-btn,
.custom-video-wrapper:-ms-fullscreen .video-big-play-btn {
  display: none;
}

/* ==================== GAME STYLES ==================== */

/* Game list in selection modal */
.game-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}

.game-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: var(--message-received-bg, white);
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 16px;
  text-align: center;
}

.game-option:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.game-icon {
  font-size: 32px;
  min-width: 50px;
  text-align: center;
}

.game-icon img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.game-name {
  font-weight: 600;
  font-size: 18px;
}

/* Game modal specific styles */
.game-modal {
  min-width: 400px;
  max-width: 500px;
}

.game-status {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  margin: 20px 0;
  padding: 15px;
  background: var(--chat-bg, #f8f9fa);
  border-radius: 8px;
}

/* Rock Paper Scissors choices */
.rps-choices {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
}

.rps-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 25px 20px;
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 100px;
}

.rps-choice:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

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

.choice-icon {
  font-size: 48px;
}

.choice-name {
  font-weight: 600;
  font-size: 16px;
}

/* Game invite message in chat */
.game-invite-message {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.game-invite-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.game-invite-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

.game-waiting-text {
  font-size: 14px;
  font-style: italic;
  opacity: 0.9;
  margin-top: 10px;
}

.game-paused-text {
  font-size: 14px;
  font-weight: 600;
  color: #ffa502;
  margin-top: 10px;
  margin-bottom: 8px;
}

.btn-resume-game {
  background: linear-gradient(135deg, #ffa502, #ff6348) !important;
  animation: pulse-resume 2s infinite;
}

@keyframes pulse-resume {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 165, 2, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 165, 2, 0); }
}

/* Paused UNO game banner */
.paused-game-banner {
  background: linear-gradient(135deg, #ff9500, #ff6348);
  padding: 12px 16px;
  margin: 0 0 15px 0;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3);
  animation: banner-pulse 2s infinite;
  position: sticky;
  top: 0;
  z-index: 100;
}

.paused-game-banner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.paused-game-text {
  color: white;
  font-weight: 600;
  font-size: 14px;
}

.btn-resume-paused {
  background: white;
  color: #ff6348;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-resume-paused:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Paused game buttons container */
.paused-game-buttons,
.game-paused-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Cancel button for paused game */
.btn-cancel-paused,
.btn-cancel-game {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-cancel-paused:hover,
.btn-cancel-game:hover {
  background: rgba(255, 0, 0, 0.6);
  border-color: #ff4444;
  transform: scale(1.1);
}

.btn-cancel-game {
  background: #ff4444;
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.btn-cancel-game:hover {
  background: #cc0000;
}

@keyframes banner-pulse {
  0%, 100% { box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3); }
  50% { box-shadow: 0 4px 25px rgba(255, 149, 0, 0.5); }
}

.game-result {
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  margin-top: 10px;
  text-align: center;
}

.game-result-win {
  background: rgba(46, 213, 115, 0.2);
  color: #2ed573;
  border: 2px solid #2ed573;
}

.game-result-lose {
  background: rgba(255, 71, 87, 0.2);
  color: #ff4757;
  border: 2px solid #ff4757;
}

.game-result-draw {
  background: rgba(255, 168, 1, 0.2);
  color: #ffa801;
  border: 2px solid #ffa801;
}

.game-invite-content .btn {
  background: white;
  color: var(--primary-color);
  font-weight: 600;
  padding: 10px 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.game-invite-content .btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Game result message in chat */
.game-result-message {
  display: flex;
  justify-content: center;
  margin: 15px 0;
}

.game-result-content {
  background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  max-width: 80%;
  box-shadow: 0 4px 12px rgba(82, 183, 136, 0.3);
}

/* Snake Game Modal */
.snake-modal {
  max-width: 650px;
  max-height: 95vh;
  overflow-y: auto;
}

.snake-game-info {
  margin: 15px 0;
}

.player-info {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  margin-bottom: 15px;
}

.player-box {
  flex: 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.player-box.active {
  border: 3px solid #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.player-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
  opacity: 0.9;
}

.player-score {
  display: block;
  font-size: 28px;
  font-weight: bold;
}

#snake-canvas {
  width: 100%;
  max-width: 600px;
  height: 600px;
  border: 3px solid #333;
  border-radius: 8px;
  background: #1a1a1a;
  margin: 15px auto;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.snake-controls {
  margin: 15px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  text-align: left;
}

.controls-info {
  margin-bottom: 10px;
  font-size: 14px;
  color: #333;
}

.game-rules {
  margin-top: 10px;
}

.game-rules strong {
  color: #333;
  font-size: 14px;
}

.game-rules ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.game-rules li {
  font-size: 13px;
  color: #666;
  margin: 4px 0;
}

/* Virtual D-Pad for Snake Game */
.snake-virtual-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 15px 0;
  padding: 15px;
  background: #f0f0f0;
  border-radius: 10px;
}

.dpad-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dpad-btn {
  width: 60px;
  height: 60px;
  font-size: 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dpad-btn:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Desktop: hide virtual d-pad on larger screens */
@media (min-width: 768px) {
  .snake-virtual-dpad {
    display: none;
  }
}

/* Mobile: Optimize snake game for mobile screens */
@media (max-width: 768px) {
  .snake-modal {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 15px;
    max-height: 100vh;
    border-radius: 0;
  }

  .snake-modal h3 {
    font-size: 20px;
    margin-bottom: 10px;
  }

  #snake-game-status {
    font-size: 14px;
    margin: 8px 0;
  }

  .player-info {
    gap: 10px;
    margin-bottom: 10px;
  }

  .player-box {
    padding: 10px;
  }

  .player-name {
    font-size: 12px;
  }

  .player-score {
    font-size: 20px;
  }

  /* Make canvas square and responsive on mobile */
  #snake-canvas {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 100%;
    margin: 10px auto;
    border: 2px solid #333;
  }

  .snake-virtual-dpad {
    margin: 10px 0;
    padding: 10px;
  }

  .dpad-btn {
    width: 55px;
    height: 55px;
    font-size: 24px;
  }

  .modal-actions {
    margin-top: 10px;
  }

  .modal-actions button {
    padding: 10px 16px;
    font-size: 14px;
  }
}

.game-result-text {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.6;
}

.game-result-content .message-time {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 10px;
}

/* Theme-specific game styles */
.theme-love .game-invite-content {
  background: linear-gradient(135deg, #ff6b9d 0%, #c06c84 100%);
}

/* Theme-specific game result styles - Better contrast for theme-love */
.theme-love .game-result-win {
  background: rgba(255, 255, 255, 0.95);
  color: #27ae60;
  border: 3px solid #27ae60;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.theme-love .game-result-lose {
  background: rgba(255, 255, 255, 0.95);
  color: #e74c3c;
  border: 3px solid #e74c3c;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.theme-love .game-result-draw {
  background: rgba(255, 255, 255, 0.95);
  color: #f39c12;
  border: 3px solid #f39c12;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.theme-ocean .game-invite-content {
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
}

.theme-sunset .game-invite-content {
  background: linear-gradient(135deg, #ff6f3c 0%, #ff9a3c 100%);
}

.theme-forest .game-invite-content {
  background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
}

.theme-dark .game-invite-content {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.theme-dark .game-result-content {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* ==================== MOBILE RESPONSIVE FOR GAMES ==================== */

@media (max-width: 768px) {
  /* Game modal adjustments */
  .game-modal {
    min-width: auto;
    max-width: 95%;
    width: 95%;
    margin: 10px;
  }

  .modal-content {
    padding: 20px 15px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Game list adjustments */
  .game-list {
    gap: 10px;
    margin: 15px 0;
  }

  .game-option {
    padding: 15px;
    gap: 10px;
  }

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

  .game-icon img {
    width: 48px !important;
    height: 48px !important;
  }

  .game-name {
    font-size: 16px;
  }

  /* Game status adjustments */
  .game-status {
    font-size: 16px;
    margin: 15px 0;
    padding: 12px;
  }

  /* Rock Paper Scissors choices - make them smaller and stack better */
  .rps-choices {
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
  }

  .rps-choice {
    padding: 15px 10px;
    min-width: 80px;
    flex: 1;
  }

  .choice-icon {
    font-size: 36px;
  }

  .choice-name {
    font-size: 14px;
  }

  /* Game invite message adjustments */
  .game-invite-content {
    padding: 15px;
    max-width: 90%;
  }

  .game-invite-text {
    font-size: 16px;
    margin-bottom: 12px;
  }

  .game-invite-content .btn {
    padding: 8px 20px;
    font-size: 14px;
  }

  /* Game result message adjustments */
  .game-result-content {
    padding: 15px;
    max-width: 90%;
  }

  .game-result-text {
    font-size: 14px;
  }

  /* Modal actions adjustments */
  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  /* Extra small screens */
  .game-modal {
    width: 98%;
    margin: 5px;
  }

  .modal-content h3 {
    font-size: 18px;
  }

  /* Make RPS choices vertical on very small screens */
  .rps-choices {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .rps-choice {
    min-width: auto;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    padding: 15px;
  }

  .choice-icon {
    font-size: 32px;
  }

  .choice-name {
    font-size: 16px;
    margin-left: 10px;
  }

  /* Smaller font sizes */
  .game-status {
    font-size: 14px;
    padding: 10px;
  }

  .game-invite-text {
    font-size: 14px;
  }

  .game-result-text {
    font-size: 13px;
  }
}

/* ==================== MOBILE UX IMPROVEMENTS ==================== */

@media (max-width: 768px) {
  /* Better touch targets - minimum 44x44px */
  button,
  a.btn,
  .btn-icon,
  .nav-link {
    min-height: 44px;
    min-width: 44px;
  }

  /* Prevent text selection on buttons */
  button,
  .btn,
  .btn-icon {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  /* Smooth scrolling */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* Better spacing for readability */
  p,
  .post-content,
  .bio-text {
    line-height: 1.6;
  }

  /* Images responsive */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Video responsive */
  video {
    max-width: 100%;
    height: auto;
  }

  /* Hide scrollbar but keep functionality */
  .profile-tabs::-webkit-scrollbar {
    height: 2px;
  }

  .profile-tabs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
  }

  /* Better focus states for accessibility */
  button:focus,
  input:focus,
  textarea:focus,
  a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }

  /* Prevent zoom on input focus (iOS) */
  input[type="text"],
  input[type="password"],
  input[type="email"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Better modal positioning */
  .modal {
    padding: 10px;
    overflow-y: auto;
  }

  /* Improved card shadows for mobile */
  .post-card,
  .create-post-card,
  .profile-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  /* Better spacing in lists */
  .conversation-item,
  .comment-item,
  .post-card {
    margin-bottom: 8px;
  }

  /* Larger tap areas for reactions */
  .reaction-option {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }

  /* Better navbar spacing */
  .navbar-menu {
    gap: 8px;
  }

  /* Improved transitions for better performance */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  button,
  a,
  .btn {
    transition: transform 0.2s ease, background 0.2s ease;
  }

  /* Active states for better feedback */
  button:active,
  .btn:active,
  .btn-icon:active {
    transform: scale(0.95);
  }

  /* Better image previews */
  .post-image,
  .message-image {
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
  }

  .post-image:active,
  .message-image:active {
    transform: scale(0.98);
  }
}

/* Extra improvements for very small screens */
@media (max-width: 480px) {
  /* Reduce animations for better performance */
  *,
  *::before,
  *::after {
    animation-duration: 0.3s !important;
    transition-duration: 0.2s !important;
  }

  /* Compact spacing */
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 18px;
  }

  h4 {
    font-size: 16px;
  }

  /* Better use of screen space */
  .container,
  .home-container,
  .chat-container {
    padding: 0;
  }

  /* Smaller gaps */
  .input-group,
  .post-actions,
  .comment-actions {
    gap: 6px;
  }
}

/* ===============================================
   GAMES PAGE STYLES
   =============================================== */

.games-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.games-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

.games-header {
  text-align: center;
  color: white;
  margin-bottom: 40px;
}

.games-header h1 {
  font-size: 48px;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.games-header p {
  font-size: 18px;
  opacity: 0.9;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin-bottom: 60px;
}

.game-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}

.game-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0,0,0,0.3);
}

.game-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.game-icon img,
.game-icon-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

.game-card h3 {
  font-size: 24px;
  color: #333;
  margin-bottom: 10px;
}

.game-card p {
  color: #666;
  margin-bottom: 20px;
  line-height: 1.6;
}

.game-stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 10px;
}

.game-stats span {
  font-weight: 600;
  color: #555;
}

.game-achievements {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
}

.achievement-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Role Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.role-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.role-badge .role-icon {
  font-size: 18px;
  line-height: 1;
  transform: translateY(-2.5px);
}

.role-badge .role-text {
  line-height: 1;
}

.role-badge.owner {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #5c4003;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.4);
}

.role-badge.owner:hover {
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.5);
}

.role-badge.girlfriend {
  background: linear-gradient(135deg, #FF69B4 0%, #FF1493 100%);
  color: white;
  box-shadow: 0 2px 12px rgba(255, 105, 180, 0.4);
}

.role-badge.girlfriend:hover {
  box-shadow: 0 4px 16px rgba(255, 105, 180, 0.5);
}

.role-badge.member {
  background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
  color: white;
  box-shadow: 0 2px 12px rgba(76, 175, 80, 0.4);
}

.role-badge.member:hover {
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.5);
}

.role-badge.user {
  background: linear-gradient(135deg, #90A4AE 0%, #607D8B 100%);
  color: white;
  box-shadow: 0 2px 12px rgba(96, 125, 139, 0.3);
}

.role-badge.user:hover {
  box-shadow: 0 4px 16px rgba(96, 125, 139, 0.4);
}

.btn-play {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 30px;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
  width: 100%;
}

.btn-play:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-customize {
  background: #f0f0f0;
  color: #333;
  border: 2px solid #ddd;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
  width: 100%;
}

.btn-customize:hover {
  background: #e0e0e0;
  border-color: #667eea;
}

/* Achievements Section */
.achievements-section {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.achievements-section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 28px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 10px;
  background: #f9f9f9;
  transition: all 0.3s;
}

.achievement-item.unlocked {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border: 2px solid #4CAF50;
}

.achievement-item.locked {
  opacity: 0.5;
  filter: grayscale(100%);
}

.achievement-icon {
  font-size: 40px;
  flex-shrink: 0;
}

.achievement-info h4 {
  color: #333;
  font-size: 16px;
  margin-bottom: 5px;
}

.achievement-info p {
  color: #666;
  font-size: 13px;
  margin: 0;
}

.unlocked-date {
  color: #4CAF50;
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-top: 5px;
}

/* Game Invite Modal */
.players-list {
  max-height: 400px;
  overflow-y: auto;
  margin: 20px 0;
}

.player-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 10px;
  background: #f5f5f5;
  margin-bottom: 10px;
  transition: all 0.3s;
}

.player-item:hover {
  background: #e8e8e8;
  transform: translateX(5px);
}

.player-item img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
}

.player-item span {
  flex: 1;
  font-weight: 600;
  color: #333;
}

/* ===============================================
   SNAKE CUSTOMIZATION PAGE STYLES
   =============================================== */

.snake-custom-page {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  min-height: 100vh;
}

.snake-custom-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 20px 40px;
}

.custom-header {
  text-align: center;
  color: white;
  margin-bottom: 40px;
  position: relative;
}

.btn-back {
  position: absolute;
  left: 0;
  top: 0;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-back:hover {
  background: rgba(255,255,255,0.2);
}

.custom-header h1 {
  font-size: 42px;
  margin-bottom: 20px;
}

.player-level {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  padding: 20px 40px;
  border-radius: 15px;
}

.player-level span {
  font-size: 18px;
  font-weight: 600;
}

.xp-bar {
  width: 300px;
  height: 20px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  overflow: hidden;
}

.xp-progress {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  transition: width 0.5s;
  border-radius: 10px;
}

/* Snake Preview */
.snake-preview-section {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.snake-preview-section h2 {
  color: #333;
  margin-bottom: 20px;
}

#snake-preview-canvas {
  border: 3px solid #333;
  border-radius: 10px;
  background: #1a1a1a;
  margin: 0 auto;
  display: block;
}

#current-skin-name {
  font-size: 24px;
  font-weight: 600;
  color: #667eea;
  margin-top: 15px;
}

/* Skins Section */
.skins-section {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.skins-section h2 {
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.skins-section-header {
  grid-column: 1 / -1;
  margin-top: 20px;
  margin-bottom: 10px;
}

.skins-section-header h3 {
  color: #333;
  font-size: 20px;
  font-weight: 600;
  padding: 10px 15px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 10px;
  border-left: 5px solid #4CAF50;
}

.skins-section-header:first-child {
  margin-top: 0;
}

.skin-card {
  background: #f9f9f9;
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
  border: 3px solid transparent;
}

.skin-card.unlocked {
  cursor: pointer;
}

.skin-card.unlocked:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.skin-card.selected {
  border-color: #4CAF50;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.skin-card.locked {
  opacity: 0.5;
  filter: grayscale(100%);
}

.skin-icon {
  font-size: 50px;
  margin-bottom: 10px;
}

.skin-preview {
  width: 100px;
  height: 30px;
  border-radius: 15px;
  margin: 10px auto;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.skin-card h4 {
  color: #333;
  font-size: 16px;
  margin: 10px 0 5px;
}

.skin-level {
  color: #666;
  font-size: 13px;
  margin-bottom: 10px;
}

.btn-select {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  width: 100%;
}

.btn-select:hover {
  transform: scale(1.05);
}

.skin-locked {
  color: #999;
  font-size: 13px;
  padding: 8px;
}

/* Unlock Guide */
.unlock-guide {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.unlock-guide h3 {
  color: #333;
  margin-bottom: 15px;
  font-size: 24px;
}

.unlock-guide ul {
  list-style: none;
  padding: 0;
}

.unlock-guide li {
  color: #555;
  font-size: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.unlock-guide li:last-child {
  border-bottom: none;
}

/* Mobile responsive for games pages */
@media (max-width: 768px) {
  .games-header h1 {
    font-size: 32px;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .custom-header h1 {
    font-size: 28px;
  }

  .btn-back {
    position: static;
    margin-bottom: 20px;
    display: inline-block;
  }

  .xp-bar {
    width: 200px;
  }

  .skins-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* CRITICAL FIX: Prevent iOS Safari auto-zoom on input focus */
/* Font-size must be >= 16px to prevent zoom - TABLET & MOBILE */
@media (max-width: 768px) {
  input,
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Ensure buttons don't cause issues */
  button {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ============================================
   HAMBURGER MENU (≤555px)
   Mobile navigation with hamburger menu
   ============================================ */
@media (max-width: 555px) {
  /* Hide hamburger by default (shown via JS) */
  .hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: all 0.3s ease;
  }

  .hamburger img {
    display: block;
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
  }

  /* Hamburger animation when active - rotate the icon */
  .hamburger.active img {
    transform: rotate(90deg);
  }

  /* Hide desktop menu, show as dropdown */
  .navbar-menu {
    position: fixed;
    top: 54px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    max-height: calc(100vh - 54px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .navbar-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .navbar-menu .nav-link {
    padding: 15px 20px;
    display: block;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    color: #333;
    text-decoration: none;
  }

  .navbar-menu .nav-link:hover {
    background: #f8f9fa;
  }

  .navbar-menu .nav-link.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    font-weight: 600;
    border-left: 4px solid var(--primary-color);
  }

  .nav-user {
    padding: 15px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    border-top: 2px solid #e0e0e0;
  }

  .nav-avatar {
    width: 40px;
    height: 40px;
  }

  #nav-username {
    display: inline-block;
    font-weight: 500;
    flex: 1;
    font-size: 14px;
    color: #333;
  }

  #logout-btn,
  #nav-logout-btn {
    background: #ff4444;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: background 0.3s;
  }

  #logout-btn:hover,
  #nav-logout-btn:hover {
    background: #dd3333;
  }
}

/* ============================================
   MOBILE PHONE ONLY (<540px): Complete Mobile Redesign
   Purpose-built mobile experience, not desktop override
   ============================================ */
@media (max-width: 540px) {

  /* ===== BASE LAYOUT ===== */
  body {
    font-size: 14px;
    overflow-x: hidden;
  }

  /* ===== NAVBAR - Compact Mobile Version ===== */
  .navbar {
    height: 54px;
    padding: 0;
  }

  .navbar-container {
    padding: 0 10px;
    max-width: 100%;
  }

  .navbar-brand {
    gap: 8px;
  }

  .navbar-logo {
    width: 24px;
    height: 24px;
  }

  .navbar-brand h1 {
    font-size: 14px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  /* ===== HOME PAGE ===== */
  .home-container {
    margin-top: 56px;
    padding: 8px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar-left,
  .sidebar-right {
    display: none; /* Hide sidebars on phones */
  }

  .newsfeed {
    width: 100%;
    padding: 0;
  }

  .post-card,
  .create-post-card {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .post-header {
    gap: 10px;
  }

  .post-avatar {
    width: 40px;
    height: 40px;
  }

  .post-author {
    font-size: 14px;
  }

  .post-time {
    font-size: 11px;
  }

  .post-content {
    font-size: 14px;
    line-height: 1.5;
    margin: 10px 0;
  }

  .post-image,
  .post-video {
    max-width: 100%;
    border-radius: 8px;
    margin: 10px 0;
  }

  .post-actions {
    padding: 10px 0;
    gap: 15px;
  }

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

  /* ===== GAMES PAGE ===== */
  .games-container {
    margin-top: 56px;
    padding: 10px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .games-header {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
  }

  .games-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .games-header p {
    font-size: 13px;
  }

  .games-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
  }

  .game-card {
    width: 100%;
    padding: 20px;
    margin: 0;
    border-radius: 12px;
  }

  .game-icon {
    font-size: 40px;
    margin-bottom: 12px;
  }

  .game-icon img,
  .game-icon-img {
    width: 50px;
    height: 50px;
  }

  .game-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .game-card p {
    font-size: 13px;
    margin-bottom: 12px;
  }

  .btn-play {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    margin-top: 10px;
  }

  .achievements-section {
    margin-top: 30px;
  }

  .achievements-section h2 {
    font-size: 20px;
    margin-bottom: 15px;
  }

  .achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* ===== CHAT PAGE - Already handled in 768px, refine for small phones ===== */
  .chat-page {
    padding-top: 54px;
  }

  .chat-header {
    min-height: 60px;
    padding: 10px;
  }

  .chat-header h3 {
    font-size: 15px;
  }

  .chat-theme {
    font-size: 11px;
  }

  .chat-avatar {
    width: 36px;
    height: 36px;
  }

  .message-avatar {
    width: 32px;
    height: 32px;
  }

  .message-avatar.game-icon-avatar {
    padding: 2px;
  }

  .message-content {
    max-width: 80%;
    font-size: 14px;
    padding: 10px 12px;
  }

  .chat-input-container {
    padding: 8px;
    background: white;
  }

  /* Ensure chat-main has solid background to hide any gaps */
  .chat-main {
    background: white !important;
  }

  /* Overlap technique for bottom gap - aggressive for mobile */
  .chat-messages {
    bottom: 60px;
  }

  #message-input {
    font-size: 14px;
    padding: 8px 12px;
    min-height: 38px;
  }

  .input-group .btn-icon {
    font-size: 18px;
    padding: 5px;
    min-width: 34px;
  }

  /* ===== MODALS - Mobile Optimized ===== */
  .modal {
    padding: 5px;
    align-items: flex-start;
    padding-top: 20px;
  }

  .modal-content,
  .game-modal,
  .snake-modal,
  .gif-picker-content {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    min-width: 0;
    max-height: calc(100vh - 40px);
    margin: 0;
    padding: 15px;
    border-radius: 12px;
    overflow-y: auto;
  }

  .modal-content h3 {
    font-size: 18px;
    margin-bottom: 12px;
  }

  .modal-actions {
    margin-top: 15px;
    gap: 10px;
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
    padding: 12px;
  }

  /* Snake Game Modal */
  .snake-modal {
    padding: 10px;
  }

  #snake-canvas {
    width: 100%;
    height: auto;
    max-width: calc(100vw - 40px);
    aspect-ratio: 1;
    border-radius: 8px;
  }

  .snake-virtual-dpad {
    margin-top: 15px;
    gap: 8px;
  }

  .dpad-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .snake-controls {
    font-size: 12px;
    padding: 10px;
    margin-top: 10px;
  }

  .snake-game-info {
    margin-bottom: 15px;
  }

  .player-info {
    gap: 10px;
    flex-wrap: wrap;
  }

  .player-box {
    flex: 1;
    min-width: calc(50% - 5px);
    padding: 8px;
    font-size: 12px;
  }

  /* RPS Game */
  .rps-choices {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .rps-choice {
    flex: 0 0 calc(33.333% - 8px);
    min-width: 90px;
    padding: 15px 10px;
  }

  .choice-icon {
    font-size: 32px;
  }

  .choice-name {
    font-size: 12px;
  }

  /* GIF Picker */
  .gif-picker-content {
    padding: 12px;
  }

  .gif-search-container {
    gap: 8px;
    flex-direction: column;
  }

  .gif-search-container input {
    width: 100%;
  }

  .gif-search-container button {
    width: 100%;
  }

  .gif-categories {
    gap: 6px;
    margin: 10px 0;
    flex-wrap: wrap;
  }

  .gif-category-btn {
    font-size: 11px;
    padding: 6px 10px;
  }

  .gif-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* ===== TABLES - Stack for Mobile ===== */
  .accounts-table {
    font-size: 12px;
  }

  .accounts-table th,
  .accounts-table td {
    padding: 8px;
    font-size: 12px;
  }

  /* Hide less important columns on small screens */
  .accounts-table th:nth-child(3),
  .accounts-table td:nth-child(3) {
    display: none;
  }

  /* ===== FORMS & INPUTS ===== */
  .form-group {
    margin-bottom: 15px;
  }

  .form-group label {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .form-group input,
  .form-group textarea {
    font-size: 16px; /* Prevent iOS zoom */
    padding: 10px 12px;
  }

  .btn {
    min-height: 44px; /* iOS touch target */
    font-size: 15px;
    padding: 10px 20px;
  }

  /* ===== LOGIN PAGE ===== */
  .login-box {
    padding: 20px 15px;
    border-radius: 15px;
  }

  .login-box h1 {
    font-size: 28px;
  }

  .subtitle {
    font-size: 13px;
  }

  /* ===== MUSIC PLAYER - Preserve but optimize ===== */
  .custom-audio-player {
    width: 100%;
    max-width: 100%;
  }

  .album-art-image {
    max-width: 180px;
    max-height: 180px;
  }

  .lyrics-container {
    font-size: 13px;
    max-height: 250px;
  }

  /* ===== PROFILE & AVATARS - Preserve dimensions ===== */
  .profile-avatar {
    width: 80px;
    height: 80px;
  }

  .conversation-avatar {
    width: 40px;
    height: 40px;
  }

  /* ===== GAME INVITES & CARDS ===== */
  .players-list {
    width: 100%;
  }

  .player-item {
    padding: 10px;
    margin-bottom: 8px;
  }

  .game-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .game-option {
    width: 100%;
    padding: 15px;
    justify-content: flex-start;
  }

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

  .game-icon img,
  .game-icon-img {
    width: 40px;
    height: 40px;
  }

  .game-name {
    font-size: 14px;
  }

  /* ===== SKINS GRID ===== */
  .skins-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .skin-item {
    padding: 10px;
  }

  /* ===== TEXT & CONTENT ===== */
  p, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Headings scale */
  h1 { font-size: 24px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  h4 { font-size: 16px; }

  /* ===== UTILITIES ===== */
  /* Ensure nothing overflows viewport */
  * {
    max-width: 100vw;
  }

  /* But allow specific elements to maintain their size */
  .nav-avatar,
  .post-avatar,
  .message-avatar,
  .chat-avatar,
  .conversation-avatar,
  .profile-avatar,
  img[class*="avatar"] {
    max-width: none;
  }

  /* Icons and buttons can be full width when needed */
  button,
  .btn {
    max-width: 100%;
  }

  /* Prevent horizontal scroll */
  html {
    overflow-x: hidden;
  }
}

/* LARGE PHONES & SMALL TABLETS: Moderate fixes (541-768px) */
@media (min-width: 541px) and (max-width: 768px) {
  /* Only fix elements that truly overflow */
  .game-modal {
    min-width: auto !important;
    max-width: 90% !important;
    width: auto !important;
  }

  .modal-content {
    min-width: auto !important;
    max-width: 90vw !important;
  }

  /* Ensure images responsive */
  img,
  video,
  canvas,
  iframe {
    max-width: 100% !important;
  }
}

/* ==================== VIDEO PLAYER STYLES ==================== */

.video-player-container {
  position: relative;
}

/* Video subtitle track styling */
video::cue {
  background-color: rgba(0, 0, 0, 0.75);
  color: #fff8dc; /* Màu kem nhẹ - lãng mạn hơn trắng thuần */
  font-size: 22px;
  font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
  font-style: italic;
  font-weight: 500;
  line-height: 1.6;
  padding: 10px 20px;
  border-radius: 8px;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.95);
}

/* Fullscreen - chữ siêu to cho màn 4K */
video:fullscreen::cue,
video:-webkit-full-screen::cue {
  font-size: 72px;
  padding: 20px 40px;
  text-shadow: 4px 4px 10px rgba(0, 0, 0, 0.95);
}

/* Mobile responsive subtitles */
@media (max-width: 768px) {
  video::cue {
    font-size: 16px;
    padding: 6px 12px;
  }

  video:fullscreen::cue,
  video:-webkit-full-screen::cue {
    font-size: 28px;
    padding: 10px 20px;
  }
}

/* =====================================================
   MASTER MUSIC BUTTON STYLES
   ===================================================== */
.master-music-action {
  margin-top: 15px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(22, 33, 62, 0.9) 100%);
  border-radius: 12px;
  text-align: center;
}

.master-music-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 400px;
}

.master-music-btn i {
  font-size: 16px;
}

/* Add to master music button (Admin only) */
.master-music-btn.master-music-add {
  background: linear-gradient(135deg, #e94560 0%, #ff6b9d 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.master-music-btn.master-music-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.master-music-btn.master-music-add:active {
  transform: translateY(0);
}

/* Open master music button (Everyone) */
.master-music-btn.master-music-open {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.master-music-btn.master-music-open:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.master-music-btn.master-music-open:active {
  transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .master-music-action {
    margin-top: 10px;
    padding: 10px;
  }

  .master-music-btn {
    padding: 10px 20px;
    font-size: 13px;
  }

  .master-music-btn i {
    font-size: 14px;
  }
}

/* ============================================
   QUIZ PAGE STYLES
   ============================================ */

.quiz-page {
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
}

.quiz-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 20px 40px;
}

/* Topic Selection */
.topic-selection {
  text-align: center;
}

.topic-selection h2 {
  color: white;
  font-size: 2rem;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.topic-subtitle {
  color: rgba(255,255,255,0.9);
  margin-bottom: 40px;
  font-size: 1.1rem;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.topic-card {
  background: white;
  border-radius: 16px;
  padding: 30px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.topic-card:hover:not(.disabled) {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.topic-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.topic-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.topic-card h3 {
  color: #333;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.topic-card p {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.topic-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-progress .progress-bar {
  flex: 1;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
}

.topic-progress .progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  border-radius: 4px;
  transition: width 0.3s ease;
}

.topic-progress .progress-text {
  color: #666;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* English Sub-topics Selection */
.subtopics-selection {
  padding: 30px;
  text-align: center;
}

.subtopics-selection h2 {
  color: #333;
  margin-bottom: 10px;
}

.subtopics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.subtopic-card {
  background: white;
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  border: 2px solid #e9ecef;
}

.subtopic-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  border-color: var(--primary-color, #667eea);
}

.subtopic-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.subtopic-card h3 {
  color: #333;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.subtopic-card p {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
}

.subtopic-card.all-topics {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
}

.subtopic-card.all-topics h3,
.subtopic-card.all-topics p {
  color: white;
}

.subtopic-card.all-topics:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* Quiz Area */
.quiz-area {
  background: white;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  flex-wrap: wrap;
  gap: 10px;
}

.quiz-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.quiz-topic-name {
  font-weight: 600;
  color: #333;
}

.quiz-progress-text {
  color: #666;
  font-size: 0.9rem;
}

.quiz-score {
  display: flex;
  gap: 15px;
}

.correct-count {
  color: #28a745;
  font-weight: 600;
}

.wrong-count {
  color: #dc3545;
  font-weight: 600;
}

.quiz-progress-bar {
  height: 6px;
  background: #e9ecef;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  transition: width 0.5s ease;
}

.quiz-content {
  padding: 30px;
}

.question-card {
  margin-bottom: 30px;
}

.question-number {
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.question-text {
  color: #333;
  font-size: 1.3rem;
  line-height: 1.6;
  margin: 0;
}

/* IPA Pronunciation Display */
.ipa-container {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-ipa-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
  width: fit-content;
}

.btn-ipa-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-ipa-toggle.active {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.ipa-display {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
  border-radius: 12px;
  border-left: 4px solid #667eea;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ipa-word {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
}

.ipa-phonetic {
  font-size: 1.3rem;
  font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif;
  color: #667eea;
  font-weight: 500;
  background: white;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.answers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 25px;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 18px 20px;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: left;
  font-size: 1rem;
}

.answer-btn:hover:not(:disabled) {
  background: white;
  border-color: var(--primary-color);
  transform: translateX(5px);
}

.answer-btn:disabled {
  cursor: not-allowed;
}

.answer-btn.correct {
  background: #d4edda;
  border-color: #28a745;
}

.answer-btn.wrong {
  background: #f8d7da;
  border-color: #dc3545;
}

.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #e9ecef;
  border-radius: 50%;
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
}

.answer-btn.correct .answer-letter {
  background: #28a745;
  color: white;
}

.answer-btn.wrong .answer-letter {
  background: #dc3545;
  color: white;
}

.answer-text {
  flex: 1;
  color: #333;
}

.explanation-box {
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.explanation-box.correct {
  background: #d4edda;
  border: 1px solid #c3e6cb;
}

.explanation-box.wrong {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.explanation-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 1rem;
}

.explanation-box.correct .explanation-icon {
  background: #28a745;
  color: white;
}

.explanation-box.wrong .explanation-icon {
  background: #dc3545;
  color: white;
}

.explanation-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.explanation-box.correct .explanation-title {
  color: #155724;
}

.explanation-box.wrong .explanation-title {
  color: #721c24;
}

.explanation-text {
  margin: 0;
  line-height: 1.6;
}

.explanation-box.correct .explanation-text {
  color: #155724;
}

.explanation-box.wrong .explanation-text {
  color: #721c24;
}

.btn-next {
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
}

/* Results Screen */
.results-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
}

.results-card {
  background: white;
  border-radius: 20px;
  padding: 50px 40px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  max-width: 500px;
  width: 100%;
}

.results-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.results-card h2 {
  color: #333;
  margin-bottom: 10px;
  font-size: 1.8rem;
}

.results-subtitle {
  color: #666;
  margin-bottom: 30px;
}

.results-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 30px;
}

.stat-box {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-box.correct .stat-number {
  color: #28a745;
}

.stat-box.wrong .stat-number {
  color: #dc3545;
}

.stat-box.percentage .stat-number {
  color: var(--primary-color);
}

.stat-label {
  color: #666;
  font-size: 0.9rem;
}

.results-message {
  background: #f8f9fa;
  padding: 15px 20px;
  border-radius: 10px;
  color: #666;
  margin-bottom: 30px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.results-actions .btn {
  padding: 15px;
  font-size: 1rem;
}

/* Quiz Mobile Responsive */
@media (max-width: 768px) {
  .quiz-container {
    padding: 80px 15px 30px;
  }

  .topic-selection h2 {
    font-size: 1.5rem;
  }

  .topics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .topic-card {
    padding: 20px 15px;
  }

  .topic-icon {
    font-size: 2.5rem;
  }

  .quiz-header {
    padding: 15px;
  }

  .quiz-content {
    padding: 20px;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .answer-btn {
    padding: 15px;
  }

  .results-card {
    padding: 30px 20px;
  }

  .results-stats {
    gap: 20px;
  }

  .stat-number {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .topics-grid {
    grid-template-columns: 1fr;
  }

  .quiz-score {
    gap: 10px;
    font-size: 0.9rem;
  }

  .results-stats {
    flex-wrap: wrap;
  }
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 0.4s ease;
  pointer-events: auto;
  max-width: 350px;
  text-align: center;
  justify-content: center;
}

.toast.toast-success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.toast.toast-error {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

.toast.toast-warning {
  background: linear-gradient(135deg, #ff9a00 0%, #ff6b00 100%);
}

.toast.toast-info {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toast-icon {
  font-size: 18px;
}

.toast.hiding {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
