:root {
    --bg-color: #050505;
    --text-color: #0f0;
    --accent-color: #f0f;
    --syntax-color: #0ff;
    --danger-color: #f00;
    --warn-color: #ff0;
    --ram-color: #ffd700;
    --boss-color: #ff4400;
    --relic-color: #aaddff;
    --event-color: #b088ff;
    /* Original Purple */
    --heal-color: #00ffff;
    /* Cyan for Heal */
    --treasure-color: #ffaa00;
    /* Orange for Treasure/Mimic */
    --slot-bg: #111;
    --slot-border: #333;
    --font-main: 'Courier New', Courier, monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: "Microsoft JhengHei", "Courier New", monospace;
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 50px;
    overscroll-behavior: none;
    user-select: none;

}

/* 1. 全局文字光暈 (Phosphor Glow) */
body {
    /* 讓所有文字帶有一點點綠色螢光暈開的感覺 */
    text-shadow: 0 0 1px rgba(0, 255, 0, 0.3);
    /* 開啟硬體加速，讓動畫更流暢 */
    will-change: text-shadow;
    /* 加入色差動畫 */
    animation: rgb-shift 5s infinite linear;
}

/* 2. RGB 色差分離動畫 (Chromatic Aberration) */
@keyframes rgb-shift {
    0% {
        text-shadow: 1px 0 rgba(255, 0, 0, 0.5), -1px 0 rgba(0, 0, 255, 0.5), 0 0 5px var(--text-color);
    }

    5% {
        text-shadow: 2px 0 rgba(255, 0, 0, 0.5), -2px 0 rgba(0, 0, 255, 0.5), 0 0 5px var(--text-color);
    }

    10% {
        text-shadow: 1px 0 rgba(255, 0, 0, 0.5), -1px 0 rgba(0, 0, 255, 0.5), 0 0 5px var(--text-color);
    }

    100% {
        text-shadow: 1px 0 rgba(255, 0, 0, 0.5), -1px 0 rgba(0, 0, 255, 0.5), 0 0 5px var(--text-color);
    }
}

/* 3. CRT 掃描線與曲面暗角 (這是重點！) */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    /* 讓滑鼠可以穿透 */

    /* 技巧：用 radial-gradient 做暗角，模擬螢幕曲面 */
    background:
        /* 掃描線紋理 (更細緻) */
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
        /* 垂直 RGB 掃描線 (模擬螢幕柵欄) */
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)),
        /* 四周暗角 (Vignette) - 這是造成「曲面錯覺」的關鍵 */
        radial-gradient(circle, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.6) 90%, rgba(0, 0, 0, 1) 100%);

    background-size: 100% 4px, 3px 100%, 100% 100%;
    opacity: 1;
}

/* 4. 畫面微微閃爍 (Flicker) - 降低不透明度以免太刺眼 */
.crt-flicker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    z-index: 9998;
    pointer-events: none;
    opacity: 0;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% {
        opacity: 0.02;
    }

    50% {
        opacity: 0.05;
    }

    100% {
        opacity: 0.02;
    }
}

.item-icon-img {

    filter: drop-shadow(2px 0 0 rgba(255, 0, 0, 0.3)) drop-shadow(-2px 0 0 rgba(0, 0, 255, 0.3));
}

@keyframes flicker {
    0% {
        opacity: 0.01;
    }

    5% {
        opacity: 0.05;
    }

    10% {
        opacity: 0.01;
    }

    100% {
        opacity: 0.01;
    }
}

.scramble-text {
    display: inline-block;
    min-width: 20px;
}

.decoding {
    color: var(--syntax-color);
    text-shadow: 0 0 5px var(--syntax-color);
}

/* Custom Tooltip */
#custom-tooltip {
    position: fixed;
    background: rgba(5, 5, 5, 0.98);
    border: 1px solid var(--text-color);
    padding: 12px;
    z-index: 10000;
    pointer-events: none;
    display: none;
    font-family: var(--font-main);
    max-width: 250px;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.2);
    font-size: 0.9em;
    line-height: 1.4;
    text-align: left;
    backdrop-filter: blur(4px);
}

.tooltip-title {
    color: #fff;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
    border-bottom: 1px dashed #333;
    padding-bottom: 3px;
}

.tooltip-desc {
    color: #ccc;
}

.tooltip-extra {
    margin-top: 8px;
    font-size: 0.8em;
    text-transform: uppercase;
    color: var(--ram-color);
}

.syntax-rule {
    background: #220000;
    color: #ff4444;
    border: 1px dashed #ff0000;
    padding: 5px;
    font-size: 0.8em;
    margin-top: 5px;
    text-align: center;
    display: none;
    animation: flashRed 1s infinite alternate;
}

@keyframes flashRed {
    from {
        opacity: 0.7;
    }

    to {
        opacity: 1;
        text-shadow: 0 0 5px red;
    }
}

#mute-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    cursor: pointer;
    color: #0f0;
    font-family: monospace;
    border: 1px solid #0f0;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.8);
    font-size: 0.8em;
}

#mute-btn:hover {
    background: #0f0;
    color: #000;
}

.side-decoration {
    display: none;
    flex: 1;
    padding: 20px;
    font-size: 0.85em;
    color: #1a5c2e;
    opacity: 0.8;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    z-index: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

@media (min-width: 1000px) {
    .side-decoration {
        display: flex;
    }
}

.hex-column {
    word-break: break-all;
    line-height: 1.4;
    font-family: monospace;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.2);
}

.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
    z-index: 10;
    background: rgba(5, 5, 5, 0.95);
    border-left: 1px solid #111;
    border-right: 1px solid #111;
    min-height: 100vh;
    transition: transform 0.05s;
}

h1 {
    text-shadow: 0 0 5px var(--text-color);
    margin-bottom: 5px;
    margin-top: 0;
    font-size: 1.5em;
    text-align: center;
}

.high-score {
    color: #666;
    font-size: 0.8em;
    margin-bottom: 10px;
    text-align: center;
}

.status-row {
    display: flex;
    gap: 20px;
}

.status-panel {
    border: 2px solid var(--text-color);
    padding: 10px;
    background: #000;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.1);
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}

.status-panel.boss-mode {
    border-color: var(--boss-color);
    box-shadow: 0 0 20px var(--boss-color);
}

.status-panel.boss-mode .hp-bar-fill {
    background: var(--boss-color);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hp-bar-container {
    width: 100%;
    height: 15px;
    background: #222;
    margin-top: 5px;
    border: 1px solid var(--text-color);
    position: relative;
    overflow: hidden;
}

@keyframes strip-flow {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 40px 0;
    }
}

.hp-bar-fill {
    height: 100%;
    /* 斜紋背景：深紅 + 亮紅 */
    background: repeating-linear-gradient(45deg,
            #8b0000,
            #8b0000 10px,
            var(--danger-color) 10px,
            var(--danger-color) 20px);
    background-size: 200% 100%;
    /* 放大背景以便移動 */
    width: 100%;
    transition: width 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 0 10px var(--danger-color);
    /* 發光 */
    animation: strip-flow 1s linear infinite;
    /* 讓紋路動起來 */
}

.player-hp-fill {
    background: repeating-linear-gradient(45deg,
            #004400,
            #004400 10px,
            #00ff00 10px,
            #00ff00 20px);
    box-shadow: 0 0 10px #00ff00;
}

.ram-display {
    color: var(--ram-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
}

.enemy-ability-icon {
    font-size: 1.5em;
    margin-left: 5px;
    transition: opacity 0.3s;
}

.enemy-ability-icon.silenced {
    opacity: 0.2;
    filter: grayscale(100%);
}

.enemy-intent {
    margin-top: 8px;
    font-size: 0.9em;
    padding: 4px;
    background: #110000;
    border: 1px solid #500;
    color: #ffaaaa;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        border-color: #500;
    }

    50% {
        border-color: #f00;
        box-shadow: 0 0 10px #f00;
    }

    100% {
        border-color: #500;
    }
}

.relic-bar {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #333;
    min-height: 25px;
    flex-wrap: wrap;
}

.relic-icon {
    font-size: 1.2em;
    cursor: help;
    border: 1px solid #444;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #111;
    transition: transform 0.2s;
}

.relic-icon.event-relic {
    border-color: var(--event-color);
    color: var(--event-color);
}

.relic-icon:hover {
    transform: scale(1.2);
    border-color: var(--relic-color);
    box-shadow: 0 0 5px var(--relic-color);
}

.combat-log {
    height: 100px;
    overflow-y: auto;
    border: 1px dashed #333;
    background: #080808;
    padding: 5px;
    font-size: 0.8em;
    color: #888;
    font-family: "Microsoft JhengHei", monospace;
    scroll-behavior: smooth;
}

.log-entry {
    margin: 2px 0;
    border-left: 2px solid transparent;
    padding-left: 5px;
    white-space: nowrap;
    overflow: hidden;
    animation: typing 0.5s steps(30, end);
    max-width: 100%;
}

.log-entry.highlight {
    color: #fff;
    font-weight: bold;
    border-left-color: #fff;
}

.log-entry.syntax {
    color: var(--syntax-color);
    border-left-color: var(--syntax-color);
}

.log-entry.danger {
    color: var(--danger-color);
    border-left-color: var(--danger-color);
}

.log-entry.boss {
    color: var(--boss-color);
    font-weight: bold;
    font-size: 1.1em;
}

.log-entry.relic {
    color: var(--relic-color);
    font-style: italic;
}

.log-entry.event {
    color: var(--event-color);
    font-weight: bold;
}

.section-header {
    font-size: 1em;
    border-bottom: 1px solid var(--text-color);
    margin-bottom: 5px;
    padding-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
}

.queue-container {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 15px;
    border: 2px solid var(--text-color);
    background: #000;
    position: relative;
}

.queue-container::before {
    content: "PROCESSING...";
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.7em;
    padding: 0 5px;
    display: none;
}

.processing .queue-container::before {
    display: block;
    animation: blink 0.5s infinite;
}

.slot {
    width: 18%;
    aspect-ratio: 1;
    background: var(--slot-bg);
    border: 2px solid var(--slot-border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5em;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.slot:hover {
    border-color: var(--text-color);
}

/* Drag and Drop Styles */
.slot.drag-over {
    border-color: #fff;
    background: #222;
    box-shadow: inset 0 0 20px #fff;
}

/* 當格子被執行時 (Resolver 加上 active class 時) */
.slot.active {
    /* ...原有設定... */
    background: #002200;
    /* 背景稍微變亮 */
    box-shadow: 0 0 15px var(--text-color), inset 0 0 20px var(--text-color);
    position: relative;
    overflow: hidden;
    /* 限制掃描線在格子內 */
}

/* 新增：掃描光束 */
.slot.active::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent 0%, rgba(0, 255, 0, 0.8) 50%, transparent 100%);
    background-size: 100% 200%;
    animation: scan-slot 0.2s linear infinite;
    /* 超快速掃描 */
    pointer-events: none;
}

@keyframes scan-slot {
    0% {
        background-position: 0% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

.slot.synergy-glow {
    border-color: gold;
    box-shadow: 0 0 10px gold, inset 0 0 10px gold;
    animation: pulseGold 2s infinite;
}

@keyframes pulseGold {
    0% {
        box-shadow: 0 0 5px gold;
    }

    50% {
        box-shadow: 0 0 15px gold;
    }

    100% {
        box-shadow: 0 0 5px gold;
    }
}

.slot.skipped {
    opacity: 0.2;
    filter: grayscale(100%);
}

.slot.locked {
    border-color: var(--danger-color);
    background: repeating-linear-gradient(45deg, #220000, #220000 10px, #440000 10px, #440000 20px);
    cursor: not-allowed;
}

.slot.locked::after {
    content: "🔒";
    position: absolute;
    font-size: 0.5em;
    top: 2px;
    right: 2px;
}

.slot-index {
    position: absolute;
    top: 2px;
    left: 5px;
    font-size: 10px;
    color: #444;
}

.inventory-panel {
    border: 2px solid var(--text-color);
    padding: 10px;
    background: #000;
    min-height: 120px;
}

.inventory-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 5px;
    max-height: 220px;
    overflow-y: auto;
    align-content: flex-start;
    padding-right: 5px;

    &::-webkit-scrollbar {
        width: 8px;
    }

    &::-webkit-scrollbar-track {
        background: #111;
    }

    &::-webkit-scrollbar-thumb {
        background: #333;
        border-radius: 4px;
    }

    &::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

.item-card {
    border: 1px solid var(--slot-border);
    padding: 5px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 60px;
    background: #0a0a0a;
    position: relative;
    z-index: 1;
    transition: transform 0.1s;
}

.item-card:hover {
    border-color: #fff;
    background: #222;
    transform: translateY(-2px);
}

.item-card:active {
    transform: scale(0.95);
    cursor: grabbing;
}

.item-card.syntax-type {
    border-color: var(--syntax-color);
    background: #001111;
}

.item-card.bug-type {
    border-color: var(--danger-color);
    background: #110000;
}

.item-emoji {
    font-size: 1.8em;
    pointer-events: none;
}

.item-name {
    font-size: 0.5em;
    text-align: center;
    color: #888;
    margin-top: 2px;
    line-height: 1.1;
    overflow: hidden;
    height: 2.2em;
    pointer-events: none;
}

.item-sell-tag {
    font-size: 0.5em;
    color: var(--ram-color);
    margin-top: 2px;
    font-weight: bold;
    border: 1px solid var(--ram-color);
    padding: 1px 3px;
    border-radius: 3px;
    pointer-events: none;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

button {
    background: #000;
    color: var(--text-color);
    border: 1px solid var(--text-color);
    clip-path: polygon(10px 0, 100% 0,
            100% calc(100% - 10px), calc(100% - 10px) 100%,
            0 100%, 0 10px);

    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
}

button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.4), transparent);
    transition: 0.5s;
}

button:hover::after {
    left: 100%;
}

button:hover {
    background: #002200;
    text-shadow: 0 0 8px var(--text-color);
    box-shadow: 0 0 15px var(--text-color);
    transform: translateY(-2px);
}

button:disabled {
    background: #222;
    color: #555;
    border-color: #444;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

#speed-btn {
    padding: 12px 15px;
    font-size: 0.9em;
    background: #003300;
    color: #0f0;
    border: 1px solid #0f0;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #111;
    border: 2px solid var(--text-color);
    padding: 30px;
    text-align: center;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.1);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.shop-content {
    border-color: var(--ram-color);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.shop-title {
    color: var(--ram-color);
    font-size: 2em;
    margin-bottom: 10px;
}

body.shopping-mode .container {
    opacity: 0.3;
    pointer-events: none;
}

body.shopping-mode .inventory-panel {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    z-index: 201;
    box-shadow: 0 0 30px var(--ram-color);
}

.shop-section {
    margin-top: 20px;
    border-top: 1px dashed #333;
    padding-top: 10px;
}

.shop-section-title {
    color: #aaa;
    font-size: 0.9em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.loot-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.loot-card {
    border: 1px solid #444;
    padding: 15px;
    cursor: pointer;
    width: 100px;
    background: #000;
    transition: all 0.2s;
}

.loot-card:hover {
    transform: scale(1.1);
    border-color: #fff;
}

.loot-card.relic-card {
    border-color: var(--relic-color);
    box-shadow: 0 0 10px rgba(170, 221, 255, 0.2);
}

.loot-card.event-relic-card {
    border-color: var(--event-color);
    box-shadow: 0 0 10px rgba(176, 136, 255, 0.2);
}

.loot-card.hardware-card {
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.hardware-card:hover {
    /* 滑鼠移過去更亮 */
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    background: rgba(255, 215, 0, 0.1);
}

.event-content {
    border-color: var(--event-color);
    box-shadow: 0 0 30px var(--event-color);
}

.event-title {
    color: var(--event-color);
    font-size: 2.5em;
    margin-bottom: 20px;
}

.event-desc {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.5;
    color: #ddd;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.event-btn {
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--event-color);
    background: #111;
    color: var(--event-color);
    padding: 15px;
    font-size: 1em;
    text-align: left;
    transition: all 0.2s;
    cursor: pointer;
}

.event-btn:hover {
    background: var(--event-color);
    color: #000;
    transform: translateX(10px);
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: default;
}

.blink {
    animation: blink 1s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Animation: Floating Damage Text */
.float-text {
    position: fixed;
    font-weight: bold;
    font-size: 1.5em;
    pointer-events: none;
    animation: floatUpFade 1.2s ease-out forwards;
    z-index: 1000;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
    font-family: var(--font-main);
}

@keyframes floatUpFade {
    0% {
        transform: translate(-50%, 0) scale(0.5);
        opacity: 0;
    }

    20% {
        transform: translate(-50%, -20px) scale(1.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -80px) scale(1);
        opacity: 0;
    }
}

.particle {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #fff;
    pointer-events: none;
    animation: particleAnim 0.5s ease-out forwards;
}

@keyframes particleAnim {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty));
    }
}

.victory-title {
    color: var(--ram-color);
    font-size: 4em;
    text-shadow: 0 0 20px var(--ram-color);
    margin-bottom: 20px;
}

.log-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.log-item {
    border: 1px solid #333;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: help;
    background: #0a0a0a;
    position: relative;
}

.log-item.locked {
    opacity: 0.3;
    filter: grayscale(100%);
}

.log-stat-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    border-bottom: 1px solid #333;
    padding: 5px 0;
}

.tab-btn {
    border: 1px solid #333;
    background: #000;
    color: #888;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    border-color: var(--syntax-color);
    background: #001111;
    color: var(--syntax-color);
    box-shadow: 0 0 10px var(--syntax-color);
    font-weight: bold;
}

.manual-section {
    text-align: left;
    margin-bottom: 20px;
}

.manual-h {
    color: var(--text-color);
    border-bottom: 1px solid #333;
    margin-bottom: 5px;
    font-weight: bold;
}

.manual-p {
    color: #aaa;
    font-size: 0.9em;
    line-height: 1.5;
}

/* OS Selection Styles */
.os-selection {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.os-card {
    border: 1px solid #333;
    background: #000;
    padding: 15px;
    width: 120px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    opacity: 0.7;
}

.os-card:hover {
    border-color: #666;
    opacity: 1;
}

.os-card.selected {
    border-color: var(--syntax-color);
    box-shadow: 0 0 15px var(--syntax-color);
    opacity: 1;
    transform: scale(1.05);
}

.os-icon {
    font-size: 2em;
    margin-bottom: 5px;
}

.os-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.os-desc {
    font-size: 0.7em;
    color: #888;
    line-height: 1.2;
}

/* BIOS Styles */
#bios-layer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#bios-credits {
    font-size: 1.2em;
    color: var(--ram-color);
    margin-bottom: 20px;
    font-weight: bold;
    text-shadow: 0 0 5px var(--ram-color);
}

.bios-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    max-width: 800px;
}

.bios-card {
    border: 1px solid #333;
    background: #050505;
    padding: 15px;
    width: 200px;
    text-align: center;
    border-radius: 5px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.bios-card:hover {
    border-color: #fff;
}

.bios-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.bios-lvl {
    font-size: 0.8em;
    color: var(--syntax-color);
    margin-bottom: 10px;
}

.bios-desc {
    font-size: 0.8em;
    color: #888;
    margin-bottom: 15px;
    min-height: 3em;
}

.bios-btn {
    background: #111;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9em;
}

.bios-btn:hover {
    background: var(--text-color);
    color: #000;
}

.bios-btn.maxed {
    border-color: #333;
    color: #333;
    cursor: default;
    background: #000;
}

.item-card.exhausted {
    opacity: 0.4;
    filter: grayscale(100%);
    pointer-events: none;
    border-color: #333;
}

.item-icon-img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    /* 保持比例，不要被拉伸 */
    pointer-events: none;
    /* 讓滑鼠點擊能穿透圖片傳到格子 */

    /* --- 下面這行是選用的「駭客濾鏡」 --- */
    /* 如果你的圖是黑白的，這行可以把它強制變成你的駭客綠色！ */
    /* 如果你的圖本身就有顏色，可以把下面這行 filter 刪掉 */
    filter: drop-shadow(0 0 2px var(--text-color));
}

/* --- 新增：讓序列中的圖片置中 --- */
.item-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    /* 使用彈性盒子 */
    justify-content: center;
    /* 水平置中 */
    align-items: center;
    /* 垂直置中 */
    pointer-events: none;
    /* 讓滑鼠點擊穿透，才不會擋到拖曳 */
}

/* 確保圖片本身不會有預設的間距 */
.item-icon-img {
    display: block;
    /* 消除圖片底部的微小空隙 */
    margin: 0 auto;
    /* 雙重保險置中 */
}

/* --- v0.6 Visual Juice Updates --- */

/* 1. 畫面震動 (Screen Shake) */
@keyframes shake-anim {
    0% {
        transform: translate(0, 0);
        text-shadow: 2px 0 red, -2px 0 blue;
    }

    20% {
        transform: translate(-5px, 5px);
        text-shadow: -5px 0 red, 5px 0 blue;
    }

    /* 色差拉大 */
    40% {
        transform: translate(5px, -5px);
        text-shadow: 5px 0 red, -5px 0 blue;
    }

    60% {
        transform: translate(-5px, -5px);
        text-shadow: -5px 0 red, 5px 0 blue;
    }

    80% {
        transform: translate(5px, 5px);
        text-shadow: 5px 0 red, -5px 0 blue;
    }

    100% {
        transform: translate(0, 0);
        text-shadow: 2px 0 red, -2px 0 blue;
    }
}

.shaking {
    animation: shake-anim 0.3s cubic-bezier(.36, .07, .19, .97) both;
}

/* 2. 傷害數字跳動 (Damage Popup) */
.float-text {
    position: fixed;
    font-weight: bold;
    pointer-events: none;
    z-index: 2000;
    font-family: 'Courier New', monospace;
    /* 動畫設定 */
    opacity: 0;
    transform: scale(0.5);
    animation: popUp 0.8s ease-out forwards;
}

@keyframes popUp {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(0);
    }

    20% {
        opacity: 1;
        transform: scale(1.5) translateY(-10px);
    }

    /* 彈出變大 */
    40% {
        opacity: 1;
        transform: scale(1.0) translateY(-20px);
    }

    /* 回彈 */
    100% {
        opacity: 0;
        transform: scale(1.0) translateY(-60px);
    }

    /* 飄走 */
}

/* --- 顏色定義 (復刻經典版) --- */
.float-text.crit {
    color: #ff0;
    /* 黃色暴擊 */
    font-size: 2.5em;
    text-shadow: 0 0 10px #f00;
    /* 紅色光暈 */
    z-index: 2001;
}

.float-text.heal {
    color: #f0f;
    /* 紫色/洋紅色 (吸血) */
    font-size: 1.5em;
    text-shadow: 0 0 5px #f0f;
}

.float-text.block {
    color: #0ff;
    /* 青色/藍色 (格檔) */
    font-size: 1.5em;
    text-shadow: 0 0 5px #0ff;
}

.float-text.dmg {
    color: #f00;
    /* 紅色 (一般傷害) */
    font-size: 1.8em;
    text-shadow: 2px 2px 0 #000;
}

.float-text.poison {
    color: #0f0;
    /* 綠色 (毒) */
    font-size: 1.2em;
}

/* 新增打字機動畫 */
@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

.click-ripple {
    position: fixed;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-color);
    background: transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    pointer-events: none;
    z-index: 9999;
    animation: ripple-anim 0.4s ease-out forwards;
}

@keyframes ripple-anim {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
        border-width: 5px;
    }

    100% {
        transform: translate(-50%, -50%) scale(3.0);
        opacity: 0;
        border-width: 0px;
    }
}

.sw-item {
    padding: 10px;
    border-bottom: 1px dashed #333;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    color: #888;
    transition: all 0.2s;
}

.sw-item:hover {
    background: #111;
    color: #fff;
}

.sw-item.selected {
    background: #222;
    color: #0ff;
    border-left: 3px solid #0ff;
}

.sw-item.installed {
    color: #0f0;
    font-weight: bold;
}

#install-progress-bar {
    background: #0f0;
    height: 100%;
    width: 0%;
    transition: width 0.5s;
}

/* --- 加大執行按鈕 --- */
#run-btn {
    font-size: 1.5em;
    /* 字體變大 */
    padding: 10px 30px;
    /* 內距加大 (上下, 左右) */
    min-width: 200px;
    /* 設定最小寬度，更有份量感 */
    font-weight: 900;
    /* 字體加粗 */
    border-width: 2px;
    /*邊框加粗 */
    clip-path: polygon(15px 0, 100% 0,
            100% calc(100% - 15px), calc(100% - 15px) 100%,
            0 100%, 0 15px);
    margin-right: 10px;
}

#speed-btn {
    font-size: 1.1em;
    padding: 15px 20px;
    border-width: 2px;
}