/* Game Portal Theme */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&display=swap');

:root {
  --bg-dark: #0a0a12;
  --bg-card: #14141f;
  --bg-card-hover: #1a1a28;
  --gold: #d4a017;
  --gold-light: #f4cf00;
  --gold-glow: rgba(244, 207, 0, 0.4);
  --red: #c41e3a;
  --red-dark: #8b0000;
  --text: #e8e0d0;
  --text-muted: #9a9080;
  --border: rgba(212, 160, 23, 0.25);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(139, 0, 0, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(212, 160, 23, 0.08) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4a017' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

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

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(180deg, rgba(10, 10, 18, 0.95) 0%, rgba(10, 10, 18, 0.7) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.site-header.scrolled {
  background: rgba(10, 10, 18, 0.98);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-logo img {
  height: 50px;
  max-width: 100%;
  filter: drop-shadow(0 0 8px var(--gold-glow));
  transition: filter 0.3s;
}

.header-logo:hover img {
  filter: drop-shadow(0 0 16px var(--gold-glow));
}

/* Hero Banner */
.hero {
  position: relative;
  height: 520px;
  margin-top: 74px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transform: scale(1.05);
  transition: transform 8s ease;
}

.hero:hover .hero-bg {
  transform: scale(1.1);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(10, 10, 18, 0.1) 0%,
    rgba(10, 10, 18, 0.2) 70%,
    var(--bg-dark) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 60px;
}

.hero-tag {
  display: inline-block;
  padding: 6px 16px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 16px;
  width: fit-content;
  animation: pulse-tag 2s ease-in-out infinite;
}

@keyframes pulse-tag {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.4); }
  50% { box-shadow: 0 0 20px 4px rgba(196, 30, 58, 0.2); }
}

.hero-title {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, #fff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  line-height: 1.3;
  max-width: 700px;
  letter-spacing: 2px;
}

.hero-sub {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-muted);
  max-width: 500px;
}

/* Main Content */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

/* Section */
.game-section {
  margin-bottom: 50px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, var(--gold), transparent) 1;
}

.section-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

.section-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 3px;
  text-shadow: 0 0 20px var(--gold-glow);
}

.section-title img {
  height: 32px;
  vertical-align: middle;
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
}

/* Game Card */
.game-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, transparent, var(--gold), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  z-index: 2;
}

.game-card:hover {
  border-color: rgba(212, 160, 23, 0.5);
  background: var(--bg-card-hover);
}

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

.card-image {
  position: relative;
  height: 220px;
  overflow: hidden;
}

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

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

.card-hot {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  background: linear-gradient(135deg, #ff4444, var(--red));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: 1px;
  animation: hot-blink 1.5s ease-in-out infinite;
  box-shadow: 0 2px 10px rgba(255, 68, 68, 0.5);
}

@keyframes hot-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(10, 10, 18, 0.9) 100%);
  opacity: 0;
  transition: opacity 0.35s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

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

.btn-enter {
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #1a1000;
  font-size: 15px;
  font-weight: 700;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.35s;
  box-shadow: 0 4px 20px var(--gold-glow);
  letter-spacing: 2px;
}

.game-card:hover .btn-enter {
  transform: translateY(0);
  opacity: 1;
}

.btn-enter:hover {
  box-shadow: 0 6px 30px var(--gold-glow);
  transform: scale(1.05);
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  line-height: 1.4;
  transition: color 0.3s;
}

.card-title:hover {
  color: var(--gold-light);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.card-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.card-info-item .label {
  color: var(--gold);
  font-weight: 500;
  min-width: 70px;
}

.card-info-item .label::before {
  content: '\25C6';
  margin-right: 4px;
  font-size: 8px;
}

.btn-play {
  display: block;
  width: 100%;
  padding: 12px;
  text-align: center;
  background: linear-gradient(135deg, var(--red-dark) 0%, var(--red) 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid rgba(255, 100, 100, 0.2);
  letter-spacing: 4px;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-play::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s;
}

.btn-play:hover {
  background: linear-gradient(135deg, var(--red) 0%, #e63950 100%);
  box-shadow: 0 4px 20px rgba(196, 30, 58, 0.4);
  transform: translateY(-2px);
}

.btn-play:hover::after {
  left: 100%;
}

/* Footer */
.site-footer {
  background: linear-gradient(180deg, transparent, #06060c);
  border-top: 1px solid var(--border);
  padding: 40px 20px 30px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

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

.footer-links a {
  color: var(--text-muted);
  font-size: 13px;
  padding: 4px 12px;
  transition: color 0.3s;
}

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

.footer-links .sep {
  color: rgba(212, 160, 23, 0.3);
}

.footer-copy {
  font-size: 12px;
  color: #666;
  line-height: 1.8;
}

.footer-copy em {
  font-style: normal;
  color: var(--text-muted);
}

/* Sidebar - WeChat */
.sidebar {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 99;
  background: linear-gradient(180deg, var(--bg-card) 0%, #0d0d16 100%);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 12px 0 0 12px;
  padding: 20px 16px;
  width: 180px;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  transform: translateY(-50%) translateX(calc(100% - 40px));
}

.sidebar-toggle {
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translate(-100%, -50%);
  width: 28px;
  height: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 14px;
  transition: background 0.3s;
}

.sidebar-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--gold-light);
}

.sidebar-title {
  font-size: 13px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.sidebar-qr {
  text-align: center;
  margin-bottom: 12px;
}

.sidebar-qr img {
  width: 130px;
  height: 130px;
  border-radius: 8px;
  border: 2px solid var(--border);
}

.sidebar-text {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

.sidebar-text .highlight {
  color: var(--gold-light);
  font-weight: 500;
}

.sidebar-inner {
  display: block;
}

/* Scroll to top */
.back-top {
  position: fixed;
  right: 200px;
  bottom: 30px;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 98;
  box-shadow: 0 4px 15px var(--gold-glow);
  transition: transform 0.3s;
  color: #1a1000;
  font-size: 18px;
  font-weight: bold;
  border: none;
}

.back-top.show {
  display: flex;
}

.back-top:hover {
  transform: translateY(-4px);
}

body.no-sidebar .back-top {
  right: 24px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 16px;
}

/* Responsive grid for fewer items */
.game-grid:has(.game-card:nth-child(2):last-child) {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
}

.game-grid:has(.game-card:only-child) {
  grid-template-columns: 1fr;
  max-width: 400px;
}

/* ===== Tablet ===== */
@media (max-width: 992px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .game-grid:has(.game-card:nth-child(2):last-child),
  .game-grid:has(.game-card:only-child) {
    max-width: none;
  }

  .hero {
    height: 380px;
    margin-top: 64px;
  }

  .back-top {
    right: 24px;
  }
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .header-inner {
    padding: 10px 16px;
  }

  .header-logo img {
    height: 36px;
  }

  .hero {
    height: 220px;
    margin-top: 56px;
  }

  .hero-bg {
    background-position: center center;
    transform: none;
  }

  .main-content {
    padding: 16px 12px 60px;
  }

  .game-section {
    margin-bottom: 36px;
  }

  .section-header {
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  .section-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .section-title {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .section-title img {
    height: 24px;
    max-width: 160px;
    object-fit: contain;
  }

  .section-line {
    display: none;
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card-image {
    height: 200px;
  }

  .card-body {
    padding: 16px;
  }

  .card-title {
    font-size: 16px;
  }

  .btn-play {
    padding: 14px;
    font-size: 16px;
    letter-spacing: 2px;
  }

  /* Touch: always show enter button on overlay */
  .card-overlay {
    opacity: 1;
    background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 18, 0.75) 100%);
  }

  .btn-enter {
    transform: translateY(0);
    opacity: 1;
    padding: 10px 24px;
    font-size: 14px;
  }

  .game-card:hover {
    transform: none;
  }

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

  .footer-links {
    gap: 4px;
  }

  .footer-links a {
    font-size: 12px;
    padding: 4px 8px;
  }

  .footer-links .sep {
    display: none;
  }

  .footer-copy {
    font-size: 11px;
  }

  /* Sidebar -> bottom floating */
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-radius: 16px 16px 0 0;
    border-right: 1px solid var(--border);
    border-bottom: none;
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  }

  .sidebar.collapsed {
    transform: translateY(calc(100% - 48px));
  }

  .sidebar-toggle {
    left: 50%;
    top: 0;
    transform: translate(-50%, -100%);
    width: 60px;
    height: 28px;
    border-radius: 8px 8px 0 0;
    border-right: 1px solid var(--border);
    border-bottom: none;
  }

  .sidebar:not(.collapsed) .sidebar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
  }

  .sidebar:not(.collapsed) .sidebar-title {
    margin-bottom: 0;
    text-align: left;
    flex: 1;
  }

  .sidebar:not(.collapsed) .sidebar-qr {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .sidebar:not(.collapsed) .sidebar-qr img {
    width: 80px;
    height: 80px;
  }

  .sidebar:not(.collapsed) .sidebar-text {
    text-align: left;
    flex: 1;
  }

  .back-top {
    right: 16px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    width: 40px;
    height: 40px;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* ===== Small Mobile ===== */
@media (max-width: 480px) {
  .hero {
    height: 180px;
  }

  .section-title {
    font-size: 16px;
  }

  .card-image {
    height: 180px;
  }

  .card-info-item {
    font-size: 12px;
  }

  .card-info-item .label {
    min-width: 56px;
  }
}

/* Hover effects only on devices that support hover */
@media (hover: hover) {
  .game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow), 0 0 30px rgba(212, 160, 23, 0.15);
    border-color: rgba(212, 160, 23, 0.5);
    background: var(--bg-card-hover);
  }

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

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

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

  .game-card:hover .btn-enter {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (hover: none) {
  .card-overlay {
    opacity: 1;
    background: linear-gradient(180deg, transparent 50%, rgba(10, 10, 18, 0.75) 100%);
  }

  .btn-enter {
    transform: translateY(0);
    opacity: 1;
  }
}
