:root {
    --app-bg: #000000;
    --app-card-bg: rgba(28, 28, 30, 0.65);
    --app-card-border: rgba(255, 255, 255, 0.12);
    --app-primary: #0A84FF;
    --app-danger: #FF453A;
    --app-success: #30D158;
    --app-warning: #FFD60A;
    --app-text: #FFFFFF;
    --app-text-secondary: rgba(235, 235, 245, 0.6);
    --app-radius: 18px;
    --app-blur: 25px;
}

* {
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--app-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(58, 64, 90, 0.4) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(20, 30, 48, 0.4) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--app-text);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.app-container {
    width: 100%;
    max-width: 1200px;
    height: 95vh;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    padding: 20px;
}

.glass-panel {
    background: var(--app-card-bg);
    backdrop-filter: blur(var(--app-blur));
    -webkit-backdrop-filter: blur(var(--app-blur));
    border: 1px solid var(--app-card-border);
    border-radius: var(--app-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#myCanvas {
    background: url('map.png') no-repeat center center;
    background-size: cover;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1/1;
    width: auto;
    height: 90%;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.rotate0 { transform: rotate(0deg); }
.rotate180 { transform: rotate(180deg); }

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    overflow: hidden;
}

.panel-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--app-card-border);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    letter-spacing: 0.5px;
}

.status-badge {
    font-size: 12px;
    font-weight: 400;
    color: var(--app-text-secondary);
}

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.scroll-content::-webkit-scrollbar {
    width: 0;
}

#heroList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-card {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.hero-card:active {
    transform: scale(0.98);
}

.heroliHF .hero-card {
    background: linear-gradient(90deg, rgba(255, 69, 58, 0.05) 0%, rgba(255, 255, 255, 0.05) 100%);
}
.heroliLF .hero-card {
    background: linear-gradient(90deg, rgba(10, 132, 255, 0.05) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.hero-card.dead {
    opacity: 0.4;
    filter: grayscale(80%);
}
.hero-card.low-hp {
    background: rgba(255, 69, 58, 0.25) !important;
    box-shadow: 0 0 20px rgba(255, 69, 58, 0.5), inset 0 0 15px rgba(255, 69, 58, 0.15);
    border: 1px solid rgba(255, 69, 58, 0.5);
    animation: lowHpPulse 1s ease-in-out infinite;
}
@keyframes lowHpPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 69, 58, 0.4), inset 0 0 10px rgba(255, 69, 58, 0.1);
        border-color: rgba(255, 69, 58, 0.4);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 69, 58, 0.7), inset 0 0 20px rgba(255, 69, 58, 0.2);
        border-color: rgba(255, 69, 58, 0.8);
    }
}
.hero-card.spell-used {
    animation: spellUsedFlash 0.3s ease-out 3;
}
@keyframes spellUsedFlash {
    0%, 100% {
        background: rgba(255, 214, 10, 0.1);
        box-shadow: none;
    }
    50% {
        background: rgba(255, 214, 10, 0.4);
        box-shadow: 0 0 20px rgba(255, 214, 10, 0.6);
    }
}
.death-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    background: rgba(128, 128, 128, 0.3);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(128, 128, 128, 0.3);
}

.hero-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    margin-right: 14px;
    border: 2px solid transparent;
    background-color: #333;
}

.heroTxHF { border-color: var(--app-danger); }
.heroTxLF { border-color: var(--app-primary); }

.hero-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
}

.hero-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.hero-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--app-text);
    letter-spacing: 0.5px;
}

/* 血条容器 */
.hp-bar-container {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    margin-left: 8px;
}

/* 血条外壳 */
.hp-bar {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

/* 血条填充 */
.hp-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 0 4px currentColor;
}

/* 血量颜色 */
.hp-bar-fill.hp-high {
    background: linear-gradient(90deg, #30D158, #34C759);
}
.hp-bar-fill.hp-medium {
    background: linear-gradient(90deg, #FFD60A, #FFCC00);
}
.hp-bar-fill.hp-low {
    background: linear-gradient(90deg, #FF453A, #FF3B30);
    animation: hpLowPulse 1s ease-in-out infinite;
}

@keyframes hpLowPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* 血量数字 */
.hp-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--app-text);
    min-width: 42px;
    text-align: right;
}

.skill-row {
    display: flex;
    gap: 8px;
}

.skill-tag {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.skill-tag.cooldown {
    background: rgba(255, 69, 58, 0.15);
    color: #FF453A;
    border: 1px solid rgba(255, 69, 58, 0.2);
}

.skill-tag.warning {
    background: rgba(255, 214, 10, 0.15);
    color: #FFD60A;
    border: 1px solid rgba(255, 214, 10, 0.3);
}

.skill-tag.ready {
    background: rgba(48, 209, 88, 0.15);
    color: #30D158;
    border: 1px solid rgba(48, 209, 88, 0.3);
    box-shadow: 0 0 10px rgba(48, 209, 88, 0.1);
}

.skill-label {
    margin-right: 4px;
    opacity: 0.8;
    font-weight: 400;
}

#homeList li {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(60, 60, 60, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--app-text-secondary);
}

#homeList li:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.homeListSelectLi {
    background: linear-gradient(90deg, rgba(10, 132, 255, 0.2), rgba(10, 132, 255, 0.1)) !important;
    border: 1px solid rgba(10, 132, 255, 0.3);
    color: #fff !important;
}

.control-group {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    margin: 0 10px 10px 10px;
}

.ios-input {
    flex: 1;
    background: rgba(118, 118, 128, 0.24);
    border: none;
    border-radius: 10px;
    height: 36px;
    padding: 0 12px;
    color: white;
    font-size: 14px;
    transition: background 0.2s;
}

.ios-input:focus {
    background: rgba(118, 118, 128, 0.4);
}

.ios-btn {
    background: var(--app-primary);
    color: white;
    border: none;
    border-radius: 18px;
    padding: 0 20px;
    height: 36px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-btn.small {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

.ios-btn:hover {
    opacity: 0.9;
}

.ios-btn:active {
    opacity: 0.7;
}

.ios-btn-danger {
    background: rgba(255, 69, 58, 0.2);
    color: #FF453A;
}
.ios-btn-danger:hover {
    background: rgba(255, 69, 58, 0.3);
}

@media screen and (max-width: 900px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
        padding-top: max(env(safe-area-inset-top), 10px);
        padding-bottom: max(env(safe-area-inset-bottom), 10px);
    }

    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        height: auto;
        min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        padding: 10px;
        padding-top: max(env(safe-area-inset-top), 20px);
        padding-bottom: env(safe-area-inset-bottom);
        gap: 15px;
    }

    .map-section {
        min-height: auto;
        padding: 15px;
        padding-top: max(env(safe-area-inset-top), 15px);
        align-items: flex-start;
        justify-content: center;
        overflow: visible;
    }

    #myCanvas {
        width: 100%;
        height: auto;
        max-width: 340px;
        aspect-ratio: 1/1;
        flex-shrink: 0;
    }

    .sidebar-section {
        height: auto;
        min-height: 40vh;
        padding-bottom: max(env(safe-area-inset-bottom), 10px);
    }
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--app-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(58, 64, 90, 0.4) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(20, 30, 48, 0.4) 0px, transparent 50%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}
.auth-overlay.hidden { display: none; }
.auth-box {
    background: var(--app-card-bg);
    backdrop-filter: blur(var(--app-blur));
    border: 1px solid var(--app-card-border);
    border-radius: var(--app-radius);
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.auth-box h2 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
}
.auth-box input {
    width: 200px;
    background: rgba(118, 118, 128, 0.24);
    border: none;
    border-radius: 10px;
    height: 40px;
    padding: 0 15px;
    color: white;
    font-size: 15px;
    text-align: center;
}
.auth-box input:focus { background: rgba(118, 118, 128, 0.4); }
.auth-box button {
    margin-top: 15px;
    width: 200px;
    height: 40px;
    background: var(--app-primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.auth-box button:hover { opacity: 0.9; }
.auth-error {
    color: var(--app-danger);
    font-size: 12px;
    margin-top: 10px;
    height: 16px;
}

/* ========== 设置面板样式 ========== */

/* 遮罩层 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 设置弹窗 */
.settings-modal {
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-overlay.active .settings-modal {
    transform: scale(1);
}

/* 关闭按钮 */
.close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--app-text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--app-text);
}

/* 设置按钮触发器 */
.settings-trigger-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--app-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--app-primary);
    transform: rotate(30deg);
}

.settings-trigger-btn:active {
    transform: scale(0.95) rotate(30deg);
}

/* 内容区域 */
.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-content::-webkit-scrollbar {
    width: 6px;
}

.settings-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* 配置分组 */
.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 4px;
}

/* 单个配置项 */
.setting-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.setting-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.setting-label > span:first-child {
    color: var(--app-text);
    font-weight: 500;
}

.setting-unit {
    color: var(--app-primary);
    font-weight: 600;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* 滑块容器 */
.slider-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* iOS风格滑块 */
.ios-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(118, 118, 128, 0.24);
    outline: none;
    transition: background 0.2s;
}

.ios-slider:hover {
    background: rgba(118, 118, 128, 0.32);
}

/* WebKit滑块样式 */
.ios-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.ios-slider::-webkit-slider-thumb:active {
    transform: scale(1.05);
}

/* Firefox滑块样式 */
.ios-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ios-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.ios-slider::-moz-range-thumb:active {
    transform: scale(1.05);
}

/* 数字输入框 */
.slider-number-input {
    width: 64px;
    height: 36px;
    background: rgba(118, 118, 128, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
}

.slider-number-input:focus {
    background: rgba(118, 118, 128, 0.4);
    border-color: var(--app-primary);
    outline: none;
}

.slider-number-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* 底部操作栏 */
.settings-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--app-card-border);
}

.ios-btn-secondary {
    background: rgba(118, 118, 128, 0.24);
    color: var(--app-text);
}

.ios-btn-secondary:hover {
    background: rgba(118, 118, 128, 0.35);
}

/* 移动端适配 */
@media screen and (max-width: 600px) {
    .settings-modal {
        width: 95%;
        max-height: 90vh;
    }

    .settings-content {
        padding: 15px;
    }

    .setting-item {
        padding: 14px;
    }

    .slider-container {
        gap: 10px;
    }

    .slider-number-input {
        width: 56px;
    }

    .settings-footer {
        flex-direction: column;
        gap: 10px;
    }

    .settings-footer > div {
        width: 100%;
        justify-content: stretch;
    }

    .settings-footer button {
        flex: 1;
    }
}

