/* 暴打神經貓 - 遊戲包裝與 UI 覆蓋層 */
:root {
    --primary-color: #f43f5e;
    --primary-hover: #e11d48;
    --border-color: rgba(255, 255, 255, 0.08);
}

body {
    background-color: #090d19;
    color: #f8fafc;
    font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 93px);
    gap: 16px;
    box-sizing: border-box;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.game-header .logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #f43f5e, #fb7185);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-actions {
    display: flex;
    align-items: center;
}

.game-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
}

.game-container {
    position: relative;
    width: 360px;
    height: 600px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    background-color: #000;
    border: 4px solid rgba(255, 255, 255, 0.1);
}

#gameCanvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* 排行榜覆蓋層 */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    display: none !important;
}

.overlay-content {
    background: #111827;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    width: 100%;
    max-width: 260px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: scale-up 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes scale-up {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.overlay-content h2 {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.overlay-content .subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 20px;
}

.new-record-panel {
    background: rgba(244, 63, 94, 0.05);
    border: 1px dashed rgba(244, 63, 94, 0.4);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.glow-text {
    font-weight: 900;
    color: #fb7185;
    font-size: 0.95rem;
    margin-bottom: 8px;
    animation: pulse 1.5s infinite;
}

#nickname-input {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.6);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    outline: none;
}

#nickname-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.25);
}

.primary-btn {
    width: 100%;
    height: 42px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #f43f5e, #e11d48);
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(244, 63, 94, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(244, 63, 94, 0.3);
}

.primary-btn:active {
    transform: translateY(1px);
}

.game-instruction {
    text-align: center;
    font-size: 0.82rem;
    color: #64748b;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 12px;
}

.game-instruction strong {
    color: #94a3b8;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.02); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

@media (max-width: 480px) {
    .app-container {
        padding: 10px;
        gap: 12px;
    }
    .game-container {
        width: 100%;
        height: calc(100vw * 1.667); /* 保持 3:5 的黃金比例 */
        max-height: calc(100vh - 200px);
    }
}
