:root {
    --primary-color: #ff9800;
    --secondary-color: #ffeb3b;
    --text-color: #333;
    --bg-color: #fff9e6;
    --accent-color: #e91e63;
    --btn-hover: #f57c00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    touch-action: pan-x pan-y;
}

body {
    font-family: 'Hiragino Maru Gothic ProN', 'Rounded M+ 1c', 'Meiryo', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    touch-action: none;
    padding-bottom: 60px; /* AdMaxの分を確保 */
    /* ピンチズームや不要なスクロールをブロック */
    user-select: none;
    -webkit-user-select: none;
}

header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
}

main {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--bg-color);
    padding: 20px;
    text-align: center;
    z-index: 5;
}

.screen.active {
    display: flex;
}

#game-screen {
    background-color: var(--bg-color); /* 背景をベージュに戻す */
    padding: 10px 0;
    justify-content: center;
}

/* UI Elements */
.hero-image {
    width: 150px;
    height: auto;
    margin-bottom: 20px;
    animation: bounce 2s infinite ease-in-out;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.primary-btn,
.secondary-btn {
    display: inline-block;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin: 10px 0;
    width: 80%;
    max-width: 300px;
    text-align: center;
    text-decoration: none;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:active {
    background-color: var(--btn-hover);
    transform: scale(0.95);
}

.secondary-btn {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.secondary-btn:active {
    background-color: #f0f0f0;
    transform: scale(0.95);
}

#start-screen {
    overflow-y: auto;
    touch-action: pan-y;
}

.ad-space {
    margin: 20px auto;
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.ad-label {
    color: #999;
    font-size: 0.7rem;
    margin-bottom: 5px;
}

.ad-placeholder {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 160px;
    width: 100%;
}

.ad-placeholder iframe {
    margin: 0 auto !important;
}

.highlight-text {
    font-size: 1.5rem;
    color: #e74c3c;
    font-weight: bold;
}

.hint-text {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background-color: var(--secondary-color);
    color: var(--text-color);
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}

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

/* Game canvas container */
.game-header {
    position: relative; /* absoluteから変更 */
    width: 100%;
    max-width: 480px; /* キャンバスの最大幅に合わせる */
    margin: 0 auto 10px;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    background-color: transparent;
    z-index: 20;
    font-weight: bold;
    font-size: 1.2rem;
}

#canvas-container {
    width: 100%;
    height: auto;
    flex: none;
    display: flex;
    justify-content: center;
    position: relative;
}

canvas {
    width: 90%;
    max-width: 480px;
    aspect-ratio: 1 / 1.5;
    border: 4px solid var(--primary-color);
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    background: #87CEEB;
    display: block;
}

#global-footer-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 1000;
    min-height: 50px;
}

.guide-text {
    position: absolute;
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
    pointer-events: none;
    animation: fadeOut 2s 2s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}
