/* --- DQ Pixel Battle: Game-specific CSS --- */
/* 元の index.html 内 <style> タグからの完全移行 */

:root {
    --dq-blue: #0000c0;
    --dq-frame: #f0f0f0;
    --dq-text: #ffffff;
    --dq-yellow: #f8b700;

    /* 新しい画面用カラー定義 (CRM & Bonus) */
    --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;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* === STG修正: bodyスタイルを#main-bodyにスコープ化 === */
/* Rails レイアウトとの共存のため、bodyには最小限のリセットのみ適用 */

/* ゲームページでRailsフッターを非表示 */
footer,
.footer,
[data-controller="footer"] {
    display: none !important;
}

/* ゲームコンテナ（#main-body = HAMLテンプレートのルート） */
#main-body {
    background-color: #111;
    margin: 0;
    padding: 0;
    height: calc(100dvh - 56px);
    /* ヘッダー分を引く */
    width: 100%;
    font-family: 'DotGothic16', sans-serif;
    color: var(--dq-text);
    overflow: hidden;
    user-select: none;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* ゲーム画面本体 */
#game-wrapper {
    position: relative;
    width: 375px;
    height: 667px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #000;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px #333, 0 0 30px rgba(0, 0, 0, 0.8);
    border-radius: 4px;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: #000;
    z-index: 200000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

#loading-screen.fadeout {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    font-size: 24px;
    color: #fff;
    animation: blink 1.0s infinite;
    margin-bottom: 20px;
}

.loading-bar-frame {
    width: 60%;
    height: 10px;
    border: 2px solid #fff;
    padding: 2px;
}

.loading-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--dq-yellow);
    transition: width 0.2s;
}

/* Start Overlay (Click to Start) */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: #000;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: opacity 0.3s;
}

#start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.blink-message {
    font-family: 'Zen Dots', sans-serif;
    font-size: 24px;
    color: var(--dq-yellow);
    animation: flash-text 1.2s infinite;
    letter-spacing: 2px;
}

/* ===== Loading Overlay ===== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: overlay-fade-in 0.3s ease-out;
}

/* リッチモード（モンスター紹介 / 攻略Tips） */
.ld-rich {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a2e;
}

/* 通常スピナー（リッチでない時） */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-overlay-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.78rem, 3.2vw, 0.9rem);
    font-weight: 500;
    letter-spacing: 0.04em;
}

#loading-overlay.fade-out,
.ld-rich.fade-out {
    animation: overlay-fade-out 0.25s ease-in forwards;
}

.ld-rich.hidden {
    display: none !important;
}

/* ld-wrap: ロード画面コンテナ */
.ld-wrap {
    width: 100%;
    max-width: 375px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ld-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px;
}

/* 共通タイトル */
.ld-title {
    color: #f8b700;
    font-size: 15px;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 14px;
    text-shadow: 0 0 10px rgba(248, 183, 0, 0.4);
}

/* カード枠 */
.ld-card {
    width: 100%;
    background: #222;
    border: 2px solid #f8b700;
    padding: 0;
}

/* モンスターヘッダー */
.ld-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 2px solid #444;
}

.ld-rank {
    display: inline-block;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.ld-name {
    color: #fff;
    font-size: 16px;
    flex: 1;
}

.ld-type {
    font-size: 10px;
    color: #ccc;
    padding: 2px 6px;
    border: 1px solid #666;
    white-space: nowrap;
}

/* モンスター画像+レーダー横並び */
.ld-card-body {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
}

.ld-img-side {
    flex: 0 0 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ld-monster-img {
    width: 100px;
    height: 100px;
    image-rendering: pixelated;
}

.ld-skill {
    color: #8fd;
    font-size: 10px;
    margin-top: 6px;
    text-align: center;
}

.ld-radar-side {
    flex: 1;
}

/* モンスターフッター */
.ld-card-footer {
    padding: 8px 14px;
    border-top: 2px solid #444;
}

.ld-flavor {
    color: #aaa;
    font-size: 10px;
    line-height: 1.6;
}

/* Tips ヘッダー */
.ld-tip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 2px solid #444;
}

.ld-tip-cat {
    font-size: 10px;
    padding: 2px 8px;
    font-weight: bold;
    white-space: nowrap;
}

.ld-tip-title {
    color: #fff;
    font-size: 14px;
    flex: 1;
}

.ld-tip-body {
    padding: 14px;
}

/* Tips テキスト */
.tip-text {
    color: #ccc;
    font-size: 11px;
    line-height: 1.8;
}

.tip-text .hl {
    color: #f8b700;
    font-weight: bold;
}

.tip-text .hl-red {
    color: #e74c3c;
    font-weight: bold;
}

.tip-text .hl-grn {
    color: #2ecc71;
    font-weight: bold;
}

.tip-text .hl-blue {
    color: #6cf;
    font-weight: bold;
}

/* Now Loading 点滅 */
.ld-loading-blink {
    color: #f8b700;
    font-size: 12px;
    letter-spacing: 3px;
    margin-top: 16px;
    animation: ld-blink 1.5s ease-in-out infinite;
}

@keyframes ld-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

@keyframes overlay-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes overlay-fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ===== Shared Spinner (8 dots) ===== */
.dot-spinner {
    position: relative;
    width: 48px;
    height: 48px;
    animation: spinner-rotate 1.2s linear infinite;
}

.dot-spinner .dot {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}

.dot-spinner .dot:nth-child(1) {
    top: 0;
    left: 20px;
    animation: dot-fade 1.2s 0.00s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(2) {
    top: 3px;
    left: 34px;
    animation: dot-fade 1.2s -0.15s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(3) {
    top: 20px;
    left: 40px;
    animation: dot-fade 1.2s -0.30s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(4) {
    top: 34px;
    left: 34px;
    animation: dot-fade 1.2s -0.45s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(5) {
    top: 40px;
    left: 20px;
    animation: dot-fade 1.2s -0.60s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(6) {
    top: 34px;
    left: 3px;
    animation: dot-fade 1.2s -0.75s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(7) {
    top: 20px;
    left: 0;
    animation: dot-fade 1.2s -0.90s ease-in-out infinite;
}

.dot-spinner .dot:nth-child(8) {
    top: 3px;
    left: 3px;
    animation: dot-fade 1.2s -1.05s ease-in-out infinite;
}

@keyframes spinner-rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes dot-fade {

    0%,
    40%,
    100% {
        opacity: 0.12;
        transform: scale(0.7);
    }

    20% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Error Overlay ===== */
#error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100000;
    backdrop-filter: blur(2px);
}

.error-modal {
    background-color: #ffffff;
    color: #333;
    padding: 5%;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 85%;
    max-width: 500px;
    aspect-ratio: 1.5;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-main {
    font-size: clamp(1rem, 5vw, 1.5rem);
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: #333;
}

.error-sub {
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    color: #666;
    margin-bottom: 8%;
    line-height: 1.4;
    max-width: 90%;
}

.text-red {
    color: #e74c3c !important;
}

.modal-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 3% 8%;
    font-size: clamp(0.875rem, 4vw, 1.125rem);
    font-weight: 500;
    border-radius: 100px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.modal-button:hover {
    background-color: #0056b3;
}

.modal-button:active {
    transform: scale(0.98);
}

.button-icon {
    display: block;
    width: 1.2em;
    height: 1.2em;
}

@keyframes flash-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Game UI */
#pixi-container {
    position: relative;
    width: 100%;
    height: 50%;
    flex-shrink: 0;
    z-index: 0;
    background: #000;
    border-bottom: 2px solid #333;
}

#pixi-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-layer {
    position: relative;
    width: 100%;
    height: 50%;
    flex-shrink: 0;
    z-index: 10;
    background: #111;
    overflow: hidden;
}

.dq-window {
    background-color: var(--dq-blue);
    border: 4px solid var(--dq-frame);
    border-radius: 6px;
    box-shadow: inset 2px 2px 0 #000, 2px 2px 5px #000;
}

#message-window {
    position: absolute;
    top: 5px;
    left: 2%;
    right: 2%;
    height: 20%;
    font-size: clamp(16px, 5vw, 20px);
    line-height: 1.4;
    padding: 12px;
    display: flex;
    align-items: center;
    pointer-events: none;
    z-index: 20;
}

#bet-status-panel {
    position: absolute;
    bottom: 15px;
    left: 2%;
    right: 2%;
    height: 35%;
    background: linear-gradient(180deg, #222 0%, #000 100%);
    border: 2px solid #555;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 10px;
    gap: 12px;
    z-index: 15;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.9);
}

#bet-status-panel.hidden {
    display: none !important;
}

/* Ticket */
.ticket-left {
    width: 80px;
    height: 80px;
    background: #333;
    border: 1px solid #777;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.ticket-left img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.ticket-center {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

.ticket-monster-name {
    font-size: 18px;
    color: #fff;
    font-weight: bold;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-row {
    font-size: 13px;
    color: #aaa;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ticket-label {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

.ticket-val {
    color: #fff;
    font-weight: bold;
}

.ticket-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #666;
    min-width: 90px;
}

.payout-label {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 4px;
    letter-spacing: 1px;
}

.payout-value {
    font-size: 17px;
    color: var(--dq-yellow);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(248, 183, 0, 0.5);
    white-space: nowrap;
}

/* Betting Overlay */
#betting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    z-index: 100;
    display: none;
    grid-template-rows: 45px 1fr 65px;
    padding: 0;
}

#betting-overlay.open {
    display: grid;
}

.header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    background: #222;
    border-bottom: 1px solid #444;
}

.header-title-group {
    display: flex;
    flex-direction: column;
}

h2 {
    color: var(--dq-yellow);
    margin: 0;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
}

.field-info {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

.header-btn-group {
    display: flex;
    gap: 8px;
}

.mini-btn {
    font-size: 11px;
    padding: 0 6px;
    height: 34px;
    background: var(--dq-blue);
    border: 2px solid #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 3px 0 #000080;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.05s;
    white-space: nowrap;
}

.mini-btn:active {
    transform: translateY(3px);
    box-shadow: none;
}

.mini-btn:disabled {
    background: #555;
    border-color: #888;
    color: #aaa;
    box-shadow: none;
    cursor: not-allowed;
    transform: translateY(2px);
}

.card-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 8px 12px;
}

.bet-card {
    border: 2px solid var(--dq-frame);
    width: 100%;
    height: 68px;
    flex-shrink: 0;
    padding: 4px;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    position: relative;
    border-radius: 4px;
    z-index: 5;
    transition: transform 0.1s;
}

.card-type-rock {
    background: linear-gradient(90deg, #8b0000 0%, #b22222 100%);
    border-color: #ffcccc;
}

.card-type-scissors {
    background: linear-gradient(90deg, #006400 0%, #228b22 100%);
    border-color: #ccffcc;
}

.card-type-paper {
    background: linear-gradient(90deg, #00008b 0%, #0000cd 100%);
    border-color: #ccccff;
}

.janken-icon {
    font-size: 42px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: bold;
    line-height: 1;
    pointer-events: none;
    margin-left: auto;
    margin-right: 2px;
    z-index: 1;
}

.bet-card.selected {
    border-color: var(--dq-yellow);
    box-shadow: 0 0 10px var(--dq-yellow);
    border-width: 3px;
    transform: scale(1.02);
    z-index: 10;
}

.monster-preview {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 8px;
    flex: none;
    position: relative;
    z-index: 5;
    padding-bottom: 2px;
}

.monster-preview img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.rank-stars {
    position: absolute;
    top: -2px;
    left: 0px;
    font-size: 9px;
    color: #fff;
    z-index: 10;
    line-height: 1.2;
    letter-spacing: -1px;
    filter: drop-shadow(1px 1px 0 #000);
}

.card-info-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    flex: 1;
    overflow: hidden;
    height: 100%;
    z-index: 5;
}

.name-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 2px;
}

.monster-name {
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 4px;
    text-shadow: 1px 1px 0 #000;
}

.personality-row {
    display: flex;
    gap: 4px;
    margin-bottom: 2px;
}

.personality-badge {
    font-size: 10px;
    padding: 0 4px;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.5);
    color: #ddd;
    border: 1px solid #777;
    flex-shrink: 0;
}

/* Overlays */
.global-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: center;
}

.global-overlay.open {
    display: flex !important;
}

.replay-ready-overlay {
    position: absolute;
    inset: 0;
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.82);
    cursor: pointer;
}

.replay-ready-overlay.open {
    display: flex;
}

.replay-ready-overlay.hidden {
    display: none !important;
}

.replay-ready-box {
    width: min(88%, 380px);
    padding: 18px 14px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
    animation: replayReadyFade 1.4s ease-in-out infinite;
}

.replay-ready-text {
    color: #fff;
    font-family: 'DotGothic16', sans-serif;
    font-size: clamp(22px, 6vw, 32px);
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

.replay-countdown {
    color: #fff;
    font-family: 'Zen Dots', 'DotGothic16', sans-serif;
    font-size: clamp(54px, 17vw, 104px);
    line-height: 1;
    letter-spacing: 0.02em;
    text-shadow: 0 3px 16px rgba(0, 0, 0, 0.9);
    animation: replayCountdownSoft 0.34s ease-out both;
}

@keyframes replayReadyFade {
    0%, 100% {
        opacity: 0.72;
    }

    50% {
        opacity: 1;
    }
}

@keyframes replayCountdownSoft {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.decision-box,
.history-box {
    background: var(--dq-blue);
    border: 4px solid var(--dq-frame);
    padding: 15px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 1);
}

.hint-window {
    width: 85%;
    max-width: 350px;
    padding: 15px;
    text-align: left;
}

.hint-header {
    text-align: center;
    font-size: 18px;
    color: var(--dq-yellow);
    margin-bottom: 15px;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.hint-section {
    margin-bottom: 20px;
}

.hint-title {
    color: #fff;
    font-size: 14px;
    margin-bottom: 8px;
    border-left: 3px solid var(--dq-yellow);
    padding-left: 6px;
}

.type-chart-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 4px;
}

.type-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.type-desc {
    color: #ddd;
}

.personality-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    color: #ccc;
}

.personality-list li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-close {
    text-align: center;
    margin-top: 15px;
}

.hint-close button {
    background: #222;
    color: #fff;
    border: 1px solid #fff;
    padding: 8px 30px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
}

.pers-smart {
    color: #81d4fa;
    border-color: #81d4fa;
}

.pers-sly {
    color: #ce93d8;
    border-color: #ce93d8;
}

.pers-vindictive {
    color: #ffab91;
    border-color: #ffab91;
}

.pers-whimsical {
    color: #a5d6a7;
    border-color: #a5d6a7;
}

.pers-lazy {
    color: #a8a8a8;
    border-color: #a8a8a8;
}

.monster-feature {
    font-size: 10px;
    color: #ffeb3b;
    margin-bottom: 0;
    text-shadow: 1px 1px #000;
}

.skill-name {
    font-size: 10px;
    color: #aaddff;
    text-shadow: 1px 1px 0 #000;
}

.odds-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    width: 60px;
    z-index: 5;
}

.odds-text {
    font-size: 16px;
    color: var(--dq-yellow);
    font-weight: bold;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    padding: 2px 4px;
}

.controls-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 2px;
    border-top: 1px solid #333;
    background: #151515;
    gap: 8px;
}

.bet-control-group {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #222;
    padding: 4px 8px;
    border-radius: 30px;
    border: 1px solid #444;
    flex: 1;
    justify-content: center;
    height: 45px;
}

.bet-label {
    font-size: 10px;
    color: #aaa;
    margin-right: 2px;
}

.bet-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
    display: grid;
    place-items: center;
    padding: 0;
    background: #444;
}

#bet-amount {
    font-size: 18px;
    color: var(--dq-yellow);
    min-width: 45px;
    text-align: center;
    font-weight: bold;
}

#start-btn {
    font-size: 16px;
    border-width: 2px;
    width: auto;
    flex: 0 0 100px;
    height: 45px;
    background: linear-gradient(to bottom, #d32f2f, #b71c1c);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#start-btn:disabled {
    background: #555;
    border-color: #777;
}

button {
    color: #fff;
    border: 2px solid #fff;
    font-family: inherit;
    cursor: pointer;
    border-radius: 4px;
    box-shadow: 2px 2px 0 #000;
}

button:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

#janken-chart {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid #555;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.janken-mini {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    font-size: 14px;
    border: 1px solid #fff;
    color: #fff;
    text-shadow: 1px 1px 0 #000;
    line-height: 1;
}

.janken-mini.type-rock {
    background: linear-gradient(135deg, #8b0000, #b22222);
    border-color: #ffcccc;
}

.janken-mini.type-scissors {
    background: linear-gradient(135deg, #006400, #228b22);
    border-color: #ccffcc;
}

.janken-mini.type-paper {
    background: linear-gradient(135deg, #00008b, #0000cd);
    border-color: #ccccff;
}

.arrow {
    color: #ccc;
    font-size: 10px;
    font-family: 'Zen Dots', sans-serif;
}

#mute-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #fff;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    z-index: 60;
}

.skip-btn {
    position: absolute;
    bottom: 20px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 2px solid #fff;
    padding: 5px 15px;
    z-index: 30;
    min-width: 80px;
}

.pop-badge,
.longshot-badge {
    position: absolute;
    top: -10px;
    right: -8px;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 4px;
    border: 1px solid #fff;
    z-index: 20;
    transform: rotate(10deg);
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

.pop-badge {
    background: #ff2222;
}

.longshot-badge {
    background: #4422ff;
}

.history-list {
    width: 100%;
    height: auto;
    min-height: 280px;
    margin: 10px 0;
    border: 2px solid #444;
    background: #000;
    text-align: left;
    padding: 5px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #333;
    padding: 6px;
    font-size: 12px;
}

.win-bar-container {
    width: 100%;
    height: 12px;
    display: flex;
    border: 1px solid #fff;
    margin-bottom: 5px;
}

.win-bar {
    height: 100%;
}

.hidden {
    display: none !important;
}

/* Decision Overlay Styles (WIN CASE) */
#decision-overlay .decision-box {
    width: 92%;
    max-width: 380px;
    padding: 20px 15px;
    background: var(--dq-blue);
    border: 4px solid var(--dq-frame);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8), 0 0 60px rgba(0, 0, 192, 0.3);
}

#decision-overlay .win-title {
    font-size: 22px;
    color: var(--dq-yellow);
    text-shadow: 0 0 10px rgba(248, 183, 0, 0.6), 2px 2px 0 #000;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

#decision-overlay .win-subtitle {
    font-size: 13px;
    color: #ccc;
    margin-bottom: 16px;
}

#decision-overlay .monsters-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    margin-bottom: 14px;
    position: relative;
}

#decision-overlay .monster-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#decision-overlay .monster-slot.loser {
    width: 80px;
    opacity: 0.45;
    filter: grayscale(0.9);
    transform: translateY(5px);
}

#decision-overlay .monster-slot.loser .decision-monster-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: pixelated;
}

#decision-overlay .monster-slot.loser .monster-name {
    font-size: 10px;
    color: #fff;
    margin-top: 2px;
    text-shadow: 1px 1px 0 #000;
}

#decision-overlay .monster-slot.loser .monster-odds {
    font-size: 11px;
    color: #ddd;
    text-shadow: 1px 1px 0 #000;
}

#decision-overlay .skull-icon {
    position: absolute;
    top: -4px;
    right: 4px;
    font-size: 14px;
    opacity: 1;
}

#decision-overlay .monster-slot.winner {
    width: 140px;
    z-index: 10;
    margin: 0 -5px;
}

#decision-overlay .monster-slot.winner .decision-monster-img {
    width: 110px;
    height: 110px;
    object-fit: contain;
    image-rendering: pixelated;
    position: relative;
    z-index: 2;
    animation: decision-winner-bounce 2s ease-in-out infinite;
}

@keyframes decision-winner-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

#decision-overlay .monster-slot.winner .monster-name {
    font-size: 14px;
    color: #fff;
    margin-top: 4px;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
}

#decision-overlay .monster-slot.winner .monster-odds {
    font-size: 13px;
    color: var(--dq-yellow);
    font-weight: bold;
}

#decision-overlay .winner-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(248, 183, 0, 0.35) 0%, rgba(248, 183, 0, 0.1) 40%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
    animation: decision-glow-pulse 2s ease-in-out infinite;
}

@keyframes decision-glow-pulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -55%) scale(0.95); }
    50% { opacity: 1; transform: translate(-50%, -55%) scale(1.1); }
}

#decision-overlay .hit-badge {
    background: rgba(248, 183, 0, 0.2);
    border: 1px solid var(--dq-yellow);
    color: var(--dq-yellow);
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 20px;
    margin-top: 4px;
    display: inline-block;
    animation: decision-badge-pop 0.5s ease-out;
}

@keyframes decision-badge-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#decision-overlay .payout-text {
    font-size: 14px;
    color: #fff;
    margin-bottom: 12px;
}

#decision-overlay .payout-text .amount {
    color: var(--dq-yellow);
    font-size: 22px;
    font-weight: bold;
}

#decision-payout-note {
    color: var(--dq-yellow);
    font-weight: bold;
}

#decision-overlay .stats-area {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(248, 183, 0, 0.3);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#decision-overlay .stats-multiplier {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#decision-overlay .stats-label {
    font-size: 10px;
    color: #999;
    margin-bottom: 2px;
}

#decision-overlay .stats-progression {
    font-size: 13px;
    color: #ccc;
}

#decision-overlay .stats-progression .orig {
    color: #888;
}

#decision-overlay .stats-progression .arrow {
    color: var(--dq-yellow);
    margin: 0 4px;
}

#decision-overlay .stats-progression .current {
    color: var(--dq-yellow);
    font-weight: bold;
    font-size: 16px;
}

#decision-overlay .stats-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

#decision-overlay .big-multiplier {
    font-family: 'Zen Dots', sans-serif;
    font-size: 28px;
    color: var(--dq-yellow);
    font-weight: bold;
    text-shadow: 0 0 15px rgba(248, 183, 0, 0.5), 2px 2px 0 #000;
    line-height: 1;
}

#decision-overlay .streak-badge {
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #ff6666;
    white-space: nowrap;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

#decision-overlay .decision-btns {
    display: flex;
    gap: 10px;
}

#decision-overlay .decision-btn {
    flex: 1;
    padding: 14px 8px;
    font-size: 14px;
    font-family: 'DotGothic16', sans-serif;
    border: 2px solid #fff;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    background: var(--dq-blue);
    box-shadow: 2px 2px 0 #000;
    transition: transform 0.1s;
}

#decision-overlay .decision-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

#decision-overlay .decision-btn.highlight-btn {
    background: linear-gradient(to bottom, #d32f2f, #b71c1c);
    font-size: 15px;
    font-weight: bold;
    animation: decision-btn-pulse 2s ease-in-out infinite;
}

@keyframes decision-btn-pulse {
    0%, 100% { box-shadow: 2px 2px 0 #000, 0 0 0 rgba(211, 47, 47, 0); }
    50% { box-shadow: 2px 2px 0 #000, 0 0 12px rgba(211, 47, 47, 0.5); }
}

#decision-overlay .decision-btn.normal-btn {
    background: var(--dq-blue);
    font-size: 13px;
}

.dq-btn {
    background: var(--dq-blue);
    border: 2px solid #fff;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    text-shadow: 1px 1px 0 #000;
    box-shadow: 0 4px 0 #000080;
    transition: transform 0.1s;
}

.dq-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.closable {
    padding: 10px 30px;
}

/* ==========================================
   共通: オーバーレイとボックス (New CRM)
   ========================================== */
.crm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    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;
}

.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) rotate(var(--rot, 0deg));
    }

    50% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.1) rotate(var(--rot, 0deg));
    }
}

.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: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.crm-btn-primary {
    width: 100%;
    flex: 0 0 100%;
    order: 1;
    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: auto;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    order: 3;
    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-replay {
    width: auto;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    order: 2;
    padding: 10px;
    font-size: 1.0rem;
    background: rgba(255, 105, 180, 0.12);
    border: 2px solid #ff69b4;
    color: #ffb3d9;
    font-family: var(--crm-font-sub);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.22);
    cursor: pointer;
    border-radius: 8px;
    transition: 0.2s;
}

.crm-btn-replay:hover {
    background: #ff69b4;
    color: #12071c;
    box-shadow: 0 0 18px rgba(255, 105, 180, 0.5);
}

.crm-btn-redemption:hover {
    background: var(--crm-accent);
    color: #000;
    box-shadow: 0 0 20px var(--crm-accent);
}

.crm-btn-secondary {
    width: 100%;
    order: 4;
    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;
}

/* ==========================================
   TCコイン獲得画面 (Bonus Overlay)
   ========================================== */
.bonus-overlay {
    position: fixed;
    inset: 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: 16px;
    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: 10px;
}

.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);
}

.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);
}
