:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #94a3b8;
    --secondary-hover: #64748b;
    --bg-color: #e0e5ec;
    --surface-color: rgba(255, 255, 255, 0.7);
    --text-main: #334155;
    --text-muted: #64748b;
    --accent-red: #ef4444;
    --shadow-light: -6px -6px 16px #ffffff;
    --shadow-dark: 6px 6px 16px #c8d0e7;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Zen Kaku Gothic New', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.5s ease;
    overflow-x: hidden;
}

#appBackground {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--bg-color);
    transition: background-color 0.3s;
}

.app-container {
    max-width: 800px;
    /* Tablet/Desktop centered */
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 60px;
    padding-top: 40px;
}

#mainTitle {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.05em;
    padding: 10px 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Lottery Machine */
.lottery-machine {
    text-align: center;
    padding: 40px 20px;
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dark), var(--shadow-light);
    backdrop-filter: blur(10px);
}

.slot-window {
    background: #f1f5f9;
    border-radius: var(--radius-md);
    padding: 40px 20px;
    margin-bottom: 20px;
    box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.05), inset -4px -4px 8px rgba(255, 255, 255, 1);
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.slot-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: var(--font-heading);
    word-break: break-all;
    line-height: 1.2;
}

.status-message {
    color: var(--accent-red);
    font-weight: bold;
    margin-bottom: 20px;
    font-size: 1.1rem;
    animation: fadeIn 0.5s ease;
}

.hidden {
    display: none !important;
}

/* Speed Slider */
.speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.speed-text {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.styled-slider {
    -webkit-appearance: none;
    width: 200px;
    height: 8px;
    border-radius: 5px;
    background: #cbd5e1;
    outline: none;
    margin: 0 10px;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: transform 0.1s;
}

.styled-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Controls */
.controls-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    /* Increased gap */
    flex-wrap: wrap;
    width: 100%;
}

.btn {
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* Enforce uniform size */
    height: 50px;
    width: 200px;
    /* Same width for all */
    font-size: 1.1rem;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #4f46e5);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 15px 25px -5px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e2e8f0;
    color: var(--text-main);
    /* Padding removed in favor of fixed size on .btn */
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-xl {
    /* Styles merged into .btn for uniformity, keeping class for reference or slight font bump */
    font-size: 1.3rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-dashed {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed #cbd5e1;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: bold;
    transition: all 0.3s;
}

.btn-dashed:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
    transform: none !important;
}

/* Results */
.results-area {
    text-align: center;
    margin-bottom: 60px;
    /* Added spacing */
}

.section-title {
    font-size: 1.5rem;
    margin-top: 30px;
    /* Added top margin */
    margin-bottom: 30px;
    /* Increased bottom margin */
    color: var(--text-main);
}

.results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.result-item {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideUp 0.4s ease forwards;
}

.result-index {
    background: var(--primary-color);
    color: white;
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
}

.result-placeholder {
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

/* Settings and Inputs Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.glass-panel {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-dark), var(--shadow-light);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    margin: 0;
}

/* Inputs */
.text-input-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.input-entry {
    animation: fadeIn 0.3s ease;
}

/* Config Section */
.config-item {
    margin-bottom: 20px;
}

.config-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
}

.styled-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.2s;
}

.styled-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: white;
}

.color-picker-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

#bgColorPicker {
    width: 50px;
    height: 50px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

/* Info Grid */
.info-block h3 {
    margin-bottom: 24px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin: 20px 0;
}

.styled-list {
    padding-left: 20px;
    color: var(--text-main);
}

.styled-list li {
    margin-bottom: 8px;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@media (max-width: 600px) {
    .mobile-hide {
        display: none;
    }

    #mainTitle {
        font-size: 1.8rem;
    }

    .btn-xl {
        min-width: 160px;
        padding: 16px 40px;
        font-size: 1.2rem;
    }
}