/* ========================================
   style.css - 摇卦 WebApp 样式
   ======================================== */

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%; height: 100%; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    background: #1a1a2e; color: #e0ddd5;
    touch-action: manipulation;
    user-select: none; -webkit-user-select: none;
}

/* ============ 启动页 ============ */
#splash-screen {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    z-index: 100;
}
.splash-content { text-align: center; padding: 2rem; }
.splash-icon {
    font-size: 4rem; margin-bottom: 0.5rem;
    color: #d4a843; text-shadow: 0 0 20px rgba(212,168,67,0.4);
}
.splash-content h1 {
    font-size: 2.4rem; font-weight: 700; color: #d4a843;
    letter-spacing: 0.3em; margin-bottom: 0.6rem;
}
.splash-desc { font-size: 1rem; color: #8888aa; margin-bottom: 2.5rem; }

#btn-start {
    display: inline-block; padding: 0.9rem 2.8rem;
    font-size: 1.1rem; font-weight: 600; color: #1a1a2e;
    background: linear-gradient(135deg, #d4a843, #e8c463);
    border: none; border-radius: 50px; cursor: pointer;
    box-shadow: 0 4px 25px rgba(212,168,67,0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
#btn-start:active {
    transform: scale(0.96);
    box-shadow: 0 2px 12px rgba(212,168,67,0.3);
}
.splash-hint { font-size: 0.75rem; color: #555577; margin-top: 1.2rem; }

/* ============ 主界面 ============ */
#app { position: fixed; inset: 0; }

#canvas-container { position: absolute; inset: 0; z-index: 0; }
#canvas-container canvas { display: block; width: 100% !important; height: 100% !important; }

#renderCanvas {
    position: absolute; inset: 0; z-index: 0;
    width: 100%; height: 100%;
    display: block; outline: none;
    touch-action: none;
}

/* ============ 蓄力环形指示器 ============ */
#energy-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 120px; height: 120px;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
#energy-ring.visible { opacity: 1; }
#energy-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.08);
    stroke-width: 6;
}
.ring-fill {
    fill: none;
    stroke: #d4a843;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 326.73;   /* 2 * PI * 52 */
    stroke-dashoffset: 326.73;  /* 从0开始 */
    transition: stroke-dashoffset 0.15s ease-out, stroke 0.3s;
    filter: drop-shadow(0 0 6px rgba(212,168,67,0.5));
}
.ring-fill.hot {
    stroke: #ff8844;
    filter: drop-shadow(0 0 10px rgba(255,136,68,0.6));
}

#energy-label {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem; font-weight: 700;
    color: #d4a843;
    text-shadow: 0 0 10px rgba(212,168,67,0.4);
}

/* ============ 状态提示 ============ */
#status-text {
    position: absolute;
    top: max(50px, env(safe-area-inset-top, 50px));
    left: 0; right: 0;
    text-align: center;
    font-size: 1rem; color: #8888aa;
    z-index: 10; pointer-events: none;
    letter-spacing: 0.15em;
    transition: color 0.3s;
}
#status-text.charging { color: #d4a843; }
#status-text.throwing { color: #ff8844; }

/* ============ 结果面板 ============ */
#result-panel {
    position: absolute;
    bottom: 140px; left: 50%;
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    z-index: 10; pointer-events: none;
    animation: fadeInUp 0.4s ease-out;
}
#result-text {
    font-size: 2.6rem; font-weight: 700;
    color: #d4a843; letter-spacing: 0.5em;
    text-shadow: 0 0 30px rgba(212,168,67,0.5);
}
#result-detail { font-size: 0.95rem; color: #aaaacc; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============ 重置按钮 ============ */
#btn-reset {
    position: absolute; bottom: 90px; left: 50%;
    transform: translateX(-50%);
    padding: 0.65rem 2rem; font-size: 0.95rem; font-weight: 600;
    color: #d4a843;
    background: rgba(212,168,67,0.12);
    border: 1px solid rgba(212,168,67,0.35);
    border-radius: 50px; cursor: pointer; z-index: 10;
    transition: background 0.15s;
}
#btn-reset:active { background: rgba(212,168,67,0.25); }

/* ============ 底部历史 ============ */
#bottom-bar {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 10;
    background: rgba(15,15,35,0.92);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}
.history-toggle {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px; font-size: 0.8rem; color: #8888aa; cursor: pointer;
}
.history-list { max-height: 220px; overflow-y: auto; padding: 0 12px 8px; }
.history-item {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.85rem;
}
.history-time { color: #555577; font-size: 0.75rem; min-width: 60px; }
.history-result { color: #d4a843; font-weight: 600; letter-spacing: 0.3em; }
.history-detail { color: #7777aa; font-size: 0.78rem; }

.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: rgba(212,168,67,0.25); border-radius: 3px; }

/* ============ 桌面端提示 ============ */
#desktop-hint {
    position: absolute; bottom: 55px; left: 0; right: 0;
    text-align: center; font-size: 0.7rem; color: #555577;
    z-index: 10; pointer-events: none;
}
