/* Basic Reset & Body */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: sans-serif;
    background-color: #f4f4f4;
    display: flex; /* Use flexbox for centering */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    min-height: 100vh; /* Ensure body takes full viewport height */
    padding: 20px; /* Add some padding */
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Space between elements */
    width: 100%;
    max-width: 600px; /* Limit max width */
}

h1, h2 {
    color: #333;
    text-align: center;
}

/* --- Configuration Area --- */
.config-area {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-bottom: 20px;
}

.segment-list {
    max-height: 200px; /* Limit height and allow scroll */
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px; /* Space for scrollbar */
}

.segment-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 5px;
    border-bottom: 1px solid #eee;
}
.segment-entry:last-child {
    border-bottom: none;
}

.segment-entry input[type="text"] {
    flex-grow: 1; /* Take remaining space */
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.segment-entry label {
    white-space: nowrap; /* Prevent wrapping */
    cursor: pointer;
}
.segment-entry input[type="checkbox"] {
   margin-right: 3px;
   vertical-align: middle; /* Align checkbox better */
}


.segment-entry .remove-segment {
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    font-weight: bold;
    line-height: 22px; /* Center the 'x' */
    text-align: center;
    cursor: pointer;
    flex-shrink: 0; /* Don't shrink */
    transition: background-color 0.2s ease;
}

.segment-entry .remove-segment:hover {
    background-color: #c0392b;
}

.config-buttons {
    display: flex;
    justify-content: space-between; /* Space out buttons */
    gap: 10px;
    margin-top: 10px;
}

.config-buttons button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s ease;
}

#addSegmentBtn {
    background-color: #2ecc71;
    color: white;
}
#addSegmentBtn:hover {
    background-color: #27ae60;
}

#updateWheelBtn {
    background-color: #3498db;
    color: white;
}
#updateWheelBtn:hover {
    background-color: #2980b9;
}
.config-note {
    font-size: 0.9em;
    color: #555;
    margin-top: 15px;
    text-align: center;
}


/* --- Spinner Area --- */
.spinner-wrapper {
    position: relative; /* Crucial for positioning the indicator */
    width: 420px; /* Slightly wider than canvas for indicator */
    height: 420px; /* Slightly taller than canvas */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Big Indicator Arrow */
.spinner-indicator {
    width: 0;
    height: 0;
    border-left: 20px solid transparent; /* Arrow shape */
    border-right: 20px solid transparent; /* Arrow shape */
    border-top: 30px solid #e74c3c;     /* Arrow shape and color */
    position: absolute;
    top: -15px; /* Position above the center */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10; /* Ensure it's above the canvas */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.3)); /* Nice shadow */
}


.spinner-container {
    position: relative; /* Keep relative for spin button */
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#spinnerCanvas {
    display: block;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

#spinButton {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: #8e44ad; /* Purple button */
    color: white;
    font-size: 18px;
    font-weight: bold;
    border: 4px solid white;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s ease, transform 0.1s ease;
    z-index: 5;
}

#spinButton:hover {
    background-color: #7b369d;
}

#spinButton:active {
    transform: scale(0.95);
}

#spinButton:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.7;
}

/* --- Result Area --- */
#resultDisplay {
    margin-top: 10px; /* Reduced margin */
    font-size: 1.2em;
    padding: 10px 20px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
}

#resultText {
    font-weight: bold;
    color: #3498db;
}

/* --- Ad Container Styling --- */
.ad-container {
    margin-top: 15px; /* Reduced margin */
    padding: 15px;
    border: 1px dashed #ccc;
    min-height: 50px; /* Can be smaller */
    width: 90%;
    max-width: 500px;
    text-align: center;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: none; /* Initially hidden */
    overflow: hidden;
}

.ad-container.visible {
    display: block;
}

.ad-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px auto;
}