* {
  box-sizing: border-box;
}
.flex {
  display: flex;
}
.switch-toggle-group {
  display: flex;
  /* justify-content: center; */
  /* margin: 32px 0 0 0; */
}
.switch-toggle {
  position: relative;
  display: inline-block;
  width: 90px;
  height: 38px;
  user-select: none;
}
.switch-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #e3f1ff;
  border-radius: 20px;
  transition: background 0.3s;
  box-shadow: 0 2px 6px #0001;
}
.slider:before {
  position: absolute;
  content: "";
  height: 32px;
  width: 32px;
  left: 3px;
  bottom: 3px;
  background: #3399ff;
  border-radius: 50%;
  transition:
    transform 0.3s cubic-bezier(0.4, 2, 0.6, 1),
    background 0.3s;
}
.switch-toggle input:checked + .slider {
  background: #b3e0ff;
}
.switch-toggle input:checked + .slider:before {
  transform: translateX(50px);
  background: #267acc;
}
.switch-label-left {
  position: absolute;
  top: 50%;
  left: -48px;
  font-size: 15px;
  font-weight: bold;
  color: #3399ff;
  transform: translateY(-50%);
  pointer-events: none;
}
.switch-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 32px 0 0 0;
}
.switch-btn {
  width: 120px;
  padding: 12px 0;
  background: #e3f1ff;
  color: #3399ff;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px #0001;
  transition:
    background 0.3s,
    color 0.3s,
    transform 0.25s;
  outline: none;
  position: relative;
}
.switch-btn.active {
  background: #3399ff;
  color: #fff;
  transform: scale(1.08);
  z-index: 1;
}
.switch-btn:not(.active):hover {
  background: #b3e0ff;
  color: #267acc;
  transform: scale(1.03);
}
.calc-btn {
  /* ...existing styles... */
  position: relative;
  overflow: hidden;
}
.calc-btn .ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-effect 0.5s linear;
  background-color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
@keyframes ripple-effect {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}
.calc-btn {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 12px 0;
  background: #3399ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px #0001;
  transition: background 0.2s;
  letter-spacing: 2px;
}
.calc-btn:hover {
  background: #267acc;
  color: #fff;
  box-shadow: 0 4px 12px #3399ff33;
}
.equip-radio-group {
  display: flex;
  gap: 12px;
  align-items: center;
}
.search-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  width: 100%;
}
.search-col {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
/* 屬性格格化：將 6 大屬性改為雙欄或三欄 */
.attributes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

.attribute-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* 裝備卡分組框：讓三張裝備卡的欄位更有區隔感 */
.equip-group-box {
  background: var(--glass-bg);
  border: 1.5px solid var(--glass-border);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.equip-group-box:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(77, 163, 255, 0.15);
}

.equip-group-title {
  font-size: 15px;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 輸入框美化 */
.hero-input, .equip-input, .search-input {
  border: 1.5px solid var(--glass-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 15px;
  transition: all 0.2s;
  background: var(--glass-bg);
  color: var(--text-main);
}

.hero-input:focus, .equip-input:focus, .search-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.2);
  outline: none;
}

/* 計算結果強化 */
.result-highlight {
  background: rgba(255, 252, 232, 0.05);
  border-left: 5px solid #ffcc00;
  padding: 12px;
  border-radius: 4px;
}

.result-value-big {
  font-size: 1.4em;
  font-weight: 800;
  color: var(--primary-blue);
}

/* 標題樣式：加入漸層與裝飾感 */
.hero-card h2 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  color: var(--primary-blue);
  margin-top: 0;
  margin-bottom: 30px;
  padding-bottom: 15px;
  position: relative;
  letter-spacing: 2px;
}

/* 標題底下的漸層裝飾線 */
.hero-card h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-dark));
  border-radius: 2px;
}

/* 標題前的裝飾符號 */
.hero-card h2::before {
  content: "✦";
  font-size: 18px;
  color: #ffcc00;
  margin-right: 10px;
  vertical-align: middle;
}

/* 強化卡片質感 */
.hero-card {
  max-width: 550px;
  margin: 30px auto;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  color: var(--text-main);
}

.hero-card:hover {
  transform: translateY(-5px);
}

/* 修正標籤字體 */
label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  display: inline-block;
}

/* 分隔線美化 */
hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-separator), transparent);
  margin: 25px 0;
}


.hero-card .hero-form-col {
  gap: 5px; /* 由 grid 接手間距 */
}

.switch-toggle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  padding: 8px 15px;
  border-radius: 30px;
  border: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
  .attributes-grid {
    grid-template-columns: 1fr; /* 手機版改回單欄 */
  }
}

.equip-row {
  display: flex;
  gap: 8px;
  flex-direction: column;
}
.equip-col {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.equip-input {
  width: 100%;
  display: inline-block;
  box-sizing: border-box;
  height: 30px;
}
.custom-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--nav-bg-1);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-sizing: border-box;
  box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.dropdown-item {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  cursor: pointer;
  background: transparent;
  color: var(--text-main);
  transition: background 0.2s;
}
.dropdown-item:hover {
  background: var(--nav-hover-bg);
  color: var(--primary-blue);
}

.hero-search-col {
  width: 100%;
  max-width: 500px;
}
.search-input {
  padding: 6px 10px;
  width: 100%;
  font-size: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  box-sizing: border-box;
}

.hero-content {
  gap: 12px;
  display: flex;
  justify-content: center;
}

.search-toggle-container {
  gap: 12px;
}

.hero-content .hero-item {
  flex: 0 1 500px; /* grow, shrink, basis */
  min-width: 0; /* 防止內容撐破 */
  box-sizing: border-box;
}

.hero-card--hint {
  position: relative;
}
.hero-card--hint .hint-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-card--hint .hint-btn.hint-position {
  position: absolute;
  top: 24px;
  right: 24px;
}

.hero-card--hint .hint-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3399ff;
  color: yellow;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 1px 3px #0003;
}
.hero-card--hint .hint-tooltip {
  position: absolute;
  top: 100%;
  right: 0px;
  background: #3399ff;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  white-space: nowrap;
  display: none;
  z-index: 60;
  box-shadow: 0 4px 12px #0003;
}
.hero-card--hint .hint-tooltip.show {
  display: block;
}

@media (max-width: 768px) {
  .hero-card {
    width: calc(100% - 46px);
    padding: 12px;
  }
  .hero-card--hint .hint-btn.hint-position {
    position: absolute;
    top: 12px;
    right: 12px;
  }
  .hero-content {
    flex-direction: column;
  }
  .hero-content .hero-item {
    display: flex;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .hero-card {
    width: calc(100% - 46px);
    padding: 12px;
  }
  .hero-card--hint .hint-btn.hint-position {
    position: absolute;
    top: 12px;
    right: 12px;
  }
  .hero-content {
    flex-direction: column;
    padding: 0;
    margin: 0;
  }
  .main {
    padding: 10px;
  }
  .hero-content .hero-item {
    display: flex;
    justify-content: center;
  }
}

/* 白天模式：計算器／精煉頁面只調整視覺，不影響計算邏輯 */
[data-theme="light"] .hero-card {
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .hero-card:hover {
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .switch-toggle-item,
[data-theme="light"] .equip-group-box {
  background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .slider {
  background: #e2e8f0;
}

[data-theme="light"] .switch-toggle input:checked + .slider {
  background: #bfdbfe;
}

[data-theme="light"] .custom-dropdown {
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .result-highlight {
  background: rgba(255, 216, 107, 0.12);
  border-left-color: #d97706;
}

[data-theme="light"] .hero-card .attribute-item[style*="background"] {
  background: #f8fbff !important;
  border-color: #dbeafe !important;
}

[data-theme="light"] .hero-card .attribute-item[style*="background"] label {
  color: #475569 !important;
}
