:root {
  --bg-primary: #0a0b12;
  --bg-card: rgba(18, 20, 36, 0.75);
  --bg-card-hover: rgba(28, 32, 58, 0.88);
  --border-color: rgba(0, 243, 255, 0.18);
  --border-hover: rgba(0, 243, 255, 0.55);
  --cyan-glow: #00f3ff;
  --pink-neon: #ff007f;
  --gold-accent: #ffd700;
  --text-main: #f0f4fc;
  --text-muted: #8e9bb5;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.portal-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px var(--cyan-glow));
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: linear-gradient(90deg, #00f3ff, #ff007f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sub-badge {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

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

.ctrl-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn:hover {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff66;
  box-shadow: 0 0 8px #00ff66;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Rotation Bar */
.rotation-card {
  background: linear-gradient(135deg, rgba(20, 24, 46, 0.85), rgba(12, 14, 28, 0.85));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  backdrop-filter: blur(8px);
}

.rotation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge-glow {
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan-glow);
  letter-spacing: 0.5px;
}

.current-day-label {
  font-size: 12px;
  color: var(--pink-neon);
  font-weight: 600;
}

.rotation-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
  font-size: 11px;
  transition: all 0.2s ease;
}

.day-cell.active-today {
  background: rgba(0, 243, 255, 0.12);
  border-color: var(--cyan-glow);
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
}

.day-cell .day-name {
  font-weight: 700;
  color: #fff;
  display: block;
  margin-bottom: 2px;
}

.day-cell .day-genre {
  color: var(--text-muted);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hero Banner */
.hero-banner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  background: radial-gradient(circle at top left, rgba(255, 0, 127, 0.15), rgba(0, 243, 255, 0.08) 50%, rgba(10, 11, 20, 0.9) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  align-items: center;
}

.hero-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.tag-accent {
  background: var(--pink-neon);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.tag-meta {
  background: rgba(0, 243, 255, 0.12);
  color: var(--cyan-glow);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid rgba(0, 243, 255, 0.3);
}

.hero-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.hero-desc {
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 20px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #00f3ff, #0088ff);
  color: #040915;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 18px rgba(0, 243, 255, 0.4);
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-canvas-box {
  background: #060814;
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 8px;
  box-shadow: 0 0 24px rgba(0, 243, 255, 0.2);
}

#hero-mini-canvas {
  display: block;
  border-radius: 6px;
  background: #020308;
}

/* Filter Toolbar */
.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.genre-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pill-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.pill-btn.active {
  background: rgba(0, 243, 255, 0.15);
  border-color: var(--cyan-glow);
  color: var(--cyan-glow);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 20, 36, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-muted);
  width: 280px;
}

.search-box:focus-within {
  border-color: var(--cyan-glow);
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  width: 100%;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.game-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 18px rgba(0, 243, 255, 0.2);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-day {
  font-size: 11px;
  font-weight: 800;
  color: var(--pink-neon);
  letter-spacing: 0.5px;
}

.card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.card-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.card-genre {
  font-size: 12px;
  color: var(--cyan-glow);
  font-weight: 600;
}

.card-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-features {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.feature-tag {
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.card-btn {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.card-btn.primary {
  background: rgba(0, 243, 255, 0.16);
  border: 1px solid var(--cyan-glow);
  color: var(--cyan-glow);
}

.card-btn.primary:hover {
  background: var(--cyan-glow);
  color: #000;
  box-shadow: 0 0 14px rgba(0, 243, 255, 0.4);
}

.card-btn.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.card-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Footer */
.portal-footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 20px;
}

.tech-stack {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}

/* Modal Window */
.game-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s ease;
}

.game-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 14, 0.85);
  backdrop-filter: blur(8px);
}

.modal-window {
  position: relative;
  z-index: 2;
  width: 92vw;
  max-width: 960px;
  height: 85vh;
  background: #0d0f1c;
  border: 1px solid var(--cyan-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(20, 24, 42, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--cyan-glow);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-action-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.modal-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal-close-btn:hover {
  background: var(--pink-neon);
  border-color: var(--pink-neon);
}

.modal-body {
  flex: 1;
  background: #000;
  position: relative;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  display: block;
}

/* Responsive */
@media (max-width: 840px) {
  .hero-banner {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    display: none;
  }
  .rotation-days-grid {
    grid-template-columns: repeat(3, 1fr) repeat(4, 1fr);
  }
}

@media (max-width: 600px) {
  .portal-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .rotation-days-grid {
    grid-template-columns: repeat(2, 1fr) repeat(2, 1fr) repeat(3, 1fr);
  }
  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    width: 100%;
  }
  .games-grid {
    grid-template-columns: 1fr;
  }
}
