:root {
    --bg-dark: #0a0e12;
    --bg-card: #151a21;
    --primary-gold: #FFD700;
    --primary-auth: #C5A000;
    --nearpeer-green: #00897B;
    /* Adjusted for better contrast on dark */
    --text-main: #ffffff;
    --text-muted: #8b949e;
    --overlay-shadow: rgba(0, 0, 0, 0.7);
    --slot-height: 120px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top to allow scrolling if content is tall */
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    /* Allow scrolling */
    padding: 2rem 1rem;
}

/* Background Effect (Subtle Gradient) */
body::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.03) 0%, rgba(0, 0, 0, 0) 60%);
    pointer-events: none;
    z-index: -1;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeIn 0.8s forwards;
}

.logo {
    display: inline-block;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--primary-gold);
    padding-bottom: 4px;
}

.logo-text {
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

.logo-accent {
    color: var(--primary-gold);
    font-weight: 300;
    margin-left: 6px;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #fff 0%, #aaa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 0.5rem;
}

/* Panel Transitions */
.panel {
    transition: all 0.5s ease-in-out;
}

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

.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.5s forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Config Panel Inputs */
.input-group {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.8rem;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--primary-gold);
}

.input-wrapper .icon {
    color: var(--text-muted);
    margin-right: 12px;
}

.input-wrapper input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

.hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 0.8rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    height: 60px;
    /* Match height of input group */
}

.btn-primary:hover {
    background: #333;
}

.btn-gold {
    background: linear-gradient(135deg, var(--primary-gold) 0%, #dba800 100%);
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-gold:hover {
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.btn-large {
    width: 100%;
    font-size: 1.2rem;
    padding: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Game Panel */
.stats-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--primary-gold);
}

.slot-machine-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 16px;
    border: 4px solid #2a2a2a;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.slot-window {
    height: 120px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slot-reel {
    display: flex;
    flex-direction: column;
    transition: transform 5s cubic-bezier(0.1, 0, 0, 1);
    /* Premium stopping effect */
    will-change: transform;
}

.slot-item {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    padding: 0 20px;
}

.overlay-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            rgba(15, 18, 22, 1) 0%,
            rgba(15, 18, 22, 0) 30%,
            rgba(15, 18, 22, 0) 70%,
            rgba(15, 18, 22, 1) 100%);
    pointer-events: none;
    z-index: 2;
}

.selection-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
    transform: translateY(-50%);
    box-shadow: 0 0 20px var(--primary-gold);
    z-index: 1;
    opacity: 0.5;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--primary-gold);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.2);
    width: 90%;
    max-width: 500px;
    transform: scale(0.9);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.modal-header h2 {
    font-family: 'Playfair Display', serif;
    color: var(--primary-gold);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.stars {
    color: #dba800;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.winner-card {
    background: linear-gradient(to bottom, #1f252e, #151a21);
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

#winner-name {
    font-size: 2.5rem;
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.5rem;
    color: #fff;
}

.winner-detail {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

#winner-city {
    color: var(--nearpeer-green);
    font-weight: 600;
    text-transform: uppercase;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold);
    margin-bottom: 1rem;
}

.btn-outline:hover {
    background: rgba(255, 215, 0, 0.1);
}

.btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-text:hover {
    color: #fff;
}

/* UTILS */
.status-text {
    font-size: 0.8rem;
    color: var(--nearpeer-green);
    margin-top: 0.5rem;
    text-align: center;
    min-height: 1.2em;
}

.error {
    color: #ff5252;
}

/* Animations classes for JS */
.fast-spin {
    /* Used for the blur effect class toggle, handled in JS potentially or just CSS animation */
    filter: blur(1px);
}

/* Manual Entry Styles */
.manual-entry-area {
    margin-top: 1rem;
    animation: fadeIn 0.4s ease-out;
}

#manual-data {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    padding: 1rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s;
}

#manual-data:focus {
    border-color: var(--primary-gold);
}

.btn-secondary {
    background: #2a2a2a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: #3a3a3a;
}

.mt-1 {
    margin-top: 1rem;
}

/* History Panel */
.history-panel {
    margin-top: 3rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 215, 0, 0.1);
    animation: fadeIn 0.6s ease-out;
}

.history-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    color: var(--primary-gold);
}

.history-header h3 {
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
}

.history-table-wrapper {
    overflow-x: auto;
}

#table-winners {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

#table-winners th {
    padding: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#table-winners td {
    padding: 15px 10px;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

#table-winners tr:last-child td {
    border-bottom: none;
}

.winner-row {
    animation: slideInRight 0.4s ease-out forwards;
}

.row-num {
    color: var(--primary-gold);
    font-weight: 700;
}

.row-name {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

.row-city {
    color: var(--nearpeer-green);
    font-size: 0.85rem;
    font-weight: 600;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}