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

:root {
  --black-primary: #0a0e1a;
  --gold-primary: #d4af37;
  --gold-dark: #8b7500;
  --white-primary: #f5f5f0;
  --gray-muted: #6b7280;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Poppins', sans-serif;
  --font-size-h1: 48px;
  --font-size-h2: 36px;
  --font-size-h3: 24px;
  --font-size-body: 16px;
  --font-weight-h1: 700;
  --font-weight-h2: 600;
  --font-weight-h3: 600;
  --font-weight-body: 400;
}

body {
  background-color: var(--black-primary);
  color: var(--white-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-body);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-h3);
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-h1);
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-h2);
}

h3 {
  font-size: var(--font-size-h3);
}

a {
  color: var(--gold-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--gold-dark);
}

button {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.3s ease;
}

input, textarea, select {
  font-family: var(--font-body);
  background-color: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--white-primary);
  padding: 10px 15px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold-primary);
  background-color: rgba(212, 175, 55, 0.15);
}

input::placeholder, textarea::placeholder {
  color: var(--gray-muted);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.page {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

/* Header */
header {
  background-color: rgba(10, 14, 26, 0.95);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--black-primary);
  font-weight: bold;
  font-size: 20px;
}

.logo-text h1 {
  font-size: 20px;
  margin: 0;
  color: var(--white-primary);
}

.logo-text p {
  font-size: 12px;
  color: var(--gray-muted);
  margin: 0;
}

nav {
  display: flex;
  gap: 30px;
  align-items: center;
}

nav a {
  color: var(--gray-muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--gold-primary);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--gold-primary);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

.auth-buttons {
  display: flex;
  gap: 15px;
  align-items: center;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  font-size: 14px;
}

.btn-primary {
  background-color: var(--gold-primary);
  color: var(--black-primary);
}

.btn-primary:hover {
  background-color: var(--gold-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--white-primary);
  border: 1px solid rgba(212, 175, 55, 0.5);
}

.btn-secondary:hover {
  background-color: rgba(212, 175, 55, 0.1);
  border-color: var(--gold-primary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--gray-muted);
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.btn-ghost:hover {
  color: var(--gold-primary);
  border-color: rgba(212, 175, 55, 0.5);
}

.user-menu {
  position: relative;
}

.user-menu-button {
  background-color: transparent;
  color: var(--white-primary);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 8px 15px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.user-menu-button:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background-color: rgba(15, 20, 32, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  margin-top: 10px;
  min-width: 180px;
  display: none;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.dropdown-menu.active {
  display: block;
}

.dropdown-menu a, .dropdown-menu button {
  display: block;
  width: 100%;
  padding: 12px 20px;
  text-align: left;
  color: var(--white-primary);
  background-color: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.dropdown-menu a:hover, .dropdown-menu button:hover {
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--gold-primary);
}

.dropdown-info {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  margin-bottom: 10px;
}

.dropdown-label {
  color: var(--gray-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.dropdown-user-email {
  color: var(--white-primary);
  font-size: 14px;
  word-break: break-all;
  margin-bottom: 6px;
}

.user-role-badge {
  display: inline-block;
  background-color: rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.btn-danger {
  background-color: #de2b2b;
  color: #ffffff;
  margin-top: 8px;
}

.btn-danger:hover {
  background-color: #b71c1c;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 80px 0;
}

.hero-content h1 {
  font-size: 56px;
  line-height: 1.2;
  margin-bottom: 20px;
}

.hero-content .gold-text {
  color: var(--gold-primary);
}

.hero-content p {
  font-size: 18px;
  color: var(--gray-muted);
  margin-bottom: 30px;
  line-height: 1.8;
}

.hero-buttons {
  display: flex;
  gap: 20px;
  margin-bottom: 40px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-top: 40px;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 32px;
  font-weight: bold;
  color: var(--gold-primary);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  color: var(--gray-muted);
}

.hero-visual {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 16px;
  padding: 40px;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(212, 175, 55, 0.3);
}

/* Features Section */
.features {
  padding: 80px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.section-header {
  margin-bottom: 60px;
}

.section-header h2 {
  margin-bottom: 15px;
}

.section-header p {
  color: var(--gray-muted);
  font-size: 18px;
  max-width: 600px;
}

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

.feature-card {
  padding: 30px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  transition: all 0.3s ease;
  position: relative;
}

.feature-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold-primary), transparent);
  border-radius: 4px;
}

.feature-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 15px;
}

.feature-card h3 {
  margin-bottom: 15px;
}

.feature-card p {
  color: var(--gray-muted);
  font-size: 14px;
  line-height: 1.8;
}

/* Auth Forms */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-form {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 40px;
}

.auth-form h2 {
  margin-bottom: 30px;
  text-align: center;
}

.back-button {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
}

.auth-form .btn {
  width: 100%;
  margin-top: 10px;
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--gray-muted);
}

.auth-link a {
  color: var(--gold-primary);
}

.auth-quick-section {
  padding: 60px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.auth-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.auth-card {
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-card h3 {
  margin-bottom: 15px;
}

.auth-card p {
  color: var(--gray-muted);
  margin-bottom: 25px;
  line-height: 1.8;
}

.auth-subtitle {
  color: var(--gray-muted);
  margin: -10px 0 20px;
  line-height: 1.8;
  font-size: 14px;
}

.auth-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--gold-primary);
  font-size: 12px;
  font-weight: 600;
}

.code-send-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.verification-info {
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--gold-primary);
}

/* Posts List */
.posts-container {
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 40px;
  padding: 40px 0;
}

.posts-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.stats-box {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.stat-item:last-child {
  margin-bottom: 0;
}

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

.stat-info p:first-child {
  font-size: 12px;
  color: var(--gray-muted);
}

.stat-info p:last-child {
  font-size: 18px;
  font-weight: bold;
  color: var(--gold-primary);
}

.category-filter {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.category-filter h3 {
  margin-bottom: 15px;
}

.category-filter button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 15px;
  margin-bottom: 8px;
  background-color: transparent;
  color: var(--white-primary);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 14px;
}

.category-filter button:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background-color: rgba(212, 175, 55, 0.1);
  color: var(--gold-primary);
}

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

.post-card {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 25px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.post-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
}

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

.post-avatar {
  font-size: 32px;
}

.post-meta {
  flex: 1;
}

.post-author {
  font-weight: 600;
  color: var(--white-primary);
  margin-bottom: 3px;
}

.post-date {
  font-size: 12px;
  color: var(--gray-muted);
}

.post-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--white-primary);
}

.post-content {
  color: var(--gray-muted);
  font-size: 14px;
  margin-bottom: 15px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  background-color: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 20px;
  font-size: 12px;
  color: var(--gold-primary);
}

.post-stats {
  display: flex;
  gap: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  font-size: 13px;
  color: var(--gray-muted);
}

.post-stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.post-stat button {
  background-color: transparent;
  border: none;
  color: var(--gray-muted);
  cursor: pointer;
  transition: color 0.3s ease;
  font-size: 13px;
}

.post-stat button:hover {
  color: var(--gold-primary);
}

/* Community Chat (Telegram-style) */
.container-wide {
  max-width: 1280px;
}

.community-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 32px 0 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
}

.community-kanji {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 13px;
  letter-spacing: 0.35em;
  color: rgba(212, 175, 55, 0.7);
  margin-bottom: 6px;
}

.community-subtitle {
  margin-top: 8px;
  color: var(--gray-muted);
  font-size: 15px;
}

.community-stats-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--gray-muted);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 999px;
  padding: 10px 18px;
}

.community-stats-mini strong {
  color: var(--gold-primary);
}

.stats-divider {
  opacity: 0.4;
}

.telegram-app {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 220px);
  min-height: 520px;
  margin-top: 24px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(212, 175, 55, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(10, 14, 26, 0.98), rgba(5, 7, 12, 0.98));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(212, 175, 55, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

.chat-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.chat-sidebar-header input {
  width: 100%;
  margin-bottom: 12px;
}

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

.btn-sm {
  padding: 8px 12px;
  font-size: 13px;
  flex: 1;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.chat-list-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.chat-list-item:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.15);
}

.chat-list-item.active {
  background: rgba(212, 175, 55, 0.12);
  border-color: rgba(212, 175, 55, 0.35);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(139, 117, 0, 0.15));
  border: 1px solid rgba(212, 175, 55, 0.35);
  flex-shrink: 0;
}

.chat-list-body {
  min-width: 0;
}

.chat-list-name {
  font-weight: 600;
  color: var(--white-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-list-preview {
  font-size: 13px;
  color: var(--gray-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.chat-list-time {
  font-size: 11px;
  color: rgba(212, 175, 55, 0.75);
  white-space: nowrap;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--gray-muted);
}

.chat-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.chat-empty h3 {
  color: var(--gold-primary);
  margin-bottom: 8px;
}

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

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  background: rgba(0, 0, 0, 0.35);
}

.chat-back-btn {
  display: none;
  background: transparent;
  color: var(--gold-primary);
  font-size: 20px;
  padding: 4px 8px;
}

.chat-active-name {
  font-weight: 600;
  font-size: 17px;
}

.chat-meta {
  font-size: 12px;
  color: var(--gray-muted);
  margin-top: 2px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(212, 175, 55, 0.015) 0,
      rgba(212, 175, 55, 0.015) 1px,
      transparent 1px,
      transparent 12px
    );
}

.chat-date-divider {
  align-self: center;
  font-size: 12px;
  color: var(--gray-muted);
  background: rgba(10, 14, 26, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 999px;
  padding: 4px 14px;
  margin: 8px 0;
}

.chat-bubble-row {
  display: flex;
  max-width: 78%;
}

.chat-bubble-row.own {
  align-self: flex-end;
}

.chat-bubble-row.other {
  align-self: flex-start;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  word-break: break-word;
  font-size: 14px;
}

.chat-bubble-row.own .chat-bubble {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(139, 117, 0, 0.25));
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-bottom-right-radius: 4px;
}

.chat-bubble-row.other .chat-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-bubble-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-primary);
  margin-bottom: 4px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.chat-bubble-sender:hover {
  text-decoration: underline;
}

.chat-bubble-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 6px;
  text-align: right;
}

.chat-compose {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
  background: rgba(0, 0, 0, 0.4);
}

.chat-compose input {
  flex: 1;
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-loading {
  padding: 40px 20px;
}

.chat-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10600;
  padding: 20px;
}

.chat-modal-card {
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #121826, #0a0e1a);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

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

.chat-modal-header h3 {
  color: var(--gold-primary);
}

.chat-modal-close {
  background: transparent;
  color: var(--gray-muted);
  font-size: 28px;
  line-height: 1;
  padding: 0 4px;
}

.chat-modal-close:hover {
  color: var(--gold-primary);
}

.member-picker {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  padding: 8px;
}

.member-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.member-picker-item:hover {
  background: rgba(212, 175, 55, 0.1);
}

.member-picker-item input[type="checkbox"] {
  accent-color: var(--gold-primary);
  width: 16px;
  height: 16px;
}

.member-picker-item.clickable-dm {
  border: none;
  width: 100%;
  text-align: left;
  background: transparent;
  color: inherit;
}

.dm-member-list {
  margin-top: 12px;
  max-height: 320px;
}

#dm-member-search {
  width: 100%;
}

.chat-type-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
  margin-left: 6px;
  vertical-align: middle;
}

@media (max-width: 900px) {
  .telegram-app {
    grid-template-columns: 1fr;
    height: calc(100vh - 180px);
  }

  .community-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-sidebar.mobile-hidden {
    display: none;
  }

  .chat-main.mobile-hidden {
    display: none;
  }

  .chat-back-btn {
    display: inline-block;
  }
}

/* Members List */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  padding: 40px 0;
}

.member-card {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 25px;
  text-align: center;
  transition: all 0.3s ease;
}

.member-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
}

.member-avatar {
  font-size: 48px;
  margin-bottom: 15px;
}

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

.member-email {
  font-size: 12px;
  color: var(--gray-muted);
  margin-bottom: 15px;
  word-break: break-all;
}

.member-role {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  color: var(--gold-primary);
  background-color: rgba(212, 175, 55, 0.08);
  font-size: 12px;
}

.member-joined {
  font-size: 12px;
  color: var(--gray-muted);
}

/* Admin Font Editor */
.font-editor {
  position: fixed;
  bottom: 100px;
  right: 30px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(139, 117, 0, 0.05));
  border: 2px solid var(--gold-primary);
  border-radius: 12px;
  padding: 20px;
  width: 300px;
  max-height: min(500px, calc(100vh - 180px));
  overflow-y: auto;
  z-index: 10050;
  box-shadow: 0 10px 40px rgba(212, 175, 55, 0.2);
}

.font-editor h3 {
  margin-bottom: 15px;
  color: var(--gold-primary);
}

.font-editor-group {
  margin-bottom: 15px;
}

.font-editor-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-primary);
}

.font-editor-group input, .font-editor-group select {
  width: 100%;
}

.font-editor-group input[type="range"] {
  padding: 0;
  height: 6px;
}

.font-editor .btn {
  width: 100%;
  margin-top: 10px;
}

.font-editor-toggle {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  color: var(--black-primary);
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
  transition: bottom 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
  z-index: 10051;
}

.font-editor-toggle:hover {
  background-color: var(--gold-dark);
  transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-wrap: wrap;
  }

  nav {
    order: 3;
    width: 100%;
    gap: 15px;
    margin-top: 15px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 40px 0;
  }

  .hero-content h1 {
    font-size: 36px;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .hero-visual {
    display: none;
  }

  .posts-container {
    grid-template-columns: 1fr;
  }

  .posts-sidebar {
    position: static;
  }

  .members-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }

  .font-editor {
    width: 250px;
    bottom: 20px;
    right: 20px;
  }
}

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

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

.mt-20 {
  margin-top: 20px;
}

.mb-20 {
  margin-bottom: 20px;
}

.section {
  padding: 80px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

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

.cta-section {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(139, 117, 0, 0.05));
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  margin: 80px 0;
}

.cta-section h2 {
  margin-bottom: 20px;
}

.cta-section p {
  color: var(--gray-muted);
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.cta-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.player-data-section {
  padding: 80px 0;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.player-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.stat-card {
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  padding: 30px;
  text-align: center;
}

.stat-card-label {
  margin-bottom: 10px;
  color: var(--gray-muted);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stat-card-value {
  font-size: 42px;
  font-weight: 700;
  color: var(--gold-primary);
}

.player-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.player-card {
  padding: 25px;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), transparent);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.player-card:hover {
  transform: translateY(-4px);
  border-color: rgba(212, 175, 55, 0.5);
}

.player-card h3 {
  margin-bottom: 14px;
}

.player-card p {
  color: var(--gray-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 10px;
}

.registered-list-section {
  margin-top: 30px;
}

.registered-list-section h3 {
  margin-bottom: 15px;
  font-size: 18px;
  color: var(--white-primary);
}

.registered-player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.registered-player-list li {
  padding: 14px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: var(--white-primary);
  font-size: 14px;
}

.player-status {
  color: var(--gold-primary);
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 20, 32, 0.95);
  color: var(--white-primary);
  padding: 16px 24px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 999px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

.toast.hidden {
  visibility: hidden;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 14, 26, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.auth-overlay-card {
  width: 100%;
  max-width: 420px;
  background: rgba(15, 20, 32, 0.98);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-overlay-card h2 {
  margin-bottom: 18px;
}

.auth-overlay-card p {
  margin-bottom: 25px;
  color: var(--gray-muted);
  line-height: 1.8;
}

.auth-overlay-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 20px;
}

.overlay-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white-primary);
  padding: 12px 20px;
  border-radius: 12px;
}

.auth-overlay.hidden {
  display: none;
}

body.font-editor-open .scroll-to-top {
  bottom: 110px;
}

.scroll-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  color: var(--black-primary);
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 10000;
}

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

.scroll-to-top.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Loading and Messages */
.error-message {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.success-message {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--gray-muted);
}

.spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid rgba(212, 175, 55, 0.2);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Footer */
footer {
  background-color: rgba(10, 14, 26, 0.5);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  padding: 40px 0;
  margin-top: 80px;
}

footer .container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}

footer h3 {
  margin-bottom: 20px;
  color: var(--white-primary);
}

footer ul {
  list-style: none;
}

footer ul li {
  margin-bottom: 10px;
}

footer a {
  color: var(--gray-muted);
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--gold-primary);
}

footer .footer-bottom {
  text-align: center;
  padding-top: 30px;
  margin-top: 30px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
  color: var(--gray-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}

/* Community Login Overlay (separate from website auth) */
.community-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  padding: 20px;
}

.community-login-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #121826, #0a0e1a);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.community-login-card h2 {
  color: var(--gold-primary);
  margin-bottom: 8px;
}

.community-login-card .login-subtitle {
  color: var(--gray-muted);
  font-size: 14px;
  margin-bottom: 24px;
  line-height: 1.7;
}

.community-login-card .form-group {
  margin-bottom: 16px;
}

.community-login-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.community-login-actions .btn {
  flex: 1;
}

/* Community Overlay (WhatsApp/Telegram style) */
.community-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.97);
  z-index: 10500;
  display: flex;
  flex-direction: column;
}

.community-overlay-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(10, 14, 26, 0.98);
  flex-shrink: 0;
}

.community-overlay-title {
  font-weight: 600;
  color: var(--gold-primary);
  flex: 1;
  text-align: center;
}

.community-overlay-topbar .btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-primary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.community-overlay-body {
  flex: 1;
  min-height: 0;
  padding: 0 16px 16px;
  overflow: hidden;
}

.community-overlay-body .telegram-app {
  height: 100%;
  min-height: 0;
  margin-top: 12px;
}

.community-overlay-body .container-wide {
  max-width: none;
  padding: 0;
  height: 100%;
}

.community-page-intro {
  text-align: center;
  padding: 60px 20px;
}

.community-page-intro h2 {
  color: var(--gold-primary);
  margin-bottom: 12px;
}

.community-page-intro p {
  color: var(--gray-muted);
  max-width: 520px;
  margin: 0 auto 24px;
}

/* Chat search results */
.chat-search-results {
  border-top: 1px solid rgba(212, 175, 55, 0.12);
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
}

.chat-search-results-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-muted);
  padding: 6px 8px;
}

.chat-search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-search-result-item:hover {
  background: rgba(212, 175, 55, 0.1);
}

.chat-search-result-name {
  font-weight: 600;
  font-size: 14px;
}

.chat-search-result-email {
  font-size: 12px;
  color: var(--gray-muted);
}

/* Profile modal */
.profile-modal-card {
  max-width: 400px;
}

.profile-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  margin-bottom: 20px;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(139, 117, 0, 0.15));
  border: 2px solid rgba(212, 175, 55, 0.4);
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-primary);
}

.profile-role-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-primary);
}

.profile-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
}

.profile-detail-row span:first-child {
  color: var(--gray-muted);
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.profile-actions .btn {
  flex: 1;
}

.chat-header-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  min-width: 0;
}

.chat-header-info:hover .chat-active-name {
  color: var(--gold-primary);
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: 6px;
}

.online-dot.offline {
  background: var(--gray-muted);
}

/* Community FAB (WhatsApp/Telegram style) */
.community-fab-wrap {
  position: fixed;
  bottom: 100px;
  left: 24px;
  z-index: 10040;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 12px;
}

.community-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
  color: var(--black-primary);
  font-size: 26px;
  border: none;
  box-shadow: 0 8px 28px rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.community-fab:hover {
  transform: scale(1.08);
}

.community-fab-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.community-fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 20, 32, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--white-primary);
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease;
}

.community-fab-menu-item:hover {
  background: rgba(212, 175, 55, 0.15);
}

body.community-overlay-open .community-fab-wrap,
body.font-editor-open .community-fab-wrap {
  display: none;
}

/* Community settings page */
.settings-page {
  min-height: 100vh;
  padding: 40px 20px 80px;
}

.settings-card {
  max-width: 560px;
  margin: 0 auto;
  background: linear-gradient(180deg, #121826, #0a0e1a);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 16px;
  padding: 32px;
}

.settings-card h1 {
  font-size: 28px;
  color: var(--gold-primary);
  margin-bottom: 8px;
}

.settings-card .settings-subtitle {
  color: var(--gray-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

.settings-section {
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-section h3 {
  font-size: 16px;
  color: var(--gold-primary);
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .community-fab-wrap {
    bottom: 90px;
    left: 16px;
  }

  .community-overlay-body {
    padding: 0 8px 8px;
  }
}
