html, body {
            height: 100%;
            overflow: hidden;
        }
        body {
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0;
            background-color: #f0f0f0;
            color: #333;
            text-align: center;
        }

        #game-container {
            width: 100%;
            max-width: 450px;
            height: 100dvh;
            background-color: #fff;
            padding: 0;
            border-radius: 0;
            box-shadow: none;
            display: flex;
            flex-direction: column;
            box-sizing: border-box;
            position: relative;
            overflow: hidden;
        }

        .screen {
            display: none;
            flex-direction: column;
            align-items: center;
            flex-grow: 1;
            width: 100%;
            box-sizing: border-box;
            padding-left: 15px;
            padding-right: 15px;
            padding-top: calc(15px + env(safe-area-inset-top));
            padding-bottom: calc(15px + env(safe-area-inset-bottom));
            overflow-y: auto;
        }
        .screen.active {
            display: flex;
        }

        h2 {
            color: #333;
            text-shadow: 1px 1px 2px rgba(255,255,255,0.7);
        }
        h3 {
            margin-bottom: 20px;
            color: #333;
        }


        button {
            background-color: #4CAF50;
            color: white;
            border: none;
            padding: 12px 22px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 15px 5px;
            cursor: pointer;
            border-radius: 5px;
            transition: background-color 0.3s, box-shadow 0.2s, transform 0.2s;
            box-shadow: 0 3px #388E3C;
        }
        button:hover {
            background-color: #45a049;
        }
        button:active {
            background-color: #3e8e41;
            box-shadow: 0 1px #388E3C;
            transform: translateY(2px);
        }
        button:disabled {
            background-color: #ccc;
            cursor: not-allowed;
            box-shadow: 0 3px #aaa;
        }

        #start-button {
            background-color: #191970; /* 濃い紺色 */
            box-shadow: 0 3px #000050;
        }
        #start-button:hover {
            background-color: #2c2c8c;
        }
        #start-button:active {
            background-color: #101060;
            box-shadow: 0 1px #000030;
        }

        .difficulty-button {
            padding: 15px 30px;
            font-size: 1.2em;
            margin: 10px;
            min-width: 150px;
        }
        #normal-button { background-color: #2196F3; box-shadow: 0 3px #1976D2; }
        #normal-button:hover { background-color: #1E88E5; }
        #normal-button:active { background-color: #1976D2; box-shadow: 0 1px #1565C0;}

        #hard-button { background-color: #f44336; box-shadow: 0 3px #D32F2F; }
        #hard-button:hover { background-color: #E53935; }
        #hard-button:active { background-color: #D32F2F; box-shadow: 0 1px #C62828;}


        #title-screen {
            justify-content: center;
            background-image: url('../public/image/titlehaikei.webp');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        #title-image {
            max-width: 90%;
            height: auto;
            margin-bottom: 25px;
        }

        #highscore-display {
            margin-top: 20px;
            font-size: 1.2em;
            color: #fff;
            font-weight: bold;
            margin-bottom: 20px;
            background-color: transparent;
            padding: 8px 12px;
            line-height: 1.5;
            text-shadow:
                -1.5px -1.5px 0 #000,  1.5px -1.5px 0 #000,
                -1.5px  1.5px 0 #000,  1.5px  1.5px 0 #000,
                -1.5px 0 0 #000, 1.5px 0 0 #000, 0 1.5px 0 #000, 0 -1.5px 0 #000,
                2px 2px 3px rgba(0,0,0,0.5);
        }

                #difficulty-screen {
            justify-content: center;
            background-image: url('../public/image/kubarahaikei.webp');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        #difficulty-screen h3 {
            color: #fff;
            text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
            background-color: rgba(0,0,0,0.3);
            padding: 10px 15px;
            border-radius: 5px;
            margin-bottom: 25px;
        }

        #mute-button {
            position: absolute;
            top: calc(15px + env(safe-area-inset-top));
            right: 15px;
            background-color: rgba(0,0,0,0.6);
            color: white;
            padding: 8px 12px;
            font-size: 14px;
            border-radius: 5px;
            box-shadow: none;
            border: 1px solid #fff;
            margin: 0;
            width: 90px;
            text-align: center;
            z-index: 5;
        }
        #mute-button.muted {
            background-color: #f44336;
            border-color: #d32f2f;
        }

        #countdown-screen {
            justify-content: center;
        }
        #countdown-message {
            font-size: 4em;
            font-weight: bold;
            color: navy;
        }

                #quiz-screen {
            justify-content: flex-start;
            background-image: url('../public/image/kubarahaikei.webp');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            position: relative;
            padding-top: calc(15px + env(safe-area-inset-top));
            padding-bottom: calc(15px + env(safe-area-inset-bottom));
        }
        .quiz-top-area {
            width: 100%;
            box-sizing: border-box;
            margin-bottom: 5px;
            flex-shrink: 0;
            position: relative;
            z-index: 1;
        }

        .timer-main-container {
            display: flex;
            align-items: center;
            width: 100%;
            margin-bottom: 8px;
        }
        #game-timer-text-label {
            font-size: 0.9em;
            color: #fff;
            font-weight: bold;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8), -1px -1px 2px rgba(0,0,0,0.8), 1px -1px 2px rgba(0,0,0,0.8), -1px 1px 2px rgba(0,0,0,0.8);
            margin-right: 8px;
            white-space: nowrap;
        }
        .timer-bar-container {
            flex-grow: 1;
            background-color: #e0e0e0;
            border-radius: 5px;
            height: 22.5px;
            overflow: hidden;
            position: relative;
        }
        .timer-bar {
            height: 100%;
            background-color: #4CAF50;
            width: 100%;
            transition: width 0.1s linear;
            border-radius: 5px;
        }
        .timer-bar.low {
            background-color: #f44336;
        }

        #question-area-wrapper {
            width: 100%;
            background-color: rgba(249, 249, 249, 0.88);
            border: 1px solid rgba(220, 220, 220, 0.75);
            border-radius: 8px;
            padding: 10px 8px 8px 8px;
            box-sizing: border-box;
            min-height: 95px;
        }
        #question-display-area {
            display: flex;
            align-items: center;
            min-height: 50px;
        }
        #question-timer-container-circular {
            position: relative;
            width: 50px;
            height: 50px;
            margin-right: 10px;
            flex-shrink: 0;
        }
        #circular-timer { width: 100%; height: 100%; }
        .timer-bg-circle { fill: rgba(255,255,255,0.8); stroke: #e0e0e0; stroke-width: 3; }
        .timer-hand { stroke: #333; stroke-width: 3; stroke-linecap: round; transform-origin: center center; transition: transform 0.1s linear; }
        .timer-center-dot { fill: #333; }
        .timer-hand.low-time { stroke: #f44336; }

        #question-timer-text-below {
            position: absolute;
            top: 52px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 0.85em;
            font-weight: bold;
            color: #fff; /* 白文字に変更 */
            white-space: nowrap;
            background-color: transparent; /* 背景を透明に */
            padding: 1px 3px;
            border-radius: 2px;
            text-shadow: 1px 1px 2px rgba(0,0,0,0.8); /* 影を追加 */
        }

        #question-text {
            display: flex;
            align-items: center;
            flex-grow: 1;
            font-size: 1.0em;
            line-height: 1.35;
            text-align: left;
            max-height: 60px;
            overflow-y: auto;
            padding-left: 5px;
            color: #222;
        }

        #character-display {
            width: 100%;
            flex-grow: 1;
            min-height: 150px;
            position: relative;
            overflow: hidden;
            margin: 5px 0;
            flex-shrink: 1;
        }
        .character-image {
            width: 160px;
            height: 160px;
            object-fit: contain;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
        }

        #kubarush-display {
            position: absolute;
            top: 45%;
            left: 50%;
            transform: translateX(-50%) translateY(-50%);
            font-size: 1.3em;
            font-weight: bold;
            color: #fff;
            text-shadow: 1px 1px 3px rgba(0,0,0,0.7), -1px -1px 3px rgba(0,0,0,0.7), 1px -1px 3px rgba(0,0,0,0.7), -1px 1px 3px rgba(0,0,0,0.7);
            background-color: transparent;
            padding: 5px 10px;
            border-radius: 15px;
            z-index: 10;
            white-space: nowrap;
            transition: transform 0.2s ease-out, opacity 0.3s;
        }
        #kubarush-display.hidden {
            opacity: 0;
            transform: translateX(-50%) translateY(-50%) scale(0.8);
            pointer-events: none;
        }
        #kubarush-display.kubarush-effect {
            transform: translateX(-50%) translateY(-50%) scale(1.15);
            opacity: 1;
        }
        #kubarush-display.kubarush-milestone {
            animation: milestone-animation-center-no-bg 0.6s ease-in-out;
            opacity: 1;
        }
        @keyframes milestone-animation-center-no-bg {
            0% { transform: translateX(-50%) translateY(-50%) scale(1.15); color: #ffc107; }
            50% { transform: translateX(-50%) translateY(-50%) scale(1.35); color: #ff9800; }
            100% { transform: translateX(-50%) translateY(-50%) scale(1.2); color: #ffab40; }
        }

        .character-feedback-text {
            position: absolute;
            color: white;
            font-size: 1.4em;
            font-weight: bold;
            text-shadow: 1px 1px 1px black, -1px -1px 1px black, 1px -1px 1px black, -1px 1px 1px black, 0 0 5px black;
            padding: 4px 8px;
            border-radius: 5px;
            background-color: rgba(0, 0, 0, 0.4);
            z-index: 20;
            white-space: nowrap;
            display: none;
            pointer-events: none;
            animation: score-popup 0.4s ease-out;
        }

        @keyframes score-popup {
            from { transform: translateX(-50%) translateY(-30%) scale(0.8); opacity: 0.5; }
            to   { transform: translateX(-50%) translateY(-50%) scale(1); opacity: 1; }
        }

        .quiz-bottom-area {
            width: 100%;
            box-sizing: border-box;
            margin-top: auto;
            padding-top: 5px;
            flex-shrink: 0;
            position: relative;
            z-index: 1;
        }
        #choices-container {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            width: 100%;
            align-content: start;
            box-sizing: border-box;
        }
        #choices-container button {
            width: 100%;
            padding: 5px;
            font-size: 0.8em;
            background-color: #ffffff;
            color: #333;
            border: 1px solid #ccc;
            border-radius: 8px;
            height: 55px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            box-sizing: border-box;
            margin: 0;
            box-shadow: 0 3px 0 #bbb, 2px 2px 5px rgba(0,0,0,0.1);
            transition: background-color 0.2s, box-shadow 0.1s, transform 0.1s, border-color 0.2s;
            line-height: 1.25;
            overflow-wrap: break-word;
            word-break: break-word;
        }
        #choices-container button:hover:not(:disabled) {
            background-color: #f5f5f5;
            border-color: #aaa;
            box-shadow: 0 3px 0 #aaa, 2px 2px 5px rgba(0,0,0,0.15);
        }
        #choices-container button:active:not(:disabled) {
            background-color: #e0e0e0;
            box-shadow: 0 1px 0 #999, 1px 1px 3px rgba(0,0,0,0.1);
            transform: translateY(2px);
            border-color: #999;
        }
        #choices-container button:disabled {
            background-color: #f0f0f0;
            box-shadow: 0 3px 0 #d0d0d0;
            color: #aaa;
            cursor: not-allowed;
            transform: translateY(0);
            border-color: #e0e0e0;
        }
        #choices-container button.correct {
            background-color: #4CAF50 !important; border-color: #388E3C !important;
            box-shadow: 0 3px 0 #388E3C !important; color: white !important;
            animation: correct-pulse 0.5s;
        }
        #choices-container button.incorrect {
            background-color: #f44336 !important; border-color: #D32F2F !important;
            box-shadow: 0 3px 0 #D32F2F !important; color: white !important;
        }
        #choices-container button.selected:not(.correct):not(.incorrect) {
            opacity: 0.8; background-color: #e3f2fd; border-color: #90caf9;
        }
        @keyframes correct-pulse { 0% { transform: scale(1) translateY(0); } 50% { transform: scale(1.03) translateY(-1px); } 100% { transform: scale(1) translateY(0); } }

        #result-screen {
            justify-content: center;
            background-image: url('../public/image/titlehaikei.webp');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
        }
        #result-screen h2 { display: none; }
        #result-image {
            max-width: 80%; height: auto; margin-bottom: 15px;
        }
        #result-screen p {
            font-size: 1.6em; margin: 8px 0; font-weight: bold; color: #fff;
            background-color: transparent; padding: 5px 10px;
            text-shadow:
                -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000,
                -2px 0 0 #000, 2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000,
                3px 3px 4px rgba(0,0,0,0.6);
        }

        #result-buttons-container {
            display: flex;
            justify-content: center;
            align-items: center;
            flex-wrap: wrap;
            width: 100%;
            margin-top: 5px;
        }
        #result-buttons-container button {
            margin: 10px;
        }

        #restart-button {
            background-color: #333;
            color: white;
            box-shadow: 0 3px #000;
        }
        #restart-button:hover {
            background-color: #555;
        }
        #restart-button:active {
            background-color: #222;
            box-shadow: 0 1px #000;
        }

        #back-to-title-button {
            background-color: #fff;
            color: #333;
            border: 2px solid #333;
            box-shadow: 0 3px #333;
        }
        #back-to-title-button:hover {
            background-color: #f0f0f0;
        }
        #back-to-title-button:active {
            background-color: #e0e0e0;
            box-shadow: 0 1px #333;
        }

        /* --- API連携で追加するスタイル --- */
        #lottery-button {
            background-color: #1976d2;
            box-shadow: 0 3px #1565c0;
        }
        #lottery-button:hover {
            background-color: #1e88e5;
        }
        #lottery-button:active {
            background-color: #1565c0;
            box-shadow: 0 1px #1565c0;
        }

        #lottery-loading {
            color: white;
            font-weight: bold;
            margin-top: 15px;
            font-size: 1.2em;
            text-shadow: 1px 1px 2px #000;
        }

        #prize-button {
            background-color: #ff9800;
            box-shadow: 0 3px #fb8c00;
            font-size: 1.2em;
            padding: 12px 25px;
        }
        #prize-button:hover {
            background-color: #ffa726;
        }
        #prize-button:active {
            background-color: #fb8c00;
            box-shadow: 0 1px #ef6c00;
        }
        /* --- ここまで --- */

        #x-share-button-container {
            margin-top: 10px; height: 30px;
        }

        .feedback-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background-color: rgba(0, 0, 0, 0.4);
            display: none; justify-content: center; align-items: center;
            z-index: 100;
        }
        .feedback-overlay.show { display: flex; }
        .feedback-overlay.correct-feedback { background-color: rgba(255, 255, 255, 0.4); }
        #feedback-overlay-image {
            max-width: 80%; max-height: 50%; object-fit: contain;
            animation: feedback-blink 0.4s infinite alternate;
        }
        @keyframes feedback-blink {
            from { opacity: 1; transform: scale(1); }
            to   { opacity: 0.8; transform: scale(1.05); }
        }

        @media (min-width: 451px) {
            #game-container { min-height: auto; height: 90vh; max-height: 700px; border-radius: 10px; box-shadow: 0 0 15px rgba(0,0,0,0.2); }
            #mute-button { top: 15px; }
            .screen, #quiz-screen { padding: 20px; }
            .quiz-top-area { margin-bottom: 10px; }
            #character-display { height: 320px; flex-grow: 0; margin: 15px 0; }
            #kubarush-display { top: 180px; transform: translateX(-50%); }
            .quiz-bottom-area { margin-top: auto; min-height: calc(65px * 2 + 10px * 1); }
            #choices-container { gap: 10px; }
            #choices-container button { height: 65px; font-size: 0.9em; line-height: 1.3; }
            #game-timer-text-label { font-size: 1em; }
        }
