/* ===== 기본 리셋 & 변수 ===== */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2233;
  --bg-card-hover: #1f2b3d;
  --border: #2a3a50;
  --text-primary: #e2e8f0;
  --text-secondary: #8899aa;
  --text-muted: #556677;
  --accent: #4f8fff;
  --accent-hover: #6ba3ff;
  --accent-glow: rgba(79, 143, 255, 0.15);
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --gold: #f59e0b;
  --font-main: 'Segoe UI', -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --max-width: 1200px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== 네비게이션 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: 2px;
}

.logo span { color: var(--text-primary); }

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active { color: var(--text-primary); }

/* ===== 인증 영역 ===== */
.auth-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
}

.btn-login {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}

.btn-login:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

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

.user-email {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.premium-badge-nav {
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ===== 모달 ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

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

.modal-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.modal-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}

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

.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#auth-form input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

#auth-form input:focus {
  border-color: var(--accent);
}

#auth-form input::placeholder {
  color: var(--text-muted);
}

#auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 4px;
}

.auth-error {
  color: var(--red);
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

.auth-success {
  color: var(--green);
  font-size: 13px;
  text-align: center;
}

/* ===== 히어로 섹션 ===== */
.hero {
  text-align: center;
  padding: 80px 24px 60px;
  background: linear-gradient(180deg, rgba(79,143,255,0.06) 0%, transparent 100%);
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: -1px;
}

.hero h1 .highlight { color: var(--accent); }

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 32px;
}

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

.hero-stat .number {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-mono);
}

.hero-stat .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== 버튼 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-main);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79,143,255,0.3);
}

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

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

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ===== 컨테이너 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== 섹션 ===== */
.section {
  padding: 48px 0;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ===== 필터 바 ===== */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar select,
.filter-bar input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-main);
  outline: none;
  transition: border-color 0.2s;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--accent);
}

.filter-bar input {
  flex: 1;
  min-width: 200px;
}

/* ===== 게임 카드 그리드 ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
}

.game-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
}

.game-card.locked {
  cursor: pointer;
}

.game-card.locked .game-card-thumb {
  filter: brightness(0.4) blur(1px);
}

.game-card.locked .game-card-body {
  opacity: 0.6;
}

.game-card.locked:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow), 0 0 0 1px var(--gold);
}

.lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}

.lock-overlay .lock-icon {
  font-size: 36px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.lock-overlay .lock-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 12px;
  border-radius: 12px;
}

.game-card-thumb {
  width: 100%;
  height: 160px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--text-muted);
  overflow: hidden;
  position: relative;
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-thumb .genre-icon {
  font-size: 48px;
  opacity: 0.3;
}

.game-card-body {
  padding: 16px;
}

.game-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-card-author {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
  min-height: 36px;
}

.game-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-genre {
  background: rgba(79,143,255,0.12);
  color: var(--accent);
}

.badge-license {
  background: rgba(52,211,153,0.12);
  color: var(--green);
}

.badge-selfhosted {
  background: rgba(167, 139, 250, 0.15);
  color: var(--purple);
}

.card-selfhosted-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  z-index: 2;
}

/* ===== 무료/프리미엄 뱃지 ===== */
.badge-free {
  background: rgba(52, 211, 153, 0.15);
  color: var(--green);
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-premium {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
  color: var(--gold);
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  z-index: 2;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-locked {
  background: rgba(85, 102, 119, 0.3);
  color: var(--text-muted);
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  z-index: 6;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stars-badge {
  font-size: 12px;
  color: var(--yellow);
}

/* ===== 광고 영역 ===== */
.ad-banner {
  width: 100%;
  max-width: 728px;
  margin: 20px auto;
}

.ad-placeholder {
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.ad-top {
  margin-bottom: 16px;
}

.ad-bottom {
  margin-top: 16px;
}

/* ===== 구독 필요 안내 ===== */
.premium-wall {
  text-align: center;
  padding: 60px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
}

.premium-wall .lock-icon-large {
  font-size: 64px;
  margin-bottom: 16px;
}

.premium-wall h2 {
  font-size: 24px;
  margin-bottom: 12px;
  color: var(--gold);
}

.premium-wall p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 15px;
}

.btn-subscribe {
  background: linear-gradient(135deg, var(--gold), #d97706);
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s;
}

.btn-subscribe:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

/* ===== 게임 플레이 페이지 ===== */
.game-player-container {
  padding: 20px 0;
}

.game-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.game-player-header h1 {
  font-size: 24px;
}

.game-player-header .meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.game-frame-wrapper {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.game-frame-wrapper iframe {
  width: 100%;
  height: 70vh;
  min-height: 500px;
  border: none;
  display: block;
}

.game-frame-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
}

.game-frame-overlay.hidden { display: none; }

.game-info-panel {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.game-info-panel h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.game-info-panel p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.game-info-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}

.game-info-row span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== 라이선스 저작자 표시 ===== */
.license-attribution {
  margin-top: 16px;
  padding: 16px 20px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.license-attribution-title {
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 6px;
  font-size: 14px;
}

.license-attribution p {
  margin: 4px 0;
}

.license-attribution a {
  color: var(--purple);
}

.license-attribution a:hover {
  text-decoration: underline;
}

/* ===== 빈 상태 ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; }

/* ===== 푸터 ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 48px;
}

.footer a { color: var(--text-secondary); }

/* ===== 전체화면 버튼 ===== */
.fullscreen-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
}

.game-frame-wrapper:hover .fullscreen-btn {
  opacity: 1;
}

/* ===== 언어 스위처 ===== */
.lang-switcher {
  position: relative;
  margin-left: 16px;
}

.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-main);
  transition: border-color 0.2s;
}

.lang-switcher-btn:hover {
  border-color: var(--accent);
}

.lang-flag {
  font-size: 16px;
  line-height: 1;
}

.lang-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
  min-width: 180px;
}

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

.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-main);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: left;
}

.lang-option:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.lang-option.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* ===== 로딩 ===== */
.loading-spinner {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 15px; }
  .hero-stats { gap: 24px; }
  .hero-stat .number { font-size: 24px; }
  .games-grid { grid-template-columns: 1fr; }
  .navbar-inner { height: 50px; }
  .logo { font-size: 18px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 13px; }
  .game-frame-wrapper iframe { height: 50vh; min-height: 300px; }
  .filter-bar { flex-direction: column; }
  .filter-bar input { width: 100%; min-width: 0; }
  .lang-switcher-btn { padding: 5px 8px; }
  .lang-switcher { margin-left: 8px; }
  .auth-area { margin-left: 8px; }
  .user-email { max-width: 100px; font-size: 12px; }
  .modal { margin: 16px; padding: 24px; }
}

@media (max-width: 480px) {
  .hero { padding: 40px 16px 30px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { flex-direction: column; gap: 12px; }
  .game-player-header { flex-direction: column; align-items: flex-start; }
  .lang-name { display: none; }
  .lang-switcher-btn { padding: 5px 6px; }
  .user-email { display: none; }
  .btn-login { padding: 6px 14px; font-size: 12px; }
  .btn-logout { padding: 4px 10px; font-size: 11px; }
}

/* ===== 가상 터치 컨트롤러 ===== */
.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.dpad {
  display: grid;
  grid-template-areas:
    ".  up   ."
    "left . right"
    ".  down .";
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px 52px;
  gap: 4px;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: rgba(79, 143, 255, 0.1);
  color: var(--text-primary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
  background: rgba(79, 143, 255, 0.4);
  transform: scale(0.92);
}

.dpad-up    { grid-area: up; }
.dpad-left  { grid-area: left; }
.dpad-right { grid-area: right; }
.dpad-down  { grid-area: down; }

.action-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

.action-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: rgba(248, 113, 113, 0.15);
  color: var(--text-primary);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.1s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
  background: rgba(248, 113, 113, 0.45);
  transform: scale(0.92);
}

/* 터치 디바이스에서만 가상 컨트롤러 표시 */
@media (hover: none) and (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .fullscreen-btn {
    opacity: 1;
  }

  .game-frame-wrapper iframe {
    height: 45vh;
    min-height: 250px;
  }

  #start-game-btn {
    padding: 16px 36px;
    font-size: 17px;
  }
}

/* ===== RTL 지원 (아랍어) ===== */
[dir="rtl"] .navbar-inner {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-links {
  flex-direction: row-reverse;
}

[dir="rtl"] .auth-area {
  margin-left: 0;
  margin-right: 16px;
}

[dir="rtl"] .lang-switcher {
  margin-left: 0;
  margin-right: 16px;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-option {
  text-align: right;
}

[dir="rtl"] .filter-bar {
  flex-direction: row-reverse;
}

[dir="rtl"] .filter-bar input {
  text-align: right;
}

[dir="rtl"] .game-card-meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .game-player-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .game-player-header .meta {
  flex-direction: row-reverse;
}

[dir="rtl"] .section-title {
  flex-direction: row-reverse;
}

[dir="rtl"] .card-selfhosted-badge {
  right: auto;
  left: 8px;
}

[dir="rtl"] .badge-free,
[dir="rtl"] .badge-premium,
[dir="rtl"] .badge-locked {
  left: auto;
  right: 8px;
}

[dir="rtl"] .fullscreen-btn {
  right: auto;
  left: 12px;
}

[dir="rtl"] .touch-controls {
  direction: ltr;
}

[dir="rtl"] .logo {
  direction: ltr;
}

[dir="rtl"] .game-info-row {
  flex-direction: row-reverse;
}

@media (max-width: 768px) {
  [dir="rtl"] .filter-bar {
    flex-direction: column;
  }
  [dir="rtl"] .lang-switcher {
    margin-right: 8px;
  }
  [dir="rtl"] .auth-area {
    margin-right: 8px;
  }
}

@media (max-width: 480px) {
  [dir="rtl"] .game-player-header {
    flex-direction: column;
    align-items: flex-end;
  }
}
