:root {
    --primary-color: #003366;
    --secondary-color: #004488;
    --accent-color: #00cc00;
    --text-color: #ffffff;
    --border-color: #225588;
}

body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #001122;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

.race-panel {
    background-color: var(--primary-color);
    color: var(--text-color);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.race-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px;
    margin-bottom: 15px;
}

.race-details {
    flex: 1;
}

.race-details h2 {
    margin: 0 0 10px 0;
}

.track-info {
    display: flex;
    gap: 20px;
}

.race-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.start-button, .skip-button {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    white-space: nowrap; /* 防止按鈕文字換行 */
}

.start-button {
    background-color: #2ecc71;
    color: white;
    width: 120px; /* 固定寬度使按鈕大小一致 */
}

.start-button:hover {
    background-color: #27ae60;
}

.start-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.skip-button {
    background-color: #e74c3c;
    color: white;
    width: 120px; /* 固定寬度使按鈕大小一致 */
}

.skip-button:hover {
    background-color: #c0392b;
}

.skip-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.new-button {
    background-color: #3498db;
    color: white;
}

.new-button:hover {
    background-color: #2980b9;
}

.start-button:disabled, .new-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.race-track {
    height: 300px;
    background-color: #002244;
    position: relative;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.track-lanes {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.track-lane {
    flex: 1;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.1),
        rgba(255, 255, 255, 0.05)
    );
}

.track-lane:last-child {
    border-bottom: none;
}

.horse {
    position: absolute;
    width: 40px;
    height: 80%;
    top: 10%;
    left: 0;
    border-radius: 4px;
    transition: left 0.1s linear;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* JRA 馬號顏色設定 */
.horse[id="horse-1"] {
    background-color: white;
    color: black;
}

.horse[id="horse-2"] {
    background-color: black;
    color: yellow;
}

.horse[id="horse-3"] {
    background-color: #e60012;  /* 紅色 */
    color: white;
}

.horse[id="horse-4"] {
    background-color: #0068b7;  /* 藍色 */
    color: white;
}

.horse[id="horse-5"] {
    background-color: #fff100;  /* 黃色 */
    color: black;
}

.horse[id="horse-6"] {
    background-color: #009944;  /* 綠色 */
    color: white;
}

.horse[id="horse-7"] {
    background-color: #f39800;  /* 橙色 */
    color: black;
}

.horse[id="horse-8"] {
    background-color: #ff69b4;  /* 粉色 */
    color: black;
}

.horse[id="horse-9"] {
    background-color: #8a2be2;  /* 紫色 */
    color: white;
}

.horse[id="horse-10"] {
    background-color: #a52a2a;  /* 褐色 */
    color: white;
}

.horse[id="horse-11"] {
    background-color: #20b2aa;  /* 淺綠松石色 */
    color: black;
}

.horse[id="horse-12"] {
    background-color: #778899;  /* 亮灰色 */
    color: white;
}

.horse.near-finish {
    animation: nearFinish 0.7s infinite alternate;
}

.horse.final-sprint {
    animation: finalSprint 0.5s infinite alternate;
}

@keyframes nearFinish {
    0% {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.6);
    }
    100% {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.9), 0 0 30px rgba(255, 215, 0, 0.7);
    }
}

@keyframes finalSprint {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
        transform: scale(1);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 1), 0 0 40px rgba(255, 215, 0, 0.9), 0 0 60px rgba(255, 140, 0, 0.5);
        transform: scale(1.05);
    }
}

.starting-gate {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background-color: #555;
    border-right: 2px solid #999;
    z-index: 5;
    transform-origin: left center;
    transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.8s ease;
}

.gate-opened {
    transform: perspective(400px) rotateY(70deg);
    opacity: 0.3;
}

.track-lane.turf {
    background: linear-gradient(
        to right,
        #004400,
        #006600 20%,
        #008800 80%
    );
    background-image: repeating-linear-gradient(
        90deg,
        rgba(0, 0, 0, 0.05),
        rgba(0, 0, 0, 0.05) 10px,
        rgba(0, 0, 0, 0) 10px,
        rgba(0, 0, 0, 0) 20px
    );
}

.track-lane.dirt {
    background: linear-gradient(
        to right,
        #7B3F00,
        #8B4513 20%,
        #A0522D 80%
    );
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 5px,
        rgba(0, 0, 0, 0) 5px,
        rgba(0, 0, 0, 0) 10px
    );
}

.track-lane.synthetic {
    background: linear-gradient(
        to right,
        #222244,
        #333366 20%,
        #444488 80%
    );
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(80, 80, 255, 0.1),
        rgba(80, 80, 255, 0.1) 8px,
        rgba(80, 80, 255, 0) 8px,
        rgba(80, 80, 255, 0) 16px
    );
}

.finish-line {
    position: absolute;
    left: 98%; /* 與程式邏輯中finishLinePosition的值保持一致 */
    top: 0;
    bottom: 0;
    width: 8px;
    transform: translateX(-50%); /* 使終點線中心位於98%處 */
    background: repeating-linear-gradient(
        45deg,
        #fff,
        #fff 10px,
        #000 10px,
        #000 20px
    );
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.9), 0 0 40px rgba(255, 215, 0, 0.7);
    z-index: 10; /* 確保終點線顯示在馬匹上層 */
}

/* 終點線光暈效果 */
.finish-line::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    width: 2%; /* 改為百分比寬度 */
    background: linear-gradient(to right, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.horse-list table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.horse-list th,
.horse-list td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.horse-list tr {
    cursor: default;
}

.horse-list tr:hover {
    background-color: transparent;
}

.horse-list td:last-child {
    font-weight: bold;
    color: #ffcc00;
    cursor: pointer;
}

.horse-list td:last-child:hover {
    color: #00ff00;
}

.selected-row {
    background-color: #ffcc00 !important;
    color: #000000 !important;
    transition: background-color 0.2s;
}

.odds-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 20px 0;
    background-color: var(--secondary-color);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
}

.odds-row {
    display: flex;
    gap: 2px;
}

.odds-cell {
    width: 60px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 4px;
}

.header-cell, .row-header {
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-weight: bold;
}

.active-cell {
    background-color: #225588;
    color: var(--text-color);
    cursor: pointer;
}

.active-cell:hover {
    background-color: var(--accent-color);
}

.selected-cell {
    background-color: #ffcc00 !important;
    color: #000000 !important;
    transition: background-color 0.2s;
}

.empty-cell {
    background-color: transparent;
}

.diagonal-cell {
    background-color: #112244;
}

.betting-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: center;
    justify-content: end;
}

.bet-amount input {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.box-bet,
.cancel {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.box-bet {
    background-color: var(--accent-color);
    color: var(--text-color);
}

.cancel {
    background-color: #cc0000;
    color: var(--text-color);
}

.current-bets {
    margin: 20px 0;
    padding: 15px;
    background-color: #003355; /* 稍微深一點的背景 */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.current-bets h3 {
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.2em;
    color: #FFD700;
}

.controls {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 確保表格在小螢幕上可以滾動 */
@media (max-width: 768px) {
    .odds-grid {
        max-width: 100%;
    }
}

.odds-tables {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.qin-grid {
    flex: 2;
    min-width: 0;
}

.win-grid {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background-color: var(--secondary-color);
    border-radius: 8px;
    overflow: hidden;
}

.win-header {
    text-align: center;
    font-weight: bold;
    padding: 8px;
    background-color: var(--primary-color);
    color: var(--text-color);
    border-radius: 4px;
    margin-bottom: 5px;
}

.win-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #225588;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.win-cell:hover {
    background-color: var(--accent-color);
}

.win-cell .horse-number {
    font-weight: bold;
    font-size: 1.2em;
}

.win-cell .win-odds {
    color: #ffcc00;
    font-weight: bold;
}

.win-cell:hover .win-odds {
    color: var(--text-color);
}

.race-results {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.race-results.show {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

.results-content {
    background-color: var(--primary-color);
    padding: 30px;
    border-radius: 10px;
    min-width: 300px;
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.results-content h2 {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 20px;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--secondary-color);
    border-radius: 5px;
    color: var(--text-color);
    font-size: 1.2em;
    margin-bottom: 8px;
}

.horse-number {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    margin-right: 15px;
}

.horse-name {
    flex: 1;
    text-align: left;
    margin-right: 15px;
}

.horse-odds {
    color: #ffcc00;
    font-weight: bold;
    min-width: 80px;
    text-align: right;
}

.winnings-item {
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 15px;
}

.total-winnings {
    color: #2ecc71;
    font-weight: bold;
    font-size: 1.3em;
    animation: pulse 1s infinite;
}

.countdown {
    text-align: center;
    color: var(--accent-color);
    font-size: 1.2em;
    padding: 15px;
    font-weight: bold;
    animation: pulse 1s infinite;
    border-top: 1px solid var(--border-color);
    margin-top: 10px;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* 添加響應式設計 */
@media (max-width: 768px) {
    .odds-tables {
        flex-direction: column;
    }

    .qin-grid, .win-grid {
        width: 100%;
    }

    .win-grid {
        margin-top: 20px;
    }

    .race-track {
        height: 200px; /* 在窄屏幕上減少賽道高度 */
    }

    .horse-list {
        overflow-x: auto; /* 允許表格水平滾動 */
    }

    .horse-list table {
        min-width: 500px; /* 確保表格內容完整顯示 */
    }

    .betting-controls {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .start-button,
    .new-button {
        width: 100%;
    }
}

.bets-list-container {
    max-height: 300px; /* 增加最大高度以顯示更多投注 */
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
}

.bet-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    background-color: #002244;
    border-left: 4px solid #225588;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    transition: all 0.2s ease;
}

.bet-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.bet-item:last-child {
    margin-bottom: 0;
}

.bet-item.current {
    background-color: rgba(0, 76, 153, 0.3);
    border-left: 4px solid #3498db;
}

.bet-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bet-type-selection {
    font-weight: bold;
    font-size: 1.1em;
}

.bet-amount {
    font-size: 0.9em;
    color: #BBB;
}

.bet-time {
    font-size: 0.8em;
    color: #999;
    margin-top: 3px;
}

.bet-status {
    background-color: #2196F3;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
    display: inline-block;
}

.win-result, .lose-result {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: bold;
    display: inline-block;
}

.win-result {
    background-color: #2ecc71;
    color: white;
}

.lose-result {
    background-color: #e74c3c;
    color: white;
}

/* 無投注記錄的提示樣式 */
.no-bets-message {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* 響應式設計調整 */
@media (max-width: 768px) {
    .bet-item {
        grid-template-columns: 1fr;
    }
    
    .bet-status, .win-result, .lose-result {
        margin-top: 8px;
    }
    
    .bets-list-container {
        max-height: 250px;
    }
    
    .current-bets {
        padding: 10px;
    }
}

/* 更小螢幕上的調整 */
@media (max-width: 480px) {
    .bet-type-selection,
    .bet-amount {
        font-size: 0.9em;
    }
    
    .bet-time {
        font-size: 0.75em;
    }
    
    .bet-status, .win-result, .lose-result {
        padding: 3px 8px;
        font-size: 0.8em;
    }
    
    .bets-list-container {
        max-height: 200px;
    }
}

.score-system {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 5px;
    border: 1px solid var(--border-color);
}

.score-display {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-color);
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.coin-button, .payout-button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.coin-button {
    background-color: var(--accent-color);
    color: var(--text-color);
}

.coin-button:hover {
    background-color: #00ee00;
    box-shadow: 0 0 10px rgba(0,204,0,0.5);
}

.payout-button {
    background-color: #cc0000;
    color: var(--text-color);
}

.payout-button:hover {
    background-color: #ff0000;
    box-shadow: 0 0 10px rgba(204,0,0,0.5);
}

.coin-button:disabled, .payout-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.disabled-bet {
    opacity: 0.5;
    cursor: not-allowed !important;
    background-color: #cccccc !important;
    color: #666666 !important;
}

.bet-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 賽事級別和跑道類型樣式 */
.race-grade {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
    color: white;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    min-width: 45px;
}

.grade-g1 {
    background-color: #e60012; /* 紅色 */
    border: 2px solid #b00010;
    box-shadow: 0 0 10px rgba(230, 0, 18, 0.5);
}

.grade-g2 {
    background-color: #0068b7; /* 藍色 */
    border: 2px solid #004c85;
    box-shadow: 0 0 10px rgba(0, 104, 183, 0.5);
}

.grade-g3 {
    background-color: #009944; /* 綠色 */
    border: 2px solid #007033;
    box-shadow: 0 0 10px rgba(0, 153, 68, 0.5);
}

.track-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
    font-size: 0.9em;
    color: white;
    margin-left: 0; /* 移除原有的左邊距，因為現在使用flex gap */
}

.track-turf {
    background-color: #4CAF50; /* 綠色表示草地 */
}

.track-dirt {
    background-color: #6F4E37; /* 咖啡色表示泥地 */
}

.track-synthetic {
    background-color: #607D8B; /* 藍灰色表示全天候 */
}

/* 馬匹列表表格標題 */
.horse-list table caption {
    padding: 8px;
    font-weight: bold;
    font-size: 1.1em;
    color: #FFD700;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 5px 5px 0 0;
}

/* 統一投注顏色變化效果 - 使用橙紅色漸變 */
.bet-color-change {
    background-image: linear-gradient(to bottom, #ff9966, #ff5e62) !important;
    color: white !important;
    font-weight: bold !important;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* 添加陰影但不添加縮放或位置變化 */
    box-shadow: 0 0 10px rgba(255, 94, 98, 0.7) !important;
}

/* 粒子顏色設置為橙紅色 */
.bet-particle {
    background-color: #ff9966 !important;
    box-shadow: 0 0 3px #ff5e62;
}

/* 確保顏色變化在移動設備上同樣有效 */
@media (max-width: 768px) {
    .bet-color-change {
        transition: background-color 0.2s ease, color 0.2s ease;
    }
}

.race-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.race-name {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    margin-left: 10px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

/* 遊戲通知樣式 */
.game-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.game-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.game-notification.info {
    background-color: #3498db;
}

.game-notification.success {
    background-color: #2ecc71;
}

.game-notification.error {
    background-color: #e74c3c;
}

.game-notification.warning {
    background-color: #f39c12;
}

/* 馬匹列表中的號碼顯示 */
.horse-number-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
    text-align: center;
    font-size: 16px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.horse-list td {
    vertical-align: middle;
}

/* 移動裝置適配樣式 */
@media (max-width: 768px) {
    /* 現有代碼 */
    .odds-tables {
        flex-direction: column;
    }
    
    /* 新增樣式 */
    .active-cell, .win-cell {
        height: 44px; /* 增加高度適合手指操作 */
        font-size: 16px; /* 增大字體 */
    }
    
    .odds-cell {
        width: 50px; /* 稍微縮小寬度以適應小螢幕 */
    }
    
    .coin-button, .payout-button {
        padding: 12px 20px; /* 增加按鈕大小 */
        font-size: 16px; /* 增大字體 */
    }
    
    .score-system {
        flex-wrap: wrap; /* 允許在小螢幕上換行 */
        justify-content: center;
    }
    
    .score-display {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        font-size: 1.5em; /* 增大字體 */
    }
    
    .bet-item {
        padding: 15px; /* 增加內邊距 */
    }
}

/* 更小螢幕優化 */
@media (max-width: 480px) {
    .odds-cell {
        width: 44px; /* 進一步縮小 */
        height: 44px; /* 保持方形，易於觸控 */
    }
    
    .race-track {
        height: 180px; /* 進一步縮小賽道高度 */
    }
}

/* 移動裝置入銀選項樣式 */
.mobile-options-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.mobile-coin-options {
    background: var(--primary-color);
    border-radius: 10px;
    padding: 20px;
    width: 80%;
    max-width: 350px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--border-color);
}

.mobile-coin-options h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 15px;
    color: #FFD700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.coin-option-button {
    display: block;
    width: 100%;
    padding: 15px;
    margin-bottom: 10px;
    border: none;
    border-radius: 5px;
    background: var(--accent-color);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

.cancel-option-button {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 5px;
    background: #e74c3c;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
}

/* 按鈕按下效果 */
.button-pressed {
    transform: scale(0.97);
    opacity: 0.9;
}

/* 為移動裝置優化的投注表格樣式 */
.mobile-device .odds-row {
    justify-content: center;
}

.mobile-device .active-cell:active,
.mobile-device .win-cell:active {
    background-color: var(--accent-color);
}

/* 投注成功效果增強 */
.mobile-device .bet-success-animation {
    animation: mobileBetSuccess 0.6s ease-out;
}

@keyframes mobileBetSuccess {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(46, 204, 113, 0.9);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* 終點排名容器 */
.finish-rank-container {
    position: absolute;
    left: 99%; /* 改為使用與終點線一致的百分比系統 */
    top: 0;
    bottom: 0;
    width: 5%;
    z-index: 100;
    pointer-events: none;
}

/* 終點排名標記 */
.finish-rank-marker {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 5px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    animation: fadeInRank 0.5s ease-out;
    transform: translateX(100%);
    animation-fill-mode: forwards;
    margin-right: 10px;
}

.finish-horse-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-left: 3px;
}

.medal {
    font-size: 18px;
    margin-right: 3px;
}

.gold-medal {
    text-shadow: 0 0 5px #FFD700;
}

.silver-medal {
    text-shadow: 0 0 5px #C0C0C0;
}

.bronze-medal {
    text-shadow: 0 0 5px #CD7F32;
}

@keyframes fadeInRank {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 為移動設備優化終點排名 */
@media (max-width: 768px) {
    .finish-rank-container {
        width: 60px;
    }
    
    .finish-rank-marker {
        padding: 3px;
    }
    
    .finish-horse-number {
        width: 22px;
        height: 22px;
        font-size: 12px;
    }
    
    .medal {
        font-size: 16px;
    }
}

/* 跑道上的獎牌樣式 */
.lane-medal {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    padding: 5px 10px;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
    top: 50%;
    /* 移除固定位置，使用動態計算 */
    z-index: 100; /* 增加層級確保顯示在最上層 */
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-out;
    pointer-events: none; /* 防止干擾點擊 */
    white-space: nowrap; /* 防止內容換行 */
    transform-origin: center right; /* 從右側開始變形，適合終點線左側 */
    max-width: 150px;
}

.lane-medal.show {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    animation: pulseMedal 2s infinite alternate;
}

/* 名次文字 */
.rank-text {
    font-weight: bold;
    font-size: 14px;
    margin-right: 5px;
    color: white;
    text-shadow: 0 0 3px black;
}

/* 獎牌圓圈 */
.medal-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 金銀銅牌樣式 */
.gold-medal {
    background: radial-gradient(circle, #FFD700, #FFA500);
    box-shadow: 0 0 8px #FFD700, 0 0 12px #FFA500;
    animation: pulseMedal 1.5s infinite alternate;
}

.silver-medal {
    background: radial-gradient(circle, #E0E0E0, #A9A9A9);
    box-shadow: 0 0 8px #C0C0C0, 0 0 12px #A9A9A9;
    animation: pulseMedal 1.5s infinite alternate;
}

.bronze-medal {
    background: radial-gradient(circle, #CD7F32, #8B4513);
    box-shadow: 0 0 8px #CD7F32, 0 0 12px #8B4513;
    animation: pulseMedal 1.5s infinite alternate;
}

/* 馬匹號碼小圓圈 */
.horse-number-small {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

@keyframes pulseMedal {
    0% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        transform: translateY(-50%) scale(1);
    }
    100% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(255, 215, 0, 0.4);
        transform: translateY(-50%) scale(1.05);
    }
}

/* 為移動設備優化獎牌 */
@media (max-width: 768px) {
    .lane-medal {
        padding: 2px 8px 2px 2px;
    }
    
    .rank-text {
        font-size: 12px;
    }
    
    .medal-circle {
        width: 24px;
        height: 24px;
    }
    
    .horse-number-small {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .lane-medal {
        right: 25px;
        padding: 2px 6px 2px 2px;
    }
    
    .rank-text {
        font-size: 10px;
        margin-right: 3px;
    }
}

/* 派彩資訊樣式 */
.result-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 15px 0;
}

.dividend-title {
    font-weight: bold;
    font-size: 1.1em;
    color: #FFD700;
    margin-bottom: 10px;
    text-align: center;
}

.dividend-item {
    display: flex;
    align-items: center;
    background-color: rgba(0, 51, 102, 0.5);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.dividend-type {
    width: 60px;
    font-weight: bold;
    color: #ffffff;
}

.dividend-horses {
    flex: 1;
    display: flex;
    gap: 5px;
    align-items: center;
}

.dividend-horse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 12px;
}

.dividend-value {
    font-weight: bold;
    color: #ffcc00;
    font-size: 1.2em;
    min-width: 70px;
    text-align: right;
}

/* 響應式調整 */
@media (max-width: 480px) {
    .dividend-type {
        width: 50px;
        font-size: 0.9em;
    }
    
    .dividend-horse {
        width: 20px;
        height: 20px;
        font-size: 11px;
    }
    
    .dividend-value {
        min-width: 60px;
        font-size: 1.1em;
    }
}

/* 版本號樣式 */
.version-number {
    position: fixed;
    bottom: 10px;
    left: 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    background-color: rgba(0, 0, 0, 0.3);
    padding: 3px 6px;
    border-radius: 3px;
    z-index: 100;
    font-family: monospace;
}

@media (max-width: 768px) {
    .version-number {
        font-size: 10px;
        padding: 2px 4px;
        bottom: 5px;
        left: 5px;
    }
}

.finishOrder {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 0.5rem;
    color: white;
}

.finishOrder .finish-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.finishOrder .finish-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(0.5rem);
}

.finishOrder .finish-item .medal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

.finishOrder .finish-item .medal.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 0 0 0.5rem rgba(255, 215, 0, 0.5);
}

.finishOrder .finish-item .medal.silver {
    background: linear-gradient(135deg, #C0C0C0, #A9A9A9);
    box-shadow: 0 0 0.5rem rgba(192, 192, 192, 0.5);
}

.finishOrder .finish-item .medal.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    box-shadow: 0 0 0.5rem rgba(205, 127, 50, 0.5);
}

.finishOrder .finish-item .finish-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.finishOrder .finish-item .finish-info .finish-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #FFD700;
}

.finishOrder .finish-item .finish-info .finish-time {
    font-size: 0.9rem;
    color: #ccc;
} 