:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.85);
  --border-color: #334155;
  --accent-red: #ef4444;
  --accent-blue: #38bdf8;
  --accent-green: #22c55e;
  --accent-gold: #facc15;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --glow-red: rgba(239, 68, 68, 0.4);
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  line-height: 1.6;
}

/* --- Header / Top Bar --- */
.site-header {
  width: 100%;
  max-width: 1100px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

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

.logo-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 8px var(--accent-red));
}

.logo-text {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffffff;
}

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

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

.fullscreen-btn {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1.5px solid var(--accent-blue);
  color: var(--accent-blue);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fullscreen-btn:hover {
  background: var(--accent-blue);
  color: #0f172a;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.badge {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-blue);
}

/* --- Game Viewport Wrapper --- */
.game-section {
  width: 100%;
  max-width: 1100px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
}

#game-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(239, 68, 68, 0.15);
  border: 2px solid var(--border-color);
  position: relative;
}

#game-container:fullscreen {
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
}

#game-container:-webkit-full-screen {
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
}

/* Sleek Floating Fullscreen / Exit Button */
.floating-fs-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.6);
  color: #38bdf8;
  padding: 4px 8px;
  min-height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  z-index: 9999999;
  transition: all 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
}

.floating-fs-btn:hover {
  background: rgba(56, 189, 248, 0.95);
  color: #0f172a;
}

.floating-fs-btn:active {
  transform: scale(0.95);
}

/* In Fullscreen Mode */
body.is-fullscreen-app .floating-fs-btn,
:fullscreen .floating-fs-btn,
:-webkit-full-screen .floating-fs-btn {
  position: fixed !important;
  top: 8px !important;
  right: 8px !important;
  z-index: 99999999 !important;
  background: rgba(220, 38, 38, 0.8) !important;
  border: 1px solid #ffffff !important;
  color: #ffffff !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6) !important;
}

#game-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.game-controls-hint {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.key-badge {
  background: #1e293b;
  border: 1px solid #475569;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: bold;
  color: #ffffff;
  font-size: 11px;
}

/* --- SEO Landing & Content Section --- */
.content-container {
  width: 100%;
  max-width: 1000px;
  padding: 40px 20px 80px 20px;
  user-select: text; /* Allow users to read & highlight text */
}

.seo-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 28px;
}

.seo-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--accent-red);
  padding-left: 12px;
}

.seo-card p {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 14px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.feature-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 16px;
}

.feature-box h3 {
  font-size: 16px;
  color: var(--accent-blue);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feature-box p {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
}

/* Data Tables */
.table-wrapper {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid #334155;
}

th {
  background: #1e293b;
  color: #ffffff;
  font-weight: 700;
}

td {
  color: #cbd5e1;
}

tr:hover {
  background: rgba(51, 65, 85, 0.3);
}

/* FAQ Accordion */
details {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
}

details[open] {
  border-color: var(--accent-blue);
  background: #162032;
}

summary {
  font-weight: 700;
  color: #ffffff;
  font-size: 15px;
  outline: none;
}

details p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

/* --- Footer --- */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border-color);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

/* Responsive Rules & Mobile Console UX */
html, body {
  touch-action: pan-y;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-container, #game-container canvas {
  touch-action: none !important;
  -webkit-touch-callout: none !important;
}

/* Landscape Mode Reminder Overlay */
#orientation-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 13, 22, 0.96);
  z-index: 99999;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 30px;
}

.orient-box {
  background: #0f172a;
  border: 2px solid #ef4444;
  border-radius: 16px;
  padding: 30px 24px;
  max-width: 380px;
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.orient-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: rotatePhone 2s infinite ease-in-out;
}

@keyframes rotatePhone {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

.orient-box h2 {
  font-size: 18px;
  font-weight: 900;
  color: #ef4444;
  margin-bottom: 8px;
}

.orient-box p {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 18px;
}

.force-orient-btn {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
  width: 100%;
}

.force-orient-btn:active {
  transform: scale(0.96);
  background: #b91c1c;
}

@media (orientation: portrait) and (max-width: 820px) {
  #orientation-warning {
    display: flex;
  }
}

/* Fullscreen App Immersive Mode (iOS Safari & Android Fullscreen Fallback) */
body.is-fullscreen-app {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 999999 !important;
  overflow: hidden !important;
  background: #090d16 !important;
}

body.is-fullscreen-app .site-header,
body.is-fullscreen-app .seo-content,
body.is-fullscreen-app .site-footer {
  display: none !important;
}

body.is-fullscreen-app .game-section {
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

body.is-fullscreen-app #game-container {
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.is-fullscreen-app #game-container canvas,
:fullscreen #game-container canvas,
:-webkit-full-screen #game-container canvas {
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  object-fit: fill !important;
}

@media (max-width: 768px) {
  .site-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .game-section {
    padding: 2px 0;
  }
  #game-container {
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .seo-card {
    padding: 18px;
  }
}
