* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    font-family: 'Zen Maru Gothic', sans-serif;
}

.letterbox {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #87CEEB;
    overflow: hidden;
    touch-action: none;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.time-display {
    position: absolute;
    top: 1.5%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

.time-display.hidden {
    display: none;
}

.level-display {
    font-size: calc(var(--game-width) * 0.055);
    font-weight: 900;
    background: linear-gradient(180deg, #FFD700 0%, #FF8C00 50%, #FF6347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(-2px -2px 0 #000) drop-shadow(2px -2px 0 #000) drop-shadow(-2px 2px 0 #000) drop-shadow(2px 2px 0 #000) drop-shadow(0 0 8px rgba(255, 150, 0, 0.6));
    margin-bottom: calc(var(--game-width) * 0.01);
}

.countdown-display {
    font-size: calc(var(--game-width) * 0.045);
    font-weight: 700;
    background: linear-gradient(180deg, #FFFFFF 0%, #E0E0E0 50%, #B0B0B0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(-2px -2px 0 #000) drop-shadow(2px -2px 0 #000) drop-shadow(-2px 2px 0 #000) drop-shadow(2px 2px 0 #000);
}

.preview {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: calc(var(--game-width) * 0.22);
    height: calc(var(--game-width) * 0.22);
    z-index: 10;
    pointer-events: none;
    transition: left 0.05s linear;
}

.preview.hidden {
    display: none;
}

.preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.1s linear;
}

/* 共通オーバーレイスタイル */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

/* スタート画面 */
.start-text {
    font-size: calc(var(--game-width) * 0.11);
    font-weight: 900;
    text-align: center;
    line-height: 1.4;
    background: linear-gradient(180deg, #FFD700 0%, #FF8C00 50%, #FF6347 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(-3px -3px 0 #000) drop-shadow(3px -3px 0 #000) drop-shadow(-3px 3px 0 #000) drop-shadow(3px 3px 0 #000) drop-shadow(0 0 15px rgba(255, 150, 0, 0.6));
    margin-bottom: 5%;
}

.start-subtext {
    font-size: calc(var(--game-width) * 0.065);
    font-weight: 700;
    color: #fff;
    text-align: center;
    line-height: 1.5;
    text-shadow:
        -3px -3px 0 #000,
        3px -3px 0 #000,
        -3px 3px 0 #000,
        3px 3px 0 #000,
        0 -3px 0 #000,
        0 3px 0 #000,
        -3px 0 0 #000,
        3px 0 0 #000;
    margin-bottom: 10%;
}

/* ゲームオーバー画面 */
.gameover-text {
    font-size: calc(var(--game-width) * 0.12);
    font-weight: 900;
    color: #ff4444;
    text-shadow:
        calc(var(--game-width) * 0.005) calc(var(--game-width) * 0.005) 0 #aa0000,
        calc(var(--game-width) * 0.01) calc(var(--game-width) * 0.01) calc(var(--game-width) * 0.02) rgba(0, 0, 0, 0.5);
    margin-bottom: 8%;
}

/* 共通ボタンスタイル */
.game-button {
    font-family: 'Zen Maru Gothic', sans-serif;
    font-size: calc(var(--game-width) * 0.06);
    font-weight: 800;
    color: #fff;
    background: #4ecdc4;
    border: none;
    padding: 3% 12%;
    border-radius: calc(var(--game-width) * 0.03);
    cursor: pointer;
    box-shadow:
        0 calc(var(--game-width) * 0.01) calc(var(--game-width) * 0.02) rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.game-button:active {
    transform: scale(0.95);
}

/* スタートボタン */
.start-button {
    background: linear-gradient(180deg, #FF6B6B 0%, #EE5A5A 100%);
    font-size: calc(var(--game-width) * 0.08);
    padding: 4% 15%;
}

/* クリア画面（暗くしない） */
#clear-overlay {
    background: transparent;
    pointer-events: none;
}

#clear-overlay .rebuild-button {
    pointer-events: auto;
}

/* 再建築ボタン */
.rebuild-button {
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    font-size: calc(var(--game-width) * 0.06);
    margin-top: 50%;
}
