:root {
    --bg-dark: #121212;
    --text-light: #f0f0f0;
    --accent-color: #ffcc00;
    /* Retro yellow/gold */
    --accent-hover: #e0b800;
    --danger: #ff4444;
    --success: #00C851;
    --ui-bg: rgba(20, 20, 25, 0.85);
    --border-glow: 0 0 10px rgba(255, 204, 0, 0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0d0d1a;
    background-image: 
        radial-gradient(circle at 50% 0%, #1a1a3a 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, #0d0d1a 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, #1a0a2e 0%, transparent 50%);
    color: var(--text-light);
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

/* スマホ版（タッチ端末）でのみ、引っ張って更新（pull-to-refresh）を無効化する */
@media (hover: none) and (pointer: coarse) {
    body {
        overscroll-behavior-y: none;
    }
}

/* Headers use retro font */
h1,
h2,
h3,
.retro-btn,
.points-pool,
.balance {
    font-family: 'Press Start 2P', cursive;
    text-shadow: 2px 2px 0px #000;
}

#game-container {
    position: relative;
    width: 1024px;
    height: 768px;
    background-color: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(255, 204, 0, 0.1);
    border: 4px solid var(--accent-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 0 auto;
}

/* === Layout Structures === */
.site-header {
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 204, 0, 0.3);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 2000;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.site-logo {
    font-family: 'Press Start 2P', cursive;
    color: var(--accent-color);
    font-size: 1.2rem;
    text-shadow: 2px 2px 0 #000;
}

.site-nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

.site-nav a {
    color: #fff;
    text-decoration: none;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--accent-color);
}

.site-main {
    padding: 40px 0;
}

.game-section {
    display: flex;
    justify-content: center;
    padding: 20px 0 60px 0;
}

.content-section {
    background: rgba(255, 255, 255, 0.03);
    padding: 80px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.content-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
}

.content-inner h1 {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 30px;
    text-align: center;
}

.content-inner h2 {
    font-size: 1.4rem;
    color: var(--accent-color);
    margin: 40px 0 20px 0;
}

.content-inner p {
    line-height: 1.8;
    color: #ccc;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.update-log {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #444;
    padding: 25px;
    border-radius: 8px;
    margin-top: 40px;
}

.update-log h3 {
    font-size: 1rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.update-log ul {
    list-style: none;
}

.update-log li {
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 8px;
    border-bottom: 1px solid #222;
    padding-bottom: 8px;
}

.site-footer {
    background: #05050a;
    padding: 40px 0;
    border-top: 1px solid #222;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
}

.footer-inner p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.footer-links a {
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
}

.footer-links a:hover {
    color: var(--accent-color);
}

#game-canvas {
    display: block;
    background-color: #2e8b57;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through to canvas when appropriate */
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--ui-bg);
    pointer-events: auto;
    /* Re-enable clicks for active UI */
    padding: 20px;
    backdrop-filter: blur(4px);
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* === Title Screen === */
#title-screen {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.6)), url('assets/title_unicorn.png');
    background-size: cover;
    background-position: center;
    border: 2px solid var(--accent-color);
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
}

#title-screen h1 {
    font-size: 3.5rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.4;
    text-shadow: 
        4px 4px 0px #000,
        0 0 20px rgba(255, 204, 0, 0.5);
    animation: titleFloat 3s ease-in-out infinite alternate;
}

@keyframes titleFloat {
    from { transform: translateY(0); }
    to { transform: translateY(-15px); }
}

#title-screen p {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* === Buttons === */
.retro-btn {
    background-color: transparent;
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    padding: 15px 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--border-glow);
    text-transform: uppercase;
}

.retro-btn:hover:not(:disabled) {
    background-color: var(--accent-color);
    color: var(--bg-dark);
    box-shadow: 0 0 20px var(--accent-color), inset 0 0 15px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.retro-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.retro-btn:disabled {
    border-color: #555;
    color: #555;
    box-shadow: none;
    cursor: not-allowed;
}

/* === Stats Screen === */
#stats-screen h2 {
    color: var(--accent-color);
    margin-bottom: 20px;
}

.points-pool {
    font-size: 0.8rem;
    color: #4db8ff;
    margin-bottom: 30px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 300px;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.stat-row span:first-child {
    width: 120px;
}

.stat-btn {
    background-color: #333;
    color: white;
    border: 1px solid #555;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stat-btn:hover {
    background-color: #555;
}

.stat-btn:active {
    background-color: var(--accent-color);
    color: black;
}

.stat-val {
    width: 40px;
    text-align: center;
    font-weight: bold;
    font-size: 1.5rem;
}

#confirm-stats-btn {
    margin-top: 30px;
}

/* === Betting Screen === */
#betting-screen {
    justify-content: flex-start;
    padding-top: 20px;
    width: 100%;
    align-items: center;
}

.header-row {
    display: flex;
    justify-content: space-between;
    width: 95%;
    align-items: center;
    margin-bottom: 10px;
}

#betting-screen h2 {
    color: var(--accent-color);
    margin: 0;
    font-size: 1.2rem;
}

.balance {
    font-size: 1rem;
    color: var(--success);
    margin: 0;
}

.betting-container {
    display: flex;
    width: 95%;
    min-height: 660px;
    height: auto;
    gap: 15px;
    padding-bottom: 40px;
}

.betting-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 10px;
    box-sizing: border-box;
}

.betting-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #555;
    border-radius: 8px;
    padding: 8px;
    box-sizing: border-box;
    position: relative;
    z-index: 101;
    cursor: pointer;
    transition: box-shadow 0.2s, right 0.3s ease;
}

.betting-right:hover {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.bet-type-selector {
    margin-bottom: 10px;
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.bet-type-selector label {
    cursor: pointer;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    flex-grow: 1;
    margin-bottom: 10px;
}

.racer-card {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #444;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.racer-card:hover {
    border-color: #888;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.racer-card.selected-1st {
    border-color: #ffd700;
    /* Gold */
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    background: rgba(40, 30, 0, 0.8);
}

.racer-card.selected-2nd {
    border-color: #c0c0c0;
    /* Silver */
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.6);
    background: rgba(30, 30, 35, 0.8);
}

.racer-card h3 {
    font-size: 1.1rem;
    margin-bottom: 3px;
    color: white;
    text-shadow: 1px 1px 0 #000;
}

.racer-stats {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 5px;
    line-height: 1.4;
}

.racer-odds {
    font-weight: bold;
    color: var(--accent-color);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-block;
    font-size: 1.3rem;
    margin-top: auto;
}

.selection-panel {
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.selection-display {
    font-size: 0.9rem;
    color: #fff;
    font-weight: bold;
}

.bet-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tiny-btn {
    background: #444;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
}

.tiny-btn:hover {
    background: #666;
}

.tiny-btn:active {
    background: var(--accent-color);
    color: black;
}

.bet-controls input {
    background: #222;
    color: var(--accent-color);
    border: 1px solid #555;
    padding: 5px;
    font-size: 1rem;
    width: 65px;
    text-align: center;
    font-family: 'Press Start 2P', cursive;
}

.retro-btn.small {
    padding: 8px 15px;
    font-size: 0.8rem;
}

/* Cart Styles */
.betting-right h3 {
    display: none;
    /* Replaced by tabs */
}

.cart-list {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding-right: 5px;
    min-height: 0;
    /* Important for flex child scrolling */
}

.cart-item {
    background: #2a2a35;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 5px;
    font-size: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

td.hit {
    color: #ffd700;
    font-weight: bold;
}

td.miss {
    color: #ff4444;
}

.cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
}

.cart-item-remove:hover {
    color: #ff8888;
}

.cart-summary {
    border-top: 2px solid #555;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

#cart-total {
    font-family: 'Press Start 2P', cursive;
    color: var(--success);
    font-size: 1.2rem;
    float: right;
}

#checkout-btn {
    width: 100%;
}

/* === Race HUD === */
#race-hud {
    background: transparent;
    backdrop-filter: none;
    /* .screenのblurを無効化→キャンバスのぼやけを防ぐ */
    -webkit-backdrop-filter: none;
    pointer-events: none;
    justify-content: flex-start;
    padding: 10px;
}

.hud-top {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    padding: 10px 20px;
    border-radius: 0;
    border: none;
}

.hud-stamina {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.stamina-bar {
    width: 150px;
    height: 15px;
    background: #333;
    border: 1px solid #111;
    border-radius: 4px;
    overflow: hidden;
}

#stamina-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ff4444, #ffcc00, #00C851);
    transition: width 0.1s linear;
}

.hud-position {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    color: var(--accent-color);
}

/* === Result Screen === */
#result-screen {
    justify-content: flex-start;
    padding-top: 50px;
}

#result-screen h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

#result-list {
    width: 80%;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid #444;
    font-size: 1.1rem;
}

.result-row.player {
    color: var(--accent-color);
    font-weight: bold;
    background: rgba(255, 204, 0, 0.1);
}

.payout-info {
    text-align: center;
    margin-bottom: 30px;
}

#payout-message {
    font-size: 1.2rem;
    margin-bottom: 10px;
    line-height: 1.5;
}

.mt-10 {
    margin-top: 10px;
}

#new-balance {
    font-family: 'Press Start 2P', cursive;
    color: var(--success);
}

/* === Game Over Screen === */
#game-over-screen {
    background: rgba(10, 0, 0, 0.9);
}

#game-over-screen h1 {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 30px;
}

#game-over-screen p {
    font-size: 1.5rem;
    color: var(--success);
    margin-bottom: 50px;
}

/* === Phase 3: UI Additions === */
.track-info {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: #4db8ff;
    margin-top: 5px;
}

/* Tabbed Interface */
.tab-buttons {
    display: flex;
    border-bottom: 2px solid #444;
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #888;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #ccc;
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 3px solid var(--accent-color);
}

.history-item {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border: 1px solid #333;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.75rem;
}

.history-item .winner {
    color: var(--accent-color);
    font-weight: bold;
}

/* Tipster Panel */
.tipster-panel {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
}

.tipster-title {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-bottom: 8px;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.tipster-content {
    display: flex;
    gap: 10px;
}

.tipster-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.tipster-prediction {
    font-weight: bold;
    color: var(--accent-color);
    margin: 5px 0;
}

.tipster-comment {
    color: #ddd;
    line-height: 1.3;
}

#betting-screen.active~#history-panel,
#result-screen.active~#history-panel {
    right: 10px;
}

#history-panel h3 {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
}

.history-item {
    padding: 5px;
    border-bottom: 1px solid #333;
    margin-bottom: 5px;
}

.history-item .winner {
    color: var(--accent-color);
    font-weight: bold;
}

/* Screen Transitions */
.screen {
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.95);
}

.screen.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* === Slot Bonus Screen === */
#slot-bonus-screen {
    justify-content: flex-start;
    padding-top: 8px;
    gap: 6px;
    background: radial-gradient(ellipse at center, rgba(30, 10, 50, 0.95) 0%, rgba(10, 5, 20, 0.98) 100%);
}

.slot-title-banner {
    text-align: center;
    animation: slotTitlePulse 1.5s ease-in-out infinite alternate;
}

.slot-title-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.6rem;
    color: #ff3300;
    text-shadow:
        0 0 10px #ff3300,
        0 0 20px #ff6600,
        0 0 40px #ff3300,
        2px 2px 0 #000;
    letter-spacing: 4px;
}

.slot-subtitle {
    font-size: 0.9rem;
    color: #ffcc00;
    margin-top: 5px;
    text-shadow: 1px 1px 0 #000;
}

@keyframes slotTitlePulse {
    0% {
        transform: scale(1.0);
        filter: brightness(1.0);
    }

    100% {
        transform: scale(1.03);
        filter: brightness(1.3);
    }
}

.slot-machine-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.slot-cabinet {
    position: relative;
    background: linear-gradient(180deg, #1a1a2e, #2a1a3e, #1a1a2e);
    border: 4px solid #d4af37;
    border-radius: 16px;
    padding: 15px 25px 8px;
    box-shadow:
        0 0 20px rgba(212, 175, 55, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.8);
}

#slot-canvas {
    display: block;
    border-radius: 8px;
    border: 3px solid #555;
    background: #111;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.slot-line-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: absolute;
    top: 50%;
    left: -10px;
    right: -10px;
    transform: translateY(-50%);
    pointer-events: none;
}

.slot-line-arrow {
    font-size: 1.5rem;
    color: #ff3300;
    text-shadow: 0 0 10px #ff3300;
    animation: lineArrowBlink 0.5s step-end infinite;
}

.slot-line-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    color: #ff3300;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
    text-shadow: 0 0 5px #ff3300;
}

@keyframes lineArrowBlink {
    50% {
        opacity: 0.3;
    }
}

.slot-controls {
    display: flex;
    gap: 20px;
}

.slot-stop-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    padding: 14px 28px;
    background: linear-gradient(180deg, #444, #222);
    color: #fff;
    border: 3px solid #888;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px #000;
    min-width: 130px;
}

.slot-stop-btn:hover:not(:disabled) {
    background: linear-gradient(180deg, #ff4400, #cc2200);
    border-color: #ff6600;
    box-shadow:
        0 0 15px rgba(255, 68, 0, 0.6),
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.slot-stop-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background: linear-gradient(180deg, #cc2200, #991100);
}

.slot-stop-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #444;
}

.slot-stop-btn.stopped {
    background: linear-gradient(180deg, #333, #1a1a1a);
    border-color: #555;
    color: #666;
    opacity: 0.6;
}

.slot-payout-area {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    margin-top: 3px;
}

.payout-box-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#payout-box-canvas {
    border-radius: 8px;
}

.payout-box-label {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    color: #d4af37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.payout-box-count {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    color: #aaa;
}

.slot-result-panel {
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 200px;
}

.ranking-medals {
    font-family: 'Press Start 2P', cursive;
    color: var(--accent-color);
    font-size: 0.8rem;
    text-align: right;
    text-shadow: 1px 1px #000;
}

/* --- Avatar Selection Styles --- */
.avatar-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #444;
}

.avatar-option {
    width: 48px;
    height: 48px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    background-image: url('assets/horse_icons.png');
    background-size: 400% 400%; /* 4x4 grid (User Created) */
    background-repeat: no-repeat;
    transition: transform 0.2s, border-color 0.2s;
    image-rendering: pixelated;
    position: relative;
}

.avatar-option:hover {
    transform: scale(1.1);
    border-color: #777;
}

.avatar-option.selected {
    border-color: var(--accent-color);
    background-color: rgba(255, 204, 0, 0.2);
    box-shadow: 0 0 10px var(--accent-color);
}

.avatar-option.locked {
    filter: none; /* グレースケールをやめる */
    background-image: none !important; /* 馬の画像を完全に隠す */
    background-color: #000; /* 真っ黒に塗りつぶす */
    cursor: not-allowed;
    border: 1px solid #333;
}

.avatar-option.locked::after {
    content: '🔒';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.4rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* --- Ranking Icon Display --- */
.ranking-icon {
    width: 32px;
    height: 32px;
    margin-right: 10px;
    background-image: url('assets/horse_icons.png');
    background-size: 400% 400%;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.slot-result-message {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.0rem;
    color: #fff;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
    line-height: 1.6;
}

.slot-payout-amount {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.8rem;
    color: #ffcc00;
    text-shadow:
        0 0 10px #ffcc00,
        0 0 20px #ff8800,
        2px 2px 0 #000;
    text-align: center;
}

/* 777 jackpot flash animation */
@keyframes jackpotFlash {

    0%,
    100% {
        background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    }

    33% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.3) 0%, transparent 70%);
    }

    66% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 0, 0.3) 0%, transparent 70%);
    }
}

#slot-bonus-screen.jackpot-active {
    animation: jackpotFlash 0.3s linear infinite;
}

/* 確定リーチ時 P-Flash animation - 2Hz Rainbow Flashing (Soft Red included) */
@keyframes pFlashAnim {
    0% {
        background: radial-gradient(ellipse at center, rgba(255, 160, 140, 0.9) 0%, rgba(220, 130, 110, 0.8) 70%);
    }

    20% {
        background: radial-gradient(ellipse at center, rgba(255, 255, 0, 0.9) 0%, rgba(200, 200, 0, 0.8) 70%);
    }

    40% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 0, 0.9) 0%, rgba(0, 200, 0, 0.8) 70%);
    }

    60% {
        background: radial-gradient(ellipse at center, rgba(0, 255, 255, 0.9) 0%, rgba(0, 200, 200, 0.8) 70%);
    }

    80% {
        background: radial-gradient(ellipse at center, rgba(0, 0, 255, 0.9) 0%, rgba(0, 0, 200, 0.8) 70%);
    }

    100% {
        background: radial-gradient(ellipse at center, rgba(255, 160, 140, 0.9) 0%, rgba(220, 130, 110, 0.8) 70%);
    }
}

#slot-bonus-screen.pflash-active {
    animation: pFlashAnim 0.5s steps(1) infinite;
}

#slot-bonus-screen.pflash-active .slot-cabinet {
    box-shadow: 0 0 50px rgba(255, 255, 255, 1), inset 0 0 50px rgba(255, 255, 255, 0.8);
    border-color: #ffffff;
}


/* === シークレットキャラクター解禁演出 === */
.secret-unlock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    cursor: pointer;
    animation: secretOverlayFadeIn 0.5s ease-out;
}

@keyframes secretOverlayFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.secret-unlock-window {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 50%, #1a1a2e 100%);
    border: 3px solid #d4af37;
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    max-width: 520px;
    width: 90%;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 60px rgba(212, 175, 55, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    animation: secretWindowAppear 0.6s ease-out;
}

@keyframes secretWindowAppear {
    from {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }

    50% {
        transform: scale(1.05) rotate(2deg);
    }

    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.secret-unlock-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.9rem;
    color: #ff3300;
    text-shadow: 0 0 10px #ff3300, 0 0 20px #ff6600;
    margin-bottom: 20px;
    letter-spacing: 2px;
    animation: secretTitlePulse 1s ease-in-out infinite alternate;
}

@keyframes secretTitlePulse {
    from {
        filter: brightness(1.0);
        text-shadow: 0 0 10px #ff3300, 0 0 20px #ff6600;
    }

    to {
        filter: brightness(1.3);
        text-shadow: 0 0 15px #ff3300, 0 0 30px #ff6600, 0 0 50px #ff3300;
    }
}

.secret-unlock-silhouette {
    width: 180px;
    height: 140px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.secret-unlock-silhouette canvas {
    filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
}

.secret-unlock-message {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    color: #ffcc00;
    line-height: 2.0;
    text-shadow: 2px 2px 0 #000;
    animation: secretTextGlow 1.5s ease-in-out infinite alternate;
}

@keyframes secretTextGlow {
    from {
        color: #ffcc00;
        text-shadow: 2px 2px 0 #000, 0 0 5px rgba(255, 204, 0, 0.3);
    }

    to {
        color: #fff8dc;
        text-shadow: 2px 2px 0 #000, 0 0 15px rgba(255, 204, 0, 0.8), 0 0 30px rgba(255, 204, 0, 0.4);
    }
}

.secret-unlock-hint {
    font-size: 0.6rem;
    color: #888;
    margin-top: 20px;
    animation: blink 1.5s step-end infinite;
}

/* === Ranking Board Styles === */
#ranking-list {
    width: 100%;
    max-width: 600px;
    background: rgba(17, 17, 17, 0.9);
    border: 2px solid #555;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.8);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ranking-top-three {
    border-bottom: 2px solid #555;
    padding: 5px;
    background: rgba(255, 204, 0, 0.05);
}

.ranking-scroll-area {
    max-height: 380px;
    overflow-y: auto;
    padding: 5px;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for ranking scroll area */
.ranking-scroll-area::-webkit-scrollbar {
    width: 8px;
}
.ranking-scroll-area::-webkit-scrollbar-track {
    background: #111;
}
.ranking-scroll-area::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}
.ranking-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}
.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-rank {
    width: 80px;
    font-weight: bold;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    font-family: 'Press Start 2P', cursive;
}

.ranking-rank.top1 { background-color: #ffd700; color: #000; text-shadow: none; }
.ranking-rank.top2 { background-color: #c0c0c0; color: #000; text-shadow: none; }
.ranking-rank.top3 { background-color: #cd7f32; color: #000; text-shadow: none; }

.ranking-name {
    flex-grow: 1;
    margin-left: 20px;
    font-size: 1.1rem;
    color: #fff;
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ranking-medals {
    color: var(--success);
    font-weight: bold;
    font-family: 'Press Start 2P', cursive;
    text-shadow: 1px 1px #000;
}

/* ===========================
   Mobile: 横向き回転通知
   =========================== */
#rotate-notice {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0d0d1a;
    z-index: 99999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.rotate-content {
    text-align: center;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
}

.rotate-icon {
    font-size: 4rem;
    margin-bottom: 30px;
    animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

.rotate-content p {
    font-size: 1rem;
    line-height: 2;
    color: var(--accent-color);
}

/* スマホ縦持ち時のみ回転通知を表示 */
@media screen and (max-width: 768px) and (orientation: portrait) {
    #rotate-notice {
        display: flex;
    }
}

/* スマホ横持ち時のサイト構造調整 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .site-header {
        padding: 5px 0;
    }

    .site-nav ul {
        gap: 15px;
    }

    .site-nav a {
        font-size: 0.5rem;
    }

    .site-logo {
        font-size: 0.8rem;
    }

    .site-main {
        padding: 5px 0;
    }

    .game-section {
        padding: 5px 0;
    }

    .site-footer {
        display: none;
    }
}

/* === リアル対戦モード (VS Mode) 用の追加スタイル === */
/* ベットマーカーの色指定 */
.racer-card.vs-p1-1st {
    border-color: #ff4444; /* P1 赤 */
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.6);
    background: rgba(60, 0, 0, 0.8);
}
.racer-card.vs-p1-other {
    border-color: #ffcc00; /* P1 黄 */
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.6);
    background: rgba(60, 40, 0, 0.8);
}
.racer-card.vs-p2-1st {
    border-color: #00C851; /* P2 緑 */
    box-shadow: 0 0 15px rgba(0, 200, 81, 0.6);
    background: rgba(0, 60, 0, 0.8);
}
.racer-card.vs-p2-other {
    border-color: #ff8800; /* P2 オレンジ */
    box-shadow: 0 0 15px rgba(255, 136, 0, 0.6);
    background: rgba(60, 25, 0, 0.8);
}

/* 対戦成績表 */
.vs-history-table {
    width: 100%;
    border-collapse: collapse;
    color: #fff;
    font-size: 0.9rem;
    text-align: center;
}
.vs-history-table th, .vs-history-table td {
    border: 1px solid #444;
    padding: 8px;
}
.vs-history-table th {
    background: #222;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
}
.vs-history-table td.hit {
    color: #ffd700;
    font-weight: bold;
}
.vs-history-table td.miss {
    color: #555;
}
.vs-history-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   ⚔️ 聖剣エクスカリバー / 勇者システム用 UI追加スタイル ⚔️
   ========================================================================== */

/* 1. ベット画面 勇者ステータスパネル */
.yusha-status-panel {
    background: rgba(12, 13, 20, 0.9);
    border: 2px double #ffd700;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 200px;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.2);
}

.yusha-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

#yusha-status-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.72rem;
    color: #fff;
    text-shadow: 1px 1px #000;
}

.yusha-badge {
    background: #ff4444;
    color: #fff;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.55rem;
    padding: 2px 5px;
    border-radius: 3px;
    animation: yushaBadgeBlink 0.8s infinite alternate;
}

.yusha-exp-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yusha-exp-bar {
    flex-grow: 1;
    height: 10px;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    overflow: hidden;
}

#yusha-exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4488ff, #00ffff);
    box-shadow: 0 0 6px rgba(0, 255, 255, 0.6);
    transition: width 0.3s ease;
}

#yusha-exp-text {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    color: #87cefa;
    text-shadow: 1px 1px #000;
    min-width: 80px;
    text-align: right;
}

/* 2. リザルト画面 レベルアップカットイン */
.yusha-levelup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
}

.yusha-levelup-overlay.active {
    display: flex;
}

.yusha-levelup-popup {
    background: #090a10;
    border: 4px double #ffd700;
    border-radius: 12px;
    padding: 30px;
    width: 450px;
    text-align: center;
    box-shadow: 0 0 35px rgba(255, 215, 0, 0.5);
    animation: yushaPopupIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.yusha-levelup-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 2.2rem;
    color: #ffd700;
    text-shadow: 3px 3px 0 #ff4400, 0 0 20px rgba(255, 215, 0, 0.6);
    margin-bottom: 20px;
    animation: yushaPopupGold 1s infinite alternate;
}

.yusha-levelup-desc {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 20px;
    text-shadow: 2px 2px #000;
}

.yusha-levelup-stats {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.5rem;
    color: #aaa;
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    text-shadow: 2px 2px #000;
}

.yusha-levelup-bonus {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.72rem;
    color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
    border: 1px dashed #00ffff;
    padding: 10px;
    border-radius: 6px;
    text-shadow: 1px 1px #000;
}

.yusha-msg-box {
    width: 500px;
    max-width: 95%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #555;
    border-radius: 6px;
    text-align: center;
    color: #fff;
    font-size: 1.1rem;
    line-height: 1.5;
    min-height: 50px;
}

/* 3. 聖剣チャレンジ画面 */
#yusha-bonus-screen {
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.85)), url('assets/title_unicorn.png');
    background-size: cover;
    background-position: center;
}

.yusha-title-banner {
    text-align: center;
    margin-bottom: 15px;
}

.yusha-title-text {
    font-size: 2rem;
    color: #ffd700;
    text-shadow: 3px 3px 0 #000, 0 0 10px rgba(255, 215, 0, 0.4);
}

.yusha-subtitle {
    font-size: 0.95rem;
    color: #ccc;
    margin-top: 5px;
}

/* 引き抜くボタンのアニメーション */
@keyframes yushaPulse {
    from {
        transform: scale(1.0);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    to {
        transform: scale(1.06);
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.9), inset 0 0 10px rgba(255, 255, 255, 0.5);
    }
}

/* 4. ランキング切替タブ */
.ranking-tabs .tab-btn {
    border: 2px solid #555;
    background: #111;
    color: #888;
    padding: 8px 16px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.ranking-tabs .tab-btn:hover {
    color: #fff;
    border-color: #888;
}

.ranking-tabs .tab-btn.active {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* アニメーション定義 */
@keyframes yushaBadgeBlink {
    0% { opacity: 0.3; }
    100% { opacity: 1.0; }
}

@keyframes yushaPopupGold {
    from { text-shadow: 3px 3px 0 #ff4400, 0 0 15px rgba(255, 215, 0, 0.5); }
    to { text-shadow: 3px 3px 0 #ff4400, 0 0 30px rgba(255, 215, 0, 0.9); }
}

@keyframes yushaPopupIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1.0); opacity: 1; }
}

/* ========================================
   Debug Panel Style (Ver 1.1)
   ======================================== */
.debug-panel {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 10000;
    background: rgba(10, 10, 25, 0.88);
    border: 2px solid #ffcc00;
    border-radius: 8px;
    padding: 12px 15px;
    font-family: 'Roboto', 'Press Start 2P', monospace;
    font-size: 11px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    width: 250px;
    pointer-events: auto;
    max-height: 90vh;
    overflow-y: auto;
}
.debug-title {
    color: #ffcc00;
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
    padding-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.debug-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
}
.debug-options label:hover {
    color: #ffcc00;
}
.debug-options input[type="checkbox"] {
    cursor: pointer;
    accent-color: #ffcc00;
    width: 14px;
    height: 14px;
}
.debug-options select {
    background: #000;
    color: #ffcc00;
    border: 1px solid #ffcc00;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
    outline: none;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    box-sizing: border-box;
}


/* ========================================
   Volume Control Style
   ======================================== */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    margin-left: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #444;
}
.mobile-balance {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    font-size: 14px;
}

#pwa-badge {
    background-color: var(--accent-color);
    color: #000;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    font-weight: bold;
    text-transform: uppercase;
}
#volume-icon {
    cursor: pointer;
    font-size: 1.1rem;
    user-select: none;
    transition: transform 0.1s;
}
#volume-icon:active {
    transform: scale(0.9);
}
#volume-slider {
    width: 70px;
    cursor: pointer;
    accent-color: #ffcc00;
    background: #555;
    height: 5px;
    border-radius: 3px;
    outline: none;
    border: none;
}


/* ========================================
   Blog Page Styles (White Background Theme)
   ======================================== */
body.blog-page {
    background: #ffffff !important;
    background-image: none !important;
    color: #333333 !important;
}

body.blog-page .site-header {
    background: #f8f9fa !important;
    backdrop-filter: none !important;
    border-bottom: 2px solid #eaeaea !important;
}

body.blog-page .site-logo {
    color: #111111 !important;
    text-shadow: none !important;
}

body.blog-page .site-nav a {
    color: #555555 !important;
    text-shadow: none !important;
}

body.blog-page .site-nav a:hover {
    color: #d09900 !important;
}

body.blog-page .content-card {
    background: #ffffff !important;
    border: 1px solid #dddddd !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
    color: #333333 !important;
}

body.blog-page h1 {
    color: #111111 !important;
    text-shadow: none !important;
    margin-bottom: 20px;
    font-size: 1.6rem;
}

body.blog-page h2 {
    color: #222222 !important;
    text-shadow: none !important;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-left: 4px solid #d09900;
    padding-left: 12px;
}

body.blog-page h3 {
    color: #333333 !important;
    text-shadow: none !important;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.0rem;
}

body.blog-page p {
    color: #444444 !important;
    line-height: 1.8 !important;
    margin-bottom: 20px !important;
    font-size: 1.0rem !important;
}

body.blog-page li {
    color: #444444 !important;
    line-height: 1.8 !important;
    margin-bottom: 8px !important;
}

body.blog-page .update-log {
    background: #fdfdfd !important;
    border: 1px solid #e0e0e0 !important;
}

body.blog-page .update-log h3 {
    color: #111111 !important;
}

body.blog-page .update-log li {
    color: #555555 !important;
    border-bottom: 1px solid #eeeeee !important;
}

body.blog-page .site-footer {
    background: #f8f9fa !important;
    border-top: 1px solid #eaeaea !important;
}

body.blog-page .footer-inner p {
    color: #888888 !important;
}

body.blog-page .footer-links a {
    color: #666666 !important;
}

body.blog-page .footer-links a:hover {
    color: #d09900 !important;
}

body.blog-page .retro-btn {
    border-color: #333333 !important;
    color: #333333 !important;
    box-shadow: none !important;
}

body.blog-page .retro-btn:hover {
    background-color: #333333 !important;
    color: #ffffff !important;
}

/* Volume control adapt for white background */
body.blog-page .volume-control {
    color: #333 !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid #ddd !important;
}

body.blog-page #volume-slider {
    accent-color: #d09900 !important;
    background: #ccc !important;
}

/* Blog grid and post styles */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.blog-card {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    border-color: #d09900;
}

.blog-card-meta {
    font-size: 0.8rem;
    color: #888888;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
}

.blog-card-tag {
    background: rgba(208, 153, 0, 0.1);
    color: #d09900;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.blog-card-title {
    font-family: 'Roboto', sans-serif !important;
    font-size: 1.15rem;
    font-weight: bold;
    color: #111111;
    margin-bottom: 12px;
    line-height: 1.4;
    text-shadow: none !important;
}

.blog-card-excerpt {
    font-size: 0.9rem;
    color: #666666;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.blog-card-link {
    color: #d09900;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.blog-card-link:hover {
    color: #111111;
}

.blog-post-header {
    margin-bottom: 30px;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 20px;
}

.blog-post-meta {
    font-size: 0.9rem;
    color: #777777;
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.blog-post-content {
    font-family: 'Roboto', sans-serif;
    color: #333333;
}

.blog-post-content h2 {
    margin-top: 40px;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 8px;
}

.blog-post-content h3 {
    margin-top: 25px;
    font-weight: bold;
}

.blog-post-content p {
    font-size: 1.05rem !important;
    margin-bottom: 24px !important;
}

.blog-post-content li {
    font-size: 1.0rem !important;
    margin-bottom: 12px !important;
}

/* 馬名改行用のデフォルト設定（PC版では非表示） */
.mobile-space-br {
    display: none;
}

/* ==========================================================================
   📱 スマホ最適化 (ハイブリッドUI) 追加スタイル
   ========================================================================== */

/* スマホ縦画面時のみ適用するベース調整 */
html.is-mobile, body.is-mobile {
    overflow-x: hidden;
    overscroll-behavior-y: none;
    touch-action: pan-y; /* 縦スクロール以外を無効化 */
}

/* モーダル表示時は背景のタッチ操作を完全に無効化 */
/* body.is-mobile.modal-open {
    touch-action: none;
} */

/* 縦画面時の回転通知をJS制御可能にする */
#rotate-notice {
    display: none !important; /* メディアクエリによる強制表示を無効化 */
}
#rotate-notice.force-rotate {
    display: flex !important; /* JSで強制表示するときのみ表示 */
}

/* スマホ縦持ち（または幅狭画面）時のHTML画面レイアウト */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* デバッグパネルのスマホ用折りたたみ */
    .debug-title {
        cursor: pointer;
    }
    .debug-toggle-icon {
        display: inline-block !important;
        transition: transform 0.2s;
        margin-left: 10px;
    }
    .debug-panel.collapsed-on-mobile .debug-options {
        display: none !important;
    }
    .debug-panel.collapsed-on-mobile .debug-title {
        margin-bottom: 0 !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }
    .debug-panel.collapsed-on-mobile .debug-toggle-icon {
        transform: rotate(-90deg);
    }
    
    /* 馬名改行用のスマホ設定（縦画面の時は有効化） */
    .mobile-space-br {
        display: inline !important;
    }

    /* 共通ヘッダーを非表示にして画面を広く使う */
    .site-header {
        display: none !important;
    }

    .site-main {
        padding: 0 !important;
    }

    .game-section {
        padding: 0 !important;
    }

    /* ゲームコンテナを画面一杯にする */
    #game-container {
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        transform: none !important; /* scaleを無効化 */
        overflow-y: auto !important; /* スクロール可能にする */
    }

    /* 芝と天気の文字を少し大きく */
    .track-info {
        font-size: 1.15rem !important;
        padding: 4px 8px !important;
        text-align: left;
        line-height: 1.2;
    }

    /* 画面共通 of スクロール調整 */
    .screen {
        padding: 10px !important;
        box-sizing: border-box;
        justify-content: flex-start !important;
        height: auto !important; /* 高さをコンテンツに合わせる */
        min-height: 100% !important;
        overflow-y: visible !important; /* 親コンテナ側でスクロールさせる */
    }

    /* === ベット画面のスマホ最適化 === */
    #betting-screen {
        padding: 10px 10px 80px 10px !important; /* 下部固定バーの余白 */
    }

    #betting-screen .header-row {
        width: 100% !important;
        flex-direction: column;
        align-items: stretch !important;
        gap: 8px;
        margin-bottom: 15px;
    }

    /* 勇者ステータスとメダル所持数を一行にコンパクト配置 */
    #betting-screen .header-row > div:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 芝と天気を縦に並べる（スマホ用） */
    .header-track-weather {
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 4px !important;
    }

    #betting-screen .header-row > div:last-child {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
    }

    .yusha-status-panel {
        order: 1;
        min-width: 0 !important;
        flex-grow: 1;
        padding: 4px 8px !important;
        border-width: 1px !important;
    }

    /* ボタンコンテナ (セーブボタン等) */
    #betting-screen .header-row > div:last-child > div:last-child {
        order: 2;
        display: flex;
        flex-direction: row !important;
        align-items: center;
        gap: 5px;
    }

    /* 所持メダル表示を1行下げる */
    #normal-balance-display, #vs-balance-display {
        order: 3;
        width: 100%;
        margin-top: 4px;
        text-align: right;
    }
    
    .watch-ad-btn {
        order: 4;
    }

    .yusha-status-header {
        margin-bottom: 2px;
    }

    .yusha-exp-container {
        gap: 5px;
    }

    #yusha-exp-text {
        font-size: 0.5rem !important;
        min-width: 50px;
    }

    .balance {
        font-size: 0.9rem !important;
        white-space: nowrap;
    }

    /* ランキングボタンは非表示、セーブボタンは小型化して表示 */
    #register-ranking-bet-btn {
        display: none !important;
    }
    #save-quit-btn {
        display: block !important;
        font-size: 0.85rem !important;
        padding: 6px 12px !important;
        min-width: auto !important;
        margin-bottom: 0 !important;
    }

    .betting-container {
        flex-direction: column !important;
        width: 100% !important;
        gap: 0 !important;
        min-height: auto !important;
        padding-bottom: 0 !important;
    }

    .betting-left {
        width: 100% !important;
        background: transparent !important;
        padding: 0 !important;
    }

    /* PC用の右側カートエリアを隠す */
    .betting-right {
        display: none !important;
    }

    /* 投票タイプ（単勝/馬連）セレクターを中央寄せ */
    .bet-type-selector {
        justify-content: space-around;
        background: rgba(0, 0, 0, 0.4);
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #333;
        margin-bottom: 12px;
    }

    /* 馬一覧を1列表示に */
    .options-grid {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto !important;
        gap: 8px !important;
        margin-bottom: 15px !important;
    }

    /* 馬カードを横長のスリムレイアウトに変更 */
    .racer-card {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        grid-template-rows: auto auto !important;
        grid-template-areas: 
            "top odds"
            "bottom odds" !important;
        align-items: center;
        padding: 10px 12px !important;
        background: rgba(15, 15, 25, 0.85) !important;
        border: 1px solid #444 !important;
        min-height: 64px;
        gap: 4px 8px;
    }

    .racer-card:hover {
        transform: none !important;
    }

    .racer-card > div:nth-child(1) {
        grid-area: top;
        display: flex;
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-start !important;
        gap: 8px;
        margin: 0 !important;
    }
    
    .racer-card > div:nth-child(2) {
        grid-area: bottom;
        display: flex;
        flex-direction: row !important;
        align-items: center;
        justify-content: flex-start !important;
        margin: 0 !important;
        gap: 4px;
    }

    .racer-card h3 {
        font-size: 18px !important;
        font-weight: bold !important;
    }

    .racer-card > div:nth-child(2) span:first-child {
        font-size: 14px !important;
        padding: 1px 4px !important;
    }

    .racer-card > div:nth-child(2) span:nth-child(2) {
        font-size: 14px !important;
        padding: 1px 4px !important;
    }

    /* 調子・過去実績などは一覧では隠し、オッズと詳細誘導にする */
    .racer-stats {
        display: none !important;
    }

    .racer-odds {
        grid-area: odds;
        font-size: 24px !important;
        font-weight: bold !important;
        color: #FFD700 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        text-align: right;
    }

    /* 購入済み表示はバッジのみとし、カードの色等は変えない */
    .racer-card.purchased {
        border: 1px solid #444 !important;
        box-shadow: none !important;
        background: rgba(15, 15, 25, 0.85) !important;
    }

    /* 選択中（購入前）のカードをはっきり目立たせる */
    .racer-card.selected-1st {
        border: 2px solid #FFD700 !important;
        box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.4), 0 0 12px rgba(255, 215, 0, 0.6) !important;
        background: rgba(60, 45, 0, 0.85) !important;
    }

    .racer-card.selected-2nd {
        border: 2px solid #C0C0C0 !important;
        box-shadow: inset 0 0 15px rgba(192, 192, 192, 0.3), 0 0 12px rgba(192, 192, 192, 0.5) !important;
        background: rgba(40, 40, 45, 0.85) !important;
    }

    .bet-badge {
        font-size: 18px;
        font-weight: bold;
        color: #00C851;
    }

    /* カード右側に「詳細」を示す矢印またはボタン風デザイン */
    .racer-card::after {
        display: none !important;
    }

    /* PC用の選択パネルと予想屋は隠す */
    .selection-panel, #tipster-panel {
        display: none !important;
    }

    /* === スマホ用下部固定バー === */
    #mobile-bottom-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 68px;
        background: #090a10;
        border-top: 2px solid var(--accent-color);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.8);
        z-index: 500;
        padding: 8px 12px;
        gap: 10px;
        box-sizing: border-box;
        align-items: center;
    }

    #mobile-bottom-bar button {
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px !important;
        font-weight: bold !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    #mobile-checkout-btn {
        background: var(--success) !important;
        color: #000 !important;
        border-color: #00e676 !important;
        font-weight: bold;
    }
    #mobile-checkout-btn:disabled {
        background: #222 !important;
        color: #555 !important;
        border-color: #333 !important;
    }

    /* === ボトムシートモーダル共通 === */
    .mobile-modal {
        display: none; /* JSで表示切り替え */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 1000;
        justify-content: flex-end;
        flex-direction: column;
    }

    .mobile-modal.active {
        display: flex;
    }
    .mobile-modal-content {
        background: #0d0d16;
        border-top: 3px solid var(--accent-color);
        border-radius: 16px 16px 0 0;
        padding: 16px;
        height: 65% !important;
        min-height: 65% !important;
        max-height: 65% !important;
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch; /* iOSでの慣性スクロールを有効化 */
        touch-action: pan-y;
        width: 100%;
        overflow-y: auto;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.9);
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .mobile-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        border-bottom: 1px solid #333;
        padding-bottom: 10px;
    }

    .mobile-modal-header h3 {
        font-family: 'Press Start 2P', monospace;
        font-size: 20px !important;
        color: var(--accent-color);
        margin: 0;
    }

    .mobile-modal-header .close-btn {
        background: none;
        border: none;
        color: #888;
        font-size: 1.8rem;
        cursor: pointer;
        line-height: 1;
        padding: 0 5px;
    }

    /* 馬詳細モーダルのボディ */
    .mobile-modal-body {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .mobile-detail-stats {
        font-size: 18px !important;
        color: #ccc;
        line-height: 1.5;
        background: rgba(0, 0, 0, 0.3);
        padding: 10px;
        border-radius: 6px;
        border: 1px solid #222;
    }

    .mobile-detail-stats p {
        margin-bottom: 6px;
    }

    .mobile-detail-bet-area {
        background: rgba(255, 204, 0, 0.05);
        border: 1px solid rgba(255, 204, 0, 0.2);
        padding: 12px;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }

    .mobile-detail-odds-row {
        font-family: 'Press Start 2P', monospace;
        font-size: 22px !important;
        font-weight: bold !important;
        color: #FFD700 !important;
    }

    .mobile-bet-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }

    .mobile-bet-controls input {
        background: #000;
        color: var(--accent-color);
        border: 1px solid #ffcc00;
        padding: 6px;
        font-size: 18px !important;
        width: 50px;
        text-align: center;
        font-family: 'Press Start 2P', cursive;
        border-radius: 4px;
    }

    .mobile-bet-controls button.retro-btn {
        padding: 8px 16px !important;
        font-size: 18px !important;
    }

    /* カートモーダルのボディ */
    #mobile-cart-modal .cart-list {
        max-height: 40vh;
        overflow-y: auto;
    }

    .mobile-cart-summary {
        border-top: 1px solid #333;
        padding-top: 12px;
        margin-top: 10px;
        font-family: 'Press Start 2P', monospace;
        font-size: 20px !important;
        color: #00C851 !important;
        text-align: right;
    }

    /* スマホ版カートアイテムの改善 */
    #mobile-cart-modal .cart-item {
        padding: 12px !important;
        margin-bottom: 10px !important;
        background: rgba(30, 30, 45, 0.8) !important;
        border: 1px solid #555 !important;
        border-radius: 8px !important;
    }

    #mobile-cart-modal .cart-item-details {
        font-size: 16px !important;
        gap: 6px !important;
    }
    
    #mobile-cart-modal .cart-item-details span:first-child {
        font-size: 14px !important;
        color: #bbb !important;
    }

    #mobile-cart-modal .cart-item-details span:last-child {
        font-family: 'Press Start 2P', monospace;
        font-size: 14px !important;
        color: #FFD700 !important;
    }

    #mobile-cart-modal .cart-item-remove {
        font-size: 28px !important;
        padding: 0 15px !important;
        color: #ff4444 !important;
        background: rgba(255, 0, 0, 0.1) !important;
        border-radius: 6px !important;
    }
}

/* PCやスマホ横画面時など、非表示にしておく要素 */
.mobile-only {
    display: none !important;
}

/* ==========================================================================
   PC版（769px以上）でスマホ用UIを確実に非表示にする
   ========================================================================== */
@media screen and (min-width: 769px) {
    #mobile-horse-detail-modal,
    #mobile-cart-modal,
    #mobile-cart-btn-container,
    .mobile-modal {
        display: none !important;
    }
}

/* ==========================================================================
   スマホ版（768px以下）の実況メッセージUIの改善（文字拡大・背景透過）
   ========================================================================== */
@media screen and (max-width: 768px) {
    #commentary-box {
        width: 95% !important;
        padding: 24px 20px !important;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .mobile-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        border-bottom: 1px solid #333;
        padding-bottom: 10px;
        /* 馬名が隠れないように上部に固定 */
        position: sticky;
        top: 0;
        background: #0d0d16;
        z-index: 10;
        padding-top: 5px; /* 上部の余白を追加 */
    }

    .mobile-modal-header h3 {
        font-family: 'Press Start 2P', monospace;
        font-size: 20px !important;
        color: var(--accent-color);
        margin: 0;
    }

    .mobile-modal-header .close-btn {
        background: none;
        border: none;
        color: #888;
        font-size: 1.8rem;
        cursor: pointer;
        line-height: 1;
        padding: 0 5px;
    }

    /* 馬詳細モーダルのボディ */
    .mobile-modal-body {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .mobile-detail-stats {
        font-size: 18px !important;
        color: #ccc;
        line-height: 1.5;
        background: rgba(0, 0, 0, 0.3);
        padding: 10px;
        border-radius: 6px;
        border: 1px solid #222;
    }

    .mobile-detail-stats p {
        margin-bottom: 6px;
    }

    .mobile-detail-bet-area {
        background: rgba(255, 204, 0, 0.05);
        border: 1px solid rgba(255, 204, 0, 0.2);
        padding: 12px;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }

    .mobile-detail-odds-row {
        font-family: 'Press Start 2P', monospace;
        font-size: 22px !important;
        font-weight: bold !important;
        color: #FFD700 !important;
    }

    .mobile-bet-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }

    .mobile-bet-controls input {
        background: #000;
        color: var(--accent-color);
        border: 1px solid #ffcc00;
        padding: 6px;
        font-size: 18px !important;
        width: 50px;
        text-align: center;
        font-family: 'Press Start 2P', cursive;
        border-radius: 4px;
    }

    .mobile-bet-controls button.retro-btn {
        padding: 8px 16px !important;
        font-size: 18px !important;
    }

    /* カートモーダルのボディ */
    #mobile-cart-modal .cart-list {
        max-height: 40vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* iOSでの慣性スクロールを有効化 */
    }

    .mobile-cart-summary {
        border-top: 1px solid #333;
        padding-top: 12px;
        margin-top: 10px;
        font-family: 'Press Start 2P', monospace;
        font-size: 20px !important;
        color: #00C851 !important;
        text-align: right;
    }

    /* スマホ版カートアイテムの改善 */
    #mobile-cart-modal .cart-item {
        padding: 12px !important;
        margin-bottom: 10px !important;
        background: rgba(30, 30, 45, 0.8) !important;
        border: 1px solid #555 !important;
        border-radius: 8px !important;
    }

    #mobile-cart-modal .cart-item-details {
        font-size: 16px !important;
        gap: 6px !important;
    }
    
    #mobile-cart-modal .cart-item-details span:first-child {
        font-size: 14px !important;
        color: #bbb !important;
    }

    #mobile-cart-modal .cart-item-details span:last-child {
        font-family: 'Press Start 2P', monospace;
        font-size: 14px !important;
        color: #FFD700 !important;
    }

    #mobile-cart-modal .cart-item-remove {
        font-size: 28px !important;
        padding: 0 15px !important;
        color: #ff4444 !important;
        background: rgba(255, 0, 0, 0.1) !important;
        border-radius: 6px !important;
    }

    /* STOPボタン長押しでの範囲選択を防止 */
    .slot-stop-btn {
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }

    #yusha-msg-box {
        width: 90vw !important;
        max-width: 90vw !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

/* PCやスマホ横画面時など、非表示にしておく要素 */
.mobile-only {
    display: none !important;
}

/* ==========================================================================
   PC版（769px以上）でスマホ用UIを確実に非表示にする
   ========================================================================== */
@media screen and (min-width: 769px) {
    #mobile-horse-detail-modal,
    #mobile-cart-modal,
    #mobile-cart-btn-container,
    .mobile-modal {
        display: none !important;
    }
}

/* ==========================================================================
   スマホ版（768px以下）の実況メッセージUIの改善（文字拡大・背景透過）
   ========================================================================== */
@media screen and (max-width: 768px) {
    #commentary-box {
        width: 95% !important;
        padding: 24px 20px !important;
        background: rgba(0, 0, 0, 0.45) !important;
    }
    #commentary-title {
        font-size: 20px !important;
    }
    #commentary-text {
        font-size: 28px !important;
    }
    
    /* レース画面のテキスト情報拡大（2倍） */
    #hud-race-num {
        font-size: 3.0rem !important;
    }
    #hud-track-info {
        font-size: 2.0rem !important;
        top: 65px !important; /* フォント拡大による重なり防止 */
    }
    .hud-position {
        font-size: 0.65rem !important;
        white-space: nowrap !important;
    }
}

/* ==========================================================================
   オッズ画面ヘッダー左側のレイアウト復元（PC/スマホ対応）
   ========================================================================== */
/* PC版（769px以上）のオッズ画面ヘッダー左側 */
@media screen and (min-width: 769px) {
    .betting-header-left {
        display: block !important;
        width: auto !important;
    }
    .betting-header-left h2 {
        display: inline-block !important;
        margin-right: 15px !important;
    }
    .header-track-weather {
        display: inline-block !important;
    }
    .header-track-weather > div {
        display: inline-block !important;
        margin-bottom: 0 !important;
    }
    #track-info {
        margin-right: 10px !important;
    }
}

/* スマホ版（768px以下）のオッズ画面ヘッダー左側 */
@media screen and (max-width: 768px) {
    .betting-header-left {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    .header-track-weather {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
    .header-track-weather > div {
        margin: 0;
    }

    #ranking-modal, #name-input-modal, #legendary-name-modal {
        z-index: 2000 !important;
        justify-content: flex-start !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        overflow-y: hidden !important; /* iOS Safariのスクロール吸い込みを防止 */
        height: 100% !important;
    }

    #ranking-list {
        margin-bottom: 10px !important;
    }

    .ranking-scroll-area {
        max-height: 35vh !important;
    }

    #hud-race-num, #hud-track-info {
        opacity: 0.5 !important;
    }
}

/* ==========================================================================
   スマホ版（768px以下・縦画面）のレース画面レイアウト調整
   ========================================================================== */
@media screen and (max-width: 768px) and (orientation: portrait) {
    /* 縦画面用：コンテナを画面いっぱいに広げる（余白なし） */
    #game-container {
        width: 100vw !important;
        height: 100vh !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background-color: #000 !important;
    }

    /* ゲームCanvasを横幅いっぱい（アスペクト比4:3維持）で上部に配置 */
    #game-canvas, #overlay-canvas {
        width: 100vw !important;
        height: 75vw !important; /* 1024x768のアスペクト比 */
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        object-fit: contain;
    }

    /* レースHUDの調整 */
    #race-hud.active {
        display: block !important;
        height: auto !important;
        padding: 0 !important;
        pointer-events: none;
    }
    
    .hud-top {
        padding: 5px 10px !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        z-index: 200 !important;
        justify-content: flex-end !important; /* スタミナ非表示時に右寄せを維持 */
    }

    .hud-stamina {
        display: none !important; /* 縦画面ではスタミナバーを完全に非表示にして横幅を確保 */
    }

    .hud-position {
        font-size: 0.65rem !important; /* 天気の文字サイズに合わせて小さく */
        white-space: nowrap !important; /* 縦に折り返さないようにする */
        max-width: 50vw !important; /* 右半分に収まるように */
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    #hud-race-num {
        top: 5px !important;
        left: 10px !important;
        font-size: 2.0rem !important; /* 少し小さめに調整 */
        z-index: 200 !important;
        opacity: 0.5 !important; /* 文字を透過させて背後の馬券を見やすくする */
    }

    #hud-track-info {
        top: 40px !important;
        left: 10px !important;
        font-size: 1.2rem !important;
        z-index: 200 !important;
        opacity: 0.5 !important; /* 文字を透過させて背後の馬券を見やすくする */
    }

    /* 実況テキストをCanvasのすぐ下に配置 */
    #commentary-box {
        bottom: auto !important;
        top: calc(75vw + 20px) !important;
        width: 95% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 15px !important;
    }
    
    /* 巨大テキストもCanvas中央付近に配置 */
    #announcer-text {
        top: calc(75vw / 2 - 20px) !important; /* Canvasの上下中央付近 */
        font-size: 24px !important;
    }

    /* ----------------------------------------------------------------------
       スロットボーナス画面の縦持ち最適化
       ---------------------------------------------------------------------- */
    #slot-bonus-screen {
        justify-content: flex-start !important; /* 上詰めにしてスクロール可能に */
        padding-top: 20px !important;
        padding-bottom: 30px !important;
        overflow-y: auto !important; 
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    #slot-bonus-screen:not(.active) {
        display: none !important;
    }
    
    .slot-cabinet {
        width: 95vw !important;
        padding: 10px !important;
        margin: 0 auto !important;
        box-sizing: border-box;
    }
    
    #slot-canvas {
        width: 100% !important;
        height: auto !important;
    }
    
    .slot-controls {
        width: 95vw !important;
        gap: 10px !important;
        margin-top: 10px !important;
        justify-content: space-between !important;
    }
    
    .slot-stop-btn {
        flex: 1 !important;
        padding: 15px 5px !important;
        font-size: 1.0rem !important;
        height: 60px !important; /* 押しやすいサイズ */
    }
    
    .slot-payout-area {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
        margin-top: 20px !important;
    }

    /* ----------------------------------------------------------------------
       勇者ボーナス画面の縦持ち最適化
       ---------------------------------------------------------------------- */
    #yusha-bonus-screen {
        justify-content: flex-start !important;
        padding-top: 20px !important;
        padding-bottom: 30px !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    #yusha-bonus-screen:not(.active) {
        display: none !important;
    }

    .yusha-cabinet {
        width: 95vw !important;
        padding: 10px !important;
        margin: 0 auto !important;
        box-sizing: border-box;
    }
    
    #yusha-canvas {
        width: 100% !important;
        height: auto !important;
    }
    
    .yusha-stats-row {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: center !important;
        font-size: 1.2rem !important;
    }
    
    .yusha-controls {
        flex-direction: column !important;
        width: 90vw !important;
        gap: 15px !important;
    }
    
    #yusha-pull-btn {
        width: 100% !important;
        padding: 20px !important;
        font-size: 1.5rem !important;
        height: 80px !important;
    }

    #yusha-msg-box {
        width: 90vw !important;
        max-width: 90vw !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
}

