/* ==========================================================================
   1. GLOBAL STYLES & THEMING
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: #11141a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Base application wrapper grid */
.app-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    width: 100vw;
    height: 100vh;
    background: #11141a;
}

/* ==========================================================================
   2. SIDEBAR / INPUT CONTROLS
   ========================================================================== */
.sidebar {
    background: #161b22;
    padding: 30px;
    border-right: 1px solid #21262d;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.5rem;
    color: #ffffff;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 10px;
}

input[type="text"] {
    flex: 1;
    padding: 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #ffffff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: #58a6ff;
}

button {
    cursor: pointer;
    font-weight: bold;
    border-radius: 6px;
    border: none;
    transition: opacity 0.2s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
}

#add-btn {
    padding: 0 20px;
    background: #238636;
    color: #ffffff;
}

#add-btn:hover {
    opacity: 0.9;
}

/* Options List Layout */
#options-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    flex: 1;
}

#options-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #21262d;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    animation: fadeIn 0.2s ease-out;
}

.delete-btn {
    background: transparent;
    color: #f85149;
    font-size: 1.2rem;
    padding: 0 5px;
}

.delete-btn:hover {
    color: #ff7b72;
}

/* ==========================================================================
   3. SPINNER WHEEL MAIN PANEL
   ========================================================================== */
.main-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    gap: 30px;
    position: relative;
}

.spinner-container {
    position: relative;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#wheel {
    display: block;
    pointer-events: none; /* Keeps click actions clean */
}

/* 12 O'Clock Selector Arrow Pointer */
.pointer {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 30px solid #f85149;
    z-index: 10;
    filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.3));
}

/* Central Spin Hub Button */
#spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ffffff;
    color: #11141a;
    font-size: 1.1rem;
    letter-spacing: 1px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 0 0 4px #11141a;
}

#spin-btn:hover {
    background: #f0f0f0;
}

/* Live Announcement Banner */
#result {
    min-height: 40px;
    font-size: 1.6rem;
    text-align: center;
    font-weight: 600;
    color: #58a6ff;
    text-shadow: 0 2px 10px rgba(88, 166, 255, 0.2);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   4. MOBILE RESILIENT RESPONSIVE RE-OVERRIDE (CRITICAL BLOCK)
   ========================================================================== */
@media (max-width: 850px) {
    .app-layout {
        grid-template-columns: 1fr; /* Switch from 2 columns to a single vertical track */
        grid-template-rows: auto auto;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    /* Move the interactive wheel area to the top of the device screen */
    .main-content {
        grid-row: 1;
        padding: 20px 10px;
        gap: 15px;
    }

    /* Scaling the canvas down safely on small mobile viewports */
    .spinner-container {
        width: 320px;
        height: 320px;
    }

    #wheel {
        width: 100%;
        height: 100%;
    }

    #spin-btn {
        width: 70px;
        height: 70px;
        font-size: 0.95rem;
    }

    #result {
        font-size: 1.3rem;
    }

    /* Drop the inputs and share metrics down below the wheel safely */
    .sidebar {
        grid-row: 2;
        border-right: none;
        border-top: 1px solid #21262d;
        height: auto;
        padding: 20px;
        overflow-y: visible;
    }
}