:root {
  --primary: #6366f1;   /* 藍紫 Indigo */
  --accent: #818cf8;    /* 淡藍紫 */
  --blue: #a5b4fc;
  --bg-dark: #050505;
  --bg-card: #0a0f14;
  --text-main: #fff;
  --text-dim: #c4c4c4;
  --border-color: #333;
  --font-main: 'Rajdhani', sans-serif;
  --font-display: 'Orbitron', sans-serif;
}

/* 顏色主題：由自訂主題或 data-theme 切換 */
body[data-theme="cyan"] {
  --primary: #0066ff;
  --accent: #00f3ff;
  --blue: #00e5ff;
}
body[data-theme="purple-pink"] {
  --primary: #c026d3;
  --accent: #e879f9;
  --blue: #f0abfc;
}

* { box-sizing: border-box; cursor: url('https://cur.cursors-4u.net/games/gam-13/gam1282.cur'), auto !important; }

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-dark);
  background-image: url("assets/bg-pixel.gif");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }

/* --- Custom Background Wrapper --- */
#custom-bg-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -999;
  overflow: hidden;
}
#custom-bg-video, #custom-bg-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  object-fit: cover;
}
#custom-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85); /* Default Dim 85% */
  -webkit-backdrop-filter: blur(10px); /* Safari/iOS Support */
  backdrop-filter: blur(10px); /* Default Blur */
  pointer-events: none;
}

/* --- Typography --- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; margin: 0 0 1rem 0; }
.page-title {
  text-align: center;
  font-size: 2.5rem;
  margin: 40px 0;
  color: #fff;
  text-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
}

/* --- Layout --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  min-height: 100vh; /* Full Viewport Height */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* Removed extra padding */
  overflow: hidden;
  z-index: 1;
}

.hero-video-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  opacity: 0.8;
}

/* --- Sakura Canvas Fix --- */
#sakura-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* --- Neon Section Titles --- */
.neon-title, section h2 {
  color: #fff;
  text-shadow: 0 0 5px #00f3ff, 0 0 10px #00f3ff, 0 0 20px #00f3ff;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 30px;
}

/* --- Beautified Grid Controls --- */
.grid-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.grid-btn {
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 11px 12px; /* Increased padding to align height with filter buttons */
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
}
.grid-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}
.grid-btn.active {
  color: #000;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent);
  transform: scale(1.05);
}
.grid-btn svg {
  display: block;
  stroke-width: 0;
  fill: currentColor; /* Use fill instead of stroke for rects if they are solid */
}
/* Ensure the rects in the SVG use the current color */
.grid-btn svg rect {
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}
.grid-btn.active svg rect {
  stroke: #000;
  stroke-width: 2;
}

/* Dev Mode Toggle Green */
#dev-mode-toggle:checked + .slider {
  background-color: #4caf50 !important;
  box-shadow: 0 0 10px #4caf50;
}

/* User Icon Fix */
.user-menu-container {
  position: relative;
  display: inline-block;
  z-index: 1002; /* Ensure above other elements */
}

.hero-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(circle at center, rgba(26, 26, 46, 0.4) 0%, rgba(5, 5, 5, 0.8) 100%);
  z-index: -1;
}
.hero-content {
  position: relative;
  z-index: 2;
  text-align: left; /* Changed from center to left */
  padding-left: 10%; /* Add some spacing from the edge */
  width: 100%;
}
.hero-title {
  font-size: 4rem;
  margin-bottom: 20px;
  text-shadow: 0 0 20px var(--primary);
  line-height: 1.2;
}
.hero-title span:first-child { color: #fff; margin-right: 15px; }
.hero-title span:last-child { color: var(--accent); }
.hero-subtitle {
  font-size: 1.2rem;
  color: #ccc;
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: 0; /* Align left */
  margin-right: auto;
}

/* --- Features Section --- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  padding: 60px 20px;
  position: relative;
  z-index: 2;
}
.feature-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.3s, border-color 0.3s;
  backdrop-filter: blur(5px);
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.2); /* Purple Glow */
  position: relative; /* For Neon Border */
}
.feature-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  padding: 2px;
  background: linear-gradient(45deg, #6366f1, #00f3ff, #6366f1);
  -webkit-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.3s;
  pointer-events: none;
}
.feature-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 25px rgba(138, 43, 226, 0.5); /* Stronger Purple Glow */
  border-color: transparent;
}
.feature-item:hover::before {
  opacity: 1;
  animation: borderRotate 2s linear infinite;
}
.feature-item .icon { font-size: 2.5rem; margin-bottom: 20px; }
.feature-item h3 { color: var(--accent); margin-bottom: 15px; }
.feature-item p { color: #aaa; line-height: 1.6; font-size: 0.95rem; }

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  outline: none;
  font-family: var(--font-main);
  transition: all 0.2s;
}
.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}
.btn.primary:hover {
  background: #0052cc;
  box-shadow: 0 0 25px rgba(0, 102, 255, 0.6);
}
.btn.outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn.outline:hover {
  background: rgba(0, 102, 255, 0.1);
  color: #fff;
}
.btn.text { background: transparent; color: #eee; }
.btn.text:hover { color: #fff; background: rgba(255,255,255,0.05); }
.btn.big { padding: 15px 40px; font-size: 1.2rem; border-radius: 30px; }
.btn.full { width: 100%; }

/* --- Mega Menu --- */
.main-link-wrapper {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.main-link.nav-platform {
  cursor: default;
}

.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  width: 600px;
  background: rgba(15, 20, 25, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 12px 12px;
  padding: 30px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 10000;
}

.main-link-wrapper:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Darken Background on Hover */
.main-link-wrapper:hover::before {
  content: '';
  position: fixed;
  top: 80px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 80px);
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: -1; /* Behind the menu but above content */
  pointer-events: none;
  animation: fadeIn 0.3s forwards;
}

.mega-menu-column h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-family: var(--font-display);
  letter-spacing: 1px;
}

.mega-menu-column a {
  display: block;
  color: #aaa;
  padding: 8px 10px;
  margin-bottom: 5px;
  border-radius: 6px;
  transition: 0.2s;
  font-size: 0.9rem;
  text-decoration: none;
}

.mega-menu-column a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  padding-left: 15px;
  border-left: 2px solid var(--accent);
}

/* --- 疑難排解下拉 (單欄) --- */
.nav-help-wrapper .help-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  min-width: 240px;
  background: rgba(15, 20, 25, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 10px 10px;
  padding: 12px 0;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  z-index: 10000;
}
.nav-help-wrapper:hover .help-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.nav-help-wrapper .help-dropdown a {
  display: block;
  color: #ccc;
  padding: 10px 20px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-help-wrapper .help-dropdown a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.main-link.nav-help {
  cursor: default;
}

.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  z-index: 9999; /* Force Top */
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.main-nav {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.main-brand {
  display: flex;
  align-items: center;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.main-brand img {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  margin-right: 12px;
  border: 2px solid var(--primary);
}

.main-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.main-link {
  color: #ccc;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.2s;
  position: relative;
  text-transform: uppercase;
}
.main-link:hover, .main-link.active {
  color: #fff;
  background: rgba(255,255,255,0.05);
  text-shadow: 0 0 8px rgba(255,255,255,0.5);
}
.main-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.main-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.main-cart-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: 0.2s;
}
.main-cart-btn:hover {
  border-color: var(--primary);
  background: rgba(0, 102, 255, 0.1);
}

.main-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
}

.main-mobile-menu {
  position: fixed;
  top: 80px;
  left: 0;
  width: 100%;
  background: rgba(5,5,5,0.98);
  backdrop-filter: blur(15px);
  padding: 20px;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
  z-index: 9998;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  visibility: hidden;
  opacity: 0;
}
.main-mobile-menu.active {
  transform: translateY(0);
  visibility: visible;
  opacity: 1;
}

/* Badge Style */
.badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
}

@media (max-width: 992px) {
  .main-links { display: none; }
  .main-mobile-toggle { display: block; }
  .desktop-only { display: none !important; } /* Hide desktop-only elements */
}

/* --- Product Grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 60px;
}
/* 商品卡同一行等高，標題／描述以省略號截斷 */
#product-grid .grid,
.category-card-body .grid {
  align-items: stretch;
}
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

/* --- Product Card --- */
.card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 15px rgba(138, 43, 226, 0.2);
  z-index: 0;
  isolation: isolate;
}

/* 商品卡 hover：細一點、不顯眼的彩色框 */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(90deg, rgba(0,102,255,0.6), rgba(0,212,255,0.5), rgba(168,85,247,0.5), rgba(236,72,153,0.5), rgba(0,102,255,0.6));
  background-size: 400% 100%;
  -webkit-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.3s;
  pointer-events: none;
  z-index: 0;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.25), 0 0 12px rgba(99, 102, 241, 0.12);
  border-color: transparent;
}
.card:hover::before {
  opacity: 0.85;
  animation: borderRotate 4s linear infinite;
}
@keyframes borderRotate {
  0% { background-position: 0% 50%; }
  100% { background-position: 400% 50%; }
}

/* --- Product Card Image Fix (Background Method) --- */
.card-img-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  overflow: hidden;
  background: #000;
}

/* 整張商品圖可點擊進入商品頁（與查看詳情相同） */
.card-img-link {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
  cursor: pointer;
}

.card-img-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.5s ease;
}

.card-img-wrapper .tag,
.card-img-wrapper .card-category-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
}
.card-img-wrapper .card-category-tag.tag-cat-pc {
  background: #00e5ff;
  color: #000;
}
.card-img-wrapper .card-category-tag.tag-cat-mobile {
  background: rgba(255, 0, 170, 0.9);
  color: #fff;
}
.card-img-wrapper .card-category-tag.tag-cat-other {
  background: rgba(255, 255, 255, 0.85);
  color: #1a1a1a;
}
.card-img-wrapper .card-category-tag.tag-cat-agent {
  background: #f0b429;
  color: #1a1a1a;
}
.card-img-wrapper .card-category-tag.tag-cat-machine {
  background: #9d4edd;
  color: #fff;
}
.card-img-wrapper .card-category-tag.tag-cat-simulator {
  background: #00c853;
  color: #fff;
}
.card-img-wrapper .card-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 2;
}
.card-img-wrapper:hover .card-overlay {
  opacity: 1;
}

.card-soldout-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff4444;
  color: #fff;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 3;
  font-weight: 600;
}
.card.product-item.is-soldout .card-img-bg {
  filter: brightness(0.85);
}
.card.product-item .btn-soldout {
  margin-top: auto;
  opacity: 0.9;
  cursor: pointer;
  text-decoration: none;
}

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

/* 商品卡：等高、標題與描述截斷為省略號 */
.card.product-item {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.card.product-item .card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 15px;
  background: rgba(10, 15, 24, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 0 0 12px 12px;
  position: relative;
  z-index: 1;
}
.card.product-item .card-title-row {
  flex-shrink: 0;
  margin-bottom: 10px;
  min-width: 0;
}
.card.product-item .card-content .card-title,
.card.product-item .card-content h3 {
  font-size: 1.1rem;
  margin: 0;
  line-height: 1.4;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}
.card.product-item .card-content .desc {
  flex: 1;
  min-height: 0;
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.85);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.card.product-item .btn.full-width-bottom,
.card.product-item .btn-soldout {
  flex-shrink: 0;
  margin-top: auto;
}
.card.product-item .card-content > div:first-child {
  flex-shrink: 0;
}

/* 商品卡：查看詳情按鈕樣式 */
.card.product-item .btn.full-width-bottom {
  display: inline-block;
  text-align: center;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(99, 102, 241, 0.25);
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(129, 140, 248, 0.5);
  transition: all 0.25s;
}
.card.product-item .btn.full-width-bottom:hover {
  background: rgba(99, 102, 241, 0.45);
  box-shadow: 0 0 16px var(--accent);
  border-color: var(--primary);
  color: #fff;
}

/* Ensure no img tag interference */
.card-img { display: none !important; }

/* Mobile Adjustments */
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 1.1rem; margin-bottom: 10px; color: #fff; }
.card-price {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 15px;
}
.card-tags { display: flex; gap: 8px; margin-bottom: 15px; flex-wrap: wrap; }
.tag {
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  color: #ccc;
}
.card-actions { margin-top: auto; }

/* --- Modals --- */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 10001; /* Higher than main-header (9999) */
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s;
}
.modal.active { display: flex; opacity: 1; }
.modal-content {
  background: #111;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 400px;
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}
.modal.active .modal-content { transform: translateY(0); }
.modal.right { justify-content: flex-end; }
.modal.right .modal-content {
  height: 100%;
  max-width: 400px;
  border-radius: 0;
  transform: translateX(100%);
  margin: 0;
}
.modal.right.active .modal-content { transform: translateX(0); }

/* 自訂主題模態：滑條可拖動（覆寫全域 cursor、確保可點擊） */
#modal-customize input[type="range"] {
  cursor: grab !important;
  pointer-events: auto !important;
  min-height: 28px;
  padding: 0 4px;
  margin: 0;
  touch-action: none;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  width: 100%;
  flex: 1;
  min-width: 0;
}
#modal-customize input[type="range"]:active {
  cursor: grabbing !important;
}
#modal-customize input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  pointer-events: auto;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 8px var(--accent);
}
#modal-customize input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  pointer-events: auto;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 8px var(--accent);
}

.form-label { display: block; margin-bottom: 4px; color: #ccc; font-size: 0.9rem; }
.form-hint { color: var(--text-dim); font-weight: normal; font-size: 0.8rem; }
.form-err { display: block; margin-top: 4px; margin-bottom: 8px; color: #ff6b6b; font-size: 0.85rem; min-height: 1.2em; }
.form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid #333;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-main);
}
.form input:focus { border-color: var(--primary); outline: none; }
.form input.input-error { border-color: #ff6b6b; }

/* --- Cart --- */
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #333; }
.cart-items { flex: 1; overflow-y: auto; max-height: calc(100vh - 200px); }
.cart-item { display: flex; gap: 15px; padding: 15px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.cart-item img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 0.9rem; margin-bottom: 5px; }
.cart-item-price { color: var(--accent); font-size: 0.9rem; }
.cart-footer { margin-top: 20px; padding-top: 20px; border-top: 1px solid #333; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }

/* --- Responsive --- */
@media (max-width: 992px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .grid-controls.desktop-only { display: none; }
}
@media (max-width: 768px) {
  .grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
  .hero-title { font-size: 2.5rem; }
  
  /* Mobile: 商品卡佈局改為 2 欄、不拉長，視覺與電腦版一致（同 padding、字級、標題單行省略、描述 2 行） */
  #product-grid .grid,
  .category-card-body .grid,
  .game-section .grid {
    align-items: start !important;
  }
  .card.product-item,
  .game-section .card.product-item {
    width: 100%;
    min-height: 0 !important;
    height: auto !important;
    align-self: start !important;
  }
  .game-section .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .card.product-item .card-img-wrapper {
    flex-shrink: 0 !important;
    padding-top: 56.25% !important;
    height: 0 !important;
    overflow: hidden !important;
  }
  /* 與電腦版相同：content padding 15px、標題 1.1rem 單行省略、描述 2 行、按鈕樣式一致 */
  .card.product-item .card-content {
    flex: 0 0 auto !important;
    min-height: 0 !important;
    padding: 15px !important;
  }
  .card.product-item .card-title-row {
    margin-bottom: 10px !important;
  }
  .card.product-item .card-content .card-title,
  .card.product-item .card-content h3 {
    font-size: 1.1rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .card.product-item .desc {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    margin-bottom: 15px !important;
    font-size: inherit !important;
    line-height: 1.5 !important;
  }
  .card.product-item .btn.full-width-bottom,
  .card.product-item .btn-soldout {
    padding: 10px 20px !important;
    font-size: inherit !important;
    margin-top: auto !important;
  }
  .card-img-wrapper .tag,
  .card-img-wrapper .card-category-tag {
    top: 8px !important;
    left: 8px !important;
    font-size: 0.8rem !important;
    padding: 5px 12px !important;
  }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
  /* 遊戲分類商品卡：手機維持 2 欄，2*2 依序往下 */
  .game-section .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: start !important;
    gap: 10px !important;
  }
  #product-grid .grid,
  .category-card-body .grid { align-items: start !important; }
  .card.product-item { width: 100%; align-self: start !important; }
  .filter-group { flex-direction: column; }
}

/* --- Utilities --- */
/* DEFAULT VISIBLE to prevent invisible content bugs */
.fade-in-section { 
  opacity: 1; 
  transform: translateZ(0);
  visibility: visible;
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  will-change: opacity;
}

/* Only hide if we are sure JS is running and ready to animate */
.js-ready .fade-in-section.pending-show {
  opacity: 0;
  transform: translateY(24px) translateZ(0);
}

.fade-in-section.is-visible { 
  opacity: 1 !important; 
  transform: translateZ(0) !important; 
  visibility: visible !important;
  will-change: auto;
}

.fade-in-section.fade-out {
  opacity: 0 !important;
  transform: translateY(-20px) translateZ(0) !important;
  transition: opacity 0.4s ease-in, transform 0.4s ease-in;
}

/* Glass Panel for News */
.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 25px;
}

/* 最新輔助更新消息：最多顯示約 4 則，右側常駐滾動條 */
#news-container {
  max-height: 480px;
  overflow-y: scroll;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}
#news-container > *:last-child { margin-bottom: 0; padding-bottom: 0; }
/* 網頁風格滾動條（常駐顯示） */
#news-container::-webkit-scrollbar {
  width: 10px;
}
#news-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
}
#news-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 5px;
}
#news-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* User Menu Dropdown */
.user-menu-container { position: relative; display: inline-block; }
.user-icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  transition: 0.3s;
}
.user-icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--accent); }
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: #051e3c; /* Dark Blue tint like screenshot */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: none;
  z-index: 1001;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.user-dropdown.show { display: block; animation: fadeIn 0.2s; }

.user-menu-header {
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.user-avatar-large {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
}
.user-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.user-name { font-weight: bold; color: #fff; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { font-size: 0.8rem; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-menu-scroll {
  padding: 8px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #ccc;
  border-radius: 6px;
  transition: 0.2s;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.user-menu-item .icon {
  font-style: normal;
  width: 20px;
  text-align: center;
}
.user-menu-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

/* Highlight Style (紫粉) */
.user-menu-item.highlight {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 102, 255, 0.3);
}
.user-menu-item.highlight:hover {
  background: #0052cc;
}

.user-menu-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px;
  margin-top: 5px;
}

/* 手機端：用戶選單下拉不超出視窗、代理模式等項目可讀 */
@media (max-width: 480px) {
  .user-dropdown {
    width: min(280px, calc(100vw - 24px));
    max-width: none;
    right: 0;
    left: auto;
  }
  .user-menu-item {
    padding: 10px 12px;
    font-size: 0.9rem;
    flex-wrap: wrap;
    gap: 6px;
  }
  .user-menu-item .icon { flex-shrink: 0; }
  .user-menu-item #agent-mode-badge,
  .user-menu-item [id="agent-mode-badge"] {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.75rem;
  }
}

/* --- Footer & 右下角版本號 --- */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
}
.site-version {
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.8;
}
.site-version-fixed {
  position: fixed;
  bottom: 10px;
  right: 15px;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
  z-index: 9998;
  pointer-events: none;
}

/* --- 首頁 Footer 大改版：藍紫漸層、四欄、版權列 --- */
.footer-main {
  margin-top: 60px;
  background: linear-gradient(90deg, #1a1a3e 0%, #2d1b4e 25%, #3d2a6a 50%, #4a3a8a 75%, #5c4a9e 100%);
  color: #fff;
}
.footer-inner.container {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 20px 36px;
  align-items: start;
}
.footer-col.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.footer-main .footer-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  box-shadow: 0 0 16px rgba(0, 102, 255, 0.4);
}
.footer-main .footer-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.9);
  margin: 0;
  max-width: 280px;
}
.footer-main .footer-desc[contenteditable="true"] {
  outline: none;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
}
.footer-main .footer-desc[contenteditable="true"]:hover {
  background: rgba(255,255,255,0.06);
}
.footer-main .footer-desc[contenteditable="true"]:focus {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.footer-main .footer-desc:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,0.5);
}
.footer-main .footer-contact-editable {
  outline: none;
}
.footer-main .footer-contact-editable:hover {
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
}
.footer-main .footer-contact-editable:focus {
  background: rgba(255,255,255,0.08);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
  border-radius: 8px;
}
.footer-main .footer-contact-editable:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,0.5);
}
.footer-main .footer-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 14px 0;
  color: #fff;
  letter-spacing: 0.5px;
}
.footer-main .footer-line {
  margin: 0 0 8px 0;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.9);
}
.footer-main .footer-link {
  color: #a8c4ff;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-main .footer-link:hover {
  color: #c5dcff;
}
.footer-main .footer-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-main .footer-nav a {
  color: rgba(255,255,255,0.9);
  font-size: 0.9rem;
  transition: color 0.2s;
}
.footer-main .footer-nav a:hover {
  color: #c5dcff;
}
.footer-main .footer-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-main .footer-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.footer-main .footer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.footer-main .footer-btn-dc {
  background: #5865f2;
  color: #fff;
  border: none;
}
.footer-main .footer-btn-line {
  background: #06c755;
  color: #fff;
  border: none;
}
.footer-bottom.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.85);
}
.footer-bottom .site-version {
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
}
@media (max-width: 900px) {
  .footer-inner.container {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .footer-inner.container {
    grid-template-columns: 1fr;
    padding: 32px 20px 24px;
    gap: 28px;
  }
  .footer-main .footer-logo {
    width: 80px;
    height: 80px;
  }
  .footer-bottom.container {
    flex-direction: column;
    text-align: center;
  }
}

/* --- 回到頂部按鈕 --- */
.btn-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 2px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.btn-scroll-top:hover {
  background: #2d2d2d;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6);
}
.btn-scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.user-menu-item.logout {
  color: #ff6666;
}
.user-menu-item.logout:hover {
  background: rgba(255, 0, 0, 0.1);
}

/* --- Mouse Trail & Hearts --- */
.mouse-trail {
  position: absolute;
  width: 10px;
  height: 10px;
  background: pink;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  box-shadow: 0 0 10px pink;
}

.falling-heart {
  position: fixed;
  top: -20px;
  font-size: 4px !important;
  transform: scale(0.7);
  color: #ff69b4;
  user-select: none;
  pointer-events: none;
  z-index: 0;
  animation: fall linear forwards;
  text-shadow: 0 0 2px #ff69b4;
  -webkit-text-size-adjust: none;
}

@keyframes fall {
  from { transform: scale(0.7); }
  to { transform: translateY(110vh) rotate(360deg) scale(0.7); }
}

/* --- Dark Overlay for Products Page --- */
.page-dark-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85); /* 85% 暗化 */
  z-index: -1;
  pointer-events: none;
}

.category-filter {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-btn {
  background: radial-gradient(120% 120% at 10% 10%, rgba(0, 153, 255, 0.15) 0%, rgba(255, 0, 170, 0.12) 40%, rgba(255,255,255,0.06) 100%);
  border: 1px solid rgba(0, 153, 255, 0.5);
  color: #fff;
  padding: 10px 22px;
  border-radius: 22px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.2s ease-out;
  box-shadow: 0 0 8px rgba(0, 153, 255, 0.4), inset 0 0 8px rgba(255, 0, 170, 0.25);
}
.filter-btn:hover, .filter-btn.active {
  background: linear-gradient(135deg, rgba(0, 153, 255, 0.4), rgba(255, 0, 170, 0.4));
  border-color: rgba(255, 0, 170, 0.8);
  box-shadow: 0 0 16px rgba(0, 153, 255, 0.7), 0 0 22px rgba(255, 0, 170, 0.5);
}
.filter-group {
  display: none;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 153, 255, 0.35);
  background: linear-gradient(135deg, rgba(0, 153, 255, 0.12), rgba(255, 0, 170, 0.12));
  box-shadow: 0 0 20px rgba(0, 153, 255, 0.25), inset 0 0 12px rgba(255, 0, 170, 0.2);
}

/* 遊戲分類選項卡（主頁） */
.game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.game-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.2s, box-shadow 0.2s, background 0.2s;
  border-left: 3px solid transparent;
  margin-left: 0;
  border-radius: 0 6px 6px 0;
}
.game-tab:hover {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.6);
}
.game-tab.active {
  color: var(--accent);
  border-left-color: var(--primary);
  background: rgba(0, 243, 255, 0.06);
  text-shadow: 0 0 14px rgba(0, 243, 255, 0.8);
  box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
}
@media (max-width: 768px) {
  .game-tabs { gap: 6px; }
  .game-tab { padding: 10px 14px; font-size: 0.95rem; }
}

/* 遊戲分類卡（點擊才展開，預設只顯示圖示+名稱） */
.category-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}
.category-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.3s;
  z-index: 0;
  isolation: isolate;
}
/* 分類卡 hover：細一點、不顯眼的彩色框（與商品卡一致） */
.category-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(90deg, rgba(0,102,255,0.6), rgba(0,212,255,0.5), rgba(168,85,247,0.5), rgba(236,72,153,0.5), rgba(0,102,255,0.6));
  background-size: 400% 100%;
  -webkit-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.3s;
  pointer-events: none;
  z-index: 0;
}
.category-card:hover {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.22), 0 0 10px rgba(99, 102, 241, 0.1);
}
.category-card:hover::before {
  opacity: 0.85;
  animation: borderRotate 4s linear infinite;
}
.category-card-tag-wrap {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
}
.category-card-tag-wrap .card-category-tag {
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.category-card-tag-wrap .card-category-tag.tag-cat-pc { background: #00e5ff; color: #000; }
.category-card-tag-wrap .card-category-tag.tag-cat-mobile { background: rgba(255, 0, 170, 0.9); color: #fff; }
.category-card-tag-wrap .card-category-tag.tag-cat-other { background: rgba(255, 255, 255, 0.85); color: #1a1a1a; }
.category-card-tag-wrap .card-category-tag.tag-cat-agent { background: #f0b429; color: #1a1a1a; }
.category-card-tag-wrap .card-category-tag.tag-cat-machine { background: #9d4edd; color: #fff; }
.category-card-tag-wrap .card-category-tag.tag-cat-simulator { background: #00c853; color: #fff; }
.category-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  min-height: 88px;
  cursor: pointer;
  border-left: 4px solid var(--primary);
  background: rgba(99, 102, 241, 0.06);
  transition: background 0.2s, border-color 0.2s;
}
.category-card-header:hover {
  background: rgba(168, 85, 247, 0.12);
  border-left-color: rgba(168, 85, 247, 0.9);
}
.category-card:hover .category-card-header {
  border-left-color: rgba(236, 72, 153, 0.85);
}
.category-card-icon-wrap {
  width: 88px;
  min-width: 88px;
  height: 88px;
  flex-shrink: 0;
  overflow: hidden;
  background: #111;
}
.category-card-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  vertical-align: middle;
}
.category-card-title-wrap {
  flex: 1;
  padding: 12px 16px 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.category-card-title {
  color: var(--accent);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  text-shadow: 0 0 12px rgba(0, 243, 255, 0.4);
}
.category-card-badge {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
.category-card-chevron {
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
  transition: transform 0.25s;
}
.category-card.expanded .category-card-chevron {
  transform: rotate(180deg);
}
.category-card-body {
  padding: 0;
  display: none;
  flex-direction: column;
  flex: 1;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.category-card.expanded .category-card-body {
  display: flex;
  padding: 16px;
}
.category-card-body .grid {
  margin: 0;
  gap: 16px;
}
@media (max-width: 768px) {
  /* 手機：分類卡統一高度（與傳說對決同尺寸），新增分類亦同 */
  .category-cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .category-card {
    min-height: 0;
  }
  .category-card-tag-wrap {
    top: 6px;
    left: 6px;
  }
  .category-card-tag-wrap .card-category-tag {
    padding: 4px 10px;
    font-size: 0.75rem;
  }
  .category-card-header {
    height: 96px;
    min-height: 96px;
    max-height: 96px;
    align-items: center;
    gap: 0;
    position: relative;
    padding: 0;
    border-left: none;
  }
  .category-card-icon-wrap {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    height: 72px;
    min-height: 72px;
    max-height: 72px;
    flex-shrink: 0;
    border-left: 4px solid var(--primary);
  }
  .category-card-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
  .category-card-title-wrap {
    min-width: 0;
    flex: 1;
    padding: 12px 36px 12px 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .category-card-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }
  .category-card-badge {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    flex-shrink: 0;
  }
  .category-card-chevron {
    font-size: 1.25rem;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
  }
  .category-card-body .grid {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start !important;
  }
  .game-section { margin-top: 12px; }
  #product-grid > div:first-child { margin-bottom: 12px; }
  .card.product-item {
    min-width: 0;
    align-self: start !important;
  }
  /* 與電腦版一致：標題單行省略、content padding 與字級同桌面 */
  .card.product-item .card-content .card-title,
  .card.product-item .card-content h3 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .card.product-item .card-content { padding: 15px; }
  .card.product-item .desc { font-size: inherit; }
}

/* Status Section New Layout (Admin-like) */
.status-layout {
  display: flex;
  gap: 30px;
  background: transparent;
  padding: 0;
  min-height: 400px;
}

.status-sidebar {
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.status-sidebar-title {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 10px;
  padding-left: 10px;
}

.status-tab {
  background: transparent;
  border: none;
  color: #aaa;
  text-align: left;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: var(--font-main);
}

.status-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.status-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 102, 255, 0.4);
}

.status-content {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-content: start;
}

/* Status Items：遊戲分類可收起、一行兩個，各自獨立不互相綁定 */
.status-group {
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  align-self: start;
}

.status-group-header {
  padding: 15px 20px;
  font-size: 1.1rem;
  color: var(--accent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-display);
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 0.2s;
}
.status-group-header:hover {
  background: rgba(255, 255, 255, 0.05);
}
.status-group-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.25s;
}
.status-group.collapsed .status-group-chevron {
  transform: rotate(-90deg);
}
.status-group.collapsed .status-group-header {
  border-bottom: none;
}
.status-group.collapsed .status-list {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.status-list {
  display: flex;
  flex-direction: column;
  max-height: 800px;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

.status-row:last-child {
  border-bottom: none;
}

.status-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.status-name {
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
  display: flex;
  align-items: center;
}
.status-name::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 12px;
  box-shadow: 0 0 8px var(--accent);
}

.status-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-ver {
  color: #666;
  font-size: 0.85rem;
  font-family: monospace;
}

.status-badge {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.status-badge.safe { 
  background: rgba(22, 163, 74, 0.15); 
  color: #4ade80; 
  border: 1px solid rgba(22, 163, 74, 0.3); 
}

.status-badge.risk { 
  background: rgba(234, 88, 12, 0.15); 
  color: #fb923c; 
  border: 1px solid rgba(234, 88, 12, 0.3); 
}

.status-badge.maintenance { 
  background: rgba(220, 38, 38, 0.15); 
  color: #f87171; 
  border: 1px solid rgba(220, 38, 38, 0.3); 
}

@media (max-width: 768px) {
  .status-layout {
    flex-direction: column;
    gap: 10px;
  }
  .status-sidebar {
    width: 100%;
    border-right: none;
    padding-top: 0;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .status-content {
    grid-template-columns: 1fr;
  }
  .status-tab {
    white-space: nowrap;
    padding: 8px 15px;
  }
  .status-row {
    padding: 15px;
  }
  .status-meta {
    gap: 10px;
  }
}

/* --- RESTORED PRODUCT DETAIL STYLES --- */
.product-detail-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 40px;
}
@media (max-width: 768px) {
  .product-detail-container {
    grid-template-columns: 1fr;
  }
  .detail-img {
    max-height: 300px;
    object-fit: contain;
    background: rgba(0,0,0,0.2);
  }
  /* 方案選項：手機避免名稱與價格擠在一起溢出 */
  .plan-option-row { min-width: 0; }
  .plan-option-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
  }
  .plan-option-price { flex-shrink: 0; }
  .price-range { font-size: 1.25rem; }
}
.detail-img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.feature-list {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}
.feature-list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
}
.feature-list li:before {
  content: "✓";
  color: var(--accent);
  margin-right: 10px;
  font-weight: bold;
}
.plan-select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
.plan-option {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}
.plan-option:hover {
  background: rgba(255,255,255,0.1);
}
.plan-option input {
  margin-right: 15px;
  transform: scale(1.2);
}
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
}
.gallery img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.gallery img:hover, .gallery img.active {
  border-color: var(--accent);
}
.btn-neon {
  border: 1px solid var(--accent);
  box-shadow: 0 0 5px var(--accent), inset 0 0 5px var(--accent);
  color: var(--accent);
  background: rgba(0, 243, 255, 0.1);
  text-shadow: 0 0 5px var(--accent);
  transition: all 0.3s;
}
.btn-neon:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 20px var(--accent);
  text-shadow: none;
}
.neon-text {
  color: #fff;
  text-shadow: 0 0 5px var(--primary), 0 0 10px var(--primary), 0 0 20px var(--primary);
}
.neon-box {
  border: 1px solid var(--accent);
  box-shadow: 0 0 8px var(--accent), inset 0 0 8px rgba(0, 243, 255, 0.1);
  padding: 20px;
  border-radius: 12px;
  background: rgba(0, 243, 255, 0.05);
  margin-bottom: 20px;
  backdrop-filter: blur(5px);
}

/* Gallery Styles */
.main-image-wrapper {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-bottom: 10px;
}
.main-image-wrapper img {
  width: 100%;
  display: block;
  aspect-ratio: 16/9;
  object-fit: cover;
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  padding: 15px 10px;
  cursor: pointer;
  font-size: 20px;
  transition: 0.3s;
  z-index: 2;
  opacity: 0;
}
.main-image-wrapper:hover .gallery-nav {
  opacity: 1;
}
.gallery-nav:hover {
  background: rgba(0,0,0,0.8);
  color: var(--accent);
}
.gallery-nav.prev { left: 0; border-top-right-radius: 5px; border-bottom-right-radius: 5px; }
.gallery-nav.next { right: 0; border-top-left-radius: 5px; border-bottom-left-radius: 5px; }

.gallery-zoom-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.3s;
  z-index: 2;
  opacity: 0;
}
.main-image-wrapper:hover .gallery-zoom-btn {
  opacity: 1;
}
.gallery-zoom-btn:hover {
  background: var(--accent);
  color: #000;
}

/* Lightbox */
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
}
.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 20px var(--accent);
  border-radius: 8px;
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
}

/* Toast 右下角通知（付款／登入等事件） */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 15px 20px;
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  animation: toastSlideIn 0.3s ease-out forwards;
  display: flex;
  align-items: center;
  min-width: 220px;
}
.toast.error {
  border-color: #ff4444;
}
.toast i { margin-right: 10px; font-size: 1.2rem; }
@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
