/* ============================================= */
/* GLOBAL STYLES AND FONTS */
/* ============================================= */

@font-face {
    font-family: 'Monotype Corsiva';
    src: url("../fonts/Monotype-Corsiva/Monotype-Corsiva-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Monotype Corsiva', 'Arial', sans-serif;
    background: #111;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-image: radial-gradient(circle, #2a0a0a, #111);
}

/* ============================================= */
/* ANIMATIONS */
/* ============================================= */

@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes chip-bounce {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    80% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes chip-appear {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ============================================= */
/* LAYOUT CONTAINERS */
/* ============================================= */

.game-container {
    width: 95%;
    max-width: 600px;
    background: rgba(20, 0, 0, 0.8);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 30px #00ffd5;
    border: 2px solid #600;
    text-align: center;
}

.title-container {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 15px;
    border: 1px solid #600;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.roulette-wheel-wrapper {
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

.stats-container-wrapper {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 10px;
    margin: 20px 0;
    border: 1px solid #600;
}

.bet-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    border: 1px solid #600;
}

/* ============================================= */
/* TYPOGRAPHY */
/* ============================================= */

h1 {
    margin: 0;
    font-family: 'Monotype Corsiva', sans-serif;
    font-size: 2.5em;
    font-weight: normal;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
    color: #00ffd5;
    text-shadow: 0 0 10px #00ffd5;
    padding: 0 10px;
    text-align: center;
}

h1::before {
    content: 'Roulette Simulator';
    position: absolute;
    background: linear-gradient(45deg, 
        #ff0000, #ff7300, #fffb00, #48ff00, 
        #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: glowing 8s linear infinite;
    filter: drop-shadow(0 0 10px #00ffd5);
    z-index: 2;
    left: -8px;
    right: -8px;
    padding: 0 8px;
}

h1::after {
    content: 'Roulette Simulator';
    position: relative;
    color: transparent;
    text-shadow: none;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #00ff00;
    text-align: center;
}

.stat-box > div:first-child {
    text-align: center;
    color: #00ffd5;
    margin-bottom: 5px;
}

.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
}

.win-message {
    background: rgba(0, 100, 0, 0.5);
    color: #82ab82;
}

.lose-message {
    background: rgba(100, 0, 0, 0.5);
    color: #b08282;
}

.info-message {
    background: rgba(0, 0, 100, 0.5);
    color: #8282b2;
}

/* ============================================= */
/* BUTTONS & CONTROLS */
/* ============================================= */

.buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.buttons-container a.square-btn {
    text-decoration: none;
    color: #00ffd5;
    display: flex;
    justify-content: center;
    align-items: center;
}

.square-btn {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#startButton {
    min-width: 100px;
    height: 40px;
}

.settings-icon {
    font-size: 20px;
}

.glow-on-hover {
    width: 220px;
    height: 50px;
    border: none;
    outline: none;
    color: #00ffd5;
    background: #111;
    cursor: pointer;
    position: relative;
    z-index: 0;
    border-radius: 10px;
    font-size: 20px;
    letter-spacing: 1px;
    font-family: 'Monotype Corsiva', 'Arial', sans-serif;
    text-align: center;
}

.glow-on-hover:before {
    content: '';
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    position: absolute;
    top: -2px;
    left:-2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing 20s linear infinite;
    opacity: 0;
    transition: opacity .3s ease-in-out;
    border-radius: 10px;
}

.glow-on-hover:hover:before {
    opacity: 1;
}

.glow-on-hover:after {
    z-index: -1;
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: #111;
    left: 0;
    top: 0;
    border-radius: 10px;
}

/* ============================================= */
/* ROULETTE WHEEL */
/* ============================================= */

.roulette-wheel {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    max-width: 100%;
}

.wheel-number {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    color: white;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: 
        transform 0.3s ease-out,
        opacity 0.3s ease-out,
        box-shadow 0.3s ease-out;
}

.current-number {
    transform: scale(1.15);
    box-shadow: 0 0 12px gold !important;
    z-index: 2;
}

.wheel-number.green {
    background: #008000;
    border: 1px solid #00ff00;
}

.wheel-number.red {
    background: #d00;
    border: 1px solid #f33;
}

.wheel-number.black {
    background: #111;
    border: 1px solid #333;
}

/* ============================================= */
/* STATS */
/* ============================================= */

.stats-container {
    display: flex;
    justify-content: space-around;
    margin: 0;
}

.stat-box {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 8px;
    min-width: 100px;
    border: 1px solid #333;
}

/* ============================================= */
/* ROULETTE TABLE */
/* ============================================= */

.roulette-table {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background-image: url('../images/field.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    aspect-ratio: 800/400;
}

.number {
    position: absolute;
    width: 3.5%;
    height: 12%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    border-radius: 10px;
}

.zero {
    position: absolute;
    width: 3.5%;
    height: 12%;
    top: 42%;
    left: 2.5%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: white;
    background: #008000;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.number.red { background: rgba(200, 0, 0, 0.7); }
.number.black { background: rgba(0, 0, 0, 0.7); }

.covered {
    box-shadow: 0 0 0 2px gold;
    background: rgba(255, 215, 0, 0.3) !important;
}

.bet-area {
    position: absolute;
    width: 5%;
    height: 14%;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

/* ============================================= */
/* CHIPS */
/* ============================================= */

.chip-overlay {
    pointer-events: none;
    animation: chip-bounce 0.5s ease;
}

.chip-container {
    position: absolute;
    width: 25px;
    height: 25px;
    display: none;
    pointer-events: none;
}

.chip-container.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chip-positioned { 
    transform: translate(-15%, 10%);
    left: 0;
    top: 0;
}

.chip-image {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.chip-text {
    position: relative;
    color: rgb(0, 0, 0);
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
    margin-left: -3px;
}

.chip-container.new-chip {
    animation: chip-appear 0.3s ease-out forwards;
}

/* ============================================= */
/* MODAL WINDOW */
/* ============================================= */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    overflow: auto;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: rgba(20, 0, 0, 0.9);
    padding: 25px;
    border: 2px solid #600;
    border-radius: 15px;
    width: 95%;
    max-width: 570px;
    box-shadow: 0 0 30px #00ffd5;
    color: white;
    font-family: 'Monotype Corsiva', 'Arial', sans-serif;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.close-modal {
    color: #f33;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #f00;
    text-shadow: 0 0 10px #f00;
}

.modal h2 {
    color: #00ffd5;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5em;
    text-shadow: 0 0 10px #7a00ff;
}

/* ============================================= */
/* SETTINGS FORM */
/* ============================================= */

.settings-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-items: end;
}

.form-group {
    margin-bottom: 0;
    text-align: center;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #00ffd5;
    font-size: 0.95em;
    text-align: center;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #600;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-family: 'Monotype Corsiva', 'Arial', sans-serif;
    text-align: center;
}

.form-group.wide {
    grid-column: span 3;
    text-align: center;
}

.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: left;
}

.checkbox-group label {
    color: #00ffd5;
    text-align: left;
    margin-bottom: 0;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
}

.form-actions {
    grid-column: span 3;
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.form-actions button {
    padding: 8px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-family: 'Monotype Corsiva', 'Arial', sans-serif;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.save-btn {
    background: #008000;
    color: white;
}

.save-btn:hover {
    background: #00aa00;
    box-shadow: 0 0 10px #00ff00;
}

.cancel-btn {
    background: #d00;
    color: white;
}

.cancel-btn:hover {
    background: #f00;
    box-shadow: 0 0 10px #ff0000;
}

/* ============================================= */
/* MEDIA QUERIES */
/* ============================================= */

@media (max-width: 600px) {
    h1 { 
        font-size: 2em;
        padding: 0 8px;
    }
    h1::before {
        left: -6px;
        right: -6px;
        padding: 0 6px;
    }
    .title-container { 
        min-height: 70px;
        padding: 15px 10px;
    }
    .wheel-number {
        width: 26px;
        height: 26px;
        font-size: 16px;
    }
    .roulette-wheel {
        gap: 10px;
    }
    .stat-value { font-size: 20px; }
    .glow-on-hover { 
        width: 180px;
        height: 45px;
        font-size: 18px;
    }
    .number { font-size: 10px; }
    .zero { font-size: 12px; }
    .modal-content {
        width: 90%;
        padding: 15px;
        max-height: 85vh;
    }
    
    .settings-form {
        grid-template-columns: 1fr;
    }
    
    .form-group.wide {
        grid-column: span 1;
    }
    
    .form-actions {
        grid-column: span 1;
        flex-direction: column;
        gap: 10px;
    }
    
    .checkbox-group {
        justify-content: flex-start;
    }
}