body {
    margin: 0;
    padding: 0;
    background-color: #0a0a0c;
    color: #eee;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a1a2e 0%, #0a0a0c 100%);
}

#game-container {
    position: relative;
    border: 4px solid #4a90e2;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(74, 144, 226, 0.3), inset 0 0 20px rgba(0,0,0,1);
    background-color: #000;
    overflow: hidden;
}

#game-container::after {
    content: " ";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.3;
}

#ui-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 100%);
    padding: 15px;
    border-bottom: 2px solid #4a90e2;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    font-weight: bold;
    z-index: 50;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.stats {
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.8);
}

.stats span {
    color: #4a90e2;
    font-size: 1.2em;
}

#ui-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.7) 100%);
    padding: 12px 20px;
    border-top: 2px solid #4a90e2;
    z-index: 50;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
}

/* 底部 UI 的捲動條美化 */
#ui-bottom::-webkit-scrollbar {
    height: 6px;
}

#ui-bottom::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
}

#ui-bottom::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 3px;
}

#ui-bottom::-webkit-scrollbar-thumb:hover {
    background: #7b4397;
}

/* --- 全新按鈕統一樣式 (Uiverse.io Style) --- */
.spawn-btn, .footer-btn, .overlay .spawn-btn, #close-shop, #redeem-btn {
  flex-shrink: 0;
  position: relative;
  background-color: #333 !important;
  color: #e8e8e8 !important;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 130px;
  height: 48px;
  border: 2px solid #4a90e2;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 4px;
  z-index: 1000;
}

/* 邊框顏色區分 */
#spawn-ultimate, .footer-btn.shop { border-color: #f1c40f !important; }
#open-shop, .shop-item .spawn-btn { border-color: #d4af37 !important; }
#close-shop, #retry-level, #close-base, #close-quests { border-color: #e74c3c !important; }
.footer-btn.upgrade { border-color: #00a8ff !important; }
.footer-btn.base { border-color: #2ecc71 !important; }
.footer-btn.quest { border-color: #e67e22 !important; }

/* 懸停時滑出的漸層背景 (Before) */
.spawn-btn::before, .footer-btn::before, .overlay .spawn-btn::before, #close-shop::before, #redeem-btn::before {
  content: attr(data-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(135deg, #4a90e2, #7b4397);
  transform: translateY(100%);
  z-index: 2;
  position: absolute;
  top: 0;
  left: 0;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.320, 1);
}

/* 特定按鈕的懸停漸層色 */
#spawn-ultimate:hover::before, .footer-btn.shop:hover::before { background: linear-gradient(135deg, #f1c40f, #e67e22); }
#open-shop:hover::before, .shop-item .spawn-btn:hover::before { background: linear-gradient(135deg, #d4af37, #f39c12); }
#close-shop:hover::before, #retry-level:hover::before, #close-base:hover::before, #close-quests:hover::before { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.footer-btn.base:hover::before { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.footer-btn.quest:hover::before { background: linear-gradient(135deg, #e67e22, #d35400); }

/* 平時顯示的文字內容 (After) */
.spawn-btn::after, .footer-btn::after, .overlay .spawn-btn::after, #close-shop::after, #redeem-btn::after {
  content: attr(data-text);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #222;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  position: absolute;
  top: 0;
  left: 0;
  transition: all 0.5s cubic-bezier(0.23, 1, 0.320, 1);
  padding: 0 8px;
  box-sizing: border-box;
  text-align: center;
}

/* 懸停觸發動畫 */
.spawn-btn:hover:not(:disabled)::before, .footer-btn:hover:not(:disabled)::before, .overlay .spawn-btn:hover:not(:disabled)::before, #close-shop:hover:not(:disabled)::before, #redeem-btn:hover:not(:disabled)::before {
  transform: translateY(0%);
}

.spawn-btn:hover:not(:disabled)::after, .footer-btn:hover:not(:disabled)::after, .overlay .spawn-btn:hover:not(:disabled)::after, #close-shop:hover:not(:disabled)::after, #redeem-btn:hover:not(:disabled)::after {
  transform: translateY(-100%);
}

/* 狀態處理 */
.spawn-btn:disabled, .footer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
    border-color: #555 !important;
}

.spawn-btn:active:not(:disabled), .footer-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 8, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* 改為從頂部開始，防止內容被切斷 */
    align-items: center;
    text-align: center;
    z-index: 1500;
    backdrop-filter: blur(8px);
    overflow-y: auto; /* 允許垂直捲動 */
    padding: 40px 0; /* 增加上下內距 */
    box-sizing: border-box;
}

/* 自定義捲動條樣式 */
.overlay::-webkit-scrollbar {
    width: 8px;
}

.overlay::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

.overlay::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.overlay::-webkit-scrollbar-thumb:hover {
    background: #7b4397;
}

/* 初始畫面 (現代酷炫版本) */
#start-screen {
    background: radial-gradient(circle at center, #0a1525 0%, #02050a 100%);
    justify-content: center;
    padding: 0;
}

.game-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60px;
}

.logo-the {
    color: #001f3f;
    font-size: 24px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    transform: rotate(-8deg) translateX(-70px) translateY(15px);
    text-shadow: 2px 2px 0 #fff;
    z-index: 5;
    letter-spacing: 6px;
}

.logo-battle {
    color: #000b1a;
    font-size: 70px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: 900;
    line-height: 0.8;
    letter-spacing: -2px;
    -webkit-text-stroke: 1.5px #fff;
    text-shadow: 
        3px 3px 0 #005a8e,
        6px 6px 0 #003052;
    z-index: 2;
}

.logo-bricks {
    color: #001a33;
    font-size: 60px;
    font-family: 'Arial Black', Gadget, sans-serif;
    font-weight: 900;
    line-height: 0.8;
    letter-spacing: 4px;
    -webkit-text-stroke: 1px #fff;
    text-shadow: 
        3px 3px 0 #005a8e,
        6px 6px 0 #003052;
    z-index: 1;
}

.chapter-select-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: fit-content;
    min-width: 400px;
    background: #000b1a;
    padding: 10px 30px;
    border-radius: 100px;
    border: 2px solid #fff;
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.2);
    margin: 0 auto 25px auto;
    overflow: hidden;
}

.arrow-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    width: auto;
    padding: 0 10px;
}

#start-chapter-info {
    font-size: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    min-width: 150px;
    text-align: center;
}

#loading-screen {
    background: #000;
    z-index: 2000;
    display: none;
    flex-direction: column;
    justify-content: center !important; /* 強制置中 */
    align-items: center !important;
    overflow: hidden !important;
    animation: bg-pulse 3s infinite alternate;
}

@keyframes bg-pulse {
    from { background: #000; }
    to { background: #050a1a; }
}

/* From Uiverse.io by andrew-manzyk */ 
.loader {
  --main-size: 15em; /* 大幅增加尺寸 */
  --text-color: #ffffff;
  --shine-color: #ffffff40;
  --shadow-color: #aaaaaa;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  position: relative;
  font-size: 12px; /* 基礎文字大小 */
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-color);
  width: 100%;
  height: 250px;
  filter: drop-shadow(0 0 10px var(--shine-color));
}

.loader .text {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  position: absolute;
  top: 50px;
  width: 100%;
}

.loader .text:nth-child(5) {
  font-size: 80px; /* 中間主文字放大 */
  opacity: 1;
}

.loader .text:nth-child(4), .loader .text:nth-child(6) {
  font-size: 65px;
  opacity: 0.7;
}

.loader .text:nth-child(3), .loader .text:nth-child(7) {
  font-size: 50px;
  opacity: 0.5;
}

.loader .text:nth-child(2), .loader .text:nth-child(8) {
  font-size: 35px;
  opacity: 0.3;
}

.loader .text:nth-child(1), .loader .text:nth-child(9) {
  font-size: 20px;
  opacity: 0.1;
}

.loader .text span {
  animation:
    scrolling 2s cubic-bezier(0.1, 0.6, 0.9, 0.4) infinite,
    shadow 2s cubic-bezier(0.1, 0.6, 0.9, 0.4) infinite;
}

.loader .text:nth-child(1) span {
  background: linear-gradient(
    to right,
    var(--text-color) 4%,
    var(--shadow-color) 7%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(2) span {
  background: linear-gradient(
    to right,
    var(--text-color) 9%,
    var(--shadow-color) 13%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(3) span {
  background: linear-gradient(
    to right,
    var(--text-color) 15%,
    var(--shadow-color) 18%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(4) span {
  background: linear-gradient(
    to right,
    var(--text-color) 20%,
    var(--shadow-color) 23%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(6) span {
  background: linear-gradient(
    to right,
    var(--shadow-color) 29%,
    var(--text-color) 32%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(7) span {
  background: linear-gradient(
    to right,
    var(--shadow-color) 34%,
    var(--text-color) 37%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(8) span {
  background: linear-gradient(
    to right,
    var(--shadow-color) 39%,
    var(--text-color) 42%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .text:nth-child(9) span {
  background: linear-gradient(
    to right,
    var(--shadow-color) 45%,
    var(--text-color) 48%
  );
  background-size: 200% auto;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.loader .line {
  position: absolute;
  bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 4px;
  width: 300px;
  border-radius: 4px;
}

.loader .line::before {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: var(--text-color);
  opacity: 0.3;
}

.loader .line::after {
  content: "";
  position: absolute;
  height: 100%;
  width: 100%;
  background-color: var(--text-color);
  border-radius: 0.05em;
  transform: translateX(-90%);
  animation: wobble 2s cubic-bezier(0.5, 0.8, 0.5, 0.2) infinite;
}

@keyframes wobble {
  0% {
    transform: translateX(-90%);
  }
  50% {
    transform: translateX(90%);
  }
  100% {
    transform: translateX(-90%);
  }
}

@keyframes scrolling {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes shadow {
  0% {
    background-position: -98% 0;
  }
  100% {
    background-position: 102% 0;
  }
}

.click-to-start {
    font-size: 18px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 6px;
    cursor: pointer;
    animation: breathing 2s infinite ease-in-out;
    margin-bottom: 25px;
}

.start-footer-buttons {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    justify-content: center;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.footer-btn-old-to-remove {
    display: none;
}

.footer-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 #00a8ff;
    background: #001a33;
}

.footer-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0 0 0 #00a8ff;
}

.footer-btn.shop { border-color: #f1c40f; box-shadow: 6px 6px 0 #f1c40f; }
.footer-btn.upgrade { border-color: #00a8ff; box-shadow: 6px 6px 0 #00a8ff; }

.footer-btn.shop:hover { box-shadow: 8px 8px 0 #f1c40f; }
.footer-btn.upgrade:hover { box-shadow: 8px 8px 0 #00a8ff; }

.upgrade-item, .shop-item {
    background: rgba(74, 144, 226, 0.12);
    padding: 25px;
    margin-bottom: 20px;
    border-radius: 15px;
    border: 2px solid rgba(74, 144, 226, 0.3);
    width: 100%;
    max-width: 550px;
    box-sizing: border-box;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.upgrade-item:hover, .shop-item:hover {
    background: rgba(74, 144, 226, 0.2);
    border-color: rgba(74, 144, 226, 0.5);
}

.shop-item span {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.upgrade-item:hover {
    background: rgba(74, 144, 226, 0.15);
}

.upgrade-stats {
    font-size: 13px;
    color: #bbb;
    margin-top: 8px;
}

#upgrade-screen, #shop-screen {
    max-height: none; /* 移除高度限制，由 overlay 處理捲動 */
    width: 100%;
}

/* 升級畫面全新樣式 (模擬圖片佈局) */
#upgrade-screen {
    padding: 30px;
    background: #050a14;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    font-family: 'Segoe UI Black', 'Arial Black', sans-serif;
}

#upgrade-header {
    background-color: #00a8ff;
    width: 95%;
    padding: 10px 0;
    margin-bottom: 25px;
    clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
    display: flex;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(0, 168, 255, 0.4);
}

.quest-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px 25px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 550px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}

.quest-item.completed {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.quest-info h3 { margin: 0; font-size: 18px; color: #fff; }
.quest-info p { margin: 5px 0 0 0; font-size: 14px; color: #bbb; }

#upgrade-main-content {
    display: flex;
    width: 100%;
    height: calc(100% - 100px);
    gap: 20px;
}

#upgrade-left-panel {
    flex: 1.4;
    border: 2px solid #00a8ff;
    border-radius: 4px;
    padding: 15px;
    background: rgba(0, 168, 255, 0.05);
    display: flex;
    flex-direction: column;
}

#upgrade-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    flex-grow: 1;
    padding: 10px;
}

.unit-card {
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
    transition: all 0.2s;
    min-height: 140px;
}

.unit-card.selected {
    border: 4px solid #f1c40f;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.6);
    z-index: 10;
}

.unit-card .card-tags {
    position: absolute;
    top: -10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.unit-card .unit-cost-tag {
    background: #f1c40f;
    color: #000;
    padding: 4px 12px;
    font-weight: 900;
    font-size: 18px;
    border-radius: 4px;
    border: 2px solid #000;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.5);
    z-index: 2;
}

.unit-card .lv-tag {
    background: #000;
    color: #fff;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    border: 2px solid #333;
    margin-top: -5px;
    z-index: 1;
    text-transform: uppercase;
}

.unit-card .unit-name-active {
    margin-top: 20px;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#upgrade-right-panel {
    flex: 1;
    border: 2px solid #00a8ff;
    border-radius: 4px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#selected-unit-preview {
    width: 100%;
    height: 180px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}

#selected-unit-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00a8ff, transparent);
}

.preview-glow {
    position: absolute;
    width: 120px;
    height: 120px;
    background: #f1c40f;
    filter: blur(40px);
    opacity: 0.3;
    border-radius: 50%;
}

#preview-box {
    width: 80px;
    height: 80px;
    background: #f1c40f;
    border-radius: 12px;
    z-index: 2;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
}

#selected-unit-info {
    width: 100%;
    text-align: left;
}

#selected-unit-info h2 {
    margin: 10px 0;
    font-size: 32px;
    color: #00a8ff;
    text-align: center;
}

#selected-unit-info p {
    font-size: 16px;
    color: #ccc;
    line-height: 1.5;
    margin-bottom: 25px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    font-weight: bold;
    width: 100%;
}

.heart-icon {
    color: #ff4757;
    filter: drop-shadow(0 0 5px rgba(255, 71, 87, 0.5));
}

/* 頁籤按鈕 (1000x Cooler 風格) */
#upgrade-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 5px;
    background: transparent;
    justify-content: center;
    position: relative;
    width: 100%;
}

#upgrade-tabs::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 3px;
    background: #00a8ff;
    z-index: 0;
    transform: translateY(-50%);
}

.tab-btn {
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 900;
    border: 3px solid #000;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: #000;
    transition: all 0.1s;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
    box-shadow: 4px 4px 0 #000;
    min-width: 105px;
    letter-spacing: 0.5px;
}

.tab-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 #000;
    background: #f0f0f0;
}

.tab-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #000;
}

.tab-btn.active {
    background: #00a8ff;
    color: #fff;
    border-color: #000;
    box-shadow: 4px 4px 0 #000;
}

/* 模擬兩行交錯佈局 */
.tab-btn:nth-child(n+4) {
    margin-top: 5px;
}

/* 捲軸美化 */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #1a1a1a;
}
::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* From Uiverse.io by reglobby */ 
.toggle-container {
  position: relative;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 800px;
  z-index: 5;
}

.toggle-wrap {
  position: relative;
  width: 100%;
  height: 60px;
  transform-style: preserve-3d;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 30, 60, 0.4);
  border-radius: 30px;
  cursor: pointer;
  box-shadow:
    0 0 15px rgba(0, 80, 255, 0.2),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  backdrop-filter: blur(5px);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  border: 1px solid rgba(0, 150, 255, 0.3);
}

.toggle-track::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      ellipse at center,
      rgba(0, 80, 255, 0.1) 0%,
      rgba(0, 0, 0, 0) 70%
    ),
    linear-gradient(90deg, rgba(0, 60, 120, 0.1) 0%, rgba(0, 30, 60, 0.2) 100%);
  opacity: 0.6;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  height: 10px;
  background: linear-gradient(
    90deg,
    rgba(0, 170, 255, 0.3) 0%,
    rgba(0, 80, 255, 0.1) 100%
  );
  border-radius: 30px 30px 0 0;
  opacity: 0.7;
  filter: blur(1px);
}

.track-lines {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  transform: translateY(-50%);
  overflow: hidden;
}

.track-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 150, 255, 0.3) 0px,
    rgba(0, 150, 255, 0.3) 5px,
    transparent 5px,
    transparent 15px
  );
  animation: track-line-move 3s linear infinite;
}

@keyframes track-line-move {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(20px);
  }
}

.toggle-thumb {
  position: absolute;
  width: 54px;
  height: 54px;
  left: 3px;
  top: 3px;
  background: radial-gradient(
    circle,
    rgba(10, 40, 90, 0.9) 0%,
    rgba(0, 20, 50, 0.8) 100%
  );
  border-radius: 50%;
  box-shadow:
    0 2px 15px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(0, 150, 255, 0.5);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 2;
  border: 1px solid rgba(0, 170, 255, 0.6);
  overflow: hidden;
  transform-style: preserve-3d;
}

.thumb-core {
  position: absolute;
  width: 40px;
  height: 40px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(0, 180, 255, 0.6) 0%,
    rgba(0, 50, 120, 0.2) 100%
  );
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(0, 150, 255, 0.5);
  opacity: 0.9;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.thumb-inner {
  position: absolute;
  width: 25px;
  height: 25px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(100, 200, 255, 0.5) 100%
  );
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.7);
  opacity: 0.7;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(0.9);
  }
  100% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.thumb-scan {
  position: absolute;
  width: 100%;
  height: 5px;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 150, 255, 0.5) 20%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(0, 150, 255, 0.5) 80%,
    rgba(0, 0, 0, 0) 100%
  );
  top: 0;
  left: 0;
  filter: blur(1px);
  animation: thumb-scan 2s linear infinite;
  opacity: 0.7;
}

@keyframes thumb-scan {
  0% {
    top: -5px;
    opacity: 0;
  }
  20% {
    opacity: 0.7;
  }
  80% {
    opacity: 0.7;
  }
  100% {
    top: 54px;
    opacity: 0;
  }
}

.thumb-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  overflow: hidden;
}

.thumb-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(100, 200, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(100, 200, 255, 0.8);
  animation: thumb-particle-float 3s infinite ease-out;
  opacity: 0;
}

.thumb-particle:nth-child(1) {
  top: 70%;
  left: 30%;
  animation-delay: 0.2s;
}

.thumb-particle:nth-child(2) {
  top: 60%;
  left: 60%;
  animation-delay: 0.6s;
}

.thumb-particle:nth-child(3) {
  top: 50%;
  left: 40%;
  animation-delay: 1s;
}

.thumb-particle:nth-child(4) {
  top: 40%;
  left: 70%;
  animation-delay: 1.4s;
}

.thumb-particle:nth-child(5) {
  top: 80%;
  left: 50%;
  animation-delay: 1.8s;
}

@keyframes thumb-particle-float {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  20% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-30px) scale(0);
    opacity: 0;
  }
}

.toggle-data {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.data-text {
  position: absolute;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.5s ease;
}

.data-text.off {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 1;
  color: rgba(0, 150, 255, 0.6);
  text-shadow: 0 0 5px rgba(0, 100, 255, 0.4);
}

.data-text.on {
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: rgba(0, 255, 150, 0.6);
  text-shadow: 0 0 5px rgba(0, 255, 100, 0.4);
}

.status-indicator {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 180, 255, 0.8) 0%,
    rgba(0, 80, 200, 0.4) 100%
  );
  box-shadow: 0 0 10px rgba(0, 150, 255, 0.5);
  animation: blink 2s infinite alternate;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.status-indicator.off {
  top: 25px;
  right: 15px;
}

.status-indicator.on {
  top: 25px;
  left: 15px;
  opacity: 0;
  background: radial-gradient(
    circle,
    rgba(0, 255, 150, 0.8) 0%,
    rgba(0, 200, 80, 0.4) 100%
  );
  box-shadow: 0 0 10px rgba(0, 255, 150, 0.5);
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.interface-lines {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.interface-line {
  position: absolute;
  background: rgba(0, 150, 255, 0.3);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.interface-line:nth-child(1) {
  width: 15px;
  height: 1px;
  bottom: -5px;
  left: 20px;
}

.interface-line:nth-child(2) {
  width: 1px;
  height: 8px;
  bottom: -12px;
  left: 35px;
}

.interface-line:nth-child(3) {
  width: 25px;
  height: 1px;
  bottom: -12px;
  left: 35px;
}

.interface-line:nth-child(4) {
  width: 15px;
  height: 1px;
  bottom: -5px;
  right: 20px;
}

.interface-line:nth-child(5) {
  width: 1px;
  height: 8px;
  bottom: -12px;
  right: 35px;
}

.interface-line:nth-child(6) {
  width: 25px;
  height: 1px;
  bottom: -12px;
  right: 10px;
}

.toggle-reflection {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 40%
  );
  border-radius: 30px;
  pointer-events: none;
}

.toggle-label {
  position: relative;
  margin-top: 20px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  color: rgba(0, 150, 255, 0.7);
  text-shadow: 0 0 10px rgba(0, 100, 255, 0.5);
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.holo-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 150, 255, 0.2) 0%,
    rgba(0, 0, 0, 0) 70%
  );
  filter: blur(10px);
  opacity: 0.5;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  z-index: 0;
}

.toggle-input:checked + .toggle-track {
  background: rgba(0, 60, 30, 0.4);
  border-color: rgba(0, 255, 150, 0.3);
  box-shadow:
    0 0 15px rgba(0, 255, 150, 0.2),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.toggle-input:checked + .toggle-track::before {
  background: radial-gradient(
      ellipse at center,
      rgba(0, 255, 150, 0.1) 0%,
      rgba(0, 0, 0, 0) 70%
    ),
    linear-gradient(90deg, rgba(0, 120, 60, 0.1) 0%, rgba(0, 60, 30, 0.2) 100%);
}

.toggle-input:checked + .toggle-track::after {
  background: linear-gradient(
    90deg,
    rgba(0, 255, 150, 0.3) 0%,
    rgba(0, 160, 80, 0.1) 100%
  );
}

.toggle-input:checked + .toggle-track .track-line {
  background: repeating-linear-gradient(
    90deg,
    rgba(0, 255, 150, 0.3) 0px,
    rgba(0, 255, 150, 0.3) 5px,
    transparent 5px,
    transparent 15px
  );
  animation-direction: reverse;
}

.toggle-input:checked + .toggle-track .toggle-thumb {
  left: calc(100% - 57px);
  background: radial-gradient(
    circle,
    rgba(10, 90, 40, 0.9) 0%,
    rgba(0, 50, 20, 0.8) 100%
  );
  border-color: rgba(0, 255, 150, 0.6);
  box-shadow:
    0 2px 15px rgba(0, 0, 0, 0.5),
    inset 0 0 15px rgba(0, 255, 150, 0.5);
}

.toggle-input:checked + .toggle-track .thumb-core {
  background: radial-gradient(
    circle,
    rgba(0, 255, 150, 0.6) 0%,
    rgba(0, 120, 50, 0.2) 100%
  );
  box-shadow: 0 0 20px rgba(0, 255, 150, 0.5);
}

.toggle-input:checked + .toggle-track .thumb-inner {
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(100, 255, 200, 0.5) 100%
  );
  box-shadow: 0 0 10px rgba(100, 255, 200, 0.7);
}

.toggle-input:checked + .toggle-track .thumb-scan {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 255, 150, 0.5) 20%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(0, 255, 150, 0.5) 80%,
    rgba(0, 0, 0, 0) 100%
  );
}

.toggle-input:checked + .toggle-track .thumb-particle {
  background: rgba(100, 255, 200, 0.8);
  box-shadow: 0 0 5px rgba(100, 255, 200, 0.8);
}

.toggle-input:checked + .toggle-track .data-text.off {
  opacity: 0;
}

.toggle-input:checked + .toggle-track .data-text.on {
  opacity: 1;
}

.toggle-input:checked + .toggle-track .status-indicator.off {
  opacity: 0;
}

.toggle-input:checked + .toggle-track .status-indicator.on {
  opacity: 1;
}

.toggle-input:checked + .toggle-track .interface-line {
  background: rgba(0, 255, 150, 0.3);
}

.toggle-input:checked ~ .toggle-label {
  color: rgba(0, 255, 150, 0.7);
  text-shadow: 0 0 10px rgba(0, 255, 150, 0.5);
}

.toggle-input:checked + .toggle-track .holo-glow {
  background: radial-gradient(
    ellipse at center,
    rgba(0, 255, 150, 0.2) 0%,
    rgba(0, 0, 0, 0) 70%
  );
}

.toggle-input:hover + .toggle-track {
  box-shadow:
    0 0 20px rgba(0, 150, 255, 0.3),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
}

.toggle-input:checked:hover + .toggle-track {
  box-shadow:
    0 0 20px rgba(0, 255, 150, 0.3),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
}