/**
 * ZALENGA Design System
 * Professional palette and component styles.
 */

:root {
  /* Backgrounds — white & grey, professional */
  --bg-body: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8f9fa;
  --bg-elevated: #ffffff;
  --bg-muted: #f0f1f3;

  /* Borders / Strokes */
  --stroke-muted: #e9ecef;
  --stroke-subtle: #dee2e6;
  --stroke-input: #dee2e6;

  /* Text — crisp hierarchy */
  --text-primary: #1a1d21;
  --text-secondary: #6c757d;
  --text-muted: #868e96;

  /* Accent — slate grey, professional */
  --accent-primary: #495057;
  --accent-primary-hover: #343a40;
  --accent-primary-muted: rgba(73, 80, 87, 0.1);
  /* Header bar = primary action color for buttons */
  --header-bar: #144848;
  --header-bar-hover: #0f3636;
  --header-bar-muted: rgba(20, 72, 72, 0.12);
  --accent-success: #2e7d32;
  --accent-warning: #ed6c02;
  --accent-danger: #d32f2f;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius — subtle, modern */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Shadows — soft for light theme */
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-focus: 0 0 0 3px rgba(73, 80, 87, 0.25);
  --shadow-glow: 0 0 0 1px rgba(73, 80, 87, 0.1);

  /* Scrollbar */
  --scrollbar-track: #e9ecef;
  --scrollbar-thumb: #adb5bd;
  --scrollbar-thumb-hover: var(--accent-primary);
  --scrollbar-width: 8px;
  --scrollbar-radius: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Professional scrollbar styling */
.scrollable,
.country-select-dropdown,
.table-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.scrollable::-webkit-scrollbar,
.country-select-dropdown::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}

.scrollable::-webkit-scrollbar-track,
.country-select-dropdown::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--scrollbar-radius);
}

.scrollable::-webkit-scrollbar-thumb,
.country-select-dropdown::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--scrollbar-radius);
  border: 2px solid var(--scrollbar-track);
}

.scrollable::-webkit-scrollbar-thumb:hover,
.country-select-dropdown::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.scrollable::-webkit-scrollbar-corner,
.country-select-dropdown::-webkit-scrollbar-corner,
.table-wrap::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

/* Page-level scrollbar */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}

html::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--scrollbar-radius);
}

html::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--scrollbar-radius);
  border: 2px solid var(--scrollbar-track);
}

html::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Auth layout: split 50/50 */
.auth-layout {
  display: flex;
  min-height: 100vh;
}

.auth-side {
  flex: 0 0 60%;
  width: 60%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: var(--space-2xl);
  padding-top: 15vh;
  overflow: hidden;
  min-height: 100vh;
}

.auth-side-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  transform: translate(-50%, -50%) scale(1.05);
}

.auth-side-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.12) 0%, rgba(0, 0, 0, 0.06) 100%);
  z-index: 1;
}

.auth-side .auth-header {
  position: relative;
  z-index: 2;
  margin-left: 0;
  max-width: 100%;
  width: 100%;
  align-self: flex-start;
}

.auth-side .brand-name {
  color: #d4af37;
  font-family: 'Mongolian Baiti', serif;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: none;
}

.auth-side .brand-logo {
  width: 120px;
  height: 120px;
  min-width: 120px;
  min-height: 120px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.auth-side .brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-side-tagline {
  margin-top: var(--space-xl);
  max-width: 100%;
  width: 100%;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.92);
  font-weight: 400;
  text-align: left;
}

.auth-side-tagline strong {
  color: #d4af37;
  font-weight: 600;
}

.auth-content {
  flex: 0 0 40%;
  width: 40%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-2xl);
  background: #144848;
  background: linear-gradient(180deg, #144848 0%, #0f3636 100%);
}
.auth-content .login-box,
.auth-content .register-box,
.auth-content .forgot-box {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.auth-content .auth-footer {
  color: rgba(255, 255, 255, 0.85);
}
.auth-content .auth-footer .form-link {
  color: #d4af37;
}
.auth-content .auth-footer .form-link:hover {
  color: #e5c158;
}

.auth-content .btn-primary {
  background: var(--header-bar);
  box-shadow: none;
}
.auth-content .btn-primary:hover {
  background: var(--header-bar-hover);
  box-shadow: none;
}

.auth-content .form-input:focus,
.auth-content .form-select:focus,
.auth-content .country-select-wrap.open .country-select-trigger {
  border-color: #144848;
  box-shadow: 0 0 0 3px rgba(20, 72, 72, 0.18), inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Brand block */
.auth-header {
  max-width: 400px;
  width: 100%;
  margin: 0 auto var(--space-2xl);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #495057 0%, #343a40 100%);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.auth-header-text {
  margin-top: var(--space-md);
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

/* Form container */
.login-box,
.register-box,
.forgot-box {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--stroke-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}

.auth-title {
  font-size: 1.625rem;
  font-weight: 700;
  margin: 0 0 var(--space-xl);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Alerts */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.alert-error {
  background: rgba(211, 47, 47, 0.08);
  border: 1px solid rgba(211, 47, 47, 0.3);
  color: #c62828;
}

.alert-success {
  background: rgba(46, 125, 50, 0.08);
  border: 1px solid rgba(46, 125, 50, 0.3);
  color: #2e7d32;
}

/* Form groups */
.form-group {
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: visible;
}

.form-group:last-of-type {
  margin-bottom: var(--space-xl);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
  text-transform: none;
}

/* Inputs — professional, clean */
.form-input,
.form-select {
  width: 100%;
  height: 48px;
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.4;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-input:hover,
.form-select:hover {
  border-color: #c5cbd1;
  background: #fafbfc;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(73, 80, 87, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.04);
  background: #ffffff;
}

.form-input:disabled,
.form-select:disabled {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.85;
}

/* Phone row */
.phone-row {
  display: flex;
  gap: 0;
  align-items: stretch;
  position: relative;
  overflow: visible;
}

.phone-prefix {
  flex: 0 0 118px;
  width: 118px;
  min-width: 0;
  border-right: none;
  border-radius: 10px 0 0 10px;
}

.phone-number {
  flex: 1;
  min-width: 0;
  border-radius: 0 10px 10px 0;
}

/* Country select with flags */
.country-select-wrap {
  position: relative;
  flex: 0 0 118px;
  width: 118px;
  min-width: 0;
  z-index: 1;
}

.country-select-wrap.open {
  z-index: 1000;
}

.country-select-trigger {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px 14px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-right: none;
  border-radius: 10px 0 0 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.country-select-trigger:hover {
  border-color: #c5cbd1;
  background: #fafbfc;
}

.country-select-trigger:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(73, 80, 87, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.04);
  background: #ffffff;
}

.country-select-wrap.open .country-select-trigger {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(73, 80, 87, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.country-flag {
  flex-shrink: 0;
  border-radius: 2px;
  object-fit: cover;
}

.country-text {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.country-select-wrap.open .country-chevron {
  transform: rotate(180deg);
}

.country-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 10000;
  display: none;
  pointer-events: auto;
}

.country-select-wrap.open .country-select-dropdown {
  display: block;
}

.country-select-dropdown li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.country-select-dropdown li:hover,
.country-select-dropdown li[aria-selected="true"] {
  background: var(--accent-primary-muted);
}

.country-select-dropdown li .country-flag {
  width: 24px;
  height: 18px;
}

.country-select-dropdown li span {
  flex: 1;
  font-size: 0.9375rem;
}

/* Password field with toggle */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap .form-input {
  padding-right: 52px;
}

/* Hide browser's built-in password reveal to avoid duplicate icon */
.password-wrap input[type="password"]::-ms-reveal {
  display: none;
}

.btn-toggle-password {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-left: 1px solid var(--stroke-input);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  transition: color 0.2s, background 0.2s, opacity 0.2s;
  opacity: 0;
  pointer-events: none;
}

.password-wrap:focus-within .btn-toggle-password,
.password-wrap.is-active .btn-toggle-password {
  opacity: 1;
  pointer-events: auto;
}

.btn-toggle-password:hover {
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.03);
}

.btn-toggle-password:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
}

/* Form options row */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  font-size: 0.9375rem;
}

.form-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 300;
}

.form-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.form-checkbox:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.form-link {
  color: var(--accent-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

.form-link:hover {
  color: var(--accent-primary-hover);
  text-decoration: none;
}

.form-link:focus {
  outline: none;
  text-decoration: none;
  box-shadow: var(--shadow-focus);
  border-radius: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  min-height: 48px;
  letter-spacing: 0.02em;
  text-decoration: none;
}

a.btn:hover,
a.btn:focus {
  text-decoration: none;
}

.btn:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
}

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

.btn-primary {
  width: 100%;
  background: var(--header-bar);
  color: #fff;
  border: none;
  box-shadow: none;
}

.btn-primary:hover {
  background: var(--header-bar-hover);
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--stroke-input);
}

.btn-secondary:hover {
  background: var(--stroke-muted);
  border-color: var(--stroke-subtle);
}

/* Auth footer link */
.auth-footer {
  margin-top: var(--space-xl);
  text-align: center;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.auth-footer .form-link {
  font-weight: 500;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 29, 33, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.loading-overlay.visible {
  opacity: 1;
  visibility: visible;
}

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

.loading-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

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

/* App layout — sidebar left fixed (does not scroll with page), content + header right */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: #144848;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: var(--shadow-soft);
  z-index: 100;
}

.app-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: #144848;
}

.app-logo-img {
  width: 112px;
  height: 112px;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  opacity: 1;
  filter: none;
}

.app-nav {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.app-nav::-webkit-scrollbar {
  width: 6px;
}

.app-nav::-webkit-scrollbar-track {
  background: transparent;
}

.app-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

.app-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

.app-nav::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.5);
}

.app-nav-link {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 300;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  transition: color 0.2s, background 0.2s;
}

.app-nav-link:last-of-type {
  border-bottom: none;
}

.app-nav-icon {
  width: 1.125rem;
  min-width: 1.125rem;
  margin-right: 14px;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.95;
}

.app-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.app-nav-link.active {
  color: #d4af37;
  font-weight: 400;
  background: rgba(212, 175, 55, 0.15);
}

.app-sidebar-footer {
  padding: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.app-nav-balance {
  font-size: 0.875rem;
  font-weight: 600;
  color: #7dd87d;
  padding: 10px 14px;
  background: rgba(125, 216, 125, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(125, 216, 125, 0.35);
}

.app-sidebar .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.app-sidebar .btn:has(.app-nav-icon) {
  gap: 8px;
}

.app-sidebar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Right column — top bar + content (starts after fixed sidebar, scrolls independently) */
.app-right {
  flex: 1;
  min-width: 0;
  margin-left: 260px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Top header bar — ZALENGA left, user phone + balance right */
.app-top-bar {
  background: var(--header-bar);
  min-height: 64px;
  padding: var(--space-lg) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-top-header-title {
  color: #d4af37;
  text-decoration: none;
  font-family: 'Mongolian Baiti', serif;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-left: var(--space-2xl);
  margin-right: var(--space-xl);
}

.app-top-header-title:hover {
  color: #e5c158;
}

.app-top-bar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 2px;
}

.app-top-bar-phone {
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}

.app-top-bar-balance {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #7dd87d;
  letter-spacing: 0.03em;
}

.app-body {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-body);
  overflow-y: auto;
}

.app-main {
  flex: 1;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-2xl);
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 var(--space-xl);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* Page subtitle container — title + description on every page */
/* Wrapper for all page content (subtitle + body) — same width for both */
.page-content-container {
  margin-left: calc(-1 * var(--space-lg));
  margin-right: calc(-1 * var(--space-lg));
  width: calc(100% + 2 * var(--space-lg));
  max-width: none;
  box-sizing: border-box;
}

.page-subtitle-container {
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.page-subtitle-title {
  margin: 0 0 var(--space-xs);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--header-bar);
  letter-spacing: -0.02em;
}

.page-subtitle-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Dashboard category — each category is its own container (neutral border); inner boxes use header-bar border */
.dashboard-category {
  background: var(--bg-card);
  border: 1px solid var(--stroke-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.dashboard-category-title {
  margin: 0 0 var(--space-lg);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--header-bar);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.dashboard-category-title i {
  opacity: 0.85;
  font-size: 1rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-xl);
}

.card {
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--header-bar-hover);
  box-shadow: var(--shadow-hover);
}

.card h3 {
  margin: 0 0 var(--space-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card .amount {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.card .amount.positive { color: var(--accent-success); }
.card .amount.negative { color: var(--accent-danger); }

.btn-sm {
  padding: 8px 14px;
  font-size: 0.875rem;
  min-height: 36px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--stroke-muted);
}

.data-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-input);
}

.data-table td {
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-pending { background: rgba(237, 108, 2, 0.15); color: #e65100; }
.badge-completed { background: rgba(46, 125, 50, 0.12); color: var(--accent-success); }
.badge-failed { background: rgba(211, 47, 47, 0.12); color: #c62828; }

/* Game / feature pages — unified design */
.page-header-block {
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.page-header-block h2 {
  margin: 0 0 var(--space-xs);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header-block p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dashboard-card {
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.dashboard-card:hover {
  border-color: var(--header-bar-hover);
  box-shadow: var(--shadow-hover);
}

.dashboard-card h3 {
  margin: 0 0 var(--space-lg);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dashboard home page */
.dashboard-welcome {
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
}

.dashboard-section {
  margin-bottom: var(--space-2xl);
}

.dashboard-section-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.dashboard-balance-section {
  margin-bottom: var(--space-xl);
}

.dashboard-balance-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.dashboard-balance-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dashboard-balance-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dashboard-balance-amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.dashboard-balance-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 160px;
}

.dashboard-balance-actions .btn {
  width: 100%;
  min-width: 0;
  gap: var(--space-sm);
  padding: 10px 16px;
  font-size: 0.875rem;
  min-height: 40px;
  text-decoration: none;
}

.dashboard-balance-actions .btn:hover,
.dashboard-balance-actions .btn:focus {
  text-decoration: none;
}

.dashboard-pending-withdrawals {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dashboard-pending-withdrawals .pending-item {
  display: inline-block;
  margin-right: var(--space-sm);
}

.dashboard-notification-teaser {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-primary-muted);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.dashboard-notification-teaser:hover {
  background: rgba(73, 80, 87, 0.18);
}

.dashboard-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.dashboard-game-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.dashboard-game-info h3 {
  margin: 0 0 var(--space-xs);
  font-size: 1rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
}

.dashboard-game-meta,
.dashboard-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.dashboard-challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
}

.dashboard-challenge-card h3 {
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
}

.dashboard-challenge-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-sm);
}

.dashboard-challenge-progress {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-sm) 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.dashboard-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-muted);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.dashboard-progress-fill {
  height: 100%;
  background: var(--accent-success);
  border-radius: var(--radius-sm);
  transition: width 0.2s;
}

.dashboard-challenge-card.completed .dashboard-progress-fill {
  width: 100% !important;
}

.dashboard-challenge-reward {
  margin: var(--space-sm) 0 0;
  font-size: 0.8125rem;
  color: var(--accent-success);
}

.dashboard-challenge-reward span {
  margin-right: var(--space-md);
}

.dashboard-verify-cta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-primary-muted);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}
.dashboard-verify-cta i { color: var(--accent-primary); }
.dashboard-badge-inline { margin-bottom: var(--space-md); }
.dashboard-quick-deposit {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
}
.dashboard-quick-label { font-size: 0.875rem; color: var(--text-secondary); margin-right: var(--space-sm); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--stroke-subtle);
  color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--header-bar); color: var(--header-bar); }
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-md);
}
.dashboard-stat-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  text-align: center;
}
.dashboard-stat-value { display: block; font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.dashboard-stat-label { font-size: 0.8125rem; color: var(--text-secondary); }
.dashboard-leaderboard-teaser {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--accent-primary-muted);
  border-radius: var(--radius-md);
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}
.dashboard-leaderboard-teaser:hover { background: rgba(73, 80, 87, 0.18); }
.dashboard-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  margin-bottom: var(--space-sm);
}
.dashboard-chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 24px;
}
.dashboard-chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 2px;
  transition: height 0.2s;
}
.dashboard-chart-bar.positive { background: var(--accent-success); }
.dashboard-chart-bar.negative { background: var(--accent-danger); }
.dashboard-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.dashboard-chart-labels span { flex: 1; text-align: center; }
.dashboard-achievement-teaser {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
}
.dashboard-achievement-teaser i { font-size: 1.5rem; color: var(--accent-warning); }
.dashboard-activity-feed { list-style: none; padding: 0; margin: 0; }
.dashboard-activity-feed li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--stroke-muted);
  font-size: 0.9375rem;
}
.dashboard-activity-feed li:last-child { border-bottom: 0; }
.dashboard-activity-time { font-size: 0.8125rem; color: var(--text-muted); margin-left: var(--space-sm); }
.dashboard-countdown { font-size: 0.8125rem; color: var(--accent-warning); margin: 0 0 var(--space-xs); }

.withdrawal-timeline {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.timeline-step { padding: 2px 6px; border-radius: var(--radius-sm); }
.timeline-step.done { background: rgba(46, 125, 50, 0.12); color: var(--accent-success); }

.lang-switcher { margin-right: var(--space-md); font-size: 0.875rem; }
.lang-switcher a { color: var(--text-secondary); text-decoration: none; padding: 0 var(--space-xs); }
.lang-switcher a.active { font-weight: 600; color: var(--accent-primary); }
.spectator-count { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.form-section .form-group {
  margin-bottom: 0;
}

.form-section small {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.form-section select,
.form-section input[type="number"],
.form-section input[type="text"] {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--stroke-input);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-section select:focus,
.form-section input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-focus);
}

.game-session-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: var(--bg-elevated);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  transition: border-color 0.2s;
}

.game-session-card:hover {
  border-color: var(--header-bar-hover);
}

.game-session-info h4 {
  margin: 0 0 var(--space-sm);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.game-session-info p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.game-session-actions .btn {
  width: auto;
  min-width: 140px;
}

.btn-success {
  background: var(--accent-success);
  color: #fff;
  box-shadow: none;
}

.btn-success:hover {
  background: #1b5e20;
  box-shadow: none;
}

.section-grid {
  display: grid;
  gap: var(--space-xl);
}

.text-muted { color: var(--text-muted); font-size: 0.9375rem; }

/* Training page */
.training-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.training-game-card {
  background: var(--bg-elevated);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color 0.2s;
}

.training-game-card:hover {
  border-color: var(--header-bar-hover);
}

.training-game-header h4 {
  margin: 0 0 var(--space-sm);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.training-stats { font-size: 0.8125rem; color: var(--text-muted); }
.training-stats .stat-item { margin-right: var(--space-md); }
.training-game-desc {
  margin: 0 0 var(--space-lg);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.difficulty-selector { margin-bottom: var(--space-lg); }
.difficulty-selector label { display: block; margin-bottom: var(--space-sm); font-size: 0.875rem; color: var(--text-secondary); }
.difficulty-options { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.difficulty-option { cursor: pointer; }
.difficulty-option input { margin-right: var(--space-xs); }
.difficulty-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
}
.difficulty-badge.easy { background: rgba(46, 125, 50, 0.12); color: var(--accent-success); }
.difficulty-badge.medium { background: rgba(237, 108, 2, 0.15); color: var(--accent-warning); }
.difficulty-badge.hard { background: rgba(211, 47, 47, 0.12); color: var(--accent-danger); }

.btn-block { width: 100%; }

/* Leaderboard */
.filter-tabs {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-md);
  margin-bottom: var(--space-xl);
}

.filter-tabs a {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  background: var(--bg-input);
  border: 1px solid var(--stroke-muted);
  transition: all 0.2s;
}

.filter-tabs a:hover,
.filter-tabs a.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: var(--accent-primary-muted);
}

.user-rank-card {
  background: var(--accent-primary-muted);
  border: 1px solid rgba(73, 80, 87, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.user-rank-card h3 { margin: 0 0 var(--space-md); font-size: 0.875rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.rank-number { font-size: 1.5rem; font-weight: 700; color: var(--accent-primary); }
.leaderboard-table { overflow-x: auto; }
.leaderboard-table table { width: 100%; border-collapse: collapse; }
.leaderboard-table th,
.leaderboard-table td {
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--stroke-muted);
}
.leaderboard-table th { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; background: var(--bg-input); }
.leaderboard-table tr.current-user { background: rgba(73, 80, 87, 0.06); }
.leaderboard-table .player-link { color: var(--accent-primary); text-decoration: none; }
.leaderboard-table .player-link:hover { text-decoration: underline; }
.tier-badge { padding: 4px 8px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; }
.medal-1 { color: #ffd700; }
.medal-2 { color: #c0c0c0; }
.medal-3 { color: #cd7f32; }

.alert-info {
  background: rgba(73, 80, 87, 0.06);
  border: 1px solid rgba(73, 80, 87, 0.2);
  color: var(--text-secondary);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-xl);
}

.alert-info code { background: var(--bg-input); padding: 2px 6px; border-radius: var(--radius-sm); font-size: 0.875rem; }

.tournaments-grid,
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.tournament-card,
.achievement-card {
  background: var(--bg-elevated);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: border-color 0.2s;
}

.tournament-card:hover,
.achievement-card:hover { border-color: var(--header-bar-hover); }

.tournament-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--space-sm); }
.tournament-header h4 { margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--text-primary); }
.tournament-status { font-size: 0.75rem; font-weight: 600; padding: 4px 8px; border-radius: var(--radius-sm); }
.status-upcoming { background: rgba(73, 80, 87, 0.1); color: var(--accent-primary); }
.status-registration { background: rgba(237, 108, 2, 0.12); color: var(--accent-warning); }
.status-active { background: rgba(46, 125, 50, 0.12); color: var(--accent-success); }
.status-completed { background: var(--bg-input); color: var(--text-muted); }

.tournament-game { font-size: 0.875rem; color: var(--text-muted); margin: 0 0 var(--space-md); }
.tournament-info p { margin: 0 0 var(--space-xs); font-size: 0.875rem; color: var(--text-secondary); }

.achievement-card.unlocked { border-color: rgba(46, 125, 50, 0.4); }
.achievement-card.locked { opacity: 0.85; }
.achievement-icon { width: 48px; height: 48px; border-radius: var(--radius-md); margin-bottom: var(--space-md); }
.achievement-icon.placeholder { background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.achievement-card h4 { margin: 0 0 var(--space-sm); font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.achievement-card p { margin: 0 0 var(--space-md); font-size: 0.875rem; color: var(--text-secondary); line-height: 1.5; }
.achievement-stats { margin-bottom: var(--space-xl); }
.stat-card { background: var(--bg-elevated); border: 2px solid var(--header-bar); border-radius: var(--radius-lg); padding: var(--space-xl); }
.category-header { font-size: 1rem; font-weight: 600; margin: var(--space-xl) 0 var(--space-md); color: var(--text-primary); }
.achievement-rewards { margin-bottom: var(--space-sm); }
.reward-badge { font-size: 0.75rem; padding: 4px 8px; background: rgba(73, 80, 87, 0.12); border-radius: var(--radius-sm); margin-right: var(--space-xs); color: var(--text-primary); }
.unlocked-badge { color: var(--accent-success); font-size: 0.8125rem; font-weight: 600; }
.locked-badge { color: var(--text-muted); font-size: 0.8125rem; }

.progress-bar { height: 8px; background: var(--bg-input); border-radius: var(--radius-sm); overflow: hidden; margin: var(--space-md) 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #495057, #6c757d); border-radius: var(--radius-sm); transition: width 0.3s; }

.section-title { font-size: 1.125rem; font-weight: 600; margin: 0 0 var(--space-lg); color: var(--text-primary); }
.empty-state { color: var(--text-muted); font-size: 0.9375rem; }

/* Challenges */
.challenges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-xl); }
.challenge-card { background: var(--bg-elevated); border: 2px solid var(--header-bar); border-radius: var(--radius-lg); padding: var(--space-xl); transition: border-color 0.2s; }
.challenge-card.completed { border-color: rgba(46, 125, 50, 0.4); opacity: 0.95; }
.challenge-card h4 { margin: 0 0 var(--space-sm); font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.challenge-card p { margin: 0 0 var(--space-md); font-size: 0.875rem; color: var(--text-secondary); }
.challenge-progress { margin: var(--space-md) 0; }
.challenge-progress .progress-text { font-size: 0.8125rem; color: var(--text-muted); margin: var(--space-xs) 0 0; }
.challenge-rewards { margin-bottom: var(--space-sm); }
.completed-badge { color: var(--accent-success); font-size: 0.8125rem; font-weight: 600; }
.login-streak-card { background: var(--bg-elevated); border: 2px solid var(--header-bar); border-radius: var(--radius-lg); padding: var(--space-xl); margin-bottom: var(--space-xl); }
.login-streak-card h3 { margin: 0 0 var(--space-md); font-size: 1.125rem; color: var(--text-primary); }
.streak-info { display: flex; align-items: center; gap: var(--space-xl); flex-wrap: wrap; }
.streak-number { font-size: 2.5rem; font-weight: 700; color: #343a40; line-height: 1; }
.streak-details p { margin: 0 0 var(--space-xs); font-size: 0.9375rem; color: var(--text-secondary); }
.streak-note { color: var(--text-muted) !important; font-size: 0.875rem !important; margin-top: var(--space-sm) !important; }

/* Friends */
.friends-container { display: flex; flex-direction: column; gap: var(--space-xl); }
.friend-card { display: flex; justify-content: space-between; align-items: center; padding: var(--space-md); background: var(--bg-elevated); border: 2px solid var(--header-bar); border-radius: var(--radius-md); margin-bottom: var(--space-sm); }
.friend-info h4 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.friend-actions { display: flex; gap: var(--space-sm); align-items: center; }
.tournaments-section { margin-top: var(--space-xl); }
.tournaments-section h3 { font-size: 1.125rem; font-weight: 600; margin: 0 0 var(--space-lg); color: var(--text-primary); }

/* Training game play */
.training-game-container { display: flex; flex-direction: column; gap: var(--space-xl); }
.training-game-info { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.game-status-card,
.ai-opponent-card {
  background: var(--bg-card);
  border: 2px solid var(--header-bar);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}
.game-status-card h3,
.ai-opponent-card h3 { font-size: 1rem; font-weight: 600; margin: 0 0 var(--space-md); color: var(--text-primary); }
.turn-indicator { margin-bottom: var(--space-md); }
.turn-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.8125rem;
}
.turn-badge.your-turn {
  background: rgba(46, 125, 50, 0.12);
  color: var(--accent-success);
  border: 1px solid rgba(46, 125, 50, 0.3);
}
.turn-badge.ai-turn {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--stroke-muted);
}
.game-stats { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.stat-box {
  background: var(--bg-input);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.stat-box .stat-label { color: var(--text-muted); font-size: 0.75rem; }
.stat-box .stat-value { color: var(--text-primary); font-size: 0.9375rem; font-weight: 700; }
.game-result { text-align: center; }
.result-message { padding: var(--space-xl); border-radius: var(--radius-lg); margin-bottom: var(--space-lg); }
.result-message.success {
  background: rgba(46, 125, 50, 0.1);
  border: 1px solid rgba(46, 125, 50, 0.3);
}
.result-message.error {
  background: rgba(211, 47, 47, 0.08);
  border: 1px solid rgba(211, 47, 47, 0.25);
}
.ai-difficulty-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}
.ai-difficulty-badge.easy { background: rgba(46, 125, 50, 0.12); color: var(--accent-success); }
.ai-difficulty-badge.medium { background: rgba(237, 108, 2, 0.12); color: var(--accent-warning); }
.ai-difficulty-badge.hard { background: rgba(211, 47, 47, 0.12); color: var(--accent-danger); }
.ai-description { color: var(--text-muted); font-size: 0.875rem; line-height: 1.5; margin: 0; }
.training-game-board {
  background: var(--bg-card);
  border: 1px solid var(--stroke-muted);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  min-height: 480px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.training-game-board h3 { font-size: 1rem; font-weight: 600; margin: 0 0 var(--space-lg); color: var(--text-primary); }
.game-board-placeholder {
  background: var(--bg-input);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
.training-move-form { margin-top: var(--space-xl); width: 100%; max-width: 560px; }
.move-input-group { display: flex; flex-direction: column; gap: var(--space-md); }
.move-input-group label { color: var(--text-secondary); font-weight: 500; font-size: 0.875rem; }
.move-input-group input {
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid var(--stroke-input);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
}
.move-input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-focus);
}

/* Confetti celebration */
.celebration-confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ff6b6b;
  top: -10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
.confetti-piece:nth-child(odd) { border-radius: 50%; }
.confetti-piece:nth-child(3n) { width: 8px; height: 16px; border-radius: 0; }
.confetti-piece:nth-child(1) { left: 10%; background: #ff6b6b; animation-duration: 3s; }
.confetti-piece:nth-child(2) { left: 20%; background: #4ecdc4; animation-duration: 3.5s; animation-delay: 0.2s; }
.confetti-piece:nth-child(3) { left: 30%; background: #ffe66d; animation-duration: 2.8s; animation-delay: 0.4s; }
.confetti-piece:nth-child(4) { left: 40%; background: #95e1d3; animation-duration: 3.2s; }
.confetti-piece:nth-child(5) { left: 50%; background: #f38181; animation-duration: 3.7s; animation-delay: 0.3s; }
.confetti-piece:nth-child(6) { left: 60%; background: #aa96da; animation-duration: 2.9s; }
.confetti-piece:nth-child(7) { left: 70%; background: #fcbad3; animation-duration: 3.3s; }
.confetti-piece:nth-child(8) { left: 80%; background: #ffd93d; animation-duration: 3.1s; animation-delay: 0.4s; }
.confetti-piece:nth-child(9) { left: 90%; background: #6bcf7f; animation-duration: 3.6s; }
.confetti-piece:nth-child(10) { left: 15%; background: #ff9ff3; animation-duration: 2.7s; }
.confetti-piece:nth-child(11) { left: 25%; background: #54a0ff; animation-duration: 3.4s; }
.confetti-piece:nth-child(12) { left: 35%; background: #5f27cd; animation-duration: 3.8s; }
.confetti-piece:nth-child(13) { left: 45%; background: #00d2d3; animation-duration: 2.6s; }
.confetti-piece:nth-child(14) { left: 55%; background: #ff6348; animation-duration: 3.5s; }
.confetti-piece:nth-child(15) { left: 65%; background: #ffa502; animation-duration: 3.2s; }
.confetti-piece:nth-child(16) { left: 75%; background: #ff3838; animation-duration: 2.9s; }
.confetti-piece:nth-child(17) { left: 85%; background: #7bed9f; animation-duration: 3.7s; }
.confetti-piece:nth-child(18) { left: 95%; background: #70a1ff; animation-duration: 3.1s; }
.confetti-piece:nth-child(19) { left: 5%; background: #ff4757; animation-duration: 3.3s; }
.confetti-piece:nth-child(20) { left: 12%; background: #ffa502; animation-duration: 2.8s; }
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Home page */
.home-layout {
  min-height: 100vh;
  padding: var(--space-2xl);
}

.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.home-title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Error pages */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
}

.error-page h1 {
  font-size: 4rem;
  margin: 0;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.error-page p {
  color: var(--text-secondary);
  margin: var(--space-md) 0 var(--space-xl);
  font-size: 1.0625rem;
}


@media (max-width: 900px) {
  .training-game-info {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    position: relative;
    width: 100%;
    min-width: 0;
    bottom: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--stroke-muted);
  }

  .app-right {
    margin-left: 0;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-body {
    overflow: visible;
  }

  .app-logo {
    padding: var(--space-md) var(--space-lg);
    border-bottom: none;
    border-right: 1px solid var(--stroke-muted);
  }

  .app-logo-img {
    width: 48px;
    height: 48px;
  }

  .app-nav {
    flex: 1;
    flex-direction: row;
    flex-wrap: wrap;
    padding: var(--space-sm);
  }

  .app-nav-link {
    padding: 8px 12px;
    font-size: 0.875rem;
  }

  .app-sidebar-footer {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .app-sidebar-footer .btn-block {
    width: auto;
  }

  .app-top-header-title {
    font-size: 1.25rem;
    letter-spacing: 0.1em;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .app-sidebar {
    width: 220px;
    min-width: 220px;
  }

  .app-right {
    margin-left: 220px;
  }

  .auth-layout {
    flex-direction: column;
  }

  .auth-side {
    flex: 0 0 auto;
    width: 100%;
    min-height: 280px;
  }

  .auth-content {
    flex: 1;
    width: 100%;
    padding: var(--space-xl);
  }
}

@media (max-width: 768px) {
  .auth-side,
  .auth-content {
    padding: var(--space-xl);
  }

  .phone-row {
    flex-direction: column;
  }

  .phone-prefix {
    width: 100%;
    flex: none;
    min-width: 0;
    border-radius: 10px;
    border-right: 1px solid #e1e5e9;
  }

  .country-select-wrap {
    width: 100%;
    flex: none;
  }

  .country-select-trigger {
    border-radius: 10px;
    border-right: 1px solid #e1e5e9;
  }

  .country-select-wrap.open .country-select-dropdown {
    border-radius: 10px;
    border: 1px solid #e1e5e9;
    border-top: none;
  }

  .phone-number {
    border-radius: 10px;
  }

  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }
}

/* ============================================
   Transition screen (welcome / goodbye)
   ============================================ */
.transition-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #144848;
  background: linear-gradient(180deg, #144848 0%, #0f3636 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  animation: transitionFadeIn 0.6s ease-out;
}

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

.transition-screen-logo {
  width: 100px;
  height: 100px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin-bottom: var(--space-2xl);
  animation: transitionLogoIn 0.8s ease-out 0.2s both;
}

@keyframes transitionLogoIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.transition-screen-brand {
  font-family: 'Times New Roman', Times, serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: var(--space-xl);
  animation: transitionTextIn 0.6s ease-out 0.4s both;
}

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

.transition-screen-message {
  font-family: Calibri, 'Segoe UI', sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  font-style: italic;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 420px;
  line-height: 1.65;
  margin: 0;
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(212, 175, 55, 0.35);
  animation: transitionTextIn 0.6s ease-out 0.5s both;
}

.transition-screen-message strong {
  color: #fff;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.02em;
}

/* Admin / tables and forms */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.form-inline {
  display: inline;
}
.page-back-link {
  margin-bottom: var(--space-md);
}
.payout-method-row {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.card-mt {
  margin-top: var(--space-xl);
}
.ad-thumb {
  max-width: 80px;
  max-height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

/* Advert form (admin) */
.advert-form .form-group {
  margin-bottom: 16px;
}
.advert-form .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-primary, #fff);
}
.advert-form .form-group input[type="text"],
.advert-form .form-group input[type="url"],
.advert-form .form-group input[type="file"],
.advert-form .form-group textarea {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--stroke-muted, rgba(255,255,255,0.12));
  border-radius: 6px;
  background: var(--bg-input, #252535);
  color: var(--text-primary, #fff);
  font-size: 14px;
}
.advert-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}
.advert-form-row .form-group {
  margin-bottom: 0;
}
@media (max-width: 600px) {
  .advert-form-row {
    grid-template-columns: 1fr;
  }
}

/* Ad popup: top-right, shows after 5 min, lasts 5 sec */
.ad-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9998;
}
.ad-popup-box {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--stroke-muted, rgba(255,255,255,0.12));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateX(120%);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
  pointer-events: auto;
}
.ad-popup-box.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.ad-popup-box .ad-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.4);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  z-index: 2;
  transition: background 0.2s;
}
.ad-popup-box .ad-popup-close:hover {
  background: rgba(0,0,0,0.6);
}
.ad-popup-box .ad-popup-image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-elevated, #2a2a3e);
}
.ad-popup-box .ad-popup-body {
  padding: 14px 16px;
}
.ad-popup-box .ad-popup-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #888);
  margin-bottom: 4px;
}
.ad-popup-box .ad-popup-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  margin: 0 0 6px 0;
  line-height: 1.3;
}
.ad-popup-box .ad-popup-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-primary, #6c9eff);
  text-decoration: none;
  margin-top: 8px;
  transition: color 0.2s;
}
.ad-popup-box .ad-popup-cta:hover {
  color: var(--accent-primary-hover, #8bb3ff);
}
