@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;900&family=Noto+Sans+SC:wght@400;700;900&display=swap');

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0b0f19;
    font-family: 'Noto Sans SC', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #ffffff;
}

#appContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b263b 0%, #0d131f 100%);
}

/* 摄像头背景视频层 (镜像) */
#webcamVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    opacity: 0.22; /* 适度半透明，让玩家看清自己动作的同时不干扰游戏水果对比度 */
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* 游戏 Canvas 层 */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* UI 覆盖层通用 */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.ui-interactive {
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* 顶部 HUD 栏 */
.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 36px;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-badge {
    background: rgba(13, 27, 42, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 12px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.score-title {
    font-size: 14px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 42px;
    font-weight: 900;
    color: #f1c40f;
    text-shadow: 0 0 16px rgba(241, 196, 15, 0.5);
    line-height: 1.1;
}

.high-score-text {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* 健身数据监控浮窗 */
.fitness-card {
    display: flex;
    gap: 18px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 18px;
    padding: 12px 24px;
    box-shadow: 0 0 25px rgba(0, 242, 254, 0.2);
}

.fitness-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fitness-icon {
    font-size: 24px;
}

.fitness-info {
    display: flex;
    flex-direction: column;
}

.fitness-label {
    font-size: 11px;
    color: #94a3b8;
}

.fitness-val {
    font-size: 22px;
    font-weight: 900;
    color: #00f2fe;
}

/* 经典模式红叉 / 计时器 */
.strikes-indicator {
    font-size: 28px;
    letter-spacing: 4px;
}

.timer-indicator {
    font-size: 32px;
    font-weight: 900;
    color: #ff9f43;
    text-shadow: 0 0 12px rgba(255, 159, 67, 0.5);
}

/* 快捷控制按钮组 */
.quick-controls {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(0, 242, 254, 0.6);
    transform: scale(1.08);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}

.lang-btn {
    min-width: 58px;
    padding: 0 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: #00f2fe;
    border-color: rgba(0, 242, 254, 0.4);
}

.start-top-bar {
    position: absolute;
    top: 24px;
    right: 36px;
    display: flex;
    gap: 12px;
    z-index: 20;
}

/* 开始界面 */
.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    background: rgba(10, 15, 29, 0.7);
    backdrop-filter: blur(8px);
}

.game-title {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: 3px;
    text-align: center;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 50%, #ff6b6b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 24px rgba(79, 172, 254, 0.4));
}

.game-subtitle {
    font-size: 20px;
    color: #94a3b8;
    margin-bottom: 40px;
    text-align: center;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 960px;
    width: 100%;
    margin-bottom: 36px;
}

.mode-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    transition: background 0.3s;
}

.mode-card.classic::before { background: linear-gradient(90deg, #2ecc71, #27ae60); }
.mode-card.fitness::before { background: linear-gradient(90deg, #ff4757, #ff6b81); }
.mode-card.arcade::before { background: linear-gradient(90deg, #feca57, #ff9f43); }

.mode-card:hover {
    transform: translateY(-8px) scale(1.03);
    border-color: rgba(0, 242, 254, 0.5);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 242, 254, 0.25);
    background: rgba(40, 56, 80, 0.85);
}

.mode-icon {
    font-size: 52px;
    margin-bottom: 16px;
}

.mode-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.mode-desc {
    font-size: 14px;
    color: #94a3b8;
    line-height: 1.5;
}

.fitness-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ff4757;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 8px;
    text-transform: uppercase;
}

/* 玩法提示与设置条 */
.tips-bar {
    display: flex;
    align-items: center;
    gap: 30px;
    color: #cbd5e1;
    font-size: 15px;
    background: rgba(15, 23, 42, 0.6);
    padding: 12px 28px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.tip-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 模态框通用 */
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal-content {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 28px;
    padding: 40px 50px;
    text-align: center;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(0, 242, 254, 0.2);
}

.modal-title {
    font-size: 38px;
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 16px;
    color: #ff4757;
    margin-bottom: 28px;
}

/* 结算健身数据看板 */
.settlement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.settle-box {
    background: rgba(30, 41, 59, 0.8);
    border-radius: 16px;
    padding: 18px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.settle-num {
    font-size: 32px;
    font-weight: 900;
    color: #00f2fe;
    margin-bottom: 4px;
}

.settle-label {
    font-size: 13px;
    color: #94a3b8;
}

.modal-actions {
    display: flex;
    gap: 16px;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    border: none;
    border-radius: 16px;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #0b0f19;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 16px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 倒计时大字 */
.countdown-number {
    font-size: 140px;
    font-weight: 900;
    color: #00f2fe;
    text-shadow: 0 0 50px rgba(0, 242, 254, 0.8), 0 0 100px rgba(79, 172, 254, 0.5);
    animation: pulse 0.9s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.6); opacity: 0.2; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1.0); opacity: 0.9; }
}

/* 加载遮罩 */
.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(0, 242, 254, 0.2);
    border-top-color: #00f2fe;
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 杨桃货币徽章 */
.starfruit-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(249, 202, 36, 0.15);
    border: 1px solid rgba(249, 202, 36, 0.4);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 16px;
    font-weight: 900;
    color: #ffeaa7;
    text-shadow: 0 0 10px rgba(249, 202, 36, 0.5);
}

.starfruit-icon {
    font-size: 20px;
}

/* 商店模态框 */
.shop-modal-content {
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 28px;
    padding: 32px 40px;
    max-width: 820px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 242, 254, 0.2);
}

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

.shop-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.shop-tab-btn {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-tab-btn.active {
    background: rgba(0, 242, 254, 0.15);
    border-color: #00f2fe;
    color: #00f2fe;
    box-shadow: 0 0 16px rgba(0, 242, 254, 0.25);
}

.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding: 4px;
    max-height: 48vh;
}

.shop-item-card {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s ease;
}

.shop-item-card.equipped {
    border-color: #00f2fe;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.25);
    background: rgba(14, 46, 68, 0.75);
}

.skin-preview {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.blade-glow-line {
    width: 80%;
    height: 8px;
    border-radius: 4px;
    box-shadow: 0 0 14px currentColor;
}

.dojo-preview {
    width: 100%;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.shop-item-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.shop-item-desc {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 14px;
    min-height: 32px;
}

.shop-item-footer {
    width: 100%;
    margin-top: auto;
}

.shop-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-buy {
    background: linear-gradient(135deg, #f9ca24 0%, #f0932b 100%);
    color: #0b0f19;
}

.btn-buy:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(249, 202, 36, 0.4);
}

.btn-buy.disabled {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-equip {
    background: rgba(0, 242, 254, 0.2);
    border: 1px solid #00f2fe;
    color: #00f2fe;
}

.btn-equip:hover {
    background: #00f2fe;
    color: #0b0f19;
}

.btn-equipped {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid #2ecc71;
    color: #2ecc71;
    cursor: default;
}

/* 右下角倍速控制浮窗 */
.speed-widget-bottom-right {
    position: absolute;
    bottom: 24px;
    right: 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 30;
}

.speed-badge-btn {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 242, 254, 0.4);
    border-radius: 20px;
    padding: 10px 18px;
    color: #00f2fe;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 254, 0.2);
    transition: all 0.2s ease;
}

.speed-badge-btn:hover {
    transform: scale(1.06);
    background: rgba(15, 23, 42, 0.95);
    border-color: #00f2fe;
    box-shadow: 0 8px 28px rgba(0, 242, 254, 0.4);
}

.speed-panel-popover {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 20px;
    padding: 18px 22px;
    width: 290px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 242, 254, 0.25);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.25 ease;
}

.speed-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 700;
    color: #94a3b8;
}

.speed-val-highlight {
    color: #00f2fe;
    font-size: 16px;
    font-weight: 900;
}

.speed-presets-row {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.speed-preset-btn {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: 6px 4px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-preset-btn:hover {
    background: rgba(0, 242, 254, 0.2);
    border-color: #00f2fe;
}

.speed-preset-btn.active {
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    color: #0b0f19;
    border-color: #00f2fe;
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.5);
}

.speed-slider-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-slider-wrap input[type="range"] {
    flex: 1;
    accent-color: #00f2fe;
    cursor: pointer;
}

/* 手机竖屏自适应调整 */
@media (max-width: 768px) {
    .mode-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .game-title {
        font-size: 40px;
    }
    .hud-header {
        padding: 16px;
    }
    .fitness-card {
        padding: 8px 14px;
        gap: 10px;
    }
    .fitness-val {
        font-size: 16px;
    }
    .settlement-grid {
        grid-template-columns: 1fr 1fr;
    }
    .speed-widget-bottom-right {
        bottom: 16px;
        right: 16px;
    }
}
/* MedXY shared game-platform bridge. The game remains a standalone HTML/Canvas app. */
.platform-pill-button { border: 0; cursor: pointer; color: inherit; }
.platform-home-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.platform-modal-content { width: min(760px, calc(100vw - 28px)); max-height: min(82vh, 760px); overflow: auto; border: 1px solid rgba(125,211,252,.28); border-radius: 24px; padding: 24px; background: rgba(8,15,32,.97); box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.platform-modal-title { margin: 0; font-size: 24px; }
.platform-login-hint { margin: 16px 0; padding: 14px; border-radius: 12px; background: rgba(251,191,36,.12); color: #fde68a; }
.platform-login-hint a { margin-left: 8px; color: #67e8f9; font-weight: 700; }
.platform-balances { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 18px 0; }
.platform-balances > div { padding: 16px; border: 1px solid rgba(148,163,184,.2); border-radius: 14px; background: rgba(255,255,255,.04); }
.platform-balances span { display: block; color: #94a3b8; font-size: 12px; }
.platform-balances strong { display: block; margin-top: 8px; color: #fff; font-size: 24px; }
.platform-exchange-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; color: #cbd5e1; font-size: 13px; }
.platform-exchange-row input { width: 90px; margin-left: 6px; padding: 9px; border: 1px solid rgba(148,163,184,.3); border-radius: 8px; background: #111827; color: #fff; }
.platform-exchange-row .btn-primary { width: auto; padding: 10px 18px; }
.platform-tabs { display: flex; gap: 8px; margin: 16px 0 8px; }
.platform-list { min-height: 180px; }
.platform-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 12px 4px; border-bottom: 1px solid rgba(148,163,184,.14); color: #e2e8f0; font-size: 14px; }
.platform-row small { display: block; margin-top: 4px; color: #64748b; }
.platform-row strong.positive { color: #34d399; }.platform-row strong.negative { color: #fb7185; }
@media (max-width: 640px) { .platform-balances { grid-template-columns: 1fr; }.platform-modal-content { padding: 16px; }.platform-modal-title { font-size: 20px; } }
