:root {
            --device-bg: #4A90E2;    /* 遲蝉ｽ薙・濶ｲ繧貞ｰ代＠繧ｯ繝ｼ繝ｫ縺ｫ螟画峩 */
            --screen-bg: #B5C6A9;    /* 閭梧勹繝吶・繧ｹ繧貞ｰ代＠譏弱ｋ縺・ｷ代↓ */
            --screen-text: #0f380f;
            --screen-shadow: #306230;
            --app-font: 'Yu Gothic UI', 'Hiragino Kaku Gothic ProN', Meiryo, system-ui, sans-serif;
        }

        html, body {
            touch-action: manipulation;
            overscroll-behavior: none;
        }

        button {
            touch-action: manipulation;
        }

        body {
            font-family: var(--app-font);
            background: var(--device-bg);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            margin: 0;
            padding: 20px;
            box-sizing: border-box;
            
            /* Apple蟇ｩ譟ｻ蟇ｾ遲厄ｼ啗eb迚ｹ譛峨・謖吝虚繧堤┌蜉ｹ蛹・*/
            user-select: none;
            -webkit-user-select: none;
            -webkit-touch-callout: none;
            -webkit-user-drag: none;
            -webkit-tap-highlight-color: transparent;
        }

        /* 遲蝉ｽ薙ョ繧ｶ繧､繝ｳ */
        .device {
            background: var(--device-bg);
            border-radius: 50px 50px 70px 70px;
            padding: 40px 30px;
            box-sizing: border-box;
            box-shadow: 
                inset -5px -5px 15px rgba(0,0,0,0.2),
                inset 5px 5px 15px rgba(255,255,255,0.4),
                10px 10px 20px rgba(0,0,0,0.1);
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            max-width: 380px;
            position: relative;
        }

        .device-title {
            color: white;
            font-size: 1.2rem;
            margin-top: 0;
            margin-bottom: 20px;
            text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
            letter-spacing: 2px;
        }

        /* 豸ｲ譎ｶ逕ｻ髱｢蜻ｨ繧・*/
        .screen-container {
            background: #e0e0e0;
            padding: 15px;
            border-radius: 12px;
            border: 2px solid #5a5a5a;
            box-shadow: inset 2px 2px 5px rgba(0,0,0,0.3);
            width: 100%;
            box-sizing: border-box;
            display: flex;
            justify-content: center;
        }

        .screen {
            background-color: #B5C6A9; /* 繝吶・繧ｹ縺ｮ豸ｲ譎ｶ濶ｲ */
            /* 笘・螳滄圀縺ｮ縺溘∪縺斐▲縺｡鬚ｨ縺ｮ閭梧勹譟・ｼ井ｸ贋ｸ九・繝ｼ繝繝ｼ・区婿逵ｼ・・*/
            background-image: 
                /* 1. 阮・＞繝峨ャ繝域婿逵ｼ・医ヴ繧ｯ繧ｻ繝ｫ縺斐→縺ｮ繝槭せ逶ｮ諢滂ｼ・*/
                linear-gradient(rgba(15, 56, 15, 0.05) 1px, transparent 1px),
                linear-gradient(90deg, rgba(15, 56, 15, 0.05) 1px, transparent 1px),
                /* 2. 閭梧勹縺ｮ讓｡讒假ｼ亥・逵溘・繧医≧縺ｪ繝斐Φ繧ｯ繧・ｻ・牡縺ｮ豺｡縺・・繝ｼ繝繝ｼ・・*/
                linear-gradient(to bottom, 
                    rgba(255, 235, 100, 0.3) 0%, rgba(255, 235, 100, 0.3) 20%, 
                    rgba(150, 190, 220, 0.3) 20%, rgba(150, 190, 220, 0.3) 80%,
                    rgba(255, 235, 100, 0.3) 80%, rgba(255, 235, 100, 0.3) 100%
                );
            background-size: 4px 4px, 4px 4px, 100% 100%; /* 譁ｹ逵ｼ縺ｮ繧ｵ繧､繧ｺ */
            color: var(--screen-text);
            width: 100%;
            height: 280px;
            border-radius: 4px;
            box-shadow: inset 2px 2px 8px rgba(0,0,0,0.2);
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
            padding: 10px;
            box-sizing: border-box;
        }

        .status-text {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            min-height: 2.5rem;
            padding: 0 4px;
            box-sizing: border-box;
            font-size: 0.84rem;
            line-height: 1.35;
            text-align: center;
            white-space: pre-line;
            margin-bottom: 4px;
        }

        /* 最終進化後だけ表示する転生タイマー。キャラクターの下に表示する。 */
        .rebirth-countdown {
            align-self: center;
            flex-shrink: 0;
            min-width: 128px;
            margin: 2px auto 0;
            padding: 2px 5px;
            box-sizing: border-box;
            border: 1px solid var(--screen-text);
            border-radius: 3px;
            background: rgba(255, 255, 255, 0.82);
            color: var(--screen-text);
            font-size: 0.62rem;
            line-height: 1.3;
            text-align: center;
            font-weight: bold;
            pointer-events: none;
        }

        /* タイマー表示中は進化ゲージとの間隔を少し詰める。 */
        .rebirth-countdown:not([hidden]) + .progress-container {
            margin-top: 5px;
        }

        /* 笘・鬮倩ｧ｣蜒丞ｺｦ繝峨ャ繝育ｵｵ陦ｨ遉ｺ逕ｨ Canvas 笘・*/
        .art-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            min-height: 0;
            position: relative;
            /* 繧ｭ繝｣繝ｳ繝舌せ縺ｮ蠕後ｍ縺ｫ縺・▲縺吶ｉ縺ｨ髱樒せ轣ｯ繝峨ャ繝医ｒ隕九○繧・*/
            background-image: 
                radial-gradient(rgba(15, 56, 15, 0.1) 1px, transparent 1px);
            background-size: 8px 8px; /* 192px / 24繝峨ャ繝・= 8px繝槭せ縺ｮ繧ｰ繝ｪ繝・ラ縺ｫ蜷医ｏ縺帙ｋ */
            background-position: center;
            border-radius: 8px;
        }

        #pixelCanvas {
            width: 100%;
            height: 100%;
            max-width: 192px;
            max-height: 192px;
            object-fit: contain;
            image-rendering: pixelated; /* 繝峨ャ繝医ｒ縺上▲縺阪ｊ陦ｨ遉ｺ */
            transition: transform 0.2s;
            filter: drop-shadow(2px 2px 0px rgba(15, 56, 15, 0.4));
        }

        .award-badge {
            position: absolute; z-index: 6; display: none; align-items: center; justify-content: center;
            min-width: 58px; padding: 3px 7px; box-sizing: border-box; border: 2px solid var(--screen-text);
            border-radius: 14px; color: #2f2600; font-family: var(--app-font);
            font-size: 0.66rem; line-height: 1; font-weight: bold; white-space: nowrap;
            box-shadow: 0 2px 0 rgba(15,56,15,0.35); pointer-events: none;
        }
        .award-badge.visible { display: flex; }
        .main-award-badge { top: 3px; left: 50%; transform: translateX(-50%); }
        .battle-award-badge { top: -8px; left: 50%; transform: translateX(-50%); z-index: 207; }
        .award-badge-gold { background: linear-gradient(#fff8a8, #f2c230); }
        .award-badge-silver { background: linear-gradient(#fff, #bfc9cf); }
        .award-badge-bronze { background: linear-gradient(#f4cfad, #bd7544); }

        /* 謠ｺ繧後い繝九Γ繝ｼ繧ｷ繝ｧ繝ｳ */
        @keyframes shake {
            0% { transform: translateX(0); }
            25% { transform: translateX(-4px) rotate(-5deg); }
            50% { transform: translateX(0); }
            75% { transform: translateX(4px) rotate(5deg); }
            100% { transform: translateX(0); }
        }
        
        .animated { animation: shake 0.5s ease-in-out; }
        .bouncing { animation: shake 1s infinite alternate; }

        .main-stats-display {
            position: absolute;
            top: 52px;
            left: 12px;
            font-size: 1.15rem; /* 邏・.5蛟阪€懷€崎ｿ代￥縺ｫ諡｡螟ｧ縺励※隕冶ｪ肴€ｧ繧｢繝・・ */
            line-height: 1.5;
            color: var(--screen-text);
            z-index: 10;
            font-family: var(--app-font);
            text-shadow: none;
            font-weight: bold;
        }

        .battle-record-display {
            position: absolute;
            top: 52px;
            right: 12px;
            color: var(--screen-text);
            z-index: 10;
            font-family: var(--app-font);
            font-size: 1.15rem;
            line-height: 1.5;
            font-weight: bold;
            text-align: right;
        }

        /* 繝励Ο繧ｰ繝ｬ繧ｹ繝舌・ */
        .progress-container {
            border: 3px solid var(--screen-text);
            height: 28px;
            width: 100%;
            margin-top: 15px;
            position: relative;
        }
        .progress-bar {
            background: var(--screen-text);
            height: 100%;
            width: 0%;
            transition: width 0.3s;
        }
        .progress-container.progress-gain {
            animation: progressGainFlash 0.45s steps(3);
        }
        @keyframes progressGainFlash {
            0%, 100% { box-shadow: none; }
            35% { box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 0 10px 5px rgba(248,180,0,0.75); }
        }
        .progress-text {
            position: absolute;
            top: 50%; left: 0; width: 100%;
            transform: translateY(-50%);
            text-align: center; font-size: 1.3rem;
            color: white; mix-blend-mode: difference;
            line-height: 1;
            font-weight: bold;
        }

        .stats-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(181, 198, 169, 0.95); /* screen-bg縺ｫ蜷医ｏ縺帙◆濶ｲ */
            padding: 10px; box-sizing: border-box;
            display: none; flex-direction: column; overflow-y: auto; z-index: 10;
        }
        .stats-overlay.visible { display: flex; }
        .stats-row { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 4px; border-bottom: 1px dashed var(--screen-shadow); }
        .stats-group { margin-top: 10px; font-weight: bold; border-bottom: 2px solid var(--screen-text); padding-bottom: 2px; }
        .close-stats-btn { margin-top: auto; align-self: center; background: none; border: 2px solid var(--screen-text); color: var(--screen-text); font-family: inherit; padding: 4px 10px; cursor: pointer; }

        .zukan-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(181, 198, 169, 0.95); padding: 10px; box-sizing: border-box; display: none; flex-direction: column; overflow-y: auto; z-index: 10; }
        .zukan-overlay.visible { display: flex; }
        .zukan-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
        .zukan-stage-title { font-size: 0.8rem; border-bottom: 1px dotted var(--screen-shadow); margin-bottom: 5px; text-align: center; }
        .zukan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
        .zukan-item { display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,0.4); border-radius: 4px; padding: 5px; }
        .zukan-canvas { width: 48px; height: 48px; image-rendering: pixelated; background: #B5C6A9; border: 1px solid #5a5a5a; border-radius: 2px; }
        .zukan-name { font-size: 0.55rem; margin-top: 4px; text-align: center; width: 100%; word-break: break-all; line-height: 1.1; font-weight: bold; }

        .quick-settings {
            display: grid;
            margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--screen-shadow);
        }
        .save-protection-status {
            text-align: center; font-size: 0.65rem; font-weight: bold;
        }
        .tutorial-coachmark {
            position: absolute; left: 20px; right: 20px; bottom: 116px; z-index: 500;
            display: none; padding: 11px; box-sizing: border-box;
            background: #fff8d5; color: var(--screen-text);
            border: 3px double var(--screen-text); border-radius: 6px;
            box-shadow: 5px 5px 0 rgba(15, 56, 15, 0.25);
            text-align: center;
        }
        .tutorial-coachmark.visible { display: block; animation: popUp 0.25s steps(3); }
        .tutorial-step-label { font-size: 0.65rem; font-weight: bold; }
        .tutorial-coach-title { margin-top: 2px; font-size: 1rem; font-weight: bold; }
        .tutorial-coach-text { margin-top: 4px; font-size: 0.76rem; line-height: 1.45; }
        .tutorial-coach-actions { display: flex; justify-content: center; gap: 7px; margin-top: 8px; }
        .tutorial-coach-actions button {
            min-height: 32px; padding: 5px 12px;
            border: 2px solid var(--screen-text); border-radius: 3px;
            background: var(--screen-bg); color: var(--screen-text);
            font-family: inherit; font-weight: bold; cursor: pointer;
        }
        .tutorial-later-button { background: transparent !important; }
        .tutorial-highlight {
            position: relative; z-index: 510 !important;
            animation: tutorialPulse 0.8s infinite alternate !important;
        }
        @keyframes tutorialPulse {
            from { transform: scale(1); box-shadow: 0 0 0 4px rgba(255,255,255,0.65), 0 0 0 8px rgba(248,180,0,0.35); }
            to { transform: scale(1.12); box-shadow: 0 0 0 7px rgba(255,255,255,0.9), 0 0 0 14px rgba(248,180,0,0.55); }
        }

        .word-count-effect, .word-symbol-effect {
            position: absolute;
            pointer-events: none;
            will-change: transform, opacity;
            transform: translate3d(0, 0, 0);
        }
        .word-count-effect {
            z-index: 50;
            animation: wordCountFloat 1.05s cubic-bezier(0.22, 0.8, 0.35, 1) forwards;
        }
        .word-symbol-effect {
            z-index: 49;
            animation: wordSymbolFloat 1.05s cubic-bezier(0.22, 0.8, 0.35, 1) forwards;
        }
        .word-effect-milestone {
            filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 8px #f8b400);
        }
        @keyframes wordCountFloat {
            0% { opacity: 0; transform: translate3d(0, 12px, 0) scale(0.7); }
            14% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.15); }
            68% { opacity: 1; }
            100% { opacity: 0; transform: translate3d(-8px, -125px, 0) scale(1.3); }
        }
        @keyframes wordSymbolFloat {
            0% { opacity: 0; transform: translate3d(0, 15px, 0) scale(0.65) rotate(-12deg); }
            18% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.05) rotate(0deg); }
            65% { opacity: 1; }
            100% { opacity: 0; transform: translate3d(12px, -135px, 0) scale(1.45) rotate(35deg); }
        }
        /* 繝懊ち繝ｳ鄒､ */
        .controls { display: flex; justify-content: space-around; width: 100%; margin-top: 30px; }
        .btn-round { width: 60px; height: 60px; border-radius: 50%; background: #F8B400; border: none; box-shadow: inset -2px -2px 8px rgba(0,0,0,0.3), inset 2px 2px 8px rgba(255,255,255,0.5), 0 4px 6px rgba(0,0,0,0.2); cursor: pointer; color: #C0392B; font-weight: bold; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.8rem; }
        .btn-round.mic-starting { background: #E67E22; color: white; transform: scale(0.94); }
        .btn-round.mic-active { background: #E74C3C; color: white; animation: pulse-red 1.5s infinite; }
        @keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); } 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); } }
        .btn-label { margin-top: 10px; font-size: 0.8rem; color: white; text-align: center; }

        /* 繝・せ繝医ヱ繝阪Ν */
        .test-panel { background: white; padding: 15px; border-radius: 8px; margin-top: 20px; width: 100%; max-width: 380px; font-family: sans-serif; font-size: 0.9rem; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
        .test-panel h3 { margin-top: 0; font-size: 1rem; }
        .test-btns { display: flex; flex-wrap: wrap; gap: 5px; }
        .test-btn { background: #eee; border: 1px solid #ccc; padding: 5px 8px; border-radius: 4px; cursor: pointer; }

        /* 縺顔･昴＞繧ｪ繝ｼ繝舌・繝ｬ繧､ */
        .celebration-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(255, 255, 255, 0.8);
            display: none; align-items: center; justify-content: center;
            z-index: 100; text-align: center;
            flex-direction: column;
            animation: fadeIn 0.3s forwards;
            pointer-events: none;
        }
        .celebration-overlay.visible { display: flex; }
        .celebration-content {
            background: #fdfdfd; 
            border: 4px double #5a5a5a; 
            border-radius: 0; 
            padding: 20px; 
            box-shadow: 6px 6px 0 rgba(0,0,0,0.1);
            animation: popUp 0.4s steps(4);
            max-width: 85%;
            pointer-events: auto;
            position: relative;
        }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
        @keyframes popUp { 0% { transform: scale(0.8); } 100% { transform: scale(1); } }
        .confetti { 
            position: absolute; 
            width: 8px; 
            height: 8px; 
            pointer-events: none; 
            z-index: 101; 
        }

        /* 豢ｾ謇九↑繝輔Λ繝・す繝･逋ｽ鬟帙・逕ｨ */
        @keyframes flashFade { 0% { opacity: 1; } 100% { opacity: 0; } }

        /* 繝峨く繝峨く騾ｲ蛹匁囓霆｢繧ｨ繝輔ぉ繧ｯ繝育畑 */
        .evolution-overlay {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            background: #000;
            z-index: 150;
            pointer-events: none;
            opacity: 0;
            transition: opacity 1.0s ease-out;
        }
        .evolution-overlay.flashing {
            animation: evolutionPulsate 6.0s step-end forwards;
        }
        @keyframes evolutionPulsate {
            0%   { opacity: 0; }
            8%   { opacity: 1; }
            10%  { opacity: 0; }
            20%  { opacity: 1; }
            22%  { opacity: 0; }
            31%  { opacity: 1; }
            33%  { opacity: 0; }
            41%  { opacity: 1; }
            43%  { opacity: 0; }
            50%  { opacity: 1; }
            52%  { opacity: 0; }
            56%  { opacity: 1; }
            58%  { opacity: 0; }
            63%  { opacity: 1; }
            65%  { opacity: 0; }
            68%  { opacity: 1; }
            70%  { opacity: 0; }
            73%  { opacity: 1; }
            75%  { opacity: 0; }
            76%  { opacity: 1; }
            78%  { opacity: 0; }
            80%  { opacity: 1; }
            82%  { opacity: 0; }
            83%  { opacity: 1; }
            84%  { opacity: 0; }
            85%  { opacity: 1; }
            86%  { opacity: 0; }
            88%  { opacity: 1; }
            89%  { opacity: 0; }
            90%  { opacity: 1; }
            91%  { opacity: 0; }
            93%  { opacity: 1; }
            94%  { opacity: 0; }
            95%  { opacity: 1; }
            96%  { opacity: 0; }
            96.5% { opacity: 1; }
            97%  { opacity: 0; }
            98%  { opacity: 1; }
            99%  { opacity: 0; }
            100% { opacity: 1; }
        }
        
        .evolution-overlay.flashing-ultimate {
            background: #fff; /* 繝・ヵ繧ｩ繝ｫ繝磯ｻ偵ｒ荳頑嶌縺阪＠縺ｦ逋ｽ繝吶・繧ｹ縺ｫ */
            animation: ultimatePulsate 9.0s ease-in forwards;
        }
        @keyframes ultimatePulsate {
            0%   { opacity: 0; background: #fff; }
            /* 繧・▲縺上ｊ縺励◆轤ｹ貊・*/
            5%   { opacity: 0.8; background: #f1c40f; }
            10%  { opacity: 0; }
            15%  { opacity: 0.9; background: #fff; }
            20%  { opacity: 0; }
            25%  { opacity: 1; background: #f39c12; }
            30%  { opacity: 0; }
            /* 蟆代＠譌ｩ縺上↑繧狗せ貊・*/
            35%  { opacity: 1; background: #e74c3c; }
            39%  { opacity: 0; }
            43%  { opacity: 1; background: #fff; }
            47%  { opacity: 0; }
            51%  { opacity: 1; background: #f1c40f; }
            55%  { opacity: 0; }
            /* 縺輔ｉ縺ｫ譌ｩ縺上↑繧狗せ貊・*/
            58%  { opacity: 1; background: #e74c3c; }
            61%  { opacity: 0; }
            64%  { opacity: 1; background: #f39c12; }
            67%  { opacity: 0; }
            70%  { opacity: 1; background: #fff; }
            73%  { opacity: 0; }
            75%  { opacity: 1; background: #e74c3c; }
            77%  { opacity: 0; }
            /* 豼縺励￥轤ｹ貊・(繝代ヱ繝代ヱ繝代ャ) */
            79%  { opacity: 1; background: #fff; }
            80%  { opacity: 0; }
            81%  { opacity: 1; background: #f1c40f; }
            82%  { opacity: 0; }
            83%  { opacity: 1; background: #e74c3c; }
            84%  { opacity: 0; }
            85%  { opacity: 1; background: #fff; }
            86%  { opacity: 0; }
            87%  { opacity: 1; background: #f1c40f; }
            88%  { opacity: 0; }
            89%  { opacity: 1; background: #e74c3c; }
            90%  { opacity: 0; }
            /* 繧ｯ繝ｩ繧､繝槭ャ繧ｯ繧ｹ縺ｮ雜・ｫ倬溘ヵ繝ｩ繝・す繝･ */
            91%  { opacity: 1; background: #fff; }
            92%  { opacity: 0; background: #e74c3c; }
            93%  { opacity: 1; background: #fff; }
            94%  { opacity: 0; background: #f1c40f; }
            95%  { opacity: 1; background: #fff; }
            96%  { opacity: 0; background: #e74c3c; }
            97%  { opacity: 1; background: #fff; }
            98%  { opacity: 0; background: #f39c12; }
            99%  { opacity: 1; background: #fff; }
            100% { opacity: 1; background: #fff; } /* 譛蠕後・逵溘▲逋ｽ */
        }
        
        /* 霆｢逕滂ｼ医ｆ縺｣縺上ｊ證苓ｻ｢繝ｻ繧・▲縺上ｊ譏手ｻ｢・峨お繝輔ぉ繧ｯ繝育畑 */
        .rebirth-overlay {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            background: #000;
            z-index: 150;
            pointer-events: none;
            opacity: 0;
            transition: opacity 3.0s ease-in-out;
        }
        .rebirth-overlay.active {
            opacity: 1;
        }

        /* 繝ｬ繧｢繧｢繧､繝・Β繝ｻ繝昴ャ繝励い繝・・ */
        .rare-item-content {
            background: linear-gradient(135deg, #fffbeb, #ffebb3);
            border: 5px solid #f1c40f; 
            border-radius: 8px; 
            padding: 15px 10px; 
            box-shadow: 0 0 30px #f1c40f, inset 0 0 20px rgba(241, 196, 15, 0.5);
            animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
            max-width: 90%;
            pointer-events: auto;
            position: relative;
            text-align: center;
            overflow: hidden;
        }
        .rare-item-content::after {
            content: '';
            position: absolute;
            top: -50%; left: -50%; width: 200%; height: 200%;
            background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 50%, rgba(255,255,255,0) 100%);
            transform: rotate(30deg);
            animation: sweepShine 1.5s infinite;
            pointer-events: none;
            z-index: 10;
        }
        @keyframes sweepShine {
            0% { left: -150%; }
            50% { left: 100%; }
            100% { left: 100%; }
        }
        @keyframes bounceIn {
            0% { transform: scale(0.3); opacity: 0; }
            50% { transform: scale(1.1); opacity: 1; }
            70% { transform: scale(0.95); }
            100% { transform: scale(1); }
        }
        .item-glow-bg {
            position: relative;
            margin: 0 auto 5px auto;
            width: 70px; height: 70px;
            display: flex; align-items: center; justify-content: center;
        }
        /* 蝗櫁ｻ｢縺吶ｋ謾ｾ蟆・ｷ夲ｼ医し繝ｳ繝舌・繧ｹ繝茨ｼ・*/
        .item-glow-bg::before {
            content: '';
            position: absolute;
            top: -40px; left: -40px; right: -40px; bottom: -40px;
            background: repeating-conic-gradient(from 0deg, #f1c40f 0deg 15deg, transparent 15deg 30deg);
            animation: spinBurst 4s linear infinite;
            border-radius: 50%;
            z-index: 0;
            opacity: 0.6;
        }
        /* 蠕悟・縺ｮ豼縺励＞繝代Ν繧ｹ */
        .item-glow-bg::after {
            content: '';
            position: absolute;
            top: -10px; left: -10px; right: -10px; bottom: -10px;
            background: radial-gradient(circle, #fff 0%, #f39c12 50%, transparent 70%);
            animation: pulseInnerGlow 0.6s infinite alternate;
            z-index: 0;
            border-radius: 50%;
        }
        @keyframes spinBurst {
            100% { transform: rotate(360deg); }
        }
        @keyframes pulseInnerGlow {
            from { transform: scale(0.9); opacity: 0.8; }
            to { transform: scale(1.2); opacity: 1; }
        }
        .item-popup-canvas-container {
            position: relative;
            z-index: 1;
            background: rgba(255,255,255,0.9);
            border: 3px solid #f39c12;
            border-radius: 8px;
            padding: 4px;
            box-shadow: 0 0 15px #e74c3c, 0 0 30px #f1c40f;
            animation: floatItemAndGlow 1.2s ease-in-out infinite alternate;
        }
        @keyframes floatItemAndGlow {
            from { transform: translateY(0) scale(1.0); box-shadow: 0 0 10px #e74c3c, 0 0 20px #f1c40f; }
            to { transform: translateY(-3px) scale(1.08); box-shadow: 0 0 25px #e74c3c, 0 0 50px #f1c40f; }
        }
        .flashy-title {
            font-size: 1.05rem;
            font-weight: bold;
            color: #FFEA00;
            text-shadow: 
                1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000,
                0 0 10px #ff2a00, 0 0 20px #ff2a00, 0 0 30px #ff0080;
            margin-bottom: 10px;
            line-height: 1.3;
            animation: textPulseScale 0.5s infinite alternate;
        }
        @keyframes textPulseScale {
            from { transform: scale(1); }
            to { transform: scale(1.08); text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 0 0 15px #ff2a00, 0 0 30px #ff2a00, 0 0 40px #ff0080; }
        }
        .rare-btn {
            border-radius: 20px; font-weight: bold; background: #e74c3c; color: white; border: 2px solid #c0392b; padding: 6px 20px; box-shadow: 0 4px 0 #c0392b; font-family: inherit; cursor: pointer; font-size: 0.9rem;
            transition: transform 0.1s;
            margin-top: 5px;
        }
        .rare-btn:active {
            transform: translateY(4px);
            box-shadow: 0 0 0 #c0392b;
        }

        /* --- 繝舌ヨ繝ｫ逕ｨ --- */
        .battle-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: var(--screen-bg);
            box-shadow: inset 0 0 0 4px var(--screen-text);
            display: none; flex-direction: column; z-index: 200; overflow: hidden;
            border-radius: 8px; /* 逕ｻ髱｢縺ｮ隗剃ｸｸ縺ｫ蜷医ｏ縺帙ｋ */
        }
        .battle-overlay.visible { display: flex; }
        
        .battle-flash {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: white; opacity: 0; z-index: 210; pointer-events: none;
        }
        .battle-flash.active { animation: flashAnim 0.15s ease-out; }
        @keyframes flashAnim { 0% { opacity: 1; } 100% { opacity: 0; } }
        
        .battle-vs-screen {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: var(--screen-bg); z-index: 205; display: flex; flex-direction: column; align-items: center; justify-content: center;
            background-image: 
                linear-gradient(45deg, rgba(15, 56, 15, 0.1) 25%, transparent 25%, transparent 75%, rgba(15, 56, 15, 0.1) 75%), 
                linear-gradient(45deg, rgba(15, 56, 15, 0.1) 25%, transparent 25%, transparent 75%, rgba(15, 56, 15, 0.1) 75%);
            background-size: 20px 20px;
            background-position: 0 0, 10px 10px;
        }
        .battle-vs-screen .vs-text {
            font-size: 4rem; font-weight: bold; color: var(--screen-text);
            font-style: italic; text-shadow: 4px 4px 0px rgba(0,0,0,0.2);
            animation: vsBlink 0.15s steps(2, start) infinite;
        }
        .battle-vs-screen .standby-text {
            font-size: 1.2rem; margin-top: 10px; font-weight: bold; color: var(--screen-text);
            animation: blink 1s infinite alternate;
        }
        @keyframes vsBlink { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0; } }
        @keyframes blink { 0% { opacity: 1; } 100% { opacity: 0; } }
        
        .battle-arena {
            flex: 1; position: relative; width: 100%; height: 100%; display: none;
            background-color: var(--screen-bg);
            background-size: cover;
            background-position: center bottom;
            background-repeat: no-repeat;
            image-rendering: pixelated;
        }
        
        .battle-hp-container {
            position: absolute; width: 40%; border: 2px solid var(--screen-text); background: rgba(255,255,255,0.8);
            padding: 2px; border-radius: 4px; z-index: 201; box-sizing: border-box;
            box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
        }
        .battle-hp-container.enemy-hp { top: 12px; left: 12px; }
        .battle-hp-container.my-hp { bottom: 12px; right: 12px; }
        
        .battle-hp-bar { height: 6px; background: var(--screen-text); width: 100%; transition: width 0.3s ease-out; }
        .battle-hp-label { position: absolute; top: -14px; font-size: 0.6rem; font-weight: bold; }
        
        .battle-character {
            position: absolute; width: 120px; height: 120px; z-index: 200;
        }
        .battle-character canvas { 
            width: 100%; height: 100%; image-rendering: pixelated; 
            background-color: var(--screen-bg); /* 閭梧勹繧帝城℃縺輔○縺ｪ縺・ｼ亥ｮ滓ｩ溘・豸ｲ譎ｶ濶ｲ・・*/
            border: 4px solid var(--screen-text);
            border-radius: 4px;
            box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
        } 
        
        /* 謨ｵ縺ｯ蜿ｳ荳翫°繧・*/
        .battle-character.enemy { top: 10px; right: 10px; }
        /* 謨ｵ繧貞渚霆｢縺輔○縺ｦ閾ｪ蛻・・譁ｹ繧貞髄縺九○繧・*/
        .battle-character.enemy canvas { transform: scaleX(-1); }
        /* 閾ｪ蛻・・蟾ｦ荳九°繧・*/
        .battle-character.mine { bottom: 10px; left: 10px; }

        .battle-character.attack-enemy { animation: attackAnimEnemy 0.6s cubic-bezier(0.4, -0.4, 0.2, 1.5); z-index: 205; }
        .battle-character.attack-mine { animation: attackAnimMine 0.6s cubic-bezier(0.4, -0.4, 0.2, 1.5); z-index: 205; }
        
        .battle-character.hit { animation: hitAnim 0.4s steps(4); filter: brightness(1.5) sepia(1) hue-rotate(-50deg) saturate(5); }
        .battle-character.miss { animation: missAnim 0.5s ease-out; opacity: 0.5; }
        .battle-character.win { animation: winAnim 0.5s steps(2) infinite alternate; }
        .battle-character.lose { animation: loseAnim 0.5s ease-in forwards; filter: grayscale(1); }

        @keyframes attackAnimMine {
            0% { transform: translate(0, 0); }
            30% { transform: translate(-10px, 10px); } /* 蟆代＠蠕後ｍ縺ｫ荳九′繧具ｼ医メ繝｣繝ｼ繧ｸ・・*/
            60% { transform: translate(50px, -50px); } /* 遯・ｲ */
            100% { transform: translate(0, 0); }
        }
        @keyframes attackAnimEnemy {
            0% { transform: translate(0, 0); }
            30% { transform: translate(10px, -10px); } /* 蟆代＠蠕後ｍ縺ｫ荳九′繧具ｼ医メ繝｣繝ｼ繧ｸ・・*/
            60% { transform: translate(-50px, 50px); } /* 遯・ｲ */
            100% { transform: translate(0, 0); }
        }
        @keyframes hitAnim {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-15px) rotate(-10deg); }
            50% { transform: translateX(15px) rotate(10deg); }
            75% { transform: translateX(-15px) rotate(-10deg); }
        }
        @keyframes missAnim {
            0% { transform: translateY(0); }
            50% { transform: translate(-20px, -30px); }
            100% { transform: translateY(0); }
        }
        @keyframes winAnim {
            0% { transform: translateY(0); }
            100% { transform: translateY(-20px) scale(1.1); }
        }
        @keyframes loseAnim {
            0% { transform: rotate(0deg) translate(0, 0); opacity: 1; }
            100% { transform: rotate(90deg) translate(20px, 20px); opacity: 0.5; }
        }
        @keyframes hitFxAnim {
            0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
            100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
        }

        .hit-fx {
            position: absolute; z-index: 206; width: 8px; height: 8px;
            background: white; transform: translate(-50%, -50%);
            animation: pixelExplosion 0.4s steps(4) forwards;
            pointer-events: none;
        }
        @keyframes pixelExplosion {
            0% {
                box-shadow: 0 0 0 #ffeb3b, 0 0 0 #ffffff, 0 0 0 #ffeb3b, 0 0 0 #ffffff; 
                transform: scale(1);
            }
            25% {
                box-shadow: 
                    -15px -15px 0 #ffeb3b, 15px -15px 0 #ffeb3b, -15px 15px 0 #ffeb3b, 15px 15px 0 #ffeb3b,
                    0 -20px 0 #ff5722, 0 20px 0 #ff5722, -20px 0 0 #ff5722, 20px 0 0 #ff5722;
                transform: scale(2);
            }
            50% {
                box-shadow: 
                    -25px -25px 0 #ff5722, 25px -25px 0 #ff5722, -25px 25px 0 #ff5722, 25px 25px 0 #ff5722,
                    0 -30px 0 #f44336, 0 30px 0 #f44336, -30px 0 0 #f44336, 30px 0 0 #f44336;
                transform: scale(3) rotate(45deg);
            }
            100% {
                box-shadow: 
                    -35px -35px 0 transparent, 35px -35px 0 transparent, -35px 35px 0 transparent, 35px 35px 0 transparent;
                transform: scale(4) rotate(45deg); opacity: 0;
            }
        }

        .battle-popup-text {
            position: absolute; z-index: 210; font-size: 1.2rem; font-weight: bold;
            font-family: var(--app-font); pointer-events: none;
            text-shadow: 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff;
            animation: popupTextAnim 1.0s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
        }
        @keyframes popupTextAnim {
            0% { transform: translateY(0) scale(0.5); opacity: 0; }
            20% { transform: translateY(-10px) scale(1.2); opacity: 1; }
            80% { transform: translateY(-20px) scale(1); opacity: 1; }
            100% { transform: translateY(-30px) scale(1); opacity: 0; }
        }

        .battle-message {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
            font-size: 2.2rem; font-weight: bold; color: #ff2a00; z-index: 208;
            text-shadow: 2px 2px 0px #fff, -2px -2px 0px #fff, 2px -2px 0px #fff, -2px 2px 0px #fff, 0 0 10px #ff2a00;
            text-align: center; display: none; animation: popUp 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
        }

        .battle-command-panel {
            position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
            width: min(94%, 360px); z-index: 215; display: none;
            padding: 10px; box-sizing: border-box;
            background: rgba(226, 235, 218, 0.97);
            border: 3px double var(--screen-text);
            box-shadow: 4px 4px 0 rgba(15, 56, 15, 0.25);
        }
        .battle-command-panel.visible { display: block; animation: popUp 0.22s steps(3); }
        .battle-command-title { margin-bottom: 8px; text-align: center; font-size: 1rem; font-weight: bold; }
        .battle-command-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
        .battle-command-btn {
            min-height: 64px; padding: 6px 3px;
            border: 2px solid var(--screen-text); border-radius: 4px;
            background: var(--screen-bg); color: var(--screen-text);
            font-family: inherit; font-weight: bold; cursor: pointer;
        }
        .battle-command-btn span { display: block; font-size: 1rem; }
        .battle-command-btn small { display: block; margin-top: 3px; font-size: 0.57rem; line-height: 1.25; }
        .battle-command-btn.attack { background: #f6c0a9; }
        .battle-command-btn.guard { background: #b9d9f5; }
        .battle-command-btn.pray { background: #ead3f5; }
        .battle-command-btn:active { transform: translateY(2px); background: var(--screen-text); color: var(--screen-bg); }
        .battle-command-btn:focus-visible { outline: 3px solid #fff; outline-offset: 1px; }

        .online-battle-abort {
            position: absolute; right: 8px; bottom: 8px; z-index: 218;
            display: none; min-height: 38px; padding: 7px 12px;
            border: 2px solid var(--screen-text); border-radius: 5px;
            background: rgba(255, 255, 255, 0.94); color: var(--screen-text);
            font-family: inherit; font-size: 0.78rem; font-weight: bold;
        }
        .online-battle-abort.visible { display: block; }

        /* --- 逾槫勣繧ｫ繝・ヨ繧､繝ｳ蟆ら畑 --- */
        .miracle-cutin-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            display: none; justify-content: center; align-items: center; z-index: 300;
            overflow: hidden; pointer-events: none;
        }
        .miracle-cutin-bg {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0,0,0,0.85); z-index: 301;
        }
        .miracle-cutin-lines {
            position: absolute; top: 50%; left: 50%; width: 200%; height: 200%;
            transform: translate(-50%, -50%);
            background: repeating-conic-gradient(from 0deg, transparent 0deg 10deg, rgba(255, 255, 255, 0.15) 10deg 20deg);
            animation: spinLines 5s linear infinite; z-index: 302;
        }
        @keyframes spinLines {
            0% { transform: translate(-50%, -50%) rotate(0deg); }
            100% { transform: translate(-50%, -50%) rotate(360deg); }
        }
        .miracle-cutin-content {
            position: relative; z-index: 305; display: flex; flex-direction: column; align-items: center;
            opacity: 0; transform: scale(0.1);
        }
        .miracle-cutin-content.show {
            animation: miracleCutinEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, gogogogoShake 0.1s linear infinite;
        }
        @keyframes miracleCutinEnter {
            0% { opacity: 0; transform: scale(0.1); }
            100% { opacity: 1; transform: scale(1); }
        }
        @keyframes gogogogoShake {
            0% { margin-left: 0px; margin-top: 0px; }
            25% { margin-left: -5px; margin-top: 5px; }
            50% { margin-left: 5px; margin-top: -5px; }
            75% { margin-left: -5px; margin-top: -5px; }
            100% { margin-left: 5px; margin-top: 5px; }
        }
        .miracle-cutin-zukan-frame {
            background: #eadecd;
            border: 6px solid #c0392b;
            border-radius: 8px;
            padding: 8px;
            box-shadow: 0 0 40px rgba(255,234,0,0.8);
            display: flex; justify-content: center; align-items: center;
        }
        #miracleCutinCanvas {
            width: 140px; height: 140px; image-rendering: auto;
        }
        .miracle-cutin-name {
            margin-top: 15px; font-size: 1.8rem; font-weight: bold; color: #FFF;
            text-shadow: 2px 2px 0 #D35400, -2px -2px 0 #D35400, 0 0 15px #FFEA00;
            white-space: nowrap;
        }
        .miracle-cutin-flash {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: #FFF; z-index: 310; opacity: 0; pointer-events: none;
        }
        .miracle-cutin-flash.active {
            animation: miracleFlashAnim 0.8s ease-out forwards;
        }
        @keyframes miracleFlashAnim {
            0% { opacity: 1; }
            100% { opacity: 0; }
        }

        /* --- 騾壻ｿ｡蟇ｾ謌ｦ(PvP)繝｡繝九Η繝ｼ --- */
        .pvp-menu-overlay, .pvp-challenge-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(181, 198, 169, 0.95); z-index: 50; display: none;
            flex-direction: column; padding: 15px; box-sizing: border-box;
            color: var(--screen-text); transition: opacity 0.3s;
            justify-content: center; align-items: center; text-align: center;
        }
        .pvp-menu-overlay.visible, .pvp-challenge-overlay.visible {
            display: flex;
        }
        .pvp-btn {
            background: var(--screen-bg); border: 2px solid var(--screen-text);
            color: var(--screen-text); padding: 10px; margin: 8px 0;
            font-family: var(--app-font); cursor: pointer; border-radius: 4px;
            width: 85%; font-size: 1rem; font-weight: bold;
        }
        .pvp-btn:active { background: var(--screen-text); color: var(--screen-bg); }
        .kotodama-cup-button { background: #fff4ad; }
        .kotodama-cup-menu {
            width: 100%; max-height: 100%; display: none; flex-direction: column;
            align-items: center; box-sizing: border-box; overflow-y: auto; padding: 2px 3px 8px;
        }
        .kotodama-cup-heading { font-size: 1.48rem; font-weight: bold; }
        .kotodama-cup-lead { margin: 6px 0; font-size: 0.82rem; line-height: 1.5; }
        .kotodama-cup-rule { width: 94%; margin: 0 0 6px; font-size: 0.74rem; line-height: 1.45; font-weight: bold; }
        .kotodama-cup-profile,
        .kotodama-cup-season,
        .kotodama-cup-name-editor {
            width: 94%; box-sizing: border-box; font-size: 0.8rem; line-height: 1.45;
        }
        .kotodama-cup-profile {
            padding: 7px; border: 1px dashed var(--screen-text); background: rgba(255,255,255,0.4);
            white-space: pre-line; overflow-wrap: anywhere;
        }
        .kotodama-cup-name-editor { margin-top: 6px; padding: 7px; border: 1px solid var(--screen-text); border-radius: 4px; background: rgba(255,255,255,0.42); text-align: left; }
        .kotodama-cup-name-editor label { display: block; font-weight: bold; }
        .kotodama-cup-name-editor-controls { display: flex; gap: 5px; margin-top: 4px; }
        .kotodama-cup-name-editor input { min-width: 0; flex: 1; padding: 6px; border: 1px solid var(--screen-text); border-radius: 3px; background: #fffdf0; color: var(--screen-text); font: inherit; }
        .kotodama-cup-name-editor button { padding: 6px 10px; border: 1px solid var(--screen-text); border-radius: 3px; background: #fff4ad; color: var(--screen-text); font: inherit; font-weight: bold; }
        .kotodama-cup-name-editor button:disabled, .kotodama-cup-name-editor input:disabled { opacity: 0.6; }
        .kotodama-cup-name-editor div:last-child { margin-top: 4px; font-size: 0.67rem; line-height: 1.4; }
        .kotodama-cup-season { margin-top: 6px; font-weight: bold; }
        .kotodama-cup-status { min-height: 1.4em; margin: 6px 0; font-size: 0.82rem; font-weight: bold; }
        .kotodama-cup-entries {
            width: 94%; margin: 0; padding: 0; list-style: none; display: flex;
            flex-direction: column; gap: 5px;
        }
        .kotodama-cup-entry {
            display: grid; grid-template-columns: 2.8em minmax(0, 1fr) auto; align-items: center;
            gap: 6px; min-height: 42px; padding: 6px 8px; box-sizing: border-box;
            border: 1px solid var(--screen-text); border-radius: 4px; background: rgba(255,255,255,0.45);
            text-align: center;
        }
        .kotodama-cup-entry.rank-1 { background: linear-gradient(90deg, #fff1a8, #fff9d6); border-width: 2px; }
        .kotodama-cup-entry.rank-2 { background: linear-gradient(90deg, #e8edf0, #f8fbfc); border-width: 2px; }
        .kotodama-cup-entry.rank-3 { background: linear-gradient(90deg, #ecc49e, #f8e3cf); border-width: 2px; }
        .kotodama-cup-entry.is-me { outline: 3px solid #e74c3c; outline-offset: -3px; }
        .kotodama-cup-rank { font-size: 0.96rem; font-weight: bold; text-align: center; }
        .kotodama-cup-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; font-weight: bold; text-align: center; }
        .kotodama-cup-score { white-space: nowrap; font-size: 0.78rem; text-align: right; }
        .kotodama-cup-empty { grid-column: 1 / -1; padding: 3px; font-size: 0.82rem; line-height: 1.45; text-align: center; }
        .kotodama-cup-score strong { font-size: 0.95rem; }
        .kotodama-cup-me,
        .kotodama-cup-awards {
            width: 94%; box-sizing: border-box; margin-top: 6px; padding: 6px;
            border: 2px solid var(--screen-text); border-radius: 4px; background: rgba(255,255,255,0.5);
            font-size: 0.82rem; line-height: 1.5;
        }
        .kotodama-cup-me { font-weight: bold; }
        .kotodama-cup-awards-title { display: block; margin-bottom: 2px; font-weight: bold; }
        .kotodama-cup-actions { width: 94%; display: flex; gap: 7px; }
        .kotodama-cup-actions .pvp-btn { width: 50%; margin: 7px 0 0; padding: 8px 5px; font-size: 0.82rem; }
        .online-consent-overlay {
            position: absolute; inset: 0; z-index: 470; display: none; align-items: center; justify-content: center;
            box-sizing: border-box; padding: 10px; overflow-y: auto;
            background: rgba(181,198,169,0.985); color: var(--screen-text);
        }
        .online-consent-overlay.visible { display: flex; }
        .online-consent-card {
            width: 100%; max-height: 100%; overflow-y: auto; box-sizing: border-box; padding: 10px;
            border: 3px double var(--screen-text); border-radius: 6px; background: #edf4d5;
            text-align: left; box-shadow: 4px 4px 0 rgba(15,56,15,0.25);
        }
        .online-consent-title { font-size: 0.98rem; line-height: 1.35; font-weight: bold; text-align: center; }
        .online-consent-card p { margin: 7px 0; font-size: 0.68rem; line-height: 1.5; }
        .online-consent-card ul { margin: 5px 0; padding-left: 1.25rem; font-size: 0.66rem; line-height: 1.5; }
        .online-consent-actions { display: grid; gap: 6px; margin-top: 8px; }
        .online-consent-actions button {
            min-height: 34px; padding: 6px; border: 2px solid var(--screen-text); border-radius: 4px;
            background: #fff8d5; color: var(--screen-text); font-family: var(--app-font); font-size: 0.72rem; font-weight: bold;
        }
        .online-consent-actions button:last-child { background: transparent; }
        .intoku-noon-button {
            width: 95%; margin: 0 0 8px; padding: 7px; font-size: 0.82rem; line-height: 1.3;
            background: #fff8d5;
        }

        .noon-ritual-overlay,
        .noon-notification-prompt {
            position: absolute; inset: 0; z-index: 430;
            display: none; flex-direction: column; align-items: center; justify-content: center;
            box-sizing: border-box; padding: 10px;
            background: rgba(181, 198, 169, 0.985); color: var(--screen-text);
            text-align: center;
        }
        .noon-ritual-overlay.visible,
        .noon-notification-prompt.visible { display: flex; }
        .noon-ritual-header { font-size: clamp(1.15rem, 5.3vw, 1.55rem); font-weight: bold; letter-spacing: 0.04em; line-height: 1.25; white-space: pre-line; }
        .noon-ritual-lead { margin: 4px 0 8px; font-size: 0.76rem; line-height: 1.4; }
        .noon-ritual-special-message { margin: 3px 0 6px; color: #6c3c00; font-size: 0.8rem; font-weight: bold; }
        .noon-phrase-card {
            width: 96%; display: grid; grid-template-columns: 1fr auto; align-items: center;
            gap: 6px; box-sizing: border-box; margin: 3px 0; padding: 7px;
            border: 2px solid var(--screen-text); border-radius: 4px;
            background: rgba(255,255,255,0.52); text-align: left;
        }
        .noon-phrase-card.complete { background: #fff4ad; box-shadow: 0 0 0 2px rgba(248,180,0,0.45); }
        .noon-phrase-text { font-size: 0.78rem; font-weight: bold; line-height: 1.4; }
        .noon-phrase-progress { min-width: 38px; font-size: 0.9rem; font-weight: bold; text-align: right; }
        .noon-ritual-status { min-height: 1.4em; margin: 6px 0; font-size: 0.8rem; font-weight: bold; line-height: 1.4; }
        .noon-notification-status { min-height: 3.4em; width: 95%; margin: 2px 0 8px; color: #4b3b08; font-size: 0.84rem; font-weight: bold; line-height: 1.45; }
        .noon-mic-button {
            min-width: 132px; min-height: 34px; padding: 5px 14px;
            border: 2px solid var(--screen-text); border-radius: 18px;
            background: #f8b400; color: #a42f25; font-family: inherit; font-weight: bold;
        }
        .noon-mic-button.listening {
            background: #e74c3c; color: #fff; animation: pulse-red 1.5s infinite;
        }
        .noon-mic-button:disabled { opacity: 0.55; animation: none; }
        .noon-ritual-actions,
        .noon-prompt-actions { display: flex; justify-content: center; gap: 7px; margin-top: 6px; }
        .noon-ritual-actions button,
        .noon-prompt-actions button {
            min-height: 28px; padding: 4px 9px; border: 1px solid var(--screen-text); border-radius: 3px;
            background: transparent; color: var(--screen-text); font-family: inherit; font-size: 0.62rem;
        }
        .noon-reward-effect {
            position: absolute; inset: 0; z-index: 2; display: none;
            flex-direction: column; align-items: center; justify-content: center;
            background: radial-gradient(circle, rgba(255,247,161,0.98), rgba(248,180,0,0.82) 42%, rgba(181,198,169,0.25) 72%);
            pointer-events: none;
        }
        .noon-reward-effect.visible { display: flex; animation: noonRewardGlow 2.4s ease-out forwards; }
        .noon-reward-effect span { font-size: 0.95rem; }
        .noon-reward-effect strong { margin-top: 5px; font-size: 1.8rem; }
        @keyframes noonRewardGlow {
            0% { opacity: 0; transform: scale(0.7); }
            20%, 68% { opacity: 1; transform: scale(1); }
            100% { opacity: 0; transform: scale(1.12); }
        }
        .noon-notification-prompt { z-index: 440; padding: 18px; }
        .noon-prompt-icon { font-size: 2rem; }
        .noon-prompt-title { margin-top: 3px; font-size: 1rem; font-weight: bold; }
        .noon-notification-prompt p { margin: 8px 0; font-size: 0.7rem; line-height: 1.55; }
        .noon-prompt-actions button:first-child { background: #fff8d5; font-weight: bold; }
        .online-battle-code {
            width: 85%; max-width: 260px; box-sizing: border-box; padding: 10px;
            border: 2px solid var(--screen-text); border-radius: 4px; background: #fff;
            color: var(--screen-text); font-family: monospace; font-size: 1.15rem;
            letter-spacing: 0.16em; text-align: center; text-transform: uppercase;
        }
        .online-battle-status {
            min-height: 2.8em; width: 90%; margin-top: 10px; font-size: 0.78rem;
            line-height: 1.45; color: var(--screen-text);
        }
        .post-match-stamps {
            position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 240;
            display: none; flex-direction: column; align-items: center; padding: 7px;
            box-sizing: border-box; border: 2px solid var(--screen-text); border-radius: 6px;
            background: rgba(237, 244, 213, 0.96); color: var(--screen-text);
            box-shadow: 0 3px 0 rgba(15,56,15,0.35);
        }
        .post-match-stamps.visible { display: flex; animation: popUp 0.22s steps(3); }
        .post-match-stamps-title { font-size: 0.75rem; font-weight: bold; }
        .post-match-stamp-buttons { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 4px; }
        .post-match-stamp-buttons button,
        .post-match-close {
            min-height: 31px; padding: 4px 2px; border: 1px solid var(--screen-text); border-radius: 4px;
            background: #fff8d5; color: var(--screen-text); font-family: inherit; font-size: 0.62rem; font-weight: bold;
        }
        .post-match-stamp-buttons button:disabled { opacity: 0.55; }
        .post-match-stamp-status { min-height: 1.35em; margin-top: 3px; font-size: 0.65rem; font-weight: bold; }
        .post-match-close { min-width: 90px; min-height: 26px; margin-top: 2px; background: transparent; }
        #challengeUrlText {
            width: 100%; word-break: break-all; font-size: 0.7rem; color: #fff;
            margin: 10px 0; background: #000; padding: 5px; box-sizing: border-box;
            font-family: monospace; resize: none; border: 1px solid #7f8c8d;
        }
@media (max-width: 600px) {
    body { padding: 5px; }
    .device {
        max-width: 100%;
        min-height: calc(100vh - 10px);
        padding: 30px 15px;
        justify-content: space-between;
    }
    .screen-container {
        flex: 1;
        margin: 15px 0;
    }
    .btn-round { width: 75px; height: 75px; font-size: 1.1rem; }
    .btn-label { font-size: 0.95rem; margin-top: 5px; }
    .device-title { font-size: 1.8rem; margin: 10px 0; }
}

/* UI Updates */
body, html { overflow-x: hidden; }

.zukan-overlay::-webkit-scrollbar, .stats-overlay::-webkit-scrollbar, .pvp-menu-overlay::-webkit-scrollbar { width: 12px; background-color: rgba(255, 255, 255, 0.4); border-left: 1px solid rgba(0,0,0,0.1); }
.zukan-overlay::-webkit-scrollbar-thumb, .stats-overlay::-webkit-scrollbar-thumb, .pvp-menu-overlay::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.6); border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.4); }

.zukan-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
.zukan-canvas { width: 96px !important; height: 96px !important; }
.zukan-name { font-size: 1.4rem !important; }
.zukan-stage-title { font-size: 1.4rem !important; white-space: nowrap !important; }

.controls { flex-wrap: wrap !important; max-width: 320px !important; gap: 15px 20px !important; margin: 15px auto 0 auto !important; }

/* iPhone SEなど高さが小さい端末でも、操作ボタンと画面内ダイアログを見切れさせない。 */
@media (max-width: 600px) and (max-height: 667px) {
    .device {
        padding-top: max(38px, calc(env(safe-area-inset-top) + 8px)) !important;
        padding-bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)) !important;
    }
    .device-title { margin: 4px 0 !important; font-size: 1.45rem !important; }
    .screen-container { margin: 8px 0 !important; }
    .controls { max-width: 272px !important; gap: 8px 13px !important; margin: 2px auto 0 !important; }
    .btn-round { width: 59px !important; height: 59px !important; font-size: 0.92rem !important; }
    .btn-label { margin-top: 2px !important; font-size: 0.76rem !important; }
    .noon-ritual-overlay,
    .noon-notification-prompt { justify-content: flex-start !important; overflow-y: auto !important; }
}

.controls { justify-content: center !important; }


/* Scroll Fixes & Button Pos */
html, body { max-width: 100vw; width: 100%; height: 100%; overflow: hidden; position: fixed; top: 0; left: 0; overscroll-behavior: none; }
.stats-overlay, .zukan-overlay, .pvp-menu-overlay { overflow-y: scroll !important; overflow-x: hidden !important; -webkit-overflow-scrolling: touch; }

@media (max-width: 600px) {
    .device { padding: 10px 15px 15px 15px !important; min-height: 100vh !important; }
    .screen-container { margin: 15px 0 0 0 !important; }
    .controls { margin: auto auto 5px auto !important; }
}


/* Final spacing adjustments */
@media (max-width: 600px) {
    .device { 
        justify-content: flex-start !important; 
        padding-top: max(80px, env(safe-area-inset-top) + 20px) !important; 
        padding-bottom: max(60px, env(safe-area-inset-bottom) + 30px) !important; 
        height: 100vh !important; 
        height: 100dvh !important; 
        max-height: 100dvh !important; 
        overflow: hidden !important; 
        border-radius: 0 !important;
        box-shadow: none !important;
    }
    .screen-container { flex: 1 !important; margin-top: 0 !important; margin-bottom: 25px !important; display: flex; flex-direction: column; min-height: 0 !important; }
    .screen { flex: 1 !important; height: auto !important; min-height: 0 !important; }
    .controls { margin-top: 0 !important; margin-bottom: 10px !important; }
}


/* Zukan Detail Popup */
.zukan-detail-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; background-color: rgba(0, 0, 0, 0.85); display: none; z-index: 9999; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; overscroll-behavior: none; }
.zukan-detail-overlay.visible { display: flex; }
.zukan-detail-container { position: relative; background-color: #fcebed; border: 4px solid #8e624d; border-radius: 12px; width: 100%; max-width: 360px; max-height: 85vh; max-height: 85dvh; display: flex; flex-direction: column; padding: 20px; box-sizing: border-box; color: #333; box-shadow: 0 8px 24px rgba(0,0,0,0.6); }
.close-zukan-detail-btn { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 2.0rem; line-height: 1; font-weight: bold; color: #8e624d; cursor: pointer; padding: 0; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; z-index: 10; }
.zukan-detail-top { display: flex; flex-direction: column; align-items: center; margin-bottom: 10px; margin-top: 5px; }
.zukan-detail-image-wrapper { width: 140px; height: 140px; margin-bottom: 12px; border: 2px solid #8e624d; background-color: #fff; border-radius: 4px; display: flex; justify-content: center; align-items: center; overflow: hidden; padding: 8px; }
.zukan-detail-image-wrapper canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.zukan-detail-info { width: 100%; padding: 0; display: flex; flex-direction: column; align-items: center; overflow: visible; }
.zukan-detail-name { font-size: 1.4rem; font-weight: bold; color: #8e624d; margin-bottom: 8px; text-align: center; }
.zukan-detail-type { font-size: 1.1rem; font-weight: bold; margin-bottom: 4px; text-align: center; }
.zukan-detail-stats { font-size: 1.0rem; white-space: pre-line; line-height: 1.3; text-align: center; }
.zukan-detail-divider { border-bottom: 2px dashed #8e624d; margin-bottom: 10px; }
.zukan-detail-desc { font-size: 1.25rem; line-height: 1.6; text-align: left; white-space: pre-wrap; flex: 1; min-height: 100px; height: auto; overflow-y: auto; padding-right: 5px; }
.zukan-detail-desc::-webkit-scrollbar { width: 8px; background-color: rgba(142, 98, 77, 0.2); }
.zukan-detail-desc::-webkit-scrollbar-thumb { background-color: #8e624d; border-radius: 4px; }


        /* オーラエフェクト用ベース */
        .aura-effect {
            position: absolute;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            width: 0; height: 0;
            pointer-events: none;
            z-index: 0; /* キャンバスの奥 */
        }

        /* 10勝: 控えめなキラキラドット */
        .aura-10::before {
            content: '';
            position: absolute;
            width: 4px; height: 4px;
            top: -2px; left: -2px;
            box-shadow: 
                -40px -40px 0 #fff, 40px -30px 0 #ffeb3b,
                -25px 50px 0 #fff, 30px 40px 0 #ffeb3b,
                -50px 10px 0 #fff, 50px -10px 0 #ffeb3b,
                0 -60px 0 #ffeb3b, 0 60px 0 #fff;
            animation: sparkle-10 3s infinite alternate;
        }
        @keyframes sparkle-10 {
            0% { transform: scale(0.8) rotate(0deg); opacity: 0.3; }
            100% { transform: scale(1.2) rotate(10deg); opacity: 0.8; }
        }

        /* 50勝: 少し派手なキラキラドット */
        .aura-50::before, .aura-50::after {
            content: '';
            position: absolute;
            width: 6px; height: 6px;
            top: -3px; left: -3px;
            box-shadow: 
                -50px -50px 0 #ffeb3b, 50px -40px 0 #ffc107,
                -30px 60px 0 #ffeb3b, 40px 50px 0 #ffc107,
                -60px 20px 0 #ffeb3b, 60px -20px 0 #ffc107,
                -10px -70px 0 #ffeb3b, 10px 70px 0 #ffc107,
                -70px -10px 0 #ffc107, 70px 25px 0 #ffeb3b;
            animation: sparkle-50 2s infinite alternate ease-in-out;
        }
        .aura-50::after {
            width: 4px; height: 4px;
            top: -2px; left: -2px;
            transform: rotate(45deg);
            animation-delay: -1s;
        }
        @keyframes sparkle-50 {
            0% { transform: scale(0.8) rotate(0deg); opacity: 0.5; filter: drop-shadow(0 0 2px #ffc107); }
            100% { transform: scale(1.3) rotate(15deg); opacity: 1; filter: drop-shadow(0 0 5px #ffc107); }
        }

        /* 100勝: 最も派手で豪華なキラキラドット */
        .aura-100::before, .aura-100::after {
            content: '';
            position: absolute;
            width: 8px; height: 8px;
            top: -4px; left: -4px;
            box-shadow: 
                -60px -60px 0 #ffeb3b, 60px -50px 0 #ff9800,
                -40px 70px 0 #fff, 50px 60px 0 #ffeb3b,
                -70px 30px 0 #ff9800, 70px -30px 0 #fff,
                -15px -80px 0 #ffeb3b, 15px 80px 0 #ff9800,
                -80px -10px 0 #fff, 80px 35px 0 #ffeb3b,
                -30px -30px 0 #ff9800, 30px -20px 0 #fff,
                -50px 0px 0 #ffeb3b, 0px 50px 0 #fff;
            animation: sparkle-100 1.5s infinite alternate ease-in-out;
        }
        .aura-100::after {
            width: 5px; height: 5px;
            top: -2px; left: -2px;
            transform: rotate(30deg);
            animation-duration: 1s;
            animation-direction: alternate-reverse;
        }
        @keyframes sparkle-100 {
            0% { transform: scale(0.8) rotate(0deg); opacity: 0.6; filter: drop-shadow(0 0 5px #ff9800); }
            100% { transform: scale(1.5) rotate(25deg); opacity: 1; filter: drop-shadow(0 0 10px #ffeb3b); }
        }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }

    /* 進化演出は端末の「視差効果を減らす」が有効でも、本来と同じ時間をかける。
       点滅回数だけを抑え、途中で進化後の姿へ切り替わらないようにする。 */
    .evolution-overlay.flashing {
        animation-name: evolutionPulsateReduced !important;
        animation-duration: 6s !important;
        animation-timing-function: step-end !important;
        animation-iteration-count: 1 !important;
    }
    .evolution-overlay.flashing-ultimate {
        animation-name: ultimatePulsateReduced !important;
        animation-duration: 9s !important;
        animation-timing-function: step-end !important;
        animation-iteration-count: 1 !important;
    }
    @keyframes evolutionPulsateReduced {
        0%, 20%, 40%, 60%, 80% { opacity: 0; }
        10%, 30%, 50%, 70%, 90%, 100% { opacity: 1; }
    }
    @keyframes ultimatePulsateReduced {
        0%, 20%, 40%, 60%, 80% { opacity: 0; background: #fff; }
        10%, 50%, 90%, 100% { opacity: 1; background: #fff; }
        30%, 70% { opacity: 0.85; background: #f1c40f; }
    }

    /* 戦歴オーラは停止させず、回転をゆっくりにして状態が分かるようにする */
    .aura-10::before {
        animation-duration: 6s !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }
    .aura-50::before {
        animation-duration: 5.5s !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }
    .aura-50::after {
        animation-duration: 4.5s !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }
    .aura-100::before {
        animation-duration: 4.5s !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }
    .aura-100::after {
        animation-duration: 3.4s !important;
        animation-iteration-count: infinite !important;
        animation-play-state: running !important;
    }

    /* 攻撃・被弾・回避はゲーム結果を伝える動きなので、移動量を抑えて残す */
    .battle-character.attack-mine {
        animation-name: battleAttackMineReduced !important;
        animation-duration: 0.55s !important;
    }
    .battle-character.attack-enemy {
        animation-name: battleAttackEnemyReduced !important;
        animation-duration: 0.55s !important;
    }
    .battle-character.hit {
        animation-name: battleHitReduced !important;
        animation-duration: 0.35s !important;
    }
    .battle-character.miss {
        animation-name: battleMissReduced !important;
        animation-duration: 0.45s !important;
    }
    .battle-character.win {
        animation-name: battleWinReduced !important;
        animation-duration: 0.7s !important;
        animation-iteration-count: infinite !important;
    }
    .battle-character.lose {
        animation-name: battleLoseReduced !important;
        animation-duration: 0.5s !important;
    }
    .battle-flash.active {
        animation-duration: 0.18s !important;
    }
    .hit-fx {
        animation-duration: 0.4s !important;
    }
    .battle-popup-text {
        animation-duration: 0.9s !important;
    }
    .battle-message,
    .battle-command-panel.visible {
        animation-duration: 0.25s !important;
    }
    .battle-hp-bar {
        transition-duration: 0.25s !important;
    }

    .word-count-effect, .word-symbol-effect {
        animation-name: wordEffectReduced !important;
        animation-duration: 0.9s !important;
    }
    .progress-container.progress-gain {
        animation-name: progressGainReduced !important;
        animation-duration: 0.55s !important;
    }
    @keyframes wordEffectReduced {
        0% { opacity: 0; transform: scale(0.9); }
        15%, 78% { opacity: 1; transform: scale(1); }
        100% { opacity: 0; transform: scale(1); }
    }
    @keyframes progressGainReduced {
        0%, 100% { box-shadow: none; }
        25%, 70% { box-shadow: 0 0 0 3px rgba(255,255,255,0.9); }
    }
    @keyframes battleAttackMineReduced {
        0%, 100% { transform: translate(0, 0); }
        30% { transform: translate(-4px, 4px); }
        65% { transform: translate(22px, -22px); }
    }
    @keyframes battleAttackEnemyReduced {
        0%, 100% { transform: translate(0, 0); }
        30% { transform: translate(4px, -4px); }
        65% { transform: translate(-22px, 22px); }
    }
    @keyframes battleHitReduced {
        0%, 100% { transform: translateX(0); }
        35% { transform: translateX(-7px); }
        70% { transform: translateX(7px); }
    }
    @keyframes battleMissReduced {
        0%, 100% { transform: translate(0, 0); opacity: 0.5; }
        50% { transform: translate(-10px, -12px); opacity: 0.75; }
    }
    @keyframes battleWinReduced {
        0% { transform: translateY(0); }
        100% { transform: translateY(-7px) scale(1.03); }
    }
    @keyframes battleLoseReduced {
        0% { transform: translateY(0); opacity: 1; }
        100% { transform: translateY(8px); opacity: 0.55; }
    }
}

/* Android・iPadの低い横画面でも、5つの主要操作を1列で画面内に保つ。 */
@media (orientation: landscape) and (max-height: 500px) {
    body { padding: 0 !important; }
    .device {
        width: 100vw !important;
        max-width: none !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        justify-content: flex-start !important;
    }
    .device-title { margin: 0 0 3px !important; font-size: 1rem !important; line-height: 1.1; }
    .screen-container {
        flex: 1 !important;
        min-height: 0 !important;
        width: min(100%, 320px) !important;
        margin: 0 auto 4px !important;
        padding: 6px !important;
    }
    .screen { flex: 1 !important; min-height: 0 !important; height: auto !important; }
    .controls {
        width: 100% !important;
        max-width: 430px !important;
        flex-wrap: nowrap !important;
        gap: clamp(5px, 2vw, 14px) !important;
        margin: 2px auto 0 !important;
    }
    .btn-round { width: 58px !important; height: 58px !important; flex: 0 0 58px; font-size: 0.86rem !important; }
    .btn-label { margin-top: 2px !important; font-size: 0.7rem !important; }
}
