.skills-section {
  padding: 60px 0;
  background: linear-gradient(135deg, #0d1117, #161b22);
  color: #fff;
  /* 在section上方加一條線 */
  border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.skills-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  justify-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Card */
.skill-card {
  width: 100%;
  max-width: 500px;
  min-height: 400px; /* 用最小高度替代固定比例 */
  border-radius: 20px;
  background: linear-gradient(145deg,
      rgba(255, 255, 255, 0.03),
      rgba(255, 255, 255, 0.05)),
      var(--theme-bg, transparent);

  /* 邊框預設淡淡的主題色 */
  border: 1.5px solid rgba( var(--theme-rgb, 255,255,255), 0.35 );

  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all 0.4s ease;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}

/* 懸停時加強顏色和光暈 */
.skill-card:hover {
  border: 2px solid var(--theme-main);
  box-shadow: 
    0 0 25px var(--theme-shadow),
    0 12px 28px rgba(0,0,0,0.5);
  transform: translateY(-6px);
}

/* 導光條 */
.skill-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 4px;
  width: 0;
  background: var(--theme-gradient);
  box-shadow: 0 0 15px var(--theme-shadow);
  transition: width 0.7s ease;
}
.skill-card:hover::before { width: 100%; }

/* Icon - 響應式但保持比例 */
.skill-icon {
  width: 70px; 
  height: 70px;
  min-width: 60px; /* 最小尺寸保護 */
  min-height: 60px;
  border-radius: 16px;
  display: flex; 
  justify-content: center; 
  align-items: center;
  margin: 0 auto 0.5rem;
  font-size: 1.6rem;
  color: #fff;
  background: var(--theme-gradient);
  box-shadow: 0 0 20px var(--theme-shadow);
  transition: transform 0.3s ease;
  flex-shrink: 0; /* 防止被壓縮 */
}

/* 只保留旋轉效果，移除縮放以維持固定大小 */
.skill-card:hover .skill-icon { 
  transform: rotate(5deg); 
}

/* Title */
.skill-title {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Skill Item */
.skill-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
  transition: all 0.3s ease;
}
.skill-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.skill-item span {
  font-size: 0.9rem;
  font-weight: 500;
}
.skill-item .percent {
  margin-left: 1rem;
  background: rgba(255,255,255,0.08);
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--theme-main);
  text-shadow: 0 0 6px var(--theme-shadow);
  font-size: 0.85rem;
  min-width: 55px; /* 增加最小寬度 */
  width: 55px; /* 固定寬度確保對齊 */
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace; /* 使用等寬字體 */
}
.skill-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--theme-main);
  box-shadow: 0 0 12px var(--theme-shadow);
  transform: translateX(5px);
}
.skill-item:hover .percent {
  background: var(--theme-gradient);
  color: #fff;
  box-shadow: 0 0 12px var(--theme-shadow);
  transform: scale(1.05);
}

/* Progress */
.progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.progress-bar {
  width: 0;
  height: 100%;
  background: var(--theme-gradient);
  animation: fillBar 1.8s ease forwards;
}
@keyframes fillBar { from { width: 0; } to { width: var(--progress); } }

/* 主題色 */
.skill-card.ai {
  --theme-main: #00d2d3;
  --theme-rgb: 0,210,211;
  --theme-gradient: linear-gradient(135deg,#00d2d3,#58a6ff);
  --theme-shadow: rgba(88,166,255,0.6);
  --theme-bg: linear-gradient(145deg, rgba(0,210,211,0.05), rgba(88,166,255,0.05));
}

.skill-card.iot {
  --theme-main: #2ed573;
  --theme-rgb: 46,213,115;
  --theme-gradient: linear-gradient(135deg,#2ed573,#11998e);
  --theme-shadow: rgba(46,213,115,0.6);
  --theme-bg: linear-gradient(145deg, rgba(46,213,115,0.05), rgba(17,153,142,0.05));
}

.skill-card.design {
  --theme-main: #ff9f43;
  --theme-rgb: 255,159,67;
  --theme-gradient: linear-gradient(135deg,#ff9f43,#ff6b6b);
  --theme-shadow: rgba(255,159,67,0.6);
  --theme-bg: linear-gradient(145deg, rgba(255,159,67,0.05), rgba(255,107,107,0.05));
}

.skill-card.academic {
  --theme-main: #74b9ff;
  --theme-rgb: 116,185,255;
  --theme-gradient: linear-gradient(135deg,#74b9ff,#0984e3);
  --theme-shadow: rgba(116,185,255,0.6);
  --theme-bg: linear-gradient(145deg, rgba(116,185,255,0.05), rgba(9,132,227,0.05));
}

.skill-card.industry {
  --theme-main: #f093fb;
  --theme-rgb: 240,147,251;
  --theme-gradient: linear-gradient(135deg,#f093fb,#f5576c);
  --theme-shadow: rgba(240,147,251,0.6);
  --theme-bg: linear-gradient(145deg, rgba(240,147,251,0.05), rgba(245,87,108,0.05));
}

.skill-card.teaching {
  --theme-main: #a29bfe;
  --theme-rgb: 162,155,254;
  --theme-gradient: linear-gradient(135deg,#a29bfe,#6c5ce7);
  --theme-shadow: rgba(162,155,254,0.6);
  --theme-bg: linear-gradient(145deg, rgba(162,155,254,0.05), rgba(108,92,231,0.05));
}

.skills-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(
        45deg,
        #58a6ff,
        #00d2d3,
        #2ed573,
        #f093fb,
        #58a6ff
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 4s ease-in-out infinite;
    text-align: center;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.skills-section .text-muted {
    font-size: 1.2rem;
    /*color: rgba(201, 209, 217, 0.8);*/
    color: #e93b7b;
    margin: 0;
    /*font-style: italic;*/
    max-width: 800px;
    margin: 0 auto;
    text-align: center; 
}

/* 簡化的響應式設計 */
@media (max-width: 768px) {
  .skill-card {
    min-height: 350px;
  }
  
  .skill-icon {
    width: 60px;
    height: 60px;
    font-size: 1.4rem;
  }
}

@media (max-width: 480px) {
  .skill-card {
    min-height: 320px;
    padding: 1.2rem;
  }
  
  .skill-icon {
    width: 55px;
    height: 55px;
    font-size: 1.3rem;
  }
  
  .skills-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}