:root {
    --bg-color: #2b2e33;
    --neu-light: #363a40;
    --neu-dark: #202226;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;

    --neon-primary: #00f2ff;
    /* Cyan */
    --neon-secondary: #ff00ff;
    /* Magenta */
    --neon-accent: #00ff66;
    /* Lime */

    --success: #00ff66;
    --danger: #ff4d4d;

    --shadow-out: 8px 8px 16px var(--neu-dark), -8px -8px 16px var(--neu-light);
    --shadow-in: inset 8px 8px 16px var(--neu-dark), inset -8px -8px 16px var(--neu-light);
    --radius: 20px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 20px;
}

/* Header */
.neumorphic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-radius: var(--radius);
    background: var(--bg-color);
    box-shadow: var(--shadow-out);
    margin-bottom: 30px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5rem;
}

.neon-icon {
    color: var(--neon-primary);
    text-shadow: 0 0 10px var(--neon-primary);
}

.highlight {
    background: linear-gradient(45deg, var(--neon-primary), var(--neon-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    /* Fix lint */
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

/* API Control */
.api-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ... skipped lines ... */
.complex-btn .bg::before {
    filter: blur(5px);
    transition: all 0.3s ease;
    box-shadow:
        4px 4px 0 0 rgba(0, 242, 255, 0.4),
        8px 8px 0 0 rgba(0, 242, 255, 0.2);
    /* Changed from -x to +x to match Bottom-Right Shadow */
}

.connection-form {
    display: flex;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-indicator {
    color: var(--success);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
}

.dot {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .neumorphic-header {
        flex-direction: column;
        gap: 20px;
    }
}

/* Neumorphic Components */
.neu-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-out);
    height: 100%;
}

#btnGenerate {
    margin-top: 40px;
}

.neu-btn {
    border: none;
    outline: none;
    background: var(--bg-color);
    color: var(--text-primary);
    padding: 0 24px;
    /* Horizontal Padding */
    height: 48px;
    /* Fixed Height */
    border-radius: 12px;
    box-shadow: var(--shadow-out);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.neu-btn:hover {
    transform: translateY(-2px);
}

.neu-btn:active,
.neu-btn.active {
    transform: translateY(0);
    box-shadow: var(--shadow-in);
    color: var(--neon-primary);
}

.neu-btn.primary-btn {
    color: var(--neon-primary);
}

.neu-btn.primary-btn:hover {
    text-shadow: 0 0 8px var(--neon-primary);
}

.neu-btn.danger {
    color: var(--danger);
}

.neu-btn.icon-btn {
    padding: 0;
    width: 48px;
    /* Square */
    aspect-ratio: 1;
}

.neu-btn.sm-btn {
    padding: 0 16px;
    height: 40px;
    /* Small fixed height */
    font-size: 0.9rem;
}

.neu-btn.sm-btn.icon-btn {
    width: 40px;
    /* Square small */
}

.neon-btn {
    background: linear-gradient(145deg, #2b2e33, #25282c);
    color: var(--neon-primary);
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.neon-btn:hover {
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2), var(--shadow-out);
}

.neu-input,
.neu-select {
    width: 100%;
    background: var(--bg-color);
    border: none;
    padding: 15px;
    border-radius: 12px;
    box-shadow: var(--shadow-in);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: box-shadow 0.2s;
}

.neu-input:focus,
.neu-select:focus {
    box-shadow: inset 4px 4px 8px var(--neu-dark), inset -4px -4px 8px var(--neu-light), 0 0 5px rgba(0, 242, 255, 0.1);
}

.textarea {
    resize: vertical;
    min-height: 120px;
}

/* Forms */
.form-group {
    margin-bottom: 25px;
}

.form-group label,
h2,
h3 {
    display: block;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Enforce 2 columns */
    gap: 25px 20px;
    /* Row Gap 25px (match form spacing), Col Gap 20px */
}

/* Remove margin from grid items to prevent double spacing */
.options-grid .form-group {
    margin-bottom: 0;
}

/* Split Group (Resolution + Format) */
.split-group {
    display: flex;
    gap: 15px;
    /* Separate them nicely */
}

.split-label {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.split-label label {
    flex: 1;
    /* Align with inputs */
    margin-bottom: 0;
}

.split-group .neu-select {
    flex: 1;
    /* Equal Widths */
    min-width: 0;
    border-radius: 12px;
}

/* Grid Button */

.mini-toggle input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.mini-toggle .toggle-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.3s;
    z-index: 1;
    margin-bottom: 0;
    /* Override generic label margin */
    pointer-events: none;
}

.mini-toggle input:checked+.toggle-label {
    color: var(--neon-secondary);
    /* Pink for JPG */
    text-shadow: 0 0 8px var(--neon-secondary);
    content: "JPG";
    /* CSS can't change text easily without attr, but JS logic handles value */
}

/* Grid Button */
.grid-btn {
    height: 54px !important;
    border-radius: 12px;
    margin-bottom: 0 !important;
    /* Override mb-20 */
    box-shadow: var(--shadow-out);
}

.grid-btn:active {
    box-shadow: var(--shadow-in);
}

@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
        /* Stack on small mobile */
    }
}

/* Consistent Control Heights */
.neu-input,
.neu-select,
.segment-control,
.toggle-button-cover .button {
    height: 54px !important;
    /* Force equal height */
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

/* Adjust Segment Control internal alignment */
.segment-control {
    padding: 6px;
    /* slightly more padding for internal buttons */
}

.segment-btn {
    height: 100% !important;
    /* Fill parent */
}

/* Adjust Toggle Button container to match */
.toggle-button-cover {
    height: 54px;
    display: flex;
    align-items: center;
    width: 100%;
}

.button-cover {
    width: 100%;
}

.button-cover .button {
    width: 100%;
    /* Full width within grid cell */
    border-radius: 12px;
    /* Match inputs */
}

/* Dropzone */
.neu-dropzone {
    border-radius: 12px;
    box-shadow: var(--shadow-in);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.neu-dropzone:hover {
    color: var(--neon-primary);
}

.neu-dropzone i {
    font-size: 2rem;
    margin-bottom: 10px;
}

.image-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.preview-item {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-out);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
}

.neu-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.neu-radio input {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--bg-color);
    box-shadow: var(--shadow-in);
    border-radius: 50%;
    position: relative;
}

.neu-radio input:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--neon-primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon-primary);
}

/* Helpers */
.full-width {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* Result Panel */
.result-container {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
}

.image-result {
    width: 100%;
    text-align: center;
}

/* Result Grid System */
.result-grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

.result-grid.mode-1 {
    grid-template-columns: 1fr;
}

.result-grid.mode-2 {
    grid-template-columns: 1fr 1fr;
}

.result-grid.mode-3 {
    grid-template-columns: 1fr 1fr;
}

/* 3rd item will stretch or 2x2 with empty */
/* Better for 3: 2 on top, 1 bottom center? Or just grid auto */
.result-grid.mode-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.result-grid.mode-4 {
    grid-template-columns: 1fr 1fr;
}

.result-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-in);
    background: var(--bg-color);
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* changed from cover to contain to see full generation */
    display: block;
}

.result-item .download-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.result-item:hover .download-overlay {
    opacity: 1;
}

/* Segment Control */
.segment-control {
    display: flex;
    gap: 0;
    /* Remove gap for continuous slide area */
    background: var(--bg-color);
    border-radius: 12px;
    padding: 4px;
    box-shadow: var(--shadow-in);
    position: relative;
    /* For absolute positioning of indicator */
    z-index: 1;
}

.segment-btn {
    flex: 1;
    /* Height handled by parent .segment-control */
    padding: 0 !important;
    margin: 0;
    box-shadow: none !important;
    /* Flat inside container */
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    font-weight: 600;
    z-index: 2;
    /* Above indicator */
    position: relative;
    transition: color 0.3s ease;
}

.segment-indicator {
    position: absolute;
    top: 4px;
    /* Match padding of container */
    left: 4px;
    /* Initial position */
    height: calc(100% - 8px);
    width: 25%;
    /* Will be set by JS, but roughly 1/4 */
    background: var(--bg-color);
    box-shadow: var(--shadow-out);
    border-radius: 8px;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    /* Bouncy "Bubble" Effect */
}

.segment-btn.active {
    background: transparent;
    box-shadow: none !important;
    color: var(--neon-primary);
    transform: none !important;
}

.segment-btn:hover {
    color: var(--text-primary);
}

.image-result img {
    max-width: 100%;
    border-radius: 12px;
    box-shadow: var(--shadow-in);
    /* Inset for content look */
    margin-bottom: 20px;
}

.loader {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: transparent;
    /* No background needed for ring style */
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--neon-primary);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    /* Soft glow */
    position: relative;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
    /* Center horizontally and add bottom margin */
}

.loader::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--neon-secondary);
    animation: spin 2s linear infinite reverse;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.2);
}

.loading-state p {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 2px;
    animation: pulse 1.5s ease-in-out infinite;
    text-transform: uppercase;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.6;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 20px var(--neon-primary);
    }

    100% {
        opacity: 0.6;
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
    }
}

/* --- COMPLEX ANIMATED BUTTON (Adapted from User Request) --- */
.complex-btn {
    --white: #ffffff;
    --neon-100: #ccfcff;
    --neon-200: #80f2ff;
    --neon-300: #42e8ff;
    --neon-400: #00f2ff;
    --neon-500: #008c94;
    --radius: 20px;

    border-radius: var(--radius);
    outline: none;
    cursor: pointer;
    font-size: 20px;
    font-family: inherit;
    background: transparent;
    letter-spacing: 2px;
    border: 0;
    position: relative;
    width: 100%;
    height: 70px;
    /* Removed skew/rotate for fit in layout, kept inner animation vibe */
}

/* Background & Glow */
.complex-btn .bg {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    filter: blur(1px);
}

.complex-btn .bg::before,
.complex-btn .bg::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: calc(var(--radius) * 1.1);
    background: var(--neon-500);
}

.complex-btn .bg::before {
    filter: blur(5px);
    transition: all 0.3s ease;
    box-shadow:
        10px 10px 20px rgba(0, 0, 0, 0.5),
        /* Deep shadowBase */
        4px 4px 0 0 rgba(0, 242, 255, 0.4),
        /* Neon Layer 1 (Bottom-Right) */
        8px 8px 0 0 rgba(0, 242, 255, 0.2);
    /* Neon Layer 2 (Farther Bottom-Right) */
}

/* Gradient Wrap */
.complex-btn .wrap {
    border-radius: inherit;
    overflow: hidden;
    height: 100%;
    transform: translate(4px, -4px);
    /* Default lift */
    padding: 3px;
    background: linear-gradient(to bottom, var(--neon-200) 0%, var(--neon-400) 100%);
    position: relative;
    transition: all 0.3s ease;
}

/* Outline Animation */
.complex-btn .outline {
    position: absolute;
    overflow: hidden;
    inset: 0;
    opacity: 0;
    outline: none;
    border-radius: inherit;
    transition: all 0.4s ease;
}

.complex-btn .outline::before {
    content: "";
    position: absolute;
    inset: 2px;
    width: 120px;
    height: 300px;
    margin: auto;
    background: linear-gradient(to right, transparent 0%, white 50%, transparent 100%);
    animation: spin 3s linear infinite;
    animation-play-state: paused;
}

/* Content Container */
.complex-btn .content {
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    position: relative;
    height: 100%;
    gap: 16px;
    border-radius: calc(var(--radius) * 0.85);
    font-weight: 700;
    transition: all 0.3s ease;
    background: linear-gradient(to bottom, #2b2e33 0%, #1a1c1e 100%);
    color: var(--neon-400);
    box-shadow: inset 0 0 15px rgba(0, 242, 255, 0.1);
}

/* States: Hover */
.complex-btn:hover .wrap {
    transform: translate(6px, -6px);
}

.complex-btn:hover .outline {
    opacity: 1;
}

.complex-btn:hover .outline::before {
    animation-play-state: running;
}

.complex-btn:hover .content {
    color: var(--white);
    background: linear-gradient(to bottom, var(--neon-500) 0%, var(--neon-400) 100%);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* States: Active (Press) */
.complex-btn:active .wrap {
    transform: translate(2px, -2px);
}

/* Char Animations */
.complex-btn .char {
    display: flex;
    align-items: center;
}

.complex-btn .char span {
    display: inline-block;
    position: relative;
    transition: transform 0.3s;
}

.complex-btn:hover .char span {
    animation: bounce 0.6s ease infinite alternate;
}

.complex-btn:hover .char span:nth-child(1) {
    animation-delay: 0.1s;
}

.complex-btn:hover .char span:nth-child(2) {
    animation-delay: 0.15s;
}

.complex-btn:hover .char span:nth-child(3) {
    animation-delay: 0.2s;
}

.complex-btn:hover .char span:nth-child(4) {
    animation-delay: 0.25s;
}

.complex-btn:hover .char span:nth-child(5) {
    animation-delay: 0.3s;
}

.complex-btn:hover .char span:nth-child(6) {
    animation-delay: 0.35s;
}

.complex-btn:hover .char span:nth-child(7) {
    animation-delay: 0.4s;
}

.complex-btn:hover .char span:nth-child(8) {
    animation-delay: 0.45s;
}


@keyframes bounce {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-3px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- LOGIC STATES (Loading / Success) --- */

/* State: Loading */
.complex-btn.loading {
    cursor: wait;
}

.complex-btn.loading .wrap {
    transform: translate(2px, -2px);
    background: linear-gradient(to bottom, #444 0%, #222 100%);
}

.complex-btn.loading .content {
    background: #222;
    color: #888;
}

.complex-btn.loading .icon-box i {
    animation: spin 1s linear infinite;
}

.complex-btn.loading .char span {
    animation: none;
    /* Stop bounce */
}

/* State: Success */
.complex-btn.success .wrap {
    background: linear-gradient(to bottom, #00ff66 0%, #00cc52 100%);
}

.complex-btn.success .content {
    background: linear-gradient(to bottom, #00b347 0%, #00993d 100%);
    color: white;
}

.complex-btn.success .bg::before {
    box-shadow:
        10px 10px 20px rgba(0, 0, 0, 0.5),
        4px 4px 0 0 rgba(0, 255, 102, 0.4);
}

.history-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 5px;
}

.history-item {
    flex: 0 0 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-out);
    cursor: pointer;
    border: 2px solid transparent;
}

.history-item:hover {
    border-color: var(--neon-primary);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- CUSTOM TOGGLE SWITCH (PNG/JPG) --- */
/* --- CUSTOM TOGGLE SWITCH (PNG/JPG) --- */
.toggle-button-cover {
    position: relative;
    width: 100%;
    height: auto;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    /* Center in container */
}

.button-cover {
    margin: 0;
    width: 100%;
}

.button-cover .button {
    position: relative;
    width: 140px;
    /* Wider match */
    height: 54px;
    /* Match Input Height (approx 54px) */
    margin: 0;
    /* overflow: hidden;  <-- REMOVED to fix clipped shadows */
    border-radius: 27px;
    /* Half of 54px */
    background-color: var(--bg-color);
    /* Ensure bg behind track */
}

.button-cover .checkbox {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
}

.button-cover .knobs,
.button-cover .layer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.button-cover .knobs {
    z-index: 2;
}

.button-cover .layer {
    width: 100%;
    background-color: var(--bg-color);
    box-shadow: var(--shadow-in);
    transition: 0.3s ease all;
    z-index: 1;
    border-radius: 27px;
}

/* Knob Appearance */
.button-cover .knobs:before {
    content: "PNG";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 60px;
    /* Knob Width */
    height: 46px;
    /* 54 - 4 - 4 */
    color: var(--neon-primary);
    font-size: 14px;
    /* Larger Text */
    font-weight: 800;
    text-align: center;
    line-height: 46px;
    /* Center vertically */
    background-color: #2b2e33;
    box-shadow: var(--shadow-out);
    /* Now visible! */
    border-radius: 23px;
    /* Half of 46 */
    transition: 0.3s cubic-bezier(0.18, 0.89, 0.35, 1.15) all;
}

/* Checked State */
.button-cover .checkbox:checked+.knobs:before {
    content: "JPG";
    left: 76px;
    /* 140 - 60 - 4 */
    color: var(--neon-secondary);
    background-color: #2b2e33;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5), var(--shadow-out);
}

.button-cover .checkbox:not(:checked)+.knobs:before {
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5), var(--shadow-out);
}

/* Active State (Press) */
.button-cover .checkbox:active+.knobs:before {
    width: 70px;
}

.button-cover .checkbox:checked:active+.knobs:before {
    margin-left: -10px;
}

/* --- WCAG COMPLIANT ERROR MESSAGE --- */
.error-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: #ffebee;
    /* Very light red for background */
    border: 2px solid #c62828;
    /* Dark red border */
    color: #b71c1c;
    /* Dark red text for high contrast (AAA) */
    padding: 15px 25px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.35, 1.15);
    font-weight: 600;
    min-width: 300px;
    max-width: 90%;
}

.error-toast.visible {
    transform: translateX(-50%) translateY(0);
}

.error-toast i {
    font-size: 1.5rem;
    color: #d32f2f;
}

.error-toast button {
    background: transparent;
    border: none;
    color: #b71c1c;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: auto;
    padding: 5px;
}

/* --- SPA HISTORY VIEW --- */
.spa-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 2000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 50px;
}

.history-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 15px;
    box-shadow: var(--shadow-out);
    transition: transform 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.history-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), var(--shadow-out);
}

.history-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 15px;
}

.history-info h4 {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.restore-badge {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--neon-accent);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-card:hover .restore-badge {
    opacity: 1;
}

.empty-history {
    text-align: center;
    margin-top: 100px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-history i {
    font-size: 5rem;
    margin-bottom: 20px;
}

/* Eliminate Button */
.mb-20 {
    margin-bottom: 20px;
}

.eliminate-area {
    margin-bottom: 10px;
}

#btnReset:hover {
    box-shadow: inset 2px 2px 5px #000, inset -2px -2px 5px #ff4d4d;
    color: #ff4d4d;
}