:root {
    --bg-color: #f4f7f6;
    --text-color: #333;
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to top alignment */
    min-height: 100vh;
}

@media (min-width: 768px) {
    body {
        align-items: center; /* Center vertically only on larger screens */
    }
}

.container {
    max-width: 1000px;
    width: 100%;
    background-color: var(--white);
    padding: 40px;
    border-radius: 12px;
}

@media (max-width: 767px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5rem;
    }
}

header {
    margin-bottom: 40px;
}

.winner-image-circle {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 4px solid var(--primary-color);
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-image-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modals */

    text-align: center;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-bottom: 15px;
}

.counter-section {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 50px;
    background-color: #fcfcfc;
}

#slice-count {
    font-size: 1.5rem;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

#increase-btn, #decrease-btn {
    background-color: var(--primary-color);
    color: var(--white);
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.wheel-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.list-section {
    width: 100%;
}

@media (min-width: 768px) {
    .main-content {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .wheel-section {
        flex: 1;
    }
    
    .list-section {
        flex: 1;
    }
}

.wheel-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
    max-width: 500px;
}

#pointer {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 30px solid #e74c3c;
    z-index: 10;
}

#wheel-canvas {
    width: 100%;
    height: auto;
    border-radius: 50%;
    border: 5px solid #333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: block;
}

.slice-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.slice-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    padding: 10px 15px;
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    gap: 15px;
}

.player-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.color-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #ddd;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.color-input-hidden {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 100px;
    height: 100px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    opacity: 0;
}

.picture-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: #f0f0f0;
}

.picture-circle.empty {
    border: 2px dashed #ccc;
    background-color: transparent;
}

.picture-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name-input {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 1rem;
    flex: 1;
    width: 100%;
    background: transparent;
    transition: all 0.2s;
}

.player-name-input:focus {
    border-color: #007bff;
    background: var(--white);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.camera-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background-color 0.2s;
    line-height: 1;
}

.camera-btn:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: var(--white);
    padding: 30px;
    border-radius: 12px;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

#camera-feed {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    transform: scaleX(-1); /* Mirror camera */
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.modal-actions button {
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
    min-width: 140px;
}

.modal-actions button:hover {
    opacity: 0.9;
}

.modal-actions button:active {
    transform: scale(0.98);
}

#winner-info {
    margin-bottom: 30px;
    font-size: 1.25rem;
    line-height: 1.4;
}

.player-right-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Apple-style Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e9e9eb;
    transition: .3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background-color: #34c759; /* Apple green */
}

input:checked + .slider:before {
    transform: translateX(22px);
}

#remove-winner-btn {
    background-color: var(--secondary-color);
    color: var(--white);
}

#keep-winner-btn {
    background-color: var(--primary-color);
    color: var(--white);
}

#capture-btn {
    background-color: var(--primary-color);
    color: var(--white);
}

#cancel-camera-btn {
    background-color: var(--secondary-color);
    color: var(--white);
}
