/* ==========================================================================
   MarioGamesHub.com - Premium Retro Browser Gaming Portal
   Modern Responsive Arcade UI (NES, SNES, N64, GBA, Flash)
   ========================================================================== */

:root {
  --bg-dark: #090d16;
  --bg-surface: #101726;
  --bg-card: #151f33;
  --bg-card-hover: #1c2944;
  --bg-glass: rgba(16, 23, 38, 0.88);

  --mario-red: #e52521;
  --mario-red-glow: rgba(229, 37, 33, 0.35);
  --coin-gold: #facc15;
  --green-1up: #22c55e;
  --sky-blue: #38bdf8;
  --fire-orange: #f97316;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-red: rgba(229, 37, 33, 0.4);

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --header-height: 68px;
  --container-max: 1300px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::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);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle 500px at 50% -10%, rgba(229, 37, 33, 0.12), transparent 75%),
    radial-gradient(circle 400px at 90% 40%, rgba(56, 189, 248, 0.05), transparent),
    radial-gradient(circle 350px at 10% 75%, rgba(250, 204, 21, 0.05), transparent);
  background-attachment: fixed;
}

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

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

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

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.logo-badge-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #e52521 0%, #990f07 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 900;
  font-size: 1.15rem;
  box-shadow: 0 4px 15px var(--mario-red-glow);
}

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

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 6px 0;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--mario-red);
  box-shadow: 0 0 10px var(--mario-red);
  border-radius: var(--radius-full);
}

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

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: var(--transition);
}

.search-trigger:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-red);
  color: var(--text-main);
}

.kbd-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-dim);
}

.mobile-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px;
}

.mobile-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text-main);
  border-radius: 2px;
}

/* ==========================================================================
   Main Game Player Section
   ========================================================================== */
.game-hero {
  padding-top: 24px;
  padding-bottom: 24px;
}

.game-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.game-title-group h1 {
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.game-meta-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chip {
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-weight: 600;
  color: var(--text-main);
}

.chip.red {
  background: rgba(229, 37, 33, 0.15);
  border-color: rgba(229, 37, 33, 0.4);
  color: #ff524f;
}

/* Player Frame */
.game-screen-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 700px;
  min-height: 380px;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-red);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.65), 0 0 30px var(--mario-red-glow);
  transition: var(--transition);
}

body.theater-mode .game-screen-wrapper {
  max-height: 86vh;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

.game-cover-splash {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(16, 23, 38, 0.88) 0%, rgba(9, 13, 22, 0.98) 100%);
}

.cover-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.2;
  filter: blur(10px);
}

.cover-content {
  position: relative;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 20px;
}

.platform-pill {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 14px;
  background: rgba(250, 204, 21, 0.15);
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: var(--coin-gold);
  border-radius: var(--radius-full);
}

.cover-title {
  font-size: 2.2rem;
  font-weight: 900;
}

.big-mario-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 44px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #e52521 0%, #b91c1c 100%);
  border-radius: var(--radius-full);
  box-shadow: 0 0 30px var(--mario-red-glow), 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
  cursor: pointer;
}

.big-mario-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 45px rgba(229, 37, 33, 0.6), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.big-mario-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.cover-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
}

/* Toolbar */
.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-red);
}

.tool-btn.active {
  background: rgba(229, 37, 33, 0.2);
  border-color: var(--mario-red);
  color: #fff;
}

.tool-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Rating Stars Widget */
.rating-widget {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.stars-row {
  display: flex;
  gap: 3px;
  cursor: pointer;
}

.star-icon {
  width: 18px;
  height: 18px;
  color: #475569;
  transition: color 0.15s ease, transform 0.15s ease;
}

.star-icon.filled, .star-icon.hover {
  color: var(--coin-gold);
}

.star-icon:hover {
  transform: scale(1.2);
}

.rating-score {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-left: 4px;
}

.rating-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Games Catalog Grid
   ========================================================================== */
.catalog-section {
  padding-top: 20px;
  padding-bottom: 40px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 22px;
  background: var(--mario-red);
  border-radius: var(--radius-full);
  box-shadow: 0 0 10px var(--mario-red);
}

.platform-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.platform-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
  transition: var(--transition);
}

.platform-btn:hover, .platform-btn.active {
  background: rgba(229, 37, 33, 0.15);
  border-color: var(--mario-red);
  color: #fff;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.game-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

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

.game-card.current {
  border-color: var(--mario-red);
  box-shadow: 0 0 20px var(--mario-red-glow);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #090d16;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.game-card:hover .card-img-wrap img {
  transform: scale(1.08);
}

.card-play-hover {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.game-card:hover .card-play-hover {
  opacity: 1;
}

.play-circle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--mario-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--mario-red-glow);
}

.card-details {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-submeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* ==========================================================================
   Two-Column SEO Content & Sidebar
   ========================================================================== */
.content-section {
  padding-bottom: 60px;
}

.content-sidebar-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
}

.main-article {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 32px;
}

.main-article h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 28px;
  margin-bottom: 12px;
  color: var(--coin-gold);
}

.main-article h2:first-of-type {
  margin-top: 0;
}

.main-article p {
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.7;
}

/* Controls Grid */
.controls-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.control-item {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.key-badge {
  display: inline-block;
  padding: 3px 8px;
  font-family: monospace;
  font-weight: bold;
  font-size: 0.85rem;
  background: rgba(229, 37, 33, 0.15);
  border: 1px solid rgba(229, 37, 33, 0.35);
  border-radius: 4px;
  color: #ff524f;
  margin-bottom: 6px;
}

.key-purpose {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* FAQ Accordion */
.faq-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.faq-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.faq-card.open {
  border-color: var(--border-red);
  background: rgba(229, 37, 33, 0.03);
}

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  text-align: left;
}

.faq-arrow {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: transform 0.25s ease;
}

.faq-card.open .faq-arrow {
  transform: rotate(180deg);
  color: var(--mario-red);
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-card.open .faq-a {
  max-height: 300px;
  padding: 0 20px 18px 20px;
}

/* Sidebar */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.widget-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.widget-heading {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.widget-dot {
  width: 8px;
  height: 8px;
  background: var(--mario-red);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px var(--mario-red);
}

.stats-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.stat-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stat-name {
  color: var(--text-dim);
}

.stat-number {
  font-weight: 700;
  color: var(--text-main);
}

.stat-number.gold {
  color: var(--coin-gold);
}

/* Mini Top Games List */
.sidebar-game-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-game-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.sidebar-game-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.rank-num {
  font-size: 0.85rem;
  font-weight: 800;
  width: 22px;
  color: var(--text-dim);
}

.sidebar-game-item:nth-child(1) .rank-num { color: #f59e0b; }
.sidebar-game-item:nth-child(2) .rank-num { color: #94a3b8; }
.sidebar-game-item:nth-child(3) .rank-num { color: #b45309; }

.sidebar-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.sidebar-info {
  flex: 1;
}

.sidebar-game-title {
  font-weight: 700;
  font-size: 0.88rem;
}

.sidebar-game-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Modals & Notifications
   ========================================================================== */
.modal-layer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  justify-content: center;
  padding-top: 100px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-layer.active {
  opacity: 1;
  pointer-events: auto;
}

.search-container {
  width: 90%;
  max-width: 620px;
  background: var(--bg-surface);
  border: 1px solid var(--border-red);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px var(--mario-red-glow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.search-top {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.search-input-field {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.05rem;
  outline: none;
}

.search-close-x {
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.search-results-list {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-res-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.search-res-item:hover {
  background: rgba(229, 37, 33, 0.1);
}

.search-res-item img {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* Toast */
.toast-notice {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 3000;
  padding: 12px 22px;
  background: var(--bg-card);
  border: 1px solid var(--mario-red);
  color: var(--text-main);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--mario-red-glow);
  font-size: 0.9rem;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
.site-footer {
  background: #060910;
  border-top: 1px solid var(--border-subtle);
  padding: 50px 0 30px 0;
  margin-top: auto;
}

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

.footer-brand-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 12px;
  max-width: 440px;
}

.footer-nav-title {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 16px;
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links-list a {
  color: var(--text-dim);
  font-size: 0.88rem;
  transition: var(--transition);
}

.footer-links-list a:hover {
  color: var(--mario-red);
}

.footer-bottom-row {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.legal-disclaimer {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
  .content-sidebar-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .desktop-nav {
    display: none;
  }
  .mobile-toggle {
    display: flex;
  }
  .footer-columns {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .game-title-group h1 {
    font-size: 1.45rem;
  }
  .cover-title {
    font-size: 1.6rem;
  }
  .footer-columns {
    grid-template-columns: 1fr;
  }
}
