/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

:root {
    --bg-dark: #0f0e17;
    --bg-mid: #1a1a2e;
    --bg-light: #16213e;
    --accent: #e94560;
    --accent2: #0f3460;
    --gold: #f5c518;
    --text: #eee;
    --text-dim: #8b8ba7;
    --green: #4ade80;
    --border: rgba(255,255,255,0.1);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    touch-action: none;
    overscroll-behavior: none;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ===== 屏幕切换 ===== */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* ===== 启动画面 ===== */
#splash-screen {
    background: linear-gradient(160deg, #0f0e17 0%, #1a1a2e 40%, #0f3460 100%);
}

.splash-content {
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

.logo-gem {
    font-size: 80px;
    filter: drop-shadow(0 0 30px rgba(233,69,96,0.6));
    animation: float 3s ease-in-out infinite;
}

.logo h1 {
    font-size: 32px;
    font-weight: 800;
    margin-top: 16px;
    background: linear-gradient(90deg, #e94560, #f5c518, #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== HUD ===== */
.hud {
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 12px 8px 6px;
    background: rgba(15,14,23,0.85);
    backdrop-filter: blur(10px);
    gap: 4px;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.hud-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}

.hud-value.danger {
    color: var(--accent);
    animation: pulse 0.5s ease;
}

/* ===== 画布区域 ===== */
.canvas-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    overflow: hidden;
}

#game-canvas {
    display: block;
    border-radius: 12px;
    background: rgba(0,0,0,0.3);
    box-shadow: 0 4px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(0,0,0,0.3);
}

/* ===== 底部按钮栏 ===== */
.bottom-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 10px 16px env(safe-area-inset-bottom, 10px);
    background: rgba(15,14,23,0.85);
    backdrop-filter: blur(10px);
}

.btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-light);
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
}

.btn-icon:active {
    transform: scale(0.9);
    background: var(--accent2);
}

.btn-icon.muted {
    opacity: 0.4;
    border-color: var(--text-dim);
}

/* ===== 按钮 ===== */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px 32px;
    margin-top: 24px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e94560, #c23152);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(233,69,96,0.4);
    transition: transform 0.15s;
}

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

.btn-secondary {
    display: block;
    width: 100%;
    padding: 14px 32px;
    margin-top: 12px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

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

/* ===== 弹窗 ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(160deg, #1a1a2e, #0f3460);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 28px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 10px 60px rgba(0,0,0,0.5);
    animation: scaleIn 0.3s ease;
}

.modal-content h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.modal-stars {
    font-size: 40px;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

.modal-score {
    color: var(--text-dim);
    font-size: 18px;
    margin-bottom: 8px;
}

.modal-score span {
    color: var(--gold);
    font-weight: 700;
}

/* ===== 连击提示 ===== */
.combo-text {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 36px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(245,197,24,0.8), 0 2px 8px rgba(0,0,0,0.5);
    z-index: 200;
    pointer-events: none;
    opacity: 0;
}

.combo-text.show {
    animation: comboPop 1s ease forwards;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@keyframes comboPop {
    0% { transform: translate(-50%, -50%) scale(0) rotate(-15deg); opacity: 0; }
    30% { transform: translate(-50%, -50%) scale(1.2) rotate(5deg); opacity: 1; }
    60% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
    100% { transform: translate(-50%, -80%) scale(0.8) rotate(0deg); opacity: 0; }
}

/* ===== 响应式 ===== */
@media (max-height: 600px) {
    .logo-gem { font-size: 56px; }
    .logo h1 { font-size: 26px; }
    .hud-value { font-size: 16px; }
    .hud-label { font-size: 9px; }
    .hud { padding: 8px 8px 4px; }
    .btn-icon { width: 42px; height: 42px; font-size: 20px; }
    .bottom-bar { padding: 8px 16px; }
}

@media (min-width: 500px) {
    .modal-content { max-width: 380px; }
}
