:root {
  --bg-color: #050a14;
  --panel-bg: rgba(13, 22, 38, 0.7);
  --accent-primary: #00d2ff;
  --accent-secondary: #9d50bb;
  --text-main: #e0e0e0;
  --text-dim: #a0a0a0;
  --card-glow: rgba(0, 210, 255, 0.2);
  --border-color: rgba(255, 255, 255, 0.1);
  --type1-color: #4facfe;
  --type2-color: #f093fb;
  --font-title: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* --- 背景效果 --- */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 40px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 130px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.15;
  z-index: -2;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 210, 255, 0.05) 50%), 
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 4px, 40px 40px, 40px 40px;
  pointer-events: none;
  z-index: -1;
  animation: gridMove 20s linear infinite;
}

/* 掃描線動畫 (由上往下掃) */
.grid-overlay::after {
  content: '';
  position: absolute;
  top: -10%;
  left: 0;
  width: 100%;
  height: 5px;
  background: rgba(0, 210, 255, 0.3);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.8), 0 0 30px rgba(0, 210, 255, 0.5);
  animation: scanline 10s ease-in-out infinite;
  opacity: 0.6;
}

@keyframes gridMove {
  0% { transform: translateY(0); }
  100% { transform: translateY(40px); }
}

@keyframes scanline {
  0% { top: -10%; opacity: 0; }
  10% { opacity: 0.8; }
  90% { opacity: 0.8; }
  100% { top: 110%; opacity: 0; }
}

/* --- 導覽列 --- */
.glass-header {
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 5%;
  background: rgba(13, 22, 38, 0.4);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.8rem;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--text-main);
}
.logo-text span {
  color: var(--accent-primary);
  text-shadow: 0 0 15px var(--accent-primary);
}

.user-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.profile-container {
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
}

.user-info {
  text-align: right;
  font-size: 0.85rem;
}
.user-name { font-weight: 700; color: #fff; }
.user-email { color: var(--text-dim); }

.hidden { display: none !important; }

/* --- 按鈕 --- */
.btn-primary {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(45deg, var(--accent-primary), #00a8ff);
  color: #000;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px var(--accent-primary);
}

.btn-outline {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}

/* --- 內容區域 --- */
.dashboard-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.dashboard-hero {
  text-align: center;
  margin-bottom: 60px;
}
.dashboard-hero h1 {
  font-family: var(--font-title);
  font-size: 3rem;
  margin-bottom: 10px;
}
.dashboard-hero p {
  color: var(--text-dim);
  font-size: 1.2rem;
  letter-spacing: 2px;
}

/* --- 分類標籤 --- */
.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
}
.tab-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  padding: 10px 24px;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.4s;
}
.tab-btn.active {
  background: rgba(0, 210, 255, 0.1);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* --- 工具網格 --- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
}

.tool-card {
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 30px;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
  display: flex;
  flex-direction: column;
  /* Add border fallback */
  border: 1px solid var(--border-color);
  z-index: 1; /* Keep content above animated border */
}

/* --- 動態邊框效果 (Cyberpunk Line) --- */
.tool-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    transparent, 
    transparent, 
    transparent, 
    var(--accent-primary)
  );
  animation: rotateBorder 7s linear infinite;
  z-index: -2;
  opacity: 0.3;
  transition: opacity 0.3s;
}

.tool-card::after {
  content: '';
  position: absolute;
  inset: 2px; /* 邊框寬度 */
  background: var(--panel-bg);
  border-radius: 18px; /* 比外層圓角小一點 */
  z-index: -1;
}

@keyframes rotateBorder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.tool-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 210, 255, 0.15);
}

.tool-card:hover::before {
  opacity: 1; /* 懸停時邊框光線變亮 */
  animation: rotateBorder 3s linear infinite; /* 懸停時加快一點 */
}

.card-glow {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at center, var(--accent-primary), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  z-index: -1;
}
.tool-card:hover .card-glow { opacity: 0.1; }

.tool-icon {
  width: 60px;
  height: 60px;
  margin-bottom: 20px;
  color: var(--accent-primary);
}

.tool-card h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.tool-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 25px;
  flex-grow: 1;
}

.badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 20px;
  font-weight: 700;
}
.dev-api { background: rgba(79, 172, 254, 0.2); color: #4facfe; }
.user-api { background: rgba(240, 147, 251, 0.2); color: #f093fb; }

.tool-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}
.tool-card:not(.locked):hover .tool-btn {
  background: var(--accent-primary);
  color: #000;
  border-color: var(--accent-primary);
}

/* --- 鎖定狀態 --- */
.tool-card.locked {
  filter: grayscale(0.8) opacity(0.7);
}
.lock-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  font-weight: 700;
  transition: all 0.3s;
}
.lock-overlay svg { width: 40px; color: #fff; }

.tool-card.unlocked {
  filter: none;
}
.tool-card.unlocked .lock-overlay {
  opacity: 0;
  pointer-events: none;
}

/* --- 頁尾 --- */
.glass-footer {
  text-align: center;
  padding: 40px;
  color: var(--text-dim);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: 60px;
}

/* --- RWD 手機版 --- */
@media (max-width: 768px) {
  .dashboard-hero h1 { font-size: 2.2rem; }
  .logo-text { font-size: 1.4rem; }
  .user-info { display: none; }
  .filter-tabs { flex-wrap: wrap; }
}
