/* ============================================
   OnlyGames Portal — Gaming Portal Style
   ============================================ */

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-nav: #0d0d1aee;
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --accent: #ff6b35;
  --accent-glow: #ff6b3540;
  --easy: #38b764;
  --medium: #f7a020;
  --hard: #e84855;
  --radius: 12px;
  --radius-sm: 8px;
  --max-w: 1200px;
  --font: 'Exo 2', 'Noto Sans JP', 'Noto Sans TC', 'Noto Sans Thai', system-ui, sans-serif;
}

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

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

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

/* ---- NAV ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #ffffff10;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.nav-logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
  display: flex;
  gap: 16px;
  flex: 1;
}
.nav-links a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-lang {
  display: flex;
  gap: 6px;
}
.nav-lang a {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: #ffffff08;
  transition: all 0.2s;
}
.nav-lang a:hover { background: #ffffff15; color: var(--text); text-decoration: none; }
.nav-lang a.active { background: var(--accent); color: #fff; }

.nav-lang-mobile { display: none; }

.nav-burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

/* ---- HERO ---- */

.hero {
  text-align: center;
  padding: 60px 20px 40px;
  background: linear-gradient(180deg, #1a1a2e 0%, var(--bg) 100%);
}
.hero h1 {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 900;
  letter-spacing: -1px;
  margin-bottom: 12px;
}
.hero-tagline {
  font-size: clamp(16px, 3vw, 22px);
  color: var(--text-muted);
  font-weight: 600;
}

/* ---- FILTER BAR ---- */

.filter-bar {
  position: sticky;
  top: 60px;
  z-index: 90;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #ffffff10;
  padding: 12px 0;
}

.filter-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-search {
  flex: 1;
  min-width: 180px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #ffffff15;
  background: #ffffff08;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}
.filter-search:focus { border-color: var(--accent); }
.filter-search::placeholder { color: var(--text-muted); }

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid #ffffff15;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.pill:hover { background: #ffffff10; color: var(--text); }
.pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pill-easy.active { background: var(--easy); border-color: var(--easy); }
.pill-medium.active { background: var(--medium); border-color: var(--medium); }
.pill-hard.active { background: var(--hard); border-color: var(--hard); }

/* ---- GAME GRID ---- */

.game-grid-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 20px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

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

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #ffffff08;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px #00000060;
  text-decoration: none;
}

.game-card-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #0a0a15;
}
.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.game-card:hover .game-card-thumb img { transform: scale(1.05); }

.game-card-emoji {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 28px;
  background: #000000aa;
  border-radius: 8px;
  padding: 4px 8px;
  line-height: 1;
}

.game-card-difficulty {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.game-card-difficulty.easy { background: var(--easy); color: #fff; }
.game-card-difficulty.medium { background: var(--medium); color: #fff; }
.game-card-difficulty.hard { background: var(--hard); color: #fff; }

.game-card-body {
  padding: 14px 16px;
  border-top: 3px solid var(--game-color, var(--accent));
}

.game-card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.3;
}

.game-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- GAME PAGE ---- */

.game-hero {
  padding: 24px 20px 20px;
  background: linear-gradient(180deg, #1a1a2e 0%, var(--bg) 100%);
  max-width: var(--max-w);
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }

.game-hero-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.game-emoji {
  font-size: 48px;
  line-height: 1;
}

.game-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  line-height: 1.2;
}

.game-badges {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.badge-series { background: #ffffff15; color: var(--text-muted); }
.badge-easy { background: var(--easy); color: #fff; }
.badge-medium { background: var(--medium); color: #fff; }
.badge-hard { background: var(--hard); color: #fff; }

/* ---- GAME IFRAME ---- */

.game-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

.game-frame-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 2px solid #ffffff12;
  box-shadow:
    0 0 0 1px #ffffff08,
    0 4px 32px #00000080,
    0 0 80px -20px var(--game-color, var(--accent));
}

.game-frame-wrap iframe {
  display: block;
  width: 100%;
  aspect-ratio: 3/2;
  border: none;
}

.game-frame-wrap:fullscreen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-frame-wrap:fullscreen iframe {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
}
.game-frame-wrap:fullscreen .btn-fullscreen { display: none; }

.btn-exit-fullscreen {
  display: none;
}
.game-frame-wrap:fullscreen .btn-exit-fullscreen {
  display: block;
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 20;
  background: #000000cc;
  border: none;
  color: #fff;
  font-size: 22px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .game-frame-wrap iframe {
    aspect-ratio: 4/3;
  }
}
@media (max-width: 480px) {
  .game-frame-wrap iframe {
    aspect-ratio: 1/1;
  }
  .game-container { padding: 0 8px 16px; }
}

.btn-fullscreen {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: #000000cc;
  border: none;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  z-index: 10;
}
.btn-fullscreen:hover,
.btn-fullscreen:active { opacity: 1; }

@media (max-width: 768px) {
  .btn-fullscreen {
    opacity: 1;
    bottom: 8px;
    right: 8px;
    padding: 12px 18px;
    font-size: 15px;
  }
}

/* ---- GAME INFO ---- */

.game-info {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 32px;
}
.game-info-inner {
  max-width: 720px;
}
.game-description {
  font-size: 17px;
  line-height: 1.7;
  color: var(--text-muted);
}

.game-screenshots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 24px 0 8px;
  scrollbar-width: thin;
}
.game-screenshots img {
  height: 180px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* ---- GAME CONTENT BLOCKS ---- */

.game-content {
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.content-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid #ffffff08;
  padding: 28px;
}

.content-block-reverse .content-text { order: 2; }
.content-block-reverse .content-img { order: 1; }

.content-text h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.control-list,
.feature-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-list li,
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  padding-left: 4px;
}

.control-list li::before { content: "🎮"; flex-shrink: 0; }
.feature-list li::before { content: "✦"; color: var(--accent); flex-shrink: 0; }

.content-img {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 4px 24px #00000040;
  cursor: pointer;
}

.content-img img {
  width: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.3s;
}
.content-img:hover img { transform: scale(1.03); }

/* ---- SCREENSHOT GALLERY (3-col) ---- */

.content-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.content-gallery img {
  width: 100%;
  aspect-ratio: 3/2;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 12px #00000030;
}
.content-gallery img:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 20px #00000050;
}

/* ---- IMAGE MODAL ---- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000000dd;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.modal-overlay.active {
  display: flex;
}
.modal-overlay img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 8px 48px #00000080;
  object-fit: contain;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.modal-close:hover { opacity: 1; }

@media (max-width: 640px) {
  .content-block {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
  .content-block-reverse .content-text { order: 1; }
  .content-block-reverse .content-img { order: 2; }
  .content-text h2 { font-size: 20px; }
  .content-gallery { grid-template-columns: 1fr 1fr; }
}

/* ---- GAME RELATED ---- */

.game-related {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 48px;
}
.game-related h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ---- PAGE CONTENT (privacy, terms, about) ---- */

.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px 64px;
  line-height: 1.8;
}
.page-content h1 {
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  margin-bottom: 8px;
}
.page-content h2 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text);
}
.page-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--text);
}
.page-content p {
  color: var(--text-muted);
  margin-bottom: 12px;
}
.page-content ul {
  color: var(--text-muted);
  padding-left: 24px;
  margin-bottom: 12px;
}
.page-content li {
  margin-bottom: 6px;
}
.page-content a {
  color: var(--accent);
}
.page-updated {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ---- FOOTER ---- */

.footer {
  border-top: 1px solid #ffffff10;
  padding: 32px 20px;
  text-align: center;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.footer-links a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); text-decoration: none; }
.footer p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---- BUTTONS ---- */

.btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 16px;
  transition: background 0.2s;
  margin-top: 20px;
}
.btn:hover { background: #ff8555; text-decoration: none; }

/* ---- UTILITIES ---- */

.hidden { display: none !important; }

.no-results {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
  font-size: 18px;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    padding: 16px 20px;
    border-bottom: 1px solid #ffffff10;
  }
  .nav-burger { display: block; }
  .nav-lang { display: none; }
  .nav-lang-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid #ffffff10;
    margin-top: 8px;
  }

  .filter-inner { flex-direction: column; align-items: stretch; }
  .filter-search { min-width: 100%; }

  .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .game-card-body { padding: 10px 12px; }
  .game-card-title { font-size: 14px; }
  .game-card-desc { font-size: 12px; }

  .hero { padding: 40px 20px 24px; }
  .game-screenshots img { height: 120px; }
}

@media (max-width: 480px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .game-card-emoji { font-size: 20px; padding: 2px 6px; }
  .nav-lang a { padding: 3px 7px; font-size: 11px; }
}
