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

html, body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: #000;
    font-family: 'Arial', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
}

#app {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background-color: #000;
}

/* 9:16の縦横比を保つキャンバス */
#gameCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    aspect-ratio: 9 / 16;
    background-color: #2d5a3d;
    position: relative;
    z-index: 1;
}

/* UIオーバーレイ */
#ui {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

#ui > * {
    pointer-events: auto;
}

/* ヘッダー */
#header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

#life {
    color: #ff6b6b;
}

/* メッセージ */
#message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow:
        3px 3px 0px #000,
        -3px -3px 0px #000,
        3px -3px 0px #000,
        -3px 3px 0px #000;
    padding: 3%;
    background-color: rgba(0,0,0,0.5);
    border-radius: 10px;
    display: none;
    pointer-events: none;
    animation: messagePopup 0.3s ease-out;
}

#message.show {
    display: block;
}

@keyframes messagePopup {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* スクリーン */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3% 5%;
    color: white;
    text-align: center;
}

.screen.hidden {
    display: none;
}

.screen h1 {
    font-size: 32px;
    margin-bottom: 5%;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.screen h2 {
    font-size: 28px;
    margin-bottom: 4%;
    color: #ffd700;
}

.screen p {
    font-size: 16px;
    margin-bottom: 3%;
    line-height: 1.6;
}

.screen p.warning {
    color: #ff6b6b;
    font-weight: bold;
}

.screen p.info {
    color: #4dabf7;
}

.game-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    padding: 3.5% 10%;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 2%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-button:hover,
.game-button:active {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

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

/* タイトル画面 */
.title-logo {
    width: 55%;
    max-width: 400px;
    margin-bottom: 3%;
}

.title-logo img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.game-description {
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 15px;
    padding: 3% 4%;
    margin-bottom: 3%;
    width: 85%;
    max-width: 600px;
}

.game-description h2 {
    font-size: 18px;
    color: #ffd700;
    margin-bottom: 2.5%;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.game-description p {
    font-size: 12px;
    margin-bottom: 1.5%;
    line-height: 1.5;
}

.rule-item {
    text-align: left;
    padding-left: 5%;
    margin-bottom: 1.5%;
}

.highlight-tile {
    color: #ffd700;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.score-plus {
    color: #51cf66;
    font-weight: bold;
}

.life-minus {
    color: #ff6b6b;
    font-weight: bold;
}

.info-text {
    color: #4dabf7;
    font-weight: bold;
    font-size: 13px;
    margin-top: 2.5%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}
