:root {
    --bg-color: #f8f9fa;
    --text-color: #333;
    --primary-color: #ff6b6b;
    --secondary-color: #4ecdc4;
    --accent-color: #ffe66d;
    --surface-color: #ffffff;
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-inset: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    display: flex;
    gap: 4rem;
    padding: 2rem;
    background: var(--surface-color);
    border-radius: 20px;
    box-shadow: var(--shadow-light);
    max-width: 1200px;
    width: 90%;
}

.controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 1rem 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #666;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    background: #fafafa;
    box-shadow: var(--shadow-inset);
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.summary-text {
    font-size: 0.9rem;
    color: #888;
    background: #f1f3f5;
    padding: 0.8rem;
    border-radius: 8px;
}

button {
    background-color: var(--text-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    margin-top: auto;
}

button:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

button:active {
    transform: scale(0.98);
}

.wheel-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-width: 500px;
    /* Constrain wheel size */
}

canvas {
    width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.arrow {
    position: absolute;
    top: 50%;
    right: -25px;
    /* Overlap from the right */
    left: auto;
    transform: translateY(-50%) rotate(90deg);
    /* Pointing Left (towards wheel) */
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--text-color);
    z-index: 10;
    filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.2));
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.winner-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 3rem 5rem;
    border-radius: 20px;
    /* box-shadow removed to avoid "oval shade" bug */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.winner-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.winner-overlay h2 {
    font-size: 1.5rem;
    color: #888;
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.winner-overlay .winner-text {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-color);
    margin: 0;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .wheel-container {
        width: 100%;
        max-width: 350px;
    }

    button {
        width: 100%;
    }
}