body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c2f 0%, #23395d 100%);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-top: 40px;
    color: #2d3a4b;
    letter-spacing: 2px;
    text-shadow: 1px 2px 8px #b0c4de44;
}

#track {
    margin-top: 40px;
    background: #fff;
    border: 2px solid #b0bec5;
    border-radius: 18px;
    padding: 24px 18px 24px 18px;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.10);
}

.lane {
    position: relative;
    width: 1050px;
    height: 48px;
    margin-bottom: 16px;
    background: linear-gradient(90deg, #c8e6c9 80%, #fffde7 100%);
    border-radius: 24px;
    border: 1.5px solid #bdbdbd;
    overflow: hidden;
    box-shadow: 0 2px 8px #b0c4de22;
}

.horse {
    position: absolute;
    left: 0;
    top: 2px;
    width: 60px;
    height: 44px;
    transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    font-size: 44px;
    filter: drop-shadow(2px 4px 6px #8882);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.horse-icon {
    position: relative;
    z-index: 1;
}

.horse-num {
    position: absolute;
    left: 28px;
    top: 7px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 6px #222, 0 0 2px #fff;
    z-index: 2;
    width: 24px;
    text-align: center;
    pointer-events: none;
}

/* Warna background angka untuk tiap kuda */
#horse1 .horse-num {
    background: #e53935;
    border-radius: 50%;
    padding: 2px 7px;
    color: #fff;
}

#horse2 .horse-num {
    background: #fb8c00;
    border-radius: 50%;
    padding: 2px 7px;
    color: #fff;
}

#horse3 .horse-num {
    background: #43a047;
    border-radius: 50%;
    padding: 2px 7px;
    color: #fff;
}

#horse4 .horse-num {
    background: #1e88e5;
    border-radius: 50%;
    padding: 2px 7px;
    color: #fff;
}

#horse5 .horse-num {
    background: #8e24aa;
    border-radius: 50%;
    padding: 2px 7px;
    color: #fff;
}

.horse img {
    width: 60px;
    height: 44px;
    display: block;
    filter: none;
}

.horse1 img {
    filter: hue-rotate(0deg) brightness(1) saturate(1.2);
}

.horse2 img {
    filter: hue-rotate(60deg) brightness(1.1) saturate(1.3);
}

.horse3 img {
    filter: hue-rotate(140deg) brightness(1.1) saturate(1.3);
}

.horse4 img {
    filter: hue-rotate(210deg) brightness(1.1) saturate(1.3);
}

.horse5 img {
    filter: hue-rotate(280deg) brightness(1.1) saturate(1.3);
}

/* Hapus style angka pada kuda */
.horse-num,
.horse-icon {
    display: none !important;
}

.finish {
    position: absolute;
    right: 0;
    top: 0;
    width: 12px;
    height: 100%;
    background: repeating-linear-gradient(45deg,
            #ffeb3b,
            #ffeb3b 10px,
            #f44336 10px,
            #f44336 20px);
    border-left: 2px solid #d32f2f;
    z-index: 1;
}

#startBtn {
    margin-top: 36px;
    padding: 14px 38px;
    font-size: 20px;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 8px #43e97b44;
    transition: background 0.2s, transform 0.1s;
}

#startBtn:active {
    background: linear-gradient(90deg, #38f9d7 0%, #43e97b 100%);
    transform: scale(0.97);
}

#startBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#winner {
    margin-top: 36px;
    font-size: 26px;
    font-weight: bold;
    color: #d32f2f;
    text-shadow: 1px 2px 8px #fffde7cc;
    letter-spacing: 1px;
}

.bet-form {
    margin-top: 28px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 10px;
    padding: 12px 24px 10px 24px;
    box-shadow: 0 2px 8px #b0c4de22;
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 17px;
}

.bet-form label {
    margin-right: 8px;
    cursor: pointer;
}

#betBtn {
    padding: 8px 22px;
    font-size: 16px;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 8px #43e97b44;
    transition: background 0.2s, transform 0.1s;
}

#betBtn:active {
    background: linear-gradient(90deg, #38f9d7 0%, #43e97b 100%);
    transform: scale(0.97);
}

.bet-group {
    display: flex;
    gap: 10px;
    margin: 0 16px;
}

.bet-choice {
    padding: 8px 18px;
    font-size: 16px;
    background: #e0f2f1;
    color: #222;
    border: 2px solid #43e97b;
    border-radius: 7px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.18s, color 0.18s, border 0.18s;
}

.bet-choice.selected,
.bet-choice:active {
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
    border: 2px solid #38f9d7;
}

#betBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#betAmount {
    background: #23395d;
    color: #fff;
    border: 1.5px solid #43e97b;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 16px;
    font-weight: bold;
    outline: none;
    transition: border 0.2s;
}

#betAmount:focus {
    border: 1.5px solid #38f9d7;
}

/* Modal pop up pengumuman pemenang */
.modal-winner {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(2.5px);
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.7);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 44px 38px 32px 38px;
    box-shadow: 0 8px 32px #43e97b33, 0 0 0 6px #43e97b22;
    min-width: 340px;
    max-width: 95vw;
    text-align: center;
    position: relative;
    animation: popIn 0.25s cubic-bezier(.4, 2, .6, 1);
    border: 4px solid #43e97b;
    transition: border 0.2s;
}

.modal-content.lose {
    border: 4px solid #f44336;
    box-shadow: 0 8px 32px #f4433622, 0 0 0 6px #f4433622;
}

.close-modal {
    position: absolute;
    top: 12px;
    right: 18px;
    font-size: 36px;
    color: #43e97b;
    cursor: pointer;
    font-weight: bold;
    transition: color 0.2s, transform 0.1s;
    background: #fff;
    border-radius: 50%;
    border: 2px solid #43e97b;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px #43e97b22;
}

.close-modal:hover {
    color: #fff;
    background: #f44336;
    border-color: #f44336;
    transform: scale(1.08);
}

#modalText {
    font-size: 24px;
    color: #222;
    margin-top: 12px;
    margin-bottom: 8px;
    font-weight: bold;
    white-space: pre-line;
}

.modal-icon {
    font-size: 54px;
    margin-bottom: 10px;
    display: block;
}

#modalText.win {
    color: #388e3c;
}

#modalText.lose {
    color: #d32f2f;
}

.main-title {
    margin-top: 36px;
    margin-bottom: 10px;
    color: #fffde7;
    letter-spacing: 2px;
    text-shadow: 2px 4px 16px #23395d, 0 2px 8px #0008;
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
}

.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    margin-top: 18px;
    margin-bottom: 24px;
}

.balance-bar {
    margin-top: 24px;
    margin-bottom: 8px;
    background: #fff;
    color: #222;
    border-radius: 8px;
    padding: 8px 24px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 8px #23395d33;
    display: flex;
    align-items: center;
    gap: 18px;
    justify-content: center;
}

#resetBtn {
    margin-left: 18px;
    padding: 8px 22px;
    font-size: 16px;
    background: linear-gradient(90deg, #f44336 0%, #ff9800 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 8px #f4433644;
    transition: background 0.2s, transform 0.1s;
}

#resetBtn:active {
    background: linear-gradient(90deg, #ff9800 0%, #f44336 100%);
    transform: scale(0.97);
}

.main-action,
#resetBtn,
#startBtn {
    min-width: 150px;
    padding: 12px 0;
    font-size: 18px;
    background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 8px #43e97b44;
    transition: background 0.2s, transform 0.1s;
    margin: 0 4px;
    display: inline-block;
}

#resetBtn,
#resetBtn.main-action {
    background: linear-gradient(90deg, #f44336 0%, #ff9800 100%);
}

#resetBtn:active,
#resetBtn.main-action:active {
    background: linear-gradient(90deg, #ff9800 0%, #f44336 100%);
}

#startBtn:active,
#startBtn.main-action:active {
    background: linear-gradient(90deg, #38f9d7 0%, #43e97b 100%);
}

.topup-btn {
    background: linear-gradient(90deg, #ffd600 0%, #43e97b 100%);
    color: #222;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: bold;
    padding: 8px 22px;
    margin-left: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px #ffd60044;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topup-btn:active {
    background: linear-gradient(90deg, #43e97b 0%, #ffd600 100%);
    color: #222;
    transform: scale(0.97);
}

/* Modal Top Up */
.topup-modal-content {
    border: 4px solid #ffd600;
    box-shadow: 0 8px 32px #ffd60033, 0 0 0 6px #ffd60022;
}

.topup-btn-modal {
    background: linear-gradient(90deg, #ffd600 0%, #43e97b 100%);
    color: #222;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: bold;
    padding: 8px 22px;
    margin: 0 6px;
    cursor: pointer;
    box-shadow: 0 2px 8px #ffd60044;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    display: inline-block;
}

.topup-btn-modal:active {
    background: linear-gradient(90deg, #43e97b 0%, #ffd600 100%);
    color: #222;
    transform: scale(0.97);
}

.topup-btn-modal.cancel {
    background: #eee;
    color: #888;
    box-shadow: none;
    border: 1.5px solid #bbb;
}

.topup-btn-modal.cancel:active {
    background: #ccc;
    color: #555;
}

#topUpInput {
    background: #23395d;
    color: #fff;
    border: 1.5px solid #43e97b;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 18px;
    font-weight: bold;
    outline: none;
    margin-bottom: 18px;
    margin-top: 2px;
    text-align: center;
    transition: border 0.2s;
}

#topUpInput:focus {
    border: 1.5px solid #ffd600;
}

/* Fix close-modal button centering in modal top up */
.topup-modal-content .close-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    top: 14px;
    right: 18px;
    left: auto;
    bottom: auto;
    transform: none;
}
