:root {
    --app-header-offset: 0px;
    --neon-blue: #00f3ff;
    --neon-pink: #ff0055;
    --neon-purple: #bc13fe;
    --gold: #ffcc00;
    --god: #ffffff;
    --danger: #ff0000;
    --bg-color: #000000;
    --celestial-blue: #fff9c4;
    --sunlight-orange: #2e7d32;
    --mild-red: #c62828;
    --toxic-cyan: #220000;
    --abyssal-crimson: #c0c8d0;
    --wild-gold: #FFD700;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
}

#main-body {
    --header-reserve: 124px;
    --footer-reserve: 168px;
    background-color: var(--bg-color);
    background-size: cover;
    background-position: center;
    color: white;
    font-family: 'Arial Black', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    user-select: none;
    transition: background-image 0.5s ease;
    position: fixed;
    top: var(--app-header-offset, 0px);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--app-header-offset, 0px));
    min-height: calc(100dvh - var(--app-header-offset, 0px));
    padding: var(--header-reserve) 0 calc(var(--footer-reserve) + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    z-index: 0;
    overscroll-behavior: none;
    touch-action: manipulation;
}

@supports (height: 100svh) {
    #main-body {
        height: calc(100svh - var(--app-header-offset, 0px));
        min-height: calc(100svh - var(--app-header-offset, 0px));
    }
}

#main-body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(34, 0, 34, 0.5) 0%, rgba(0, 0, 0, 0.8) 70%);
    z-index: -1;
}

@keyframes bg-flicker-anim {
    0% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.7;
    }
}

#main-body.flicker-active::before {
    background: var(--flicker-color) !important;
    animation: bg-flicker-anim var(--flicker-duration, 0.08s) infinite alternate !important;
}

@keyframes burn-flicker {
    0% {
        box-shadow: 0 0 15px #ff4500, 0 0 30px #ff8c00, inset 0 0 15px #ff4500;
        filter: brightness(1.2);
    }

    100% {
        box-shadow: 0 0 25px #ff0000, 0 0 50px #ff4500, inset 0 0 25px #ff0000;
        filter: brightness(1.6);
    }
}

@keyframes rainbow-glow {
    0% {
        box-shadow: 0 0 20px 25px rgba(255, 0, 0, 0.6), inset 0 0 15px rgba(255, 0, 0, 0.3);
        border-color: #ff0000;
    }

    16% {
        box-shadow: 0 0 20px 25px rgba(255, 136, 0, 0.6), inset 0 0 15px rgba(255, 136, 0, 0.3);
        border-color: #ff8800;
    }

    33% {
        box-shadow: 0 0 20px 25px rgba(255, 255, 0, 0.6), inset 0 0 15px rgba(255, 255, 0, 0.3);
        border-color: #ffff00;
    }

    50% {
        box-shadow: 0 0 20px 25px rgba(0, 255, 0, 0.6), inset 0 0 15px rgba(0, 255, 0, 0.3);
        border-color: #00ff00;
    }

    66% {
        box-shadow: 0 0 20px 25px rgba(0, 136, 255, 0.6), inset 0 0 15px rgba(0, 136, 255, 0.3);
        border-color: #0088ff;
    }

    83% {
        box-shadow: 0 0 20px 25px rgba(136, 0, 255, 0.6), inset 0 0 15px rgba(136, 0, 255, 0.3);
        border-color: #8800ff;
    }

    100% {
        box-shadow: 0 0 20px 25px rgba(255, 0, 0, 0.6), inset 0 0 15px rgba(255, 0, 0, 0.3);
        border-color: #ff0000;
    }
}

.burning-2 {
    animation: burn-flicker 0.3s infinite alternate !important;
    border-color: #ff4500 !important;
    z-index: 21 !important;
}

.burning-3 {
    animation: rainbow-glow 2.5s linear infinite !important;
    z-index: 31 !important;
}

.wheel.locked .segment-num {
    opacity: 0.1;
    filter: brightness(0.1) grayscale(1);
    transition: all 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.segment-num.highlight-seg {
    opacity: 1 !important;
    filter: drop-shadow(0 0 30px #fff) grayscale(0) !important;
    text-shadow: 0 0 15px #ffffff, 0 0 25px #ffffff, 0 0 40px #ffffff !important;
    z-index: 100 !important;
}

.segment-num.highlight-seg-float {
    opacity: 1 !important;
    z-index: 100 !important;
    animation: float-up-glow 0.8s ease-out forwards !important;
}

@keyframes float-up-glow {
    0% {
        margin-top: 0;
        filter: drop-shadow(0 0 0 transparent) grayscale(0);
        text-shadow: none;
    }

    30% {
        margin-top: -10px;
        filter: drop-shadow(0 0 50px #fff) drop-shadow(0 0 100px #ffcc00) grayscale(0);
        text-shadow: 0 0 30px #fff, 0 0 60px #ffcc00, 0 0 90px #ff8800;
    }

    60% {
        margin-top: -7px;
        filter: drop-shadow(0 0 30px #fff) drop-shadow(0 0 70px #ffcc00) grayscale(0);
        text-shadow: 0 0 20px #fff, 0 0 40px #ffcc00, 0 0 70px #ff8800;
    }

    100% {
        margin-top: -8px;
        filter: drop-shadow(0 0 35px #fff) drop-shadow(0 0 80px #ffcc00) grayscale(0);
        text-shadow: 0 0 25px #fff, 0 0 50px #ffcc00, 0 0 80px #ff8800;
    }
}

.ui-header {
    position: absolute;
    top: 12px;
    z-index: 100;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.math-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.0rem;
    background: rgba(20, 0, 0, 0.9);
    padding: 10px 15px;
    border-radius: 40px;
    border: 2px solid var(--neon-pink);
    backdrop-filter: blur(5px);
    box-shadow: 0 0 15px var(--neon-pink);
    max-width: 95vw;
    box-sizing: border-box;
    white-space: nowrap;
}

#res-0 {
    color: var(--neon-blue);
    min-width: 65px;
    text-align: right;
}

.math-slot {
    min-width: 40px;
    text-align: center;
    display: inline-block;
    font-weight: 900;
}

.total-result {
    color: var(--gold);
    font-size: 1.4rem;
    margin-left: 5px;
    text-shadow: 0 0 10px var(--gold);
}

.mode-selector {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 20px;
    border-radius: 20px;
    border: 1px solid #555;
    font-size: 1.1rem;
    color: #fff;
}

.mode-arrow {
    cursor: pointer;
    color: var(--neon-blue);
    font-size: 1.2rem;
    padding: 5px 10px;
    transition: transform 0.1s;
}

.mode-arrow:active {
    transform: scale(1.2);
}

#mode-text {
    min-width: 100px;
    text-align: center;
    font-weight: 900;
    text-shadow: 0 0 10px #000;
}

.roulette-container {
    position: relative;
    width: 360px;
    height: 360px;
    margin-top: 0;
    transform-origin: center center;
    transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.roulette-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.target-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 50%;
    background: linear-gradient(to bottom, var(--neon-pink), transparent);
    transform: translateX(-50%);
    z-index: 45;
    box-shadow: 0 0 15px var(--neon-pink);
    pointer-events: none;
}

.master-pointer {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 20px solid transparent;
    border-top: 40px solid #fff;
    z-index: 50;
    filter: drop-shadow(0 0 15px var(--neon-pink));
}

.wheel {
    position: absolute;
    border-radius: 50%;
    border: 5px solid #222;
    box-sizing: border-box;
    filter: brightness(0.5);
    transform: rotate(0deg);
    box-shadow: inset 0 0 30px #000;
    transition: border-color 0.2s;
    will-change: transform;
}

.wheel.locked {
    contain: layout style paint;
}

#wheel-0 {
    width: 360px;
    height: 360px;
    z-index: 10;
}

#wheel-1 {
    width: 240px;
    height: 240px;
    z-index: 20;
}

#wheel-2 {
    width: 120px;
    height: 120px;
    z-index: 30;
}

.wheel.active {
    filter: brightness(1.3);
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(255, 200, 0, 0.3);
}

.wheel.locked {
    filter: brightness(0.4);
    border-color: #333;
}

.segment-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.segment-num {
    position: absolute;
    font-weight: 900;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.5s ease;
}

.ui-footer {
    position: absolute;
    bottom: 0;
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: linear-gradient(0deg, #000 0%, transparent 100%);
    padding: 14px 0 24px 0;
    z-index: 100;
}

#mute-btn {
    left: 16px !important;
    bottom: 118px !important;
    z-index: 120 !important;
}

.bet-control {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 1.1rem;
    margin-top: -4px;
}

.bet-control::after {
    content: "※最大払い出し 500,000 CS";
    flex-basis: 100%;
    display: block;
    margin-top: -2px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.35);
}

.bet-control::after {
    content: "払出上限：500,000 CS";
}

.bet-control > span:last-child {
    display: none;
}

.bet-btn {
    background: #222;
    border: 1px solid #555;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
}

#spin-btn {
    background: linear-gradient(180deg, #ff0055, #990033);
    border: 2px solid #ff99bb;
    padding: 12px 60px;
    margin-top: 2px;
    font-size: 1.8rem;
    font-weight: 900;
    color: white;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 0 20px #ff0055;
}

#spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-height: 760px) {
    #main-body {
        --header-reserve: 116px;
        --footer-reserve: 156px;
    }

    .ui-header {
        gap: 8px;
    }

    .math-display {
        font-size: 0.95rem;
        padding: 8px 12px;
    }

    .mode-selector {
        gap: 16px;
        padding: 4px 16px;
        font-size: 1rem;
    }

    .ui-footer {
        gap: 7px;
        padding: 12px 0 22px 0;
    }

    .bet-control {
        gap: 10px 12px;
        font-size: 1rem;
        margin-top: -2px;
    }

    .bet-control::after {
        font-size: 0.72rem;
        margin-top: -4px;
    }

    #spin-btn {
        padding: 10px 54px;
        font-size: 1.65rem;
    }

    #mute-btn {
        bottom: 106px !important;
    }
}

@media (max-height: 680px) {
    #main-body {
        --header-reserve: 108px;
        --footer-reserve: 142px;
    }

    .math-display {
        font-size: 0.88rem;
        padding: 7px 10px;
    }

    .total-result {
        font-size: 1.2rem;
    }

    .mode-selector {
        gap: 12px;
        padding: 3px 12px;
        font-size: 0.95rem;
    }

    .ui-footer {
        gap: 5px;
        padding: 10px 0 18px 0;
    }

    .bet-control {
        gap: 8px 10px;
    }

    .bet-control::after {
        font-size: 0.68rem;
        letter-spacing: 0.02em;
        margin-top: -5px;
    }

    #spin-btn {
        padding: 9px 46px;
        font-size: 1.5rem;
    }

    #mute-btn {
        bottom: 94px !important;
        left: 12px !important;
        font-size: 1.35rem !important;
        padding: 5px 8px !important;
    }
}

.modal-overlay {
    position: fixed;
    top: var(--app-header-offset, 0px);
    left: 0;
    width: 100%;
    height: calc(100dvh - var(--app-header-offset, 0px));
    background: rgba(0, 0, 0, 0.95);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}


.speed-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 95vw;
}

.speed-btn {
    background: #181818;
    border: 1px solid #444;
    color: #888;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.speed-btn.selected {
    background: rgba(0, 243, 255, 0.15);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

.speed-btn:active {
    transform: scale(0.93);
}

.big-win-title {
    font-size: 4rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 20px var(--gold);
    animation: god-pulse 0.2s infinite alternate;
}

@keyframes god-pulse {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 1;
    }
}

/* 第3リール演出用CSS */
@keyframes shake-medium {

    0%,
    100% {
        transform: scale(2.6) translate(0, 0);
    }

    10% {
        transform: scale(2.8) translate(-3px, -2px);
    }

    20% {
        transform: scale(2.8) translate(3px, -2px);
    }

    30% {
        transform: scale(2.8) translate(-2px, 3px);
    }

    40% {
        transform: scale(2.8) translate(2px, 3px);
    }

    50% {
        transform: scale(2.8) translate(-3px, -1px);
    }

    60% {
        transform: scale(2.8) translate(3px, 1px);
    }

    70% {
        transform: scale(2.8) translate(-1px, -3px);
    }

    80% {
        transform: scale(2.8) translate(1px, 3px);
    }

    90% {
        transform: scale(2.8) translate(-2px, -2px);
    }
}

@keyframes shake-heavy {

    0%,
    100% {
        transform: scale(2.8) translate(0, 0);
    }

    10% {
        transform: scale(3.2) translate(-4px, -3px);
    }

    20% {
        transform: scale(3.2) translate(4px, -3px);
    }

    30% {
        transform: scale(3.2) translate(-3px, 4px);
    }

    40% {
        transform: scale(3.2) translate(3px, 3px);
    }

    50% {
        transform: scale(3.2) translate(-4px, -2px);
    }

    60% {
        transform: scale(3.2) translate(4px, 2px);
    }

    70% {
        transform: scale(3.2) translate(-2px, -4px);
    }

    80% {
        transform: scale(3.2) translate(2px, 4px);
    }

    90% {
        transform: scale(3.2) translate(-3px, -3px);
    }
}

.stage-shake-medium {
    animation: shake-medium 0.08s infinite !important;
}

.stage-shake-heavy {
    animation: shake-heavy 0.06s infinite !important;
}

@keyframes gold-glow-anim {
    0% {
        box-shadow: 0 0 15px #ffcc00, 0 0 30px #ff8c00, inset 0 0 15px #ffcc00;
    }

    100% {
        box-shadow: 0 0 25px #ffcc00, 0 0 50px #ff8c00, inset 0 0 25px #ffcc00;
    }
}

.reel3-gold {
    animation: gold-glow-anim 0.3s infinite alternate !important;
    border-color: #ffcc00 !important;
    z-index: 31 !important;
}

/* 変身対象: 軽く白発光 */
.segment-num.doomed {
    color: #ffffff !important;
    text-shadow: 0 0 8px #ffffff, 0 0 16px #ffffffaa !important;
    filter: none !important;
    transition: all 0.2s ease-out !important;
}

/* 消去対象: 透明になる */
.segment-num.doomed-vanish {
    opacity: 0 !important;
    filter: brightness(0) !important;
    transition: all 0.2s ease-in !important;
}

/* スタンプインアニメーション（transformを使わない） */
@keyframes stamp-in {
    0% {
        opacity: 0;
        filter: brightness(3) drop-shadow(0 0 30px #ffcc00);
        text-shadow: 0 0 30px #ffcc00, 0 0 60px #ff8800;
    }
    50% {
        opacity: 1;
        filter: brightness(2) drop-shadow(0 0 20px #ffcc00);
        text-shadow: 0 0 20px #ffcc00, 0 0 40px #ff8800;
    }
    100% {
        opacity: 1;
        filter: brightness(1) drop-shadow(0 0 6px #ffcc00);
        text-shadow: 0 0 4px #ffcc00;
    }
}

/* 変身後のセグメント */
.segment-num.upgraded {
    animation: stamp-in 0.3s ease-out forwards !important;
}

/* 消去対象: フェードアウト（虹色演出の下位マス用） */
.segment-num.burn-out {
    opacity: 0.18 !important;
    filter: brightness(0.2) blur(2px) !important;
    transition: all 0.45s ease-out !important;
}

/* 生存セグメントのゴールド発光 */
.segment-num.survive-gold {
    filter: drop-shadow(0 0 8px #ffcc00) drop-shadow(0 0 16px #ff8c00) !important;
    transition: filter 0.4s ease !important;
}

/* 生存セグメントのレインボー発光 */
.segment-num.survive-rainbow {
    filter: drop-shadow(0 0 10px #ff0000) drop-shadow(0 0 20px #8800ff) !important;
    animation: rainbow-text-glow 1s linear infinite !important;
}

@keyframes rainbow-text-glow {
    0%   { filter: drop-shadow(0 0 10px #ff0000) drop-shadow(0 0 20px #ff0000); }
    16%  { filter: drop-shadow(0 0 10px #ff8800) drop-shadow(0 0 20px #ff8800); }
    33%  { filter: drop-shadow(0 0 10px #ffff00) drop-shadow(0 0 20px #ffff00); }
    50%  { filter: drop-shadow(0 0 10px #00ff00) drop-shadow(0 0 20px #00ff00); }
    66%  { filter: drop-shadow(0 0 10px #0088ff) drop-shadow(0 0 20px #0088ff); }
    83%  { filter: drop-shadow(0 0 10px #8800ff) drop-shadow(0 0 20px #8800ff); }
    100% { filter: drop-shadow(0 0 10px #ff0000) drop-shadow(0 0 20px #ff0000); }
}

.segment-divider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 50%;
    background: #888;
    transform-origin: bottom center;
    z-index: 5;
    pointer-events: none;
}

/* ======================================================================
   旧共通UIスタイル → common.css に移行済み（削除完了）
   common.css が .hidden, .error-modal, .spinner, .loading-text 等を提供
   ====================================================================== */

/* ======================================================================
   Result CSS（result.html テンプレート準拠 — 完全版）
   ====================================================================== */

/* --- CRM 変数 --- */
:root {
    --crm-primary: #ffcc00;
    --crm-accent: #00f2ff;
    --crm-bg-start: #050510;
    --crm-bg-end: #1a1a3a;
    --crm-text: #ffffff;
    --crm-sub-text: #666666;
    --crm-font-main: 'Zen Dots', sans-serif;
    --crm-font-sub: 'DotGothic16', sans-serif;
    --primary: #00f2ff;
}

/* --- オーバーレイ・ボックス --- */
.crm-overlay { position: fixed; top: var(--app-header-offset, 0px); left: 0; width: 100%; height: calc(100dvh - var(--app-header-offset, 0px)); background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 10000; opacity: 0; transition: opacity 0.3s; }
.crm-overlay.open { display: flex; opacity: 1; }

.crm-box { background: linear-gradient(135deg, var(--crm-bg-start) 0%, var(--crm-bg-end) 100%); border: 2px solid var(--crm-primary); box-shadow: 0 0 40px rgba(255,204,0,0.15); padding: 15px 10px; border-radius: 16px; width: 85%; max-width: 360px; max-height: 95vh; overflow-y: auto; display: flex; flex-direction: column; align-items: center; transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275); }
.crm-overlay.open .crm-box { transform: scale(1); }

.crm-header { width: 100%; text-align: center; margin-bottom: 10px; }
.crm-title { font-family: var(--crm-font-sub); font-size: 1.4rem; color: var(--crm-primary); text-shadow: 0 0 10px rgba(255,204,0,0.4); letter-spacing: 1px; }
.crm-title-line { width: 60px; height: 2px; background: var(--crm-primary); margin: 8px auto 0; box-shadow: 0 0 5px var(--crm-primary); }

/* --- カードエリア --- */
.crm-card-area { margin-bottom: 10px; position: relative; perspective: 1000px; }
.crm-card-frame { width: 150px; height: 210px; position: relative; border-radius: 12px; }
.crm-card-placeholder { width: 100%; height: 100%; background: rgba(0,0,0,0.4); border: 2px dashed var(--crm-primary); border-radius: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--crm-primary); position: relative; z-index: 2; overflow: hidden; background-image: linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.05) 50%, rgba(255,255,255,0.05) 75%, transparent 75%, transparent); background-size: 12px 12px; box-shadow: 0 0 20px rgba(255,204,0,0.2), inset 0 0 10px rgba(255,204,0,0.1); }
.crm-card-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.crm-card-icon { font-size: 3rem; font-family: var(--crm-font-main); margin-bottom: 10px; opacity: 0.8; }
.crm-card-text { font-size: 0.8rem; letter-spacing: 2px; font-family: var(--crm-font-main); }
.crm-card-name { font-family: var(--crm-font-sub); font-size: 1.1rem; color: #fff; text-shadow: 0 0 5px var(--crm-primary); margin: 5px 0 0 0; text-align: center; width: 100%; letter-spacing: 1px; }

.crm-card-glow { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 160%; height: 160%; background: radial-gradient(circle, var(--crm-primary) 0%, transparent 60%); opacity: 0.4; z-index: 1; animation: crmRotateGlow 8s infinite linear, crmPulseGlow 3s infinite ease-in-out; }
@keyframes crmRotateGlow { 0% { transform:translate(-50%,-50%) rotate(0deg); } 100% { transform:translate(-50%,-50%) rotate(360deg); } }
@keyframes crmPulseGlow { 0%, 100% { opacity: 0.3; transform:translate(-50%,-50%) scale(0.9); } 50% { opacity: 0.6; transform:translate(-50%,-50%) scale(1.1); } }

/* --- スコア&アクション --- */
.crm-score-area { display: flex; flex-direction: column; align-items: center; margin-bottom: 15px; margin-top: 5px; }
.crm-label { font-size: 0.7rem; color: var(--crm-sub-text); letter-spacing: 3px; font-family: var(--crm-font-main); margin-bottom: 2px; }
.crm-value { font-size: 1.5rem; color: var(--crm-text); font-family: var(--crm-font-main); line-height: 1; text-shadow: 0 0 15px var(--crm-primary); }

.crm-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; align-items: center; }

/* --- ボタン3種 --- */
.crm-btn-primary { width: 100%; padding: 12px; font-size: 1.1rem; background: var(--crm-primary); color: #000; border: none; font-family: var(--crm-font-sub); font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.3); cursor: pointer; border-radius: 8px; transition: transform 0.1s, box-shadow 0.1s; position: relative; overflow: hidden; }
.crm-btn-primary::after { content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent); transform: rotate(45deg) translate(-100%,0); animation: crmBtnShine 3s infinite; }
@keyframes crmBtnShine { 0%, 80% { transform: rotate(45deg) translate(-100%,0); } 100% { transform: rotate(45deg) translate(100%,0); } }
.crm-btn-primary:active { transform: scale(0.98); box-shadow: 0 2px 5px rgba(0,0,0,0.3); }

.crm-btn-redemption { width: 100%; padding: 10px; font-size: 1.0rem; background: rgba(0,242,255,0.15); border: 2px solid var(--crm-accent); color: var(--crm-accent); font-family: var(--crm-font-sub); font-weight: bold; box-shadow: 0 0 10px rgba(0,242,255,0.3); cursor: pointer; border-radius: 8px; transition: 0.2s; position: relative; overflow: hidden; }
.crm-btn-redemption:hover { background: var(--crm-accent); color: #000; box-shadow: 0 0 20px var(--crm-accent); }

.crm-btn-secondary { background: transparent; border: none; color: var(--crm-sub-text); font-size: 0.9rem; font-family: var(--crm-font-sub); text-decoration: underline; cursor: pointer; padding: 5px; opacity: 0.7; transition: opacity 0.2s; margin-top: 5px; }
.crm-btn-secondary:hover { color: var(--crm-text); opacity: 1; }

/* --- BonusOverlay (TCコイン獲得画面) --- */
.bonus-overlay { position: fixed; top: var(--app-header-offset, 0px); right: 0; bottom: 0; left: 0; background: rgba(5,5,16,0.8); display: none; justify-content: center; align-items: center; z-index: 30000; backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s ease; }
.bonus-overlay.open { display: flex; opacity: 1; }
.bonus-panel { width: 85%; max-width: 400px; background: linear-gradient(160deg, #fff5c7 0%, #ffe289 40%, #ffc644 100%); border-radius: 24px; border: 3px solid #ffb100; box-shadow: 0 15px 45px rgba(0,0,0,0.35), inset 0 0 25px rgba(255,255,255,0.35); padding: 25px; text-align: center; position: relative; font-family: 'Zen Dots', sans-serif; color: #a45d00; transform: scale(0.95); }
.bonus-panel::before { content: ''; position: absolute; inset: 6px; border-radius: 18px; background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,255,255,0)); pointer-events: none; }
.bonus-title { font-size: 1.3rem; letter-spacing: 1px; margin-bottom: 24px; color: #c05c00; text-shadow: 0 2px 8px rgba(255,255,255,0.6); }
.bonus-body { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 24px; }
.bonus-coin { width: 80px; height: 80px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff1b3, #ffbb33 60%, #cc8400 100%); border: 3px solid rgba(255,255,255,0.5); box-shadow: inset 0 0 15px rgba(255,255,255,0.4), 0 6px 18px rgba(204,132,0,0.6); display: flex; align-items: center; justify-content: center; position: relative; }
.bonus-coin-inner { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; font-weight: bold; color: #8b4b00; background: radial-gradient(circle at 30% 30%, #ffe8a0, #ffbf3d); }
.bonus-amount { font-size: 2.5rem; color: #d05600; text-shadow: 0 4px 10px rgba(255,255,255,0.7); min-width: 120px; text-align: left; }
.bonus-close-btn { min-width: 120px; background: linear-gradient(180deg, #ffb931, #ff8a00); border: none; border-radius: 24px; padding: 12px 24px; font-family: 'Zen Dots', sans-serif; font-size: 1rem; color: #3e1d00; cursor: pointer; box-shadow: 0 6px 18px rgba(255,138,0,0.45); transition: transform 0.15s ease; }
.bonus-close-btn:active { transform: scale(0.97); }

/* ======================================================================
   Resource Loading Screen CSS（resource_loading テンプレート準拠）
   ====================================================================== */
#resource-loading-screen {
    position: fixed;
    top: var(--app-header-offset, 0px);
    right: 0;
    bottom: 0;
    left: 0;
    background: #111;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out;
}

#resource-loading-screen.done {
    opacity: 0;
    pointer-events: none;
}

.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    width: 75%;
    max-width: 280px;
}

/* --- Circular Spinner --- */
.rl-spinner {
    position: relative;
    width: 48px;
    height: 48px;
    animation: rl-spinner-rotate 1.2s linear infinite;
}

.rl-spinner .dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}

.rl-spinner .dot:nth-child(1) { top: 0;   left: 20px; animation: rl-dot-fade 1.2s 0.00s ease-in-out infinite; }
.rl-spinner .dot:nth-child(2) { top: 3px;  left: 34px; animation: rl-dot-fade 1.2s -0.15s ease-in-out infinite; }
.rl-spinner .dot:nth-child(3) { top: 20px; left: 40px; animation: rl-dot-fade 1.2s -0.30s ease-in-out infinite; }
.rl-spinner .dot:nth-child(4) { top: 34px; left: 34px; animation: rl-dot-fade 1.2s -0.45s ease-in-out infinite; }
.rl-spinner .dot:nth-child(5) { top: 40px; left: 20px; animation: rl-dot-fade 1.2s -0.60s ease-in-out infinite; }
.rl-spinner .dot:nth-child(6) { top: 34px; left: 3px;  animation: rl-dot-fade 1.2s -0.75s ease-in-out infinite; }
.rl-spinner .dot:nth-child(7) { top: 20px; left: 0;    animation: rl-dot-fade 1.2s -0.90s ease-in-out infinite; }
.rl-spinner .dot:nth-child(8) { top: 3px;  left: 3px;  animation: rl-dot-fade 1.2s -1.05s ease-in-out infinite; }

@keyframes rl-spinner-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rl-dot-fade { 0%, 40%, 100% { opacity: 0.12; transform: scale(0.7); } 20% { opacity: 1; transform: scale(1); } }

/* --- Progress Bar --- */
.progress-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: #fff;
    transition: width 0.3s ease-out;
}

.progress-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.loading-label {
    color: rgba(255, 255, 255, 0.35);
    font-size: clamp(0.7rem, 3vw, 0.8rem);
    text-align: center;
    transition: opacity 0.3s ease;
}

/* --- Tap to Start --- */
.tap-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: tap-fade-in 0.5s ease-out;
    cursor: pointer;
}

.tap-prompt.hidden { display: none; }

.tap-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(1rem, 4.5vw, 1.15rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    animation: tap-pulse 1.6s ease-in-out infinite;
}

.loading-card.ready .rl-spinner,
.loading-card.ready .progress-area,
.loading-card.ready .loading-label { display: none; }

@keyframes tap-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tap-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
