body {
    background: #e0f7fa;
    font-family: 'Zen Maru Gothic', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    color: #333;
    min-height: 100dvh;
    -webkit-user-select: none;
    user-select: none;
}

.game-container {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 640px;
    text-align: center;
    box-sizing: border-box;
}

h1 {
    font-size: 1.5rem;
    color: #d84315;
    margin: 0 0 5px 0;
}

#instruction {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 12px 0;
}

.seo-text-box {
    margin-top: 50px;
    background-color: #fff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    max-width: 600px;
    width: 85%;
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 30px;
}
.seo-text-box h2 {
    font-size: 1.2rem;
    color: #333;
    margin-top: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

canvas {
    background: linear-gradient(to bottom, #87ceeb, #e0f8ff 70%, #a8e6cf 70%);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    height: auto;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    display: block;
    margin: 0 auto 12px auto;
    touch-action: none;
    cursor: grab;
}
canvas:active { cursor: grabbing; }

.hud {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
#best-hud,
#speed-hud {
    background: #fff3e0;
    border: 2px solid #ffb74d;
    border-radius: 20px;
    padding: 4px 16px;
    font-weight: bold;
    color: #e65100;
    font-size: 0.95rem;
}

.overlay-panel {
    background: #fff8e1;
    border: 2px solid #ffcc80;
    border-radius: 16px;
    padding: 16px;
    max-width: 420px;
    margin: 0 auto 12px auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.overlay-panel.hidden { display: none; }

.prep-copy {
    margin: 0;
    font-size: 1.15rem;
    font-weight: bold;
    color: #e65100;
}
.prep-hint {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.prev-link {
    font-size: 0.85rem;
    color: #1565c0;
    text-decoration: none;
    margin-top: 4px;
}

.hint-toast {
    position: relative;
    z-index: 5;
    margin: 0 auto 8px auto;
    max-width: 340px;
    padding: 12px 16px;
    background: rgba(255, 87, 34, 0.98);
    color: #fff;
    font-weight: bold;
    font-size: 1.15rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.hint-toast.hidden { display: none; }

.result-area {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}
.result-area.hidden { display: none; }

.result-summary {
    background: #fff3e0;
    border-radius: 12px;
    padding: 10px 12px;
    margin: 0 0 8px 0;
    font-weight: bold;
    color: #e65100;
    white-space: pre-line;
}

.main-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.1s, background 0.2s;
}
.main-btn:active { transform: scale(0.95); }

.jump-color { background: #43a047; }
.jump-color:active { background: #2e7d32; }

.restart-color { background: #ab47bc; }
.restart-color:active { background: #8e24aa; }

.back-btn {
    align-self: flex-start;
    margin-bottom: 15px;
    text-decoration: none;
    color: #555;
    font-weight: bold;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

@media (max-width: 480px) {
    .main-btn { padding: 14px; font-size: 1.05rem; }
    h1 { font-size: 1.25rem; }
}
