/* ============================================================
   platform.css — Shared dark-theme game portal styles
   Used by base.html for ALL pages on game.blog.ne.kr
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-input: #12122a;
  --accent-gold: #F0C040;
  --accent-gold-dim: rgba(240, 192, 64, 0.15);
  --accent-gold-hover: #f5d060;
  --text-primary: #ffffff;
  --text-secondary: #b0b0c8;
  --text-muted: #6c6c8a;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(240, 192, 64, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(240, 192, 64, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
  --header-height: 64px;
  --max-width: 1200px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans',
               'Noto Sans KR', 'Noto Sans JP', 'Noto Sans SC', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* --- Layout Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  height: var(--header-height);
  overflow: visible;
}

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

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  transition: opacity var(--transition-fast);
}

.header-logo:hover {
  opacity: 0.85;
}

.header-logo .logo-icon {
  width: 32px;
  height: 32px;
}

.header-logo .logo-accent {
  color: var(--accent-gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Language Selector --- */
.lang-selector {
  position: relative;
}

.lang-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.lang-selector-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.lang-selector-btn .lang-globe {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.lang-selector-btn .lang-arrow {
  font-size: 0.625rem;
  opacity: 0.5;
  transition: transform var(--transition-fast);
}

.lang-selector.open .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 150px;
  max-height: min(50vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 200;
  -webkit-overflow-scrolling: touch;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown-item {
  display: block;
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  border: none;
  background: none;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-dropdown-item:hover {
  background: var(--accent-gold-dim);
  color: var(--text-primary);
}

.lang-dropdown-item.active {
  color: var(--accent-gold);
  font-weight: 600;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 56px 24px 40px;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

/* --- Search Bar --- */
.search-wrap {
  max-width: 480px;
  margin: 28px auto 0;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 18px 12px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-gold-dim);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

/* --- Hub Tabs --- */
.hub-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  max-width: var(--max-width);
  margin: 8px auto 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.hub-tab {
  position: relative;
  padding: 14px 32px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.hub-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background var(--transition-fast);
}

.hub-tab:hover {
  color: var(--text-secondary);
}

.hub-tab.active {
  color: var(--accent-gold);
}

.hub-tab.active::after {
  background: var(--accent-gold);
}

/* --- Category Filters --- */
.category-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 24px;
  margin: 24px auto 32px;
  max-width: var(--max-width);
}

.category-pill {
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.category-pill:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--accent-gold-dim);
}

.category-pill.active {
  background: var(--accent-gold);
  color: #0f0f1a;
  border-color: var(--accent-gold);
  font-weight: 600;
}

/* --- Game Card Grid --- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* --- Game Card --- */
.game-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-normal);
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card-hover), var(--shadow-glow);
  background: var(--bg-card-hover);
}

.game-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

.game-card:hover .game-card-thumb img {
  transform: scale(1.05);
}

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

.game-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.game-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Category Badge */
.game-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(15, 15, 26, 0.75);
  backdrop-filter: blur(6px);
  color: var(--accent-gold);
  border: 1px solid rgba(240, 192, 64, 0.2);
}

/* NEW Badge */
.game-card-new-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #ef4444;
  color: #fff;
  animation: pulse-new 2s ease-in-out infinite;
}

@keyframes pulse-new {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; box-shadow: 0 0 8px rgba(239,68,68,0.6); }
}

/* Rank Badge (Top 3 in recommended) */
.game-card-rank {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gold);
  color: #0f0f1a;
  box-shadow: 0 2px 8px rgba(240,192,64,0.4);
}

/* Play Count */
.game-play-count {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.game-play-count svg {
  color: var(--accent-gold);
  flex-shrink: 0;
}

.game-play-count strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* Hide ads on mobile */
@media (max-width: 768px) {
  .ad-desktop-only {
    display: none !important;
  }
}

/* Platform Icon */
.game-card-platform {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 4px;
}

.platform-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(15, 15, 26, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Featured Glow */
.game-card.featured {
  border-color: rgba(240, 192, 64, 0.15);
}

.game-card.featured::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
}

/* No Results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

/* --- Modal (Platform Warning) --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

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

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
  box-shadow: var(--shadow-card);
}

.modal-overlay.visible .modal-box {
  transform: scale(1);
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-message {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.modal-btn-primary {
  background: var(--accent-gold);
  color: #0f0f1a;
}

.modal-btn-primary:hover {
  background: var(--accent-gold-hover);
}

.modal-btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.modal-btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* --- Ad Wraps --- */
.ad-wrap {
  max-width: var(--max-width);
  margin: 0 auto 32px;
  padding: 0 24px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
}

.ad-wrap.ad-hidden {
  display: none;
}

.ad-wrap ins {
  max-width: 100%;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: rgba(15, 15, 26, 0.6);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-gold);
}

.footer-copy {
  color: var(--text-muted);
}

/* --- Utility Classes --- */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-card {
  animation: fadeInUp 0.4s ease both;
}

.game-card:nth-child(1) { animation-delay: 0s; }
.game-card:nth-child(2) { animation-delay: 0.05s; }
.game-card:nth-child(3) { animation-delay: 0.1s; }
.game-card:nth-child(4) { animation-delay: 0.15s; }
.game-card:nth-child(5) { animation-delay: 0.2s; }
.game-card:nth-child(6) { animation-delay: 0.25s; }
.game-card:nth-child(7) { animation-delay: 0.3s; }
.game-card:nth-child(8) { animation-delay: 0.35s; }
.game-card:nth-child(9) { animation-delay: 0.4s; }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

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

/* ============================================================
   Responsive Breakpoints
   ============================================================ */

/* Tablet: <= 768px */
@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .hub-tabs {
    padding: 0 16px;
  }

  .hub-tab {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .hero {
    padding: 40px 20px 28px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0 16px 36px;
  }

  .category-filters {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 16px;
    gap: 6px;
  }

  .category-filters::-webkit-scrollbar {
    display: none;
  }

  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 0 16px;
  }

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

  .game-card-title {
    font-size: 1rem;
  }
}

/* Mobile: <= 480px */
@media (max-width: 480px) {
  .hub-tabs {
    padding: 0 8px;
    gap: 0;
  }

  .hub-tab {
    padding: 10px 12px;
    font-size: 0.8rem;
    flex: 1;
    text-align: center;
  }

  .hero {
    padding: 20px 12px 14px;
  }

  .hero-title {
    font-size: 1.3rem;
  }

  .hero-subtitle {
    font-size: 0.85rem;
  }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 10px 20px;
  }

  .game-card-thumb {
    aspect-ratio: 4 / 3;
  }

  .game-card-body {
    padding: 8px 10px 10px;
  }

  .game-card-title {
    font-size: 0.85rem;
    margin-bottom: 2px;
  }

  .game-card-desc {
    font-size: 0.72rem;
    -webkit-line-clamp: 1;
    line-height: 1.3;
  }

  .game-card-badge {
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    font-size: 0.6rem;
  }

  .game-card-new-badge {
    top: 6px;
    right: 6px;
    padding: 1px 5px;
    font-size: 0.55rem;
  }

  .game-card-rank {
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    font-size: 0.65rem;
  }

  .game-play-count {
    margin-top: 4px;
    font-size: 0.65rem;
  }

  .game-play-count svg {
    width: 10px;
    height: 10px;
  }

  .search-wrap {
    margin-top: 14px;
  }

  .search-input {
    padding: 10px 14px 10px 40px;
    font-size: 0.9rem;
  }

  .category-filters {
    margin: 14px auto 16px;
  }

  .category-pill {
    padding: 5px 12px;
    font-size: 0.75rem;
  }

  .modal-box {
    padding: 24px;
    margin: 12px;
  }

  .ad-wrap {
    padding: 0 12px;
  }

  .site-footer {
    padding: 24px 16px;
  }
}

/* ============================================================
   RTL Support (Arabic, etc.)
   ============================================================ */
[dir="rtl"] .header-inner {
  flex-direction: row-reverse;
}

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

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

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

[dir="rtl"] .search-input {
  padding: 12px 44px 12px 18px;
}

[dir="rtl"] .search-icon {
  left: auto;
  right: 16px;
}

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

[dir="rtl"] .game-card-platform {
  right: auto;
  left: 12px;
}

[dir="rtl"] .category-filters {
  direction: rtl;
}

[dir="rtl"] .lang-selector-btn {
  flex-direction: row-reverse;
}

/* ============================================================
   Visitor Stats Bar
   ============================================================ */
.visitor-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 720px;
  margin: 0 auto 8px;
  padding: 10px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 14px;
}

.stat-icon {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.stat-online-icon {
  color: #4ade80;
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.stat-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 20px;
  text-align: center;
}

.stat-online-value {
  color: #4ade80;
}

.stat-divider {
  width: 1px;
  height: 20px;
  background: var(--border-color);
}

@media (max-width: 600px) {
  .visitor-stats {
    gap: 4px;
    padding: 8px 10px;
    margin: 0 12px 8px;
  }
  .stat-item {
    padding: 2px 8px;
  }
  .stat-label {
    font-size: 0.7rem;
  }
  .stat-value {
    font-size: 0.8rem;
  }
  .stat-divider {
    height: 16px;
  }
}
