/* General Styles */
body {
    display: flex; /* Enable flexbox for centering */
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center items horizontally */
    font-family: sans-serif;
    background-color: #f0f0f0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    margin: 0; /* Remove default body margin */
}

h1, h2 {
    color: #333;
    text-align: center;
    margin-bottom: 20px; /* Add some space below headings */
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center wheel section within */
    width: 100%;
    max-width: 600px;
}

/* Wheel Styles */
.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center buttons/result below wheel */
    margin-bottom: 30px;
}

.wheel-container {
    position: relative; /* CRUCIAL: Allows absolute positioning of pointer */
    width: 400px;
    height: 400px;
    margin: 20px 0;
}

#wheelCanvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

/* --- POINTER STYLES --- */
.pointer {
    position: absolute; /* Position relative to wheel-container */
    width: 0;
    height: 0;
    border-left: 15px solid transparent; /* Creates triangle shape */
    border-right: 15px solid transparent;
    border-top: 35px solid #e74c3c; /* Pointer color and height */
    top: -15px; /* Position it slightly above the center top */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Fine-tune horizontal centering */
    z-index: 10; /* Ensure it's above the canvas */
    filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
}
/* --- END POINTER STYLES --- */


/* Button Styles */
button {
    padding: 10px 20px;
    font-size: 1em;
    cursor: pointer;
    margin: 8px 5px;
    border: none;
    border-radius: 5px;
    background-color: #3498db;
    color: white;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
button:hover { background-color: #2980b9; }
button:active { transform: translateY(1px); }
button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}
#spinButton {
    padding: 15px 30px;
    font-size: 1.3em;
    font-weight: bold;
    background-color: #2ecc71;
}
#spinButton:hover { background-color: #27ae60; }
#editSettingsButton { background-color: #f39c12; }
#editSettingsButton:hover { background-color: #e67e22; }

#result {
    margin-top: 25px;
    font-size: 1.6em;
    font-weight: bold;
    color: #333;
    min-height: 1.5em;
    text-align: center;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none; /* <<< HIDDEN BY DEFAULT */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.modal-overlay.visible {
    display: flex; /* <<< SHOWN WHEN VISIBLE CLASS IS ADDED */
}
/* --- END MODAL STYLES --- */


/* --- Settings Panel Styles (Inside Modal) --- */
.settings-section {
    position: relative;
    background-color: #ffffff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2em;
    color: #888;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    box-shadow: none;
}
.close-button:hover {
    color: #333;
    background: none;
}

.setting-item, .segment-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}
.segment-input-group:last-of-type { border-bottom: none; }

label {
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
}

input[type="text"], input[type="number"] {
    padding: 9px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
    width: 100%;
}

.segment-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.segment-controls label {
    flex-shrink: 0;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}
/* Ensure the probability label+input container doesn't take full width */
.segment-controls > div:first-child {
    display: flex;
    flex-direction: column; /* Stack label and input */
    gap: 4px; /* Space between label and input */
    width: auto; /* Don't take full width */
}

.segment-controls input[type="number"] {
   width: 80px;
   flex-grow: 0;
   flex-shrink: 0;
}
.segment-controls input[type="checkbox"] {
   width: 18px;
   height: 18px;
   margin: 0;
}

.remove-segment-button {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
}
.remove-segment-button:hover { background-color: #c0392b; }

#addSegmentButton { background-color: #1abc9c; }
#addSegmentButton:hover { background-color: #16a085; }
#applySettingsButton {
    background-color: #9b59b6;
    font-weight: bold;
}
#applySettingsButton:hover { background-color: #8e44ad; }

.warning {
    color: #e74c3c;
    font-size: 0.9em;
    font-weight: bold;
    margin-top: 5px;
    text-align: center;
}
/* --- END Settings Panel Styles --- */