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

html {
  font-size: clamp(14px, 1.8vh, 24px);
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(135deg, #0a0e1a 0%, #0d1b2e 30%, #0f3460 70%, #0a1628 100%);
  min-height: 0;
  color: #eee;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* =============================================
   Animated Background Particles
   ============================================= */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-particles span {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(74, 158, 255, 0.4), rgba(156, 107, 255, 0.15), transparent);
  animation: floatUp linear infinite;
}

@keyframes floatUp {
  0%   { transform: translateY(110vh) translateX(0)    scale(0);   opacity: 0; }
  10%  { opacity: 1; }
  85%  { opacity: 0.5; }
  100% { transform: translateY(-15vh) translateX(30px) scale(1.3); opacity: 0; }
}

.bg-particles span:nth-child(1)  { width: 60px;  height: 60px;  left: 4%;   animation-duration: 18s; animation-delay: 0s; }
.bg-particles span:nth-child(2)  { width: 25px;  height: 25px;  left: 12%;  animation-duration: 22s; animation-delay: 2s; }
.bg-particles span:nth-child(3)  { width: 75px;  height: 75px;  left: 22%;  animation-duration: 15s; animation-delay: 4s; }
.bg-particles span:nth-child(4)  { width: 18px;  height: 18px;  left: 33%;  animation-duration: 26s; animation-delay: 1s; }
.bg-particles span:nth-child(5)  { width: 50px;  height: 50px;  left: 44%;  animation-duration: 20s; animation-delay: 6s; }
.bg-particles span:nth-child(6)  { width: 38px;  height: 38px;  left: 54%;  animation-duration: 17s; animation-delay: 3s; }
.bg-particles span:nth-child(7)  { width: 70px;  height: 70px;  left: 63%;  animation-duration: 23s; animation-delay: 8s; }
.bg-particles span:nth-child(8)  { width: 22px;  height: 22px;  left: 74%;  animation-duration: 19s; animation-delay: 5s; }
.bg-particles span:nth-child(9)  { width: 55px;  height: 55px;  left: 83%;  animation-duration: 21s; animation-delay: 7s; }
.bg-particles span:nth-child(10) { width: 32px;  height: 32px;  left: 91%;  animation-duration: 16s; animation-delay: 9s; }
.bg-particles span:nth-child(11) { width: 42px;  height: 42px;  left: 8%;   animation-duration: 24s; animation-delay: 11s; }
.bg-particles span:nth-child(12) { width: 65px;  height: 65px;  left: 28%;  animation-duration: 13s; animation-delay: 1.5s; }
.bg-particles span:nth-child(13) { width: 14px;  height: 14px;  left: 49%;  animation-duration: 27s; animation-delay: 3.5s; }
.bg-particles span:nth-child(14) { width: 85px;  height: 85px;  left: 69%;  animation-duration: 29s; animation-delay: 5.5s; }
.bg-particles span:nth-child(15) { width: 20px;  height: 20px;  left: 87%;  animation-duration: 14s; animation-delay: 7.5s; }
.bg-particles span:nth-child(16) { width: 48px;  height: 48px;  left: 17%;  animation-duration: 20s; animation-delay: 10s; }
.bg-particles span:nth-child(17) { width: 30px;  height: 30px;  left: 40%;  animation-duration: 25s; animation-delay: 13s; }
.bg-particles span:nth-child(18) { width: 58px;  height: 58px;  left: 60%;  animation-duration: 18s; animation-delay: 2.5s; }
.bg-particles span:nth-child(19) { width: 16px;  height: 16px;  left: 78%;  animation-duration: 22s; animation-delay: 4.5s; }
.bg-particles span:nth-child(20) { width: 44px;  height: 44px;  left: 95%;  animation-duration: 19s; animation-delay: 6.5s; }

/* =============================================
   Views
   ============================================= */
.view {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}
.view.active { display: block; }

/* Home view: only as tall as content — no extra empty space at bottom */
#home-view {
  min-height: 0;
}

/* =============================================
   Logo Showcase (Hero)
   ============================================= */
.logo-showcase {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  animation: fadeInDown 0.8s ease backwards;
}

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

.customer-logo-hero {
  max-height: clamp(80px, 14vh, 180px);
  max-width: 70%;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%,  100% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5)); transform: scale(1); }
  50%       { filter: drop-shadow(0 0 50px rgba(255, 215, 0, 1));   transform: scale(1.04); }
}

/* =============================================
   Home Header
   ============================================= */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lang-switcher {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lang-btn {
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.lang-btn:hover { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.5); }
.lang-btn.active {
  background: rgba(74, 158, 255, 0.35);
  border-color: rgba(74, 158, 255, 0.8);
  box-shadow: 0 0 12px rgba(74, 158, 255, 0.3);
}

.settings-btn {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform 0.3s, background 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(4px);
}

.settings-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(30deg) scale(1.1);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

/* =============================================
   Game List & Title
   ============================================= */
.game-list {
  padding: 1.5rem 1.25rem 2rem;
  max-width: 2600px;
  margin: 0 auto;
}

.home-title-animated {
  text-align: center;
  margin: 0 0 2rem;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  background: linear-gradient(90deg, #ffffff, #ffd700, #4a9eff, #9c6bff, #ffd700, #ffffff);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 5s linear infinite, fadeInUp 0.8s ease backwards;
  animation-delay: 0s, 0.2s;
  letter-spacing: 0.05em;
}

@keyframes shimmerText {
  to { background-position: 300% center; }
}

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

/* =============================================
   Games Grid & Cards
   ============================================= */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(220px, 18vw, 340px), 1fr));
  gap: clamp(1rem, 2vw, 2rem);
  margin-bottom: 3rem;
}

.game-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s, border-color 0.3s;
  animation: cardEnter 0.6s ease backwards;
  animation-delay: calc(var(--i, 0) * 0.1s + 0.3s);
  position: relative;
}

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(40px) scale(0.88); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(74,158,255,0.12), rgba(156,107,255,0.08));
  opacity: 0;
  transition: opacity 0.3s;
}

.game-card:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 40px rgba(74, 158, 255, 0.25);
  border-color: rgba(74, 158, 255, 0.5);
}

.game-card:hover::before { opacity: 1; }
.game-card:active { transform: translateY(-4px) scale(1.01); }

.game-card-inner {
  padding: clamp(1.5rem, 3vh, 3rem) clamp(1rem, 2vw, 2rem);
  text-align: center;
  position: relative;
  z-index: 1;
}

.game-icon {
  font-size: clamp(3rem, 6vw, 5.5rem);
  display: block;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s;
}

.game-card:hover .game-icon {
  transform: scale(1.15) rotate(-5deg);
}

.game-card h2 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  font-weight: 700;
  color: #fff;
}

.game-card p {
  margin: 0;
  opacity: 0.8;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
  line-height: 1.5;
}

/* =============================================
   Records Section (Tabbed)
   ============================================= */
.records-section {
  margin-top: 1rem;
  animation: fadeInUp 0.8s ease backwards;
  animation-delay: 0.8s;
}

.records-section h3 {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  margin: 0 0 1rem;
  color: #ffd700;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.records-section h3::before { content: '🏆'; }

.records-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.55rem 1.1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  cursor: pointer;
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(74, 158, 255, 0.2);
  border-color: rgba(74, 158, 255, 0.5);
  color: #fff;
}

.tab-btn.active {
  background: rgba(74, 158, 255, 0.35);
  border-color: rgba(74, 158, 255, 0.8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(74, 158, 255, 0.35);
}

.records-tab-content { display: none; }
.records-tab-content.active-tab { display: block; animation: fadeInUp 0.3s ease; }

.records-table-wrap {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  overflow: hidden;
  max-height: clamp(200px, 30vh, 400px);
  overflow-y: auto;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
}

.records-table th,
.records-table td {
  padding: clamp(0.5rem, 1.2vh, 1rem) clamp(0.75rem, 1.5vw, 1.25rem);
  text-align: right;
}

[dir="ltr"] .records-table th,
[dir="ltr"] .records-table td { text-align: left; }

.records-table th {
  background: rgba(74, 158, 255, 0.15);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 1;
}

.records-table tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.records-table tr:not(:last-child) { border-bottom: 1px solid rgba(255, 255, 255, 0.05); }

.records-table td:first-child {
  color: #ffd700;
  font-weight: 700;
}

.records-empty {
  padding: 2rem;
  text-align: center;
  opacity: 0.5;
  font-size: 0.95rem;
}

/* =============================================
   Modals Base
   ============================================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active { display: flex; animation: modalFadeIn 0.25s ease; }

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

.modal-content {
  background: linear-gradient(160deg, #1a2640 0%, #111826 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: modalSlideIn 0.3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(74, 158, 255, 0.1);
}

@keyframes modalSlideIn {
  from { transform: scale(0.88) translateY(20px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.modal-content.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-logo {
  max-height: 40px;
  max-width: 110px;
  object-fit: contain;
}

.modal-header h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  flex: 1;
  color: #fff;
}

.close-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

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

.modal-body { padding: 1.5rem; }

/* =============================================
   Settings Modal
   ============================================= */
.setting-row {
  display: block;
  margin-bottom: 1.25rem;
}

.setting-row label { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.setting-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: #4a9eff; flex-shrink: 0; }
.logo-upload { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.logo-preview { margin-top: 0.75rem; min-height: 60px; }
.logo-preview img { max-height: 80px; max-width: 200px; object-fit: contain; border-radius: 8px; }
.setting-row.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* =============================================
   Password Modal
   ============================================= */
.password-error {
  color: #ff6b6b;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 80, 80, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 80, 80, 0.3);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%,  100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}

/* =============================================
   Customer Form
   ============================================= */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; margin-bottom: 0.4rem; font-size: 0.95rem; color: rgba(255, 255, 255, 0.8); }
.form-group input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: rgba(74, 158, 255, 0.7);
  box-shadow: 0 0 12px rgba(74, 158, 255, 0.2);
}

.form-group input::placeholder { color: rgba(255, 255, 255, 0.35); }

/* =============================================
   Buttons
   ============================================= */
.btn {
  padding: 0.85rem 1.4rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #4a9eff, #3b7fd4);
  color: #fff;
  box-shadow: 0 4px 16px rgba(74, 158, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.15); box-shadow: 0 6px 24px rgba(74, 158, 255, 0.5); }
.btn-secondary { background: rgba(255, 255, 255, 0.18); color: #fff; }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.28); }
.btn-outline { background: transparent; color: #f66; border: 1px solid #f66; }
.btn-outline:hover { background: rgba(255, 80, 80, 0.1); }
.btn-danger { background: linear-gradient(135deg, #e04444, #b83333); color: #fff; }
.btn-danger:hover { filter: brightness(1.15); }
.btn-block { width: 100%; }

/* =============================================
   Game-Over Leaderboard Modal
   ============================================= */
.gameover-modal-content {
  max-width: clamp(360px, 55vw, 700px);
  width: 95%;
  max-height: 92vh;
  overflow-y: auto;
  background: linear-gradient(160deg, #0d1b2a 0%, #0a0f1e 60%, #1a1040 100%);
  border: 1px solid rgba(255, 215, 0, 0.25);
  box-shadow: 0 0 60px rgba(255, 215, 0, 0.15), 0 24px 60px rgba(0, 0, 0, 0.7);
  text-align: center;
}

.gameover-logo-section {
  padding: 2rem 1rem 0.5rem;
  min-height: 10px;
}

.gameover-logo-img {
  max-height: clamp(70px, 14vh, 150px);
  max-width: 65%;
  object-fit: contain;
  filter: drop-shadow(0 0 24px rgba(255, 215, 0, 0.8));
  animation: logoPulse 2.5s ease-in-out infinite;
}

.gameover-header {
  padding: 1rem 1.5rem 0.5rem;
}

.gameover-trophy {
  font-size: clamp(3rem, 8vw, 6rem);
  display: block;
  margin-bottom: 0.25rem;
  animation: bounceIn 0.6s cubic-bezier(.34,1.56,.64,1) backwards;
  animation-delay: 0.1s;
}

@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  to   { opacity: 1; transform: scale(1) rotate(0); }
}

.gameover-header h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 900;
  background: linear-gradient(90deg, #ffd700, #ffaa00, #ffd700);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmerText 3s linear infinite;
}

.gameover-score-display {
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 0 60px rgba(255, 215, 0, 0.4);
  margin: 0.5rem 0;
  animation: scorePopIn 0.5s cubic-bezier(.34,1.56,.64,1) backwards;
  animation-delay: 0.25s;
}

@keyframes scorePopIn {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

.gameover-leaderboard-body {
  padding: 0.5rem 1.5rem 1rem;
}

.gameover-leaderboard-body h3 {
  margin: 0.5rem 0 0.75rem;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}

.gameover-table-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 215, 0, 0.15);
  background: rgba(0, 0, 0, 0.3);
  max-height: clamp(220px, 30vh, 400px);
  overflow-y: auto;
}

.gameover-table th {
  background: rgba(255, 215, 0, 0.12);
  color: #ffd700;
}

.gameover-table td:first-child {
  color: #ffd700;
  font-weight: 700;
}

.current-player-row td {
  background: rgba(255, 215, 0, 0.15) !important;
  color: #ffd700 !important;
  font-weight: 700 !important;
}

.current-player-row td:first-child::after {
  content: ' ◀';
  font-size: 0.75em;
}

[dir="ltr"] .current-player-row td:first-child::after { content: ' ▶'; }

.gameover-footer {
  padding: 1.25rem 1.5rem 1.75rem;
}

.gameover-continue-btn {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  padding: clamp(0.75rem, 2vh, 1.25rem) 3rem;
  background: linear-gradient(135deg, #9c6bff, #4a9eff);
  border-radius: 16px;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 30px rgba(156, 107, 255, 0.45);
  transition: filter 0.2s, transform 0.2s, box-shadow 0.2s;
}

.gameover-continue-btn:hover {
  filter: brightness(1.2);
  transform: scale(1.05);
  box-shadow: 0 12px 40px rgba(156, 107, 255, 0.65);
}

/* =============================================
   Game View — فقط وقتی active است نمایش داده شود (بدون اسکرول خالی در صفحهٔ اصلی)
   ============================================= */
#game-view {
  display: none;
}
#game-view.view.active {
  display: flex;
  flex-direction: column;
  padding: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.game-view-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  min-height: 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.game-view-logo {
  max-height: clamp(36px, 6vh, 56px);
  max-width: 160px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}

.game-back-btn {
  padding: 0.55rem 1.1rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  font-weight: 600;
  transition: background 0.2s, transform 0.15s;
}

.game-back-btn:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.04); }

#game-container {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

/* =============================================
   Car Game Controls
   ============================================= */
.car-game-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 0;
}

.car-game-wrap canvas {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.car-game-controls {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 0.5rem 1.25rem;
  background: rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
  touch-action: manipulation;
}

.car-game-controls .car-btn {
  min-width: 120px;
  min-height: 72px;
  padding: 1rem 2rem;
  font-size: 1.5rem;
  font-weight: bold;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.car-game-controls .car-btn:active,
.car-game-controls .car-btn.pressed {
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0.96);
}

.car-game-controls .car-btn:hover { background: rgba(255, 255, 255, 0.3); }
[dir="ltr"] .car-game-controls .car-btn-left { order: 1; }
[dir="ltr"] .car-game-controls .car-btn-right { order: 2; }
[dir="ltr"] .game-view-header { flex-direction: row-reverse; }

/* =============================================
   Portrait / Vertical 55" Responsive
   ============================================= */
@media (orientation: portrait), (max-aspect-ratio: 1/1) {
  html { font-size: clamp(16px, 2vh, 30px); }
  .home-title-animated { font-size: clamp(2.5rem, 7vw, 5rem); }
  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(clamp(180px, 40vw, 320px), 1fr));
    gap: 1.25rem;
  }
  .game-card-inner { padding: 2rem 1.25rem; }
  .game-icon { font-size: clamp(3rem, 8vw, 6rem); }
  .customer-logo-hero { max-height: clamp(80px, 16vw, 200px); }
}

/* Large landscape (55" 4K) */
@media (min-width: 2000px) {
  html { font-size: clamp(18px, 1.4vw, 30px); }
  .games-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 2.5rem;
    max-width: 100%;
  }
  .game-card-inner { padding: 3.5rem 2rem; }
  .game-icon { font-size: 6rem; }
  .customer-logo-hero { max-height: 200px; }
  .logo-showcase { padding: 3rem 1rem 1.5rem; }
  .home-title-animated { font-size: 5rem; margin-bottom: 2.5rem; }
  .game-list { padding: 2rem 2.5rem 3rem; }
  .gameover-modal-content { max-width: 900px; }
}

/* Very large portrait (55" vertical) */
@media (orientation: portrait) and (min-width: 1200px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (orientation: portrait) and (min-width: 1800px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); }
  .game-icon { font-size: 5rem; }
}
