/* ==========================================================================
   EAST ASIAN & DESI TRADITIONAL ARCADE - CORE STYLESHEET
   Design System: Asian Heritage Modernized (Ink, Vermilion, Dancheong, Gold)
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #0a0e17;
  --bg-card: #131c2e;
  --bg-card-hover: #1b2842;
  --bg-surface: #1e293b;
  --bg-surface-light: #2d3b55;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.35);
  --accent-gold-light: #fbbf24;

  --chinese-red: #dc2626;
  --chinese-red-glow: rgba(220, 38, 38, 0.3);
  --korean-blue: #2563eb;
  --korean-blue-glow: rgba(37, 99, 235, 0.3);
  --desi-saffron: #f97316;
  --desi-green: #10b981;
  --jade-green: #059669;

  --wood-board: #d8b070;
  --wood-dark: #5c3a1e;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(245, 158, 11, 0.4);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--accent-gold-glow);

  --font-main: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Noto Sans', 'Noto Sans SC', 'Noto Sans KR', 'Noto Sans Devanagari', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(220, 38, 38, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(37, 99, 235, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: var(--transition);
}

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

/* Accessibility Focus */
:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 3px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.logo-symbol {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #c82333, #f59e0b);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

.brand-text span {
  color: var(--accent-gold);
}

.brand-sub {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-size: 1.1rem;
}

.icon-btn:hover {
  background: var(--bg-surface-light);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-2px);
}

.mobile-menu-btn {
  display: none;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-section {
  padding: 3.5rem 0 2rem;
  text-align: center;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  color: var(--accent-gold-light);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ef4444 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Search & Filter Controls */
.filter-search-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  margin-bottom: 2.5rem;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab-btn {
  padding: 8px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-surface-light);
}

.tab-btn.active {
  color: #000;
  background: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 4px 14px var(--accent-gold-glow);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 380px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
}

.search-input:focus {
  border-color: var(--accent-gold);
  outline: none;
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* ==========================================================================
   GAME GRID & CARDS
   ========================================================================== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.game-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0.1, 1), box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--accent-gold-glow);
}

.game-card-banner {
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b, #0f172a);
}

.banner-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge-chinese { color: #f87171; border-color: rgba(239, 68, 68, 0.4); }
.badge-korean { color: #60a5fa; border-color: rgba(96, 165, 250, 0.4); }
.badge-japanese { color: #c084fc; border-color: rgba(168, 85, 247, 0.4); }
.badge-shared { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }

.card-icon-art {
  font-size: 4.5rem;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6));
  transition: transform 0.3s ease;
}

.game-card:hover .card-icon-art {
  transform: scale(1.1) rotate(-3deg);
}

.game-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.game-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
}

.game-native-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
}

.game-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.game-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

.game-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.game-high-score {
  font-size: 0.8rem;
  color: var(--accent-gold-light);
  font-weight: 600;
}

.play-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-gold);
  color: #000;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.play-link-btn:hover {
  background: var(--accent-gold-light);
  transform: translateX(3px);
  box-shadow: 0 4px 12px var(--accent-gold-glow);
}

/* ==========================================================================
   GAME PLAY PAGE LAYOUT & CONTROLS
   ========================================================================== */
.game-page-wrapper {
  padding: 1.5rem 0 3rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.breadcrumbs a {
  color: var(--text-muted);
}
.breadcrumbs a:hover {
  color: var(--accent-gold);
}
.breadcrumbs span {
  color: var(--text-dim);
}

.game-header-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.game-page-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 900;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.game-page-title .native-script {
  color: var(--accent-gold);
  font-size: 0.85em;
  font-weight: 700;
}

/* Controls Toolbar */
.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  gap: 10px;
}

.toolbar-status {
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 600;
}

.status-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  font-size: 0.88rem;
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge.highlight {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent-gold);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--accent-gold-light);
  box-shadow: 0 4px 12px var(--accent-gold-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
  background: var(--bg-surface-light);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.4);
}
.btn-danger:hover {
  background: rgba(220, 38, 38, 0.4);
}

/* Select Box */
.custom-select {
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  cursor: pointer;
}
.custom-select:focus {
  border-color: var(--accent-gold);
  outline: none;
}

/* Main Game Canvas/Board Container */
.game-viewport-card {
  background: #0d131f;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 480px;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.game-canvas {
  max-width: 100%;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: block;
}

/* Toast Message Overlay */
.game-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 22px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold-light);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.game-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   CONTENT ARTICLE (RULES, HISTORY, STRATEGY, FAQ)
   ========================================================================== */
.game-article-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 3.5rem;
}

.content-block {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.content-block h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.content-block h2 .icon {
  color: var(--accent-gold);
}

.rules-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rules-list li {
  position: relative;
  padding-left: 28px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.rules-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--accent-gold);
  font-size: 0.9rem;
}

.history-text {
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.tips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.tip-card {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-gold);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tip-card strong {
  color: var(--text-main);
  display: block;
  margin-bottom: 4px;
}

/* FAQ Accordion */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-question {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  background: none;
  border: none;
  padding: 4px 0;
}

.faq-question:hover {
  color: var(--accent-gold);
}

.faq-answer {
  padding-top: 8px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Sidebar Info Card */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: sticky;
  top: 90px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.info-table tr {
  border-bottom: 1px solid var(--border-subtle);
}

.info-table td {
  padding: 10px 0;
}

.info-table td:first-child {
  color: var(--text-dim);
  font-weight: 600;
}

.info-table td:last-child {
  text-align: right;
  color: var(--text-main);
  font-weight: 700;
}

/* Related Games */
.related-games-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.related-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   MODAL WINDOWS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1.25rem;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-backdrop.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-gold);
}

.modal-close-btn {
  font-size: 1.5rem;
  color: var(--text-dim);
  line-height: 1;
}

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

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  margin-top: auto;
  background: #090d16;
  border-top: 1px solid var(--border-subtle);
  padding: 3rem 0 1.5rem;
  color: var(--text-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand p {
  font-size: 0.9rem;
  margin-top: 0.75rem;
  max-width: 340px;
  color: var(--text-muted);
}

.footer-col h4 {
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
}

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

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 900px) {
  .game-article-container {
    grid-template-columns: 1fr;
  }
  .sidebar-card {
    position: static;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 680px) {
  .nav-links {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .filter-search-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    max-width: 100%;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .game-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar-status {
    justify-content: space-between;
  }
}
