:root {
    --bg-color: #FAFAFA;
    --text-main: #1A1A1A;
    --text-muted: #666666;
    --accent: #E53E3E;
    --box-bg: #FFFFFF;
    --border-radius: 20px;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-raised: 0 16px 32px -4px rgba(0, 0, 0, 0.15), 0 8px 16px -4px rgba(0, 0, 0, 0.1);
    --shadow-pressed: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    /* Prevent the body from scrolling overall to strictly enforce the output box scroll */
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, #1A1A1A, #4A4A4A);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subhead {
    font-size: 1.125rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Main Layout */
.main-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2rem;
}

/* The Hero Button */
.buffet-btn {
    width: 100%;
    height: 35vh;
    min-height: 200px;
    max-height: 400px;
    border: none;
    background-color: #E2E8F0;
    background-image: url('images/DB.png');
    background-size: cover;
    background-position: center;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-raised);
    cursor: pointer;
    transition: transform 120ms cubic-bezier(0.4, 0, 0.2, 1), box-shadow 120ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-shrink: 0;
}

/* State: Hover */
.buffet-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -4px rgba(0, 0, 0, 0.18), 0 10px 20px -4px rgba(0, 0, 0, 0.12);
}

/* State: Pressed */
.buffet-btn:active,
.buffet-btn.pressing {
    transform: translateY(6px) scale(0.98);
    box-shadow: var(--shadow-pressed);
    transition: transform 90ms ease-out, box-shadow 90ms ease-out;
    /* Match spec: Down: 90ms */
}

/* State: Loading/Disabled */
.buffet-btn:disabled,
.buffet-btn.loading {
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: var(--shadow-light);
    opacity: 0.8;
}

.buffet-btn:disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    border-radius: var(--border-radius);
}

/* Output Container */
.distraction-box-wrapper {
    flex: 1;
    min-height: 0;
    /* Important to let flex child shrink and scroll internally */
}

.distraction-box {
    height: 350px;
    /* Fixed height requested by spec */
    margin: 0 auto;
    overflow-y: auto;
    padding: 1.5rem 1.5rem;
    border-radius: var(--border-radius);
    background: var(--box-bg);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), var(--shadow-light);
    line-height: 1.6;
    font-size: 1.125rem;
    color: var(--text-main);
    position: relative;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.distraction-box::-webkit-scrollbar {
    width: 8px;
}

.distraction-box::-webkit-scrollbar-track {
    background: transparent;
}

.distraction-box::-webkit-scrollbar-thumb {
    background-color: #CBD5E1;
    border-radius: 4px;
}

.placeholder-text {
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
    margin-top: 4rem;
}

/* Loading State Container */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 1rem;
}

.hidden {
    display: none !important;
}

/* Simple Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E2E8F0;
    border-top-color: var(--text-main);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* New content animation */
.distraction-item {
    animation: fadeInUp 200ms ease-out forwards;
}

.distraction-separator {
    border: none;
    border-top: 1px solid #E2E8F0;
    margin: 1.5rem 0;
}

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

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

/* Mobile responsive fixes */
@media (max-height: 700px) {
    .buffet-btn {
        height: 180px;
    }

    .distraction-box {
        height: 250px;
    }
}