@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Inter:wght@400;500;600;700;900&display=swap');

:root {
    --bg: #0a0e1a;
    --accent: #e94560;
    --gold: #f6c943;
    --gem: #8b5cf6;
    --text: #e2e8f0;
    --text-dim: #64748b;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    width: 100%;
    max-width: 430px;
    height: 100%;
    max-height: 932px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(180deg, #0d1117, #161b22);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    overflow: hidden;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    flex-shrink: 0;
}

.res-item {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 700;
}

.res-icon {
    font-size: 0.8rem;
}

.res-val {
    color: var(--gold);
}

.res-item:nth-child(2) .res-val {
    color: var(--gem);
}

.level-item {
    margin-left: auto;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.level-item .res-val {
    color: var(--accent);
}

.hero-item {
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.hero-item .res-val {
    color: #60a5fa;
}

.canvas-area {
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.placeholder-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-title {
    font-size: 2rem;
    font-weight: 900;
}

.page-sub {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.task-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(40, 30, 15, 0.7);
    border-top: 1px solid rgba(200, 160, 60, 0.15);
    flex-shrink: 0;
    cursor: pointer;
    transition: background 0.2s;
}

.task-bar:hover {
    background: rgba(50, 38, 18, 0.85);
}

.task-bar.completed {
    background: rgba(74, 222, 128, 0.15);
    border-top-color: rgba(74, 222, 128, 0.35);
}

.task-icon {
    font-size: 1.1rem;
}

.task-text {
    flex: 1;
    font-size: 0.78rem;
    font-weight: 600;
}

.task-reward {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
}

.task-btn {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 12px;
    background: rgba(200, 160, 60, 0.1);
    color: rgba(200, 180, 120, 0.6);
    border: 1px solid rgba(200, 160, 60, 0.15);
    transition: all 0.2s;
}

.task-bar.completed .task-btn {
    background: rgba(74, 222, 128, 0.25);
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.4);
}

.bottom-nav {
    display: flex;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.7);
    border-top: 1px solid var(--border);
}

.nav-btn {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border-top: 2px solid transparent;
    font-family: inherit;
}

.nav-btn.active {
    color: var(--accent);
    border-top-color: var(--accent);
    background: rgba(233, 69, 96, 0.05);
}

.hidden {
    display: none !important;
}

/* Challenge Button */
.challenge-btn {
    position: absolute;
    bottom: 25px;
    right: 20px;
    padding: 10px 24px;
    background: linear-gradient(135deg, #e94560, #921b31);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
    z-index: 50;
    transition: all 0.2s;
    border: 2px solid rgba(251, 191, 36, 0.85); /* 更亮的描边提示可点击 */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Top Progress Bar （复制 V2 外观） */
.top-progress-bar-container {
    position: relative;
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.top-progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.3s ease-in-out;
}

.top-progress-text {
    position: absolute;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    z-index: 2;
    pointer-events: none;
}

.top-challenge-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -18px;
    padding: 4px 16px;
    font-size: 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(250, 204, 21, 0.8);
    background: linear-gradient(135deg, #facc15, #eab308);
    color: #0b1520;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 101;
}

.top-challenge-btn.hidden {
    display: none;
}

.challenge-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

/* Modal Overlay */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 100px;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    width: 85%;
    max-width: 320px;
    background: #1a1a2e;
    border-radius: 20px;
    padding: 30px 20px;
    text-align: center;
    border: 2px solid var(--border);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin-bottom: 15px;
}

.victory .modal-title {
    color: #4ade80;
    text-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

.defeat .modal-title {
    color: #e94560;
    text-shadow: 0 0 15px rgba(233, 69, 96, 0.4);
}

.modal-body {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

/* Deploy Modal specific */
.modal-content.deploy {
    max-width: 400px;
    padding: 20px;
}

.deploy-slots {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.slot-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 10px;
}

.slot {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.slot.locked {
    background: rgba(0, 0, 0, 0.4);
    font-size: 1rem;
    opacity: 0.5;
    border-style: dashed;
}

.roster-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-dim);
    text-align: left;
}

.hero-roster {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    padding: 5px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.roster-item {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.roster-item.selected {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.roster-item:active {
    transform: scale(0.9);
}

.modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    flex: 1;
    min-width: 120px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-btn.primary {
    background: #4ade80;
    color: #0b1520;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
}

.modal-btn.primary:active {
    transform: scale(0.95);
    background: #22c55e;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn.secondary:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

/* ============ TECH TREE MODAL ============ */
.modal-content.tech-tree {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
    padding: 16px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tech-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.tech-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.tech-points {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--gold);
}

.tech-tabs {
    display: flex;
    gap: 6px;
}

.tech-tab-button {
    flex: 1;
    padding: 6px 0;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.tech-tab-button.active {
    background: linear-gradient(135deg, #e94560, #9333ea);
    color: #fff;
    border-color: rgba(251, 191, 36, 0.85);
    box-shadow: 0 0 12px rgba(233, 69, 96, 0.4);
}

.tech-panels {
    flex: 1;
    min-height: 0;
    margin-top: 4px;
    padding-bottom: 4px;
}

.tech-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tech-card {
    background: radial-gradient(circle at top left, rgba(251, 191, 36, 0.12), rgba(15, 23, 42, 0.95));
    border-radius: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tech-tree-column {
    height: 100%;
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    gap: 10px;
}

.tech-node {
    position: relative;
}

.tech-node:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 50%;
    top: -10px;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: rgba(148, 163, 184, 0.6);
}

.tech-card-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tech-card-title {
    font-size: 1rem;
    font-weight: 800;
}

.tech-card-level {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.tech-card-body {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tech-card-cost {
    font-size: 0.8rem;
    color: var(--gold);
}

.tech-card.unlocked {
    border-color: rgba(74, 222, 128, 0.8);
    box-shadow: 0 0 18px rgba(74, 222, 128, 0.35);
}

.tech-card.next {
    border-color: rgba(251, 191, 36, 0.9);
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.35);
}

.tech-card.locked {
    opacity: 0.6;
}

.modal-btn.small {
    padding: 6px 14px;
    font-size: 0.78rem;
    align-self: flex-end;
}

.tech-footer {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.4);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.tech-footer .tech-tabs {
    gap: 8px;
}

.tech-close-bottom {
    width: 100%;
    justify-content: center;
}

#reward-amount {
    color: var(--gold);
    font-weight: 800;
}

.toast {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: var(--text);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10000;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: toastIn 0.3s ease-out, toastOut 0.3s 1.7s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* Summon Bar */
.summon-bar {
    position: absolute;
    top: 32%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1000;
    padding: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s, transform 0.3s;
}

.summon-bar.challenge {
    top: auto;
    bottom: 20px;
}

.summon-bar.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

.summon-bar.challenge.hidden {
    transform: translateX(-50%) translateY(20px);
}

.skill-item {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.skill-item:hover {
    border-color: #4ade80;
    background: linear-gradient(135deg, #22c55e20, #16213e);
}

.skill-item:active {
    transform: scale(0.9);
}

.skill-icon {
    font-size: 1rem;
}

.skill-key {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e94560;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.skill-cooldown {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0 0 13px 13px;
    transition: height 0.1s linear;
}

.skill-item.cd {
    pointer-events: none;
    filter: grayscale(1);
    opacity: 0.6;
}


/* Weapon Modal Override */
.modal-content.weapon {
    border-color: rgba(233, 69, 96, 0.4);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.15);
    max-width: 360px;
    /* Slightly wider for the two-card result view */
}

/* Equipment Card */
.weapon-main-container,
.comparison-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.equip-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.equip-card.new-equip {
    border-color: rgba(74, 222, 128, 0.4);
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.1);
}

.equip-name {
    font-weight: 800;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.equip-icon {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.equip-level {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.equip-power {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 10px;
}

.equip-stats {
    width: 100%;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 8px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.stat-section-title {
    font-size: 0.65rem;
    color: var(--gold);
    border-bottom: 1px solid rgba(250, 204, 21, 0.3);
    padding-bottom: 2px;
    margin-bottom: 4px;
    text-align: left;
    opacity: 0.8;
}

.sub-stat {
    font-size: 0.65rem;
    color: #a1a1aa;
}

.stat-up {
    color: #4ade80;
    font-weight: 700;
}

.stat-down {
    color: #f87171;
    font-weight: 700;
}

/* Item Quality Colors */
.q0 {
    color: #ffffff !important;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.q1 {
    color: #4ade80 !important;
    text-shadow: 0 0 5px rgba(74, 222, 128, 0.3);
    border-color: rgba(74, 222, 128, 0.4) !important;
}

.q2 {
    color: #60a5fa !important;
    text-shadow: 0 0 5px rgba(96, 165, 250, 0.3);
    border-color: rgba(96, 165, 250, 0.4) !important;
}

.q3 {
    color: #c084fc !important;
    text-shadow: 0 0 5px rgba(192, 132, 252, 0.3);
    border-color: rgba(192, 132, 252, 0.4) !important;
}

.q4 {
    color: #facc15 !important;
    text-shadow: 0 0 5px rgba(250, 204, 21, 0.3);
    border-color: rgba(250, 204, 21, 0.4) !important;
}

/* Equipment Inventory List */
.inventory-list {
    width: 140px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 250px;
    overflow-y: auto;
}

.inv-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 5px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
}

.inv-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.inv-item.selected {
    border-color: #e94560;
    background: rgba(233, 69, 96, 0.15);
}

.inv-item-active-mark {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e94560;
    color: white;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 900;
}

/* Proficiency Bar */
.prof-bar-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
}

.mini-prof {
    margin-top: 10px;
    margin-bottom: 0;
    width: 100%;
    padding: 8px;
}

.prof-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-align: left;
    margin-bottom: 5px;
    color: var(--text-dim);
}

.prof-track {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 7px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.prof-fill {
    height: 100%;
    background: linear-gradient(90deg, #d97706, #fbbf24);
    transition: width 0.3s;
}

.prof-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    text-align: center;
    font-size: 0.65rem;
    line-height: 14px;
    font-weight: 800;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Material Cost */
.material-cost {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
}

.mat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Forging Minigame */
.forge-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    height: 180px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-bottom: 20px;
}

.forge-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.forge-clicks {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dim);
}

.action-btn {
    width: 80px;
    height: 80px;
    border-radius: 40px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #e94560, #921b31);
    border: 4px solid rgba(255, 255, 255, 0.1);
}

.action-btn:active {
    transform: scale(0.9);
}

.forge-progress-container {
    width: 40px;
    height: 100%;
    padding-right: 10px;
}

.forge-track {
    width: 20px;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto;
}

.forge-target-zone {
    position: absolute;
    width: 100%;
    background: rgba(250, 204, 21, 0.3);
    border-top: 2px solid #facc15;
    border-bottom: 2px solid #facc15;
    /* values will be set via JS, e.g. top: 20%; height: 30%; */
}

.forge-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(0deg, #ef4444, #f97316);
    border-radius: 8px;
    transition: height 0.1s linear;
}

.forge-cursor {
    position: absolute;
    left: -10px;
    width: 40px;
    height: 4px;
    background: #fff;
    box-shadow: 0 0 5px #fff;
    border-radius: 2px;
    transition: bottom 0.1s linear;
    z-index: 2;
}

/* Result Modal */
.select-btn {
    margin-top: 15px;
    font-size: 0.8rem;
    padding: 6px 0;
    width: 100%;
    border-radius: 8px;
}

.result-prof {
    margin: 10px 0;
}

.recycle-info {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 10px;
}

/* Existing Steel Mill Modals */
.modal-content.steelmill {
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: 0 0 20px rgba(96, 165, 250, 0.15);
}

.bld-stats {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin: 10px 0;
}

.refine-list {
    max-height: 200px;
    overflow-y: auto;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.refine-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 5px;
}

.refine-item button {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.upgrade-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.upgrade-info {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--text-dim);
}

.resource-info {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    text-align: left;
}

/* Bestiary Styles */
.pet-container {
    width: 100%;
    margin-top: 10px;
}

.pet-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 10px;
}

.pet-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

.pet-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.pet-item.active {
    border-color: var(--gold);
    background: rgba(250, 204, 21, 0.1);
}

.pet-item.active::after {
    content: "已出战";
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.6rem;
    background: var(--gold);
    color: #000;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.pet-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.pet-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-base);
}

.pet-info {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 5px;
}

/* Capture Phase Styles */
#page-capture {
    background: linear-gradient(to bottom, #0f172a, #1e293b);
    position: relative;
}

.capture-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 20px;
    text-align: center;
    z-index: 100;
}

.capture-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.capture-prob,
.capture-count {
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    color: white;
}

.capture-prob span {
    color: var(--gold);
    font-size: 1.5rem;
}

.capture-count span {
    color: #60a5fa;
    font-size: 1.5rem;
}

.capture-btn-main {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    border: none;
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transition: all 0.2s;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.capture-btn-main:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.capture-btn-main:active {
    transform: scale(0.95);
}

/* Animations */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* Mana Bar */
.mana-bar-container {
    height: 12px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex: 1;
    margin: 0 10px;
    min-width: 80px;
}

.mana-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #60a5fa, #818cf8);
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}

.mana-text {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: #fff;
    font-weight: bold;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}



.skill-item.cd .skill-cooldown {
    background: rgba(0, 0, 0, 0.6);
}

.skill-item:not(.active):not(.cd) {
    cursor: pointer;
}

.skill-item.active {
    border-color: #facc15;
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
}

.skill-item.no-mana {
    filter: grayscale(1);
    opacity: 0.6;
}

/* Capture Phase Overlay */
#capture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent, rgba(0, 0, 0, 0.6));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 100px 0 150px 0;
    z-index: 100;
    pointer-events: none;
}

.capture-ui * {
    pointer-events: auto;
}

/* Weapon Shop Tabs */
.weapon-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.w-tab-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.w-tab-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
}

.w-tab-content.hidden {
    display: none;
}

/* ============ WEAPON SHOP REDESIGN ============ */
.modal-content.weapon {
    padding: 16px;
    max-height: calc(100dvh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ws-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.ws-title {
    font-size: 1.2rem;
    font-weight: 900;
}

.ws-gold-badge {
    background: rgba(250, 204, 21, 0.12);
    border: 1px solid rgba(250, 204, 21, 0.35);
    color: var(--gold);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Upper section */
.ws-upper {
    display: flex;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ws-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    width: 100px;
}

.ws-icon-box {
    width: 90px;
    height: 90px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    flex-shrink: 0;
}

.ws-forge-bar-wrap {
    width: 90px;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ws-forge-bar-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 4px;
    transition: width 0.2s linear;
}

.ws-meta {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.6;
    width: 100%;
}

.ws-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--text-dim);
    cursor: pointer;
}

.ws-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.ws-equip-name-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.ws-equip-name {
    font-size: 1rem;
    font-weight: 800;
}

.ws-equip-lv {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 700;
}

.ws-stats-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 10px;
    flex: 1;
    overflow-y: auto;
    font-size: 0.8rem;
}

.ws-reforge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.ws-reforge-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    border-radius: 10px;
    min-width: unset;
    flex: none;
}

/* Divider */
.ws-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
    flex-shrink: 0;
}

/* Lower section */
.ws-lower {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 职业筛选按钮行 */
.ws-role-row {
    display: flex;
    gap: 8px;
}

.ws-role-btn {
    flex: 1;
    padding: 6px 8px;
    font-size: 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(15,23,42,0.8);
    color: rgba(248,250,252,0.8);
    cursor: pointer;
    transition: all 0.15s ease-out;
}

.ws-role-btn:hover {
    background: rgba(148,163,184,0.18);
}

.ws-role-btn.ws-role-btn-active {
    background: linear-gradient(135deg,#22c55e,#16a34a);
    color: #0b1520;
    border-color: rgba(74,222,128,0.6);
    box-shadow: 0 0 10px rgba(74,222,128,0.4);
}

/* Inventory Row: horizontal row of item boxes */
.ws-inv-row {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
}

.ws-inv-row .inv-item {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    padding: 4px;
    font-size: 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.ws-inv-row .inv-item-lv {
    font-size: 0.55rem;
    opacity: 0.7;
    margin-top: 2px;
}

/* Great Success Toast */
.great-success-toast {
    background: linear-gradient(135deg, rgba(10, 8, 0, 0.95), rgba(30, 20, 0, 0.95)) !important;
    border: 2px solid var(--gold) !important;
    color: var(--gold) !important;
    font-size: 1rem !important;
    font-weight: 900 !important;
    box-shadow: 0 0 25px rgba(246, 201, 67, 0.5), 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

/* Auto Forge Panel */
.autoforge-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    text-align: left;
}

.af-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.af-level-ctrl {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 900;
    font-size: 1.1rem;
}

.af-level-ctrl button {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
}

.af-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 12px;
}

.af-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.af-status {
    margin-top: 10px;
}

.af-status-title {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.af-hero-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.af-hero-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
}

.af-progress-bg {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.af-progress-fill {
    height: 100%;
    background: var(--gold);
    transition: width 0.1s linear;
}

/* Switch Toggle Component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid var(--border);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* ============ POWER BANNER ============ */
.power-banner {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 6000;
    pointer-events: none;
    animation: powerBannerIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               powerBannerOut 0.5s 2.3s ease-in forwards;
}

.power-banner-hero {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.5));
}

.power-banner-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.power-banner-diff {
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1;
}

.power-banner-diff.up {
    color: #4ade80;
    text-shadow:
        0 0 20px rgba(74, 222, 128, 0.9),
        0 0 50px rgba(74, 222, 128, 0.5),
        0 2px 0 rgba(0,0,0,0.5);
}

.power-banner-diff.down {
    color: #f87171;
    text-shadow:
        0 0 20px rgba(248, 113, 113, 0.9),
        0 0 50px rgba(248, 113, 113, 0.5),
        0 2px 0 rgba(0,0,0,0.5);
}

@keyframes powerBannerIn {
    from { opacity: 0; transform: translateX(-50%) scale(0.4); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

@keyframes powerBannerOut {
    from { opacity: 1; transform: translateX(-50%) scale(1); }
    to   { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.85); }
}

/* ============ CHALLENGE LIST MODAL ============ */
.modal-content.challenge-list {
    max-width: 360px;
    padding: 20px;
    max-height: calc(100dvh - 120px);
    display: flex;
    flex-direction: column;
}

.challenge-list-body {
    flex: 1;
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
    padding-right: 2px;
}

/* ---- 挑战列表单行布局（重置为简单、可靠的版本） ---- */
.challenge-row {
    display: flex;
    align-items: center;              /* 左右垂直居中，对齐视觉中心 */
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    gap: 16px;
    transition: background 0.2s;
}

.challenge-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

.challenge-row-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.challenge-row-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}

.challenge-row-sub {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.challenge-row-timer {
    font-size: 0.7rem;
    color: #60a5fa;
    margin-top: 3px;
    font-weight: 700;
}

.challenge-row-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    margin-left: 24px;
}

/* 只在挑战列表里重置 modal 按钮的通用 flex 行为，避免被 .modal-btn 的 flex:1 顶跑 */
.challenge-row-btn.modal-btn {
    flex: 0 0 auto;
    min-width: 72px;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    box-sizing: border-box;
    white-space: nowrap;
}

/* ============ EXPEDITION MODAL ============ */
.modal-content.expedition {
    max-width: 340px;
    padding: 20px;
}

.expedition-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.25);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.expedition-duration {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.expedition-reward {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.9rem;
}

.expedition-select-hint {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: 8px 0 10px;
    text-align: center;
}

.expedition-hero-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px;
    min-height: 64px;
    margin-bottom: 4px;
    justify-content: center;
}

/* =====================================================
   晶石矿场 弹窗
   ===================================================== */
.modal-content.crystalmine {
    max-width: 380px;
    width: 92%;
}

.cmine-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.cmine-info-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.cmine-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.cmine-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #a78bfa;
}

.cmine-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.cmine-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    border-radius: 4px;
    transition: width 0.2s;
    width: 0%;
}

/* =====================================================
   增益铺老虎机 弹窗
   ===================================================== */
.modal-content.slotmachine {
    max-width: 400px;
    width: 94%;
}

.sm-resource-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.sm-res-item {
    font-weight: 600;
    color: #a78bfa;
}

.sm-cost-label {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.sm-accumulated {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.sm-acc-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
}

.sm-acc-item.atk {
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.sm-acc-item.hp {
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Buff 栏 */
.sm-buff-bar {
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.sm-buff-title {
    margin-bottom: 4px;
}

.sm-buff-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sm-buff-tag {
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    font-size: 0.72rem;
    background: rgba(15, 23, 42, 0.9);
}

.sm-buff-tag--size {
    border-color: rgba(52, 211, 153, 0.8);
    color: #6ee7b7;
}

.sm-buff-tag--spd {
    border-color: rgba(59, 130, 246, 0.8);
    color: #93c5fd;
}

.sm-buff-tag--range {
    border-color: rgba(251, 191, 36, 0.8);
    color: #facc15;
}

.sm-buff-tag--crit {
    border-color: rgba(248, 113, 113, 0.8);
    color: #fecaca;
}

.sm-buff-empty {
    opacity: 0.7;
}

.sm-reels {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 14px;
}

.sm-reel {
    width: 70px;
    height: 70px;
    background: rgba(15, 10, 30, 0.8);
    border: 2px solid rgba(167, 139, 250, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.2);
    transition: border-color 0.2s;
}

.sm-reel.spinning {
    animation: reelBounce 0.4s ease-out;
    border-color: #a78bfa;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

@keyframes reelBounce {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.25) rotate(-8deg); }
    60%  { transform: scale(0.95) rotate(4deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.sm-result {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #9ca3af;
    min-height: 1.4em;
    margin-bottom: 12px;
}

.sm-rules {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.76rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.sm-rule-item {
    margin-bottom: 2px;
}

/* ---- 槽位中奖高亮 ---- */
.sm-reel.reel-win2 {
    animation: reelWin2 0.55s ease-out forwards;
    border-color: #f6c943;
    box-shadow: 0 0 28px rgba(246, 201, 67, 0.85), inset 0 0 12px rgba(246, 201, 67, 0.25);
}

@keyframes reelWin2 {
    0%   { transform: scale(1);    filter: brightness(1); }
    20%  { transform: scale(1.35); filter: brightness(1.8); }
    50%  { transform: scale(1.15); filter: brightness(1.4); }
    75%  { transform: scale(1.22); filter: brightness(1.6); }
    100% { transform: scale(1.1);  filter: brightness(1.3); }
}

.sm-reel.reel-win3 {
    animation: reelWin3 0.7s ease-out forwards;
    border-color: #f43f5e;
    box-shadow: 0 0 36px rgba(244, 63, 94, 0.9), inset 0 0 16px rgba(244, 63, 94, 0.3);
}

@keyframes reelWin3 {
    0%   { transform: scale(1)    rotate(0deg);  filter: brightness(1)   hue-rotate(0deg); }
    15%  { transform: scale(1.5)  rotate(-10deg);filter: brightness(2.5) hue-rotate(60deg); }
    35%  { transform: scale(1.25) rotate(8deg);  filter: brightness(2)   hue-rotate(120deg); }
    55%  { transform: scale(1.4)  rotate(-5deg); filter: brightness(2.2) hue-rotate(200deg); }
    75%  { transform: scale(1.2)  rotate(3deg);  filter: brightness(1.8) hue-rotate(280deg); }
    100% { transform: scale(1.15) rotate(0deg);  filter: brightness(1.5) hue-rotate(360deg); }
}

/* ---- 槽位组包裹容器（用于定位 win-banner 在其内） ---- */
.sm-reels-wrap {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 14px;
}

.sm-reels-wrap .sm-reels {
    margin-bottom: 0;
}

/* ---- 说明区包裹（为横幅提供定位基准） ---- */
.sm-rules-wrap {
    position: relative;
}

/* ---- 中奖特效横幅（绝对定位覆盖说明区，零位移） ---- */
.sm-win-banner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 8px;
    pointer-events: none;
    z-index: 5;
}

.sm-win-banner--2 {
    background: linear-gradient(135deg, rgba(246,201,67,0.22) 0%, rgba(246,201,67,0.08) 100%);
    border: 1px solid rgba(246,201,67,0.5);
    animation: winBanner2 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

.sm-win-banner--3 {
    background: linear-gradient(135deg, rgba(244,63,94,0.25) 0%, rgba(167,139,250,0.12) 100%);
    border: 1px solid rgba(244,63,94,0.6);
    animation: winBanner3 0.45s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes winBanner2 {
    0%   { opacity: 0; transform: scale(0.7); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes winBanner3 {
    0%   { opacity: 0; transform: scale(0.5) rotate(-3deg); }
    60%  { transform: scale(1.06) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.sm-win-mult {
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    text-shadow: 0 0 14px currentColor;
    white-space: nowrap;
}

.sm-win-mult--2 {
    color: #f6c943;
    animation: multPulse2 0.6s ease-in-out infinite alternate;
}

@keyframes multPulse2 {
    from { text-shadow: 0 0 10px #f6c943, 0 0 22px #f6c943; filter: brightness(1); }
    to   { text-shadow: 0 0 20px #f6c943, 0 0 45px #f6c943; filter: brightness(1.4); }
}

.sm-win-mult--3 {
    color: #f43f5e;
    animation: multPulse3 0.45s ease-in-out infinite alternate;
    background: linear-gradient(90deg, #f43f5e, #fb923c, #f6c943, #4ade80, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 100%;
    animation: multRainbow3 0.8s linear infinite;
}

@keyframes multRainbow3 {
    0%   { background-position: 0% 50%;   filter: brightness(1.1); }
    50%  { background-position: 100% 50%; filter: brightness(1.5); }
    100% { background-position: 0% 50%;   filter: brightness(1.1); }
}

.sm-win-gain {
    font-size: 1rem;
    font-weight: 700;
    color: #e2e8f0;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
    white-space: nowrap;
}

/* 用分隔线分开乘数和属性文字 */
.sm-win-sep {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.sm-win-banner--fade {
    animation: winFade 0.4s ease-in forwards !important;
}

@keyframes winFade {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.85); }
}

/* ---- 槽位区震动（X3时，只动槽位不闪窗口） ---- */
.sm-reels-wrap.shake3 {
    animation: modalShake 0.45s ease-out;
}

@keyframes modalShake {
    0%  { transform: translateX(0); }
    15% { transform: translateX(-8px) rotate(-1deg); }
    30% { transform: translateX(8px)  rotate(1deg); }
    45% { transform: translateX(-5px) rotate(-0.5deg); }
    60% { transform: translateX(5px)  rotate(0.5deg); }
    80% { transform: translateX(-2px); }
    100%{ transform: translateX(0); }
}

/* ============ ARMOR SHOP UI (美化版) ============ */
.rpg-title {
    font-family: 'Cinzel', serif;
}

@keyframes pulse-gold {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.5), 0 0 20px rgba(212, 175, 55, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 25px rgba(212, 175, 55, 0.8), 0 0 50px rgba(212, 175, 55, 0.5);
        transform: scale(1.02);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.animate-pulse-gold {
    animation: pulse-gold 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.animate-glow-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(212,175,55,0.6);
    border-radius: 50%;
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
}

.armor-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.modal-content.armor-shop {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(10,13,20,0.95) 0%, rgba(13,17,23,0.98) 100%);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(212,175,55,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212,175,55,0.02) 0%, transparent 50%);
}

/* 顶部区域 */
.armor-top-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    flex-shrink: 0;
    position: relative;
}

.armor-level-badge {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

.level-badge {
    background: linear-gradient(135deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.6) 100%);
    border: 2px solid #d4af37;
    box-shadow: 0 0 15px rgba(212,175,55,0.5), inset 0 0 10px rgba(212,175,55,0.1);
    padding: 8px 16px;
    border-radius: 8px;
    position: relative;
}

.level-badge::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent, rgba(212,175,55,0.3), transparent);
    border-radius: inherit;
    z-index: -1;
    animation: glow-pulse 2s ease-in-out infinite;
}

.level-badge .rpg-title {
    color: #d4af37;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 2px;
}

.weapon-container {
    position: relative;
    filter: drop-shadow(0 0 20px rgba(212,175,55,0.3));
    transition: all 0.3s ease;
    margin: 20px 0;
}

.weapon-container:hover {
    filter: drop-shadow(0 0 30px rgba(212,175,55,0.6));
    transform: scale(1.05);
}

.weapon-glow {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(212,175,55,0.3) 0%, rgba(0,0,0,0) 70%);
    filter: blur(30px);
    opacity: 0.4;
    animation: glow-pulse 2s ease-in-out infinite;
}

.armor-icon-display {
    font-size: 120px;
    line-height: 1;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 0 15px rgba(212,175,55,0.4));
    border-radius: 18px;
    padding: 10px;
    border: 3px solid rgba(255,255,255,0.2);
    box-shadow: 0 0 15px rgba(0,0,0,0.6);
}

/* 护甲品阶外观（根据 tier 切换边框颜色和发光） */
.armor-tier-0 {
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 10px rgba(255,255,255,0.2);
}

.armor-tier-1 {
    border-color: #4ade80;
    box-shadow: 0 0 15px rgba(74,222,128,0.6);
}

.armor-tier-2 {
    border-color: #60a5fa;
    box-shadow: 0 0 18px rgba(96,165,250,0.7);
}

.armor-tier-3 {
    border-color: #c084fc;
    box-shadow: 0 0 20px rgba(192,132,252,0.8);
}

.armor-tier-4 {
    border-color: #facc15;
    box-shadow: 0 0 24px rgba(250,204,21,0.9);
}

.armor-name-section {
    text-align: center;
    margin-top: 20px;
}

.armor-name-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.8), 0 0 20px rgba(212, 175, 55, 0.4);
    color: #d4af37;
}

.armor-name-underline {
    height: 2px;
    width: 120px;
    background: linear-gradient(to right, transparent, #d4af37, transparent);
    margin: 8px auto 0;
    animation: shimmer 2s infinite;
}

/* 中间区域 */
.armor-middle-section {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
}

.armor-stats-container {
    background: linear-gradient(180deg, rgba(22,27,34,0.95) 0%, rgba(13,17,23,0.95) 100%);
    border: 1px solid #30363d;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6), 0 4px 12px rgba(0,0,0,0.3);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.armor-stats-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,175,55,0.3), transparent);
}

.stats-decorative-corner {
    position: absolute;
    width: 60px;
    height: 60px;
    pointer-events: none;
}

.stats-decorative-corner.top-right {
    top: 0;
    right: 0;
    background: linear-gradient(to bottom left, rgba(212,175,55,0.1) 0%, transparent 100%);
}

.stats-decorative-corner.bottom-left {
    bottom: 0;
    left: 0;
    background: linear-gradient(to top right, rgba(212,175,55,0.1) 0%, transparent 100%);
}

.stats-connecting-line {
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, transparent, rgba(212,175,55,0.4), transparent);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 1rem;
    position: relative;
    transition: all 0.2s ease;
}

.stat-item::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: rgba(212,175,55,0.5);
    font-size: 0.6rem;
    transition: color 0.2s;
}

.stat-item:hover {
    transform: translateX(4px);
}

.stat-item:hover::before {
    color: rgba(212,175,55,1);
}

.stat-label {
    color: #8b949e;
    font-size: 1rem;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.stat-value.highlight {
    color: #f0883e;
}

.stat-value.accent {
    color: #d4af37;
}

.stat-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #30363d, transparent);
    margin: 8px 0;
}

.armor-effect-box {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(8px);
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 16px;
    font-size: 0.9rem;
    color: #8b949e;
    line-height: 1.5;
    position: relative;
}

.armor-effect-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
}

.skill-box {
    border-left: 3px solid #d4af37;
    background: linear-gradient(90deg, rgba(212,175,55,0.05) 0%, transparent 100%);
    position: relative;
}

.skill-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, #d4af37, transparent);
    animation: glow-pulse 2s ease-in-out infinite;
}

/* 护甲铺高热槽进度条 */
.armor-heat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 4px;
}

.armor-heat-bar {
    width: 100%;
    height: 40px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

.armor-heat-fill {
    width: 100%;
    height: 0%;
    position: absolute;
    left: 0;
    bottom: 0;
    background: linear-gradient(180deg, #f97316, #ef4444);
    box-shadow: 0 0 12px rgba(248, 113, 22, 0.9);
    transition: height 0.25s ease-out;
}

.armor-heat-text {
    margin-top: 4px;
    text-align: right;
    font-size: 0.8rem;
    color: #e5e7eb;
    opacity: 0.9;
}

/* 进度条 */
.armor-progress-container {
    margin: 20px 0;
    flex-shrink: 0;
}

.armor-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: hidden;
    border: 1px solid #30363d;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.armor-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 10px rgba(212,175,55,0.6);
    position: relative;
    transition: width 0.3s ease;
}

.armor-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

/* 底部区域 */
.armor-bottom-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-shrink: 0;
}

.armor-role-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.tab-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-radius: 10px;
    border: 1px solid #30363d;
    background: rgba(22,27,34,0.6);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(212,175,55,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.tab-button:hover::before {
    width: 200%;
    height: 200%;
}

.tab-button.active {
    background: linear-gradient(135deg, rgba(212,175,55,0.2) 0%, rgba(212,175,55,0.1) 100%);
    border-color: #d4af37;
    box-shadow: 0 0 15px rgba(212,175,55,0.4), inset 0 0 10px rgba(212,175,55,0.1);
}

.tab-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 6px;
    filter: grayscale(1);
    opacity: 0.5;
    transition: all 0.3s;
}

.tab-button.active .tab-icon {
    filter: none;
    opacity: 1;
    transform: scale(1.1);
}

.tab-label {
    font-size: 0.7rem;
    color: #8b949e;
    font-weight: 600;
    transition: color 0.3s;
}

.tab-button.active .tab-label {
    color: #d4af37;
    font-weight: 700;
}

.armor-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.armor-main-btn-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.cost-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 100%);
    border: 1px solid rgba(212,175,55,0.3);
    box-shadow: 0 0 10px rgba(212,175,55,0.2);
    padding: 6px 14px;
    border-radius: 999px;
    transition: all 0.3s ease;
}

.cost-badge:hover {
    border-color: rgba(212,175,55,0.6);
    box-shadow: 0 0 15px rgba(212,175,55,0.4);
    transform: scale(1.05);
}

.cost-icon {
    font-size: 1.5rem;
    animation: pulse-gold 2s infinite;
}

.armor-batch-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.armor-batch-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #d4af37;
}

.armor-batch-toggle span {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 2px;
}

.enhance-button {
    width: 100%;
    max-width: 200px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
    background-size: 200% 100%;
    color: #0a0d14;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(212,175,55,0.4);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.enhance-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.enhance-button:hover:not(:disabled)::before {
    left: 100%;
}

.enhance-button:hover:not(:disabled) {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212,175,55,0.6), 0 0 30px rgba(212,175,55,0.4);
}

.enhance-button:active:not(:disabled) {
    transform: translateY(0);
}

.enhance-button:disabled {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    box-shadow: none;
    border-color: rgba(255,255,255,0.1);
}

.armor-advance-section {
    margin-top: -5px;
}

.back-button {
    width: 48px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22,27,34,0.8);
    border: 1px solid #30363d;
    border-radius: 10px;
    color: #8b949e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(212,175,55,0.5);
    color: #d4af37;
    transform: translateX(-4px);
}

.back-icon {
    width: 28px;
    height: 28px;
}

.armor-resources {
    position: absolute;
    top: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: right;
    font-weight: 600;
    z-index: 10;
}

.armor-resources span {
    color: #d4af37;
    font-weight: 700;
    font-size: 1.1rem;
}

/* 全屏弹窗覆盖层 */
#modal-armor.modal-overlay {
    bottom: 0;
    height: 100%;
    backdrop-filter: blur(8px);
}

/* 护甲高热模式中央弹窗 */
.heat-popup {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 9999;
}

.heat-popup-inner {
    min-width: 220px;
    padding: 18px 28px;
    border-radius: 999px;
    background: radial-gradient(circle at 50% 0%, rgba(254, 249, 195, 0.9), rgba(248, 113, 22, 0.95));
    box-shadow: 0 0 40px rgba(248, 113, 22, 0.9);
    color: #111827;
    font-size: 1.8rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: 4px;
}

.heat-popup-inner.super {
    background: radial-gradient(circle at 50% 0%, rgba(254, 226, 226, 0.95), rgba(248, 113, 113, 0.98));
    box-shadow: 0 0 50px rgba(248, 113, 113, 1);
}