/* Dark theme color scheme matching tkinter GUI */
:root {
    --bg-color: #353b41;
    --fg-color: #ffffff;
    --entry-bg: #2a2f34;
    --entry-fg: #ffffff;
    --button-bg: #4a5157;
    --button-hover: #5a6167;
    --accent-bg: #4a90e2;
    --accent-hover: #5aa0f2;
    --border-color: #5a6167;
    --link-color: #4a90e2;
}

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

@keyframes glow-rare {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

@keyframes glow-mythic {
    0%, 100% {
        box-shadow: 0 0 15px rgba(218, 112, 214, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(218, 112, 214, 1);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--fg-color);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 20px 40px;
    overflow-x: hidden; /* Prevent horizontal scroll */
    box-sizing: border-box; /* Include padding in width */
}

/* Header */
.header {
    margin-bottom: 15px;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 40px;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: bold;
}

/* Sections */
section {
    background-color: var(--entry-bg);
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 10px;
    box-sizing: border-box; /* Include padding in width */
    overflow-x: hidden; /* Prevent content overflow */
}

section h2 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--fg-color);
}

section h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--fg-color);
}

/* Parameters Grid */
.params-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0; /* Allow shrinking below content size */
}

.form-group label {
    font-size: 0.85rem;
    color: var(--fg-color);
    font-weight: 500;
}

.range-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 0; /* Allow shrinking */
}

.range-box {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow shrinking */
}

.form-control {
    background-color: var(--entry-bg);
    color: var(--entry-fg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    box-sizing: border-box; /* Include padding/border in width */
    max-width: 100%; /* Never exceed parent width */
    min-width: 0; /* Allow shrinking */
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-bg);
}

.form-control.small {
    width: 130px;
    min-width: 130px;
}

.help-text {
    font-size: 0.75rem;
    color: #aaaaaa;
    margin-top: 2px;
}

/* Options row */
.options-row {
    display: flex;
    gap: 15px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Color Filter */
.color-filter-section {
    padding: 10px 15px;
}

.color-filter-section.hidden {
    display: none;
}

.color-filter-compact {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.colors-row,
.mode-row,
.filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-label {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 60px;
}

/* Additional Filters specific styles */
.filter-row {
    margin-bottom: 10px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.range-container-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-control.small-inline {
    width: 70px;
    padding: 4px 8px;
    font-size: 0.85rem;
}

.range-separator {
    font-size: 0.85rem;
    color: var(--fg-color);
    font-weight: 500;
}

/* Salt Toggle Button */
.salt-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--fg-color);
}

.salt-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.salt-toggle-btn .salt-icon {
    font-size: 1rem;
}

.salt-toggle-btn .salt-label {
    font-weight: 600;
}

.salt-toggle-btn.chill {
    background-color: white;
    border-color: #4a90e2;
    color: #4a90e2;
}

.salt-toggle-btn.salty {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.set-filter-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.set-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.set-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
}

.set-input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
}

.set-input::placeholder {
    text-transform: none;
    font-family: inherit;
    font-style: italic;
    color: #999;
}

.set-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.1);
}

.color-checkboxes {
    display: flex;
    gap: 8px;
    margin-right: 24px; /* Increased spacing between colors and # of colors */
}

.num-colors-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.num-colors-container .compact-label {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: auto;
}

/* Advanced toggle button */
.btn-advanced {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--fg-color);
    padding: 2px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 6px;
    white-space: nowrap;
}

.btn-advanced:hover {
    background-color: var(--button-bg);
    border-color: var(--accent-bg);
}

.btn-advanced.active {
    background-color: var(--accent-bg);
    border-color: var(--accent-bg);
}

/* Color count modes */
.color-count-mode {
    display: flex;
    align-items: center;
    gap: 6px;
}

.color-count-mode.hidden {
    display: none;
}

.range-label {
    font-size: 0.75rem;
    color: var(--fg-color);
    margin-left: 8px;
}
/* Colors and mode grouping */
.colors-and-mode-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mode-row-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Color count buttons */
.color-count-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-count-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.color-count-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--fg-color);
    text-align: center;
    white-space: nowrap;
}

.color-count-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid var(--border-color);
    background-color: var(--entry-bg);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.color-count-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-bg);
}

.color-count-button input {
    display: none;
}

.color-count-button span {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--fg-color);
    transition: all 0.3s ease;
    line-height: 1;
}

/* Selected state */
.color-count-button input:checked + span {
    color: var(--accent-bg);
    text-shadow: 0 0 8px var(--accent-bg);
}

/* Checkmark indicator in top right corner */
.color-count-button input:checked + span::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #4a90e2;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.color-count-button.selected {
    border-color: var(--accent-bg);
    background-color: rgba(74, 144, 226, 0.1);
    box-shadow: 0 0 10px var(--accent-bg);
}

.color-count-button.selected:hover {
    transform: translateY(-2px);
}

.color-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.color-checkbox:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.color-checkbox input {
    display: none;
}

.color-checkbox span {
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.color-checkbox.white {
    background-color: #F0E68C;
    color: #000;
}

.color-checkbox.blue {
    background-color: #ADD8E6;
    color: #000;
}

.color-checkbox.black {
    background-color: #D3D3D3;
    color: #000;
}

.color-checkbox.red {
    background-color: #FFB6C1;
    color: #000;
}

.color-checkbox.green {
    background-color: #90EE90;
    color: #000;
}

.color-checkbox.colorless {
    background-color: #999999;
    color: #fff;
}

/* Enhanced selected state */
.color-checkbox input:checked + span {
    font-size: 1.4rem;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

.color-checkbox.white input:checked ~ span::before,
.color-checkbox.blue input:checked ~ span::before,
.color-checkbox.black input:checked ~ span::before,
.color-checkbox.red input:checked ~ span::before,
.color-checkbox.green input:checked ~ span::before,
.color-checkbox.colorless input:checked ~ span::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 8px;
    pointer-events: none;
}

/* Selected state with colored borders */
.color-checkbox.white input:checked ~ span::before {
    border: 3px solid #DAA520;
    box-shadow: 0 0 10px #DAA520, inset 0 0 10px rgba(218, 165, 32, 0.3);
}

.color-checkbox.blue input:checked ~ span::before {
    border: 3px solid #0066CC;
    box-shadow: 0 0 10px #0066CC, inset 0 0 10px rgba(0, 102, 204, 0.3);
}

.color-checkbox.black input:checked ~ span::before {
    border: 3px solid #333;
    box-shadow: 0 0 10px #666, inset 0 0 10px rgba(51, 51, 51, 0.3);
}

.color-checkbox.red input:checked ~ span::before {
    border: 3px solid #CC0000;
    box-shadow: 0 0 10px #CC0000, inset 0 0 10px rgba(204, 0, 0, 0.3);
}

.color-checkbox.green input:checked ~ span::before {
    border: 3px solid #228B22;
    box-shadow: 0 0 10px #228B22, inset 0 0 10px rgba(34, 139, 34, 0.3);
}

.color-checkbox.colorless input:checked ~ span::before {
    border: 3px solid #666;
    box-shadow: 0 0 10px #888, inset 0 0 10px rgba(102, 102, 102, 0.3);
}

/* Checkmark indicator */
.color-checkbox input:checked + span::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #4a90e2;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Additional selected class for JavaScript toggle */
.color-checkbox.selected {
    transform: scale(1.05);
}

.color-checkbox.selected:hover {
    transform: scale(1.05) translateY(-2px);
}

.radio-group {
    display: flex;
    gap: 12px;
    flex: 1;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Options Section */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Validation Warning */
.validation-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin: 0 15px;
    background: linear-gradient(135deg, #ff9800 0%, #ff6b00 100%);
    border-left: 4px solid #ff5722;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.validation-warning.hidden {
    display: none;
}

.warning-icon {
    font-size: 1.3rem;
    animation: pulse 2s infinite;
}

/* Scryfall API Error Banner */
.scryfall-error-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    margin: 0 15px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-left: 4px solid #a93226;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
    animation: slideIn 0.3s ease-out;
}

.scryfall-error-banner.hidden {
    display: none;
}

.error-icon {
    font-size: 1.3rem;
    animation: pulse 2s infinite;
}

.error-message {
    flex: 1;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.buttons-section {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease, transform 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-bg);
    color: var(--fg-color);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--button-bg);
    color: var(--fg-color);
}

.btn-secondary:hover {
    background-color: var(--button-hover);
}

/* Results Section */
.results-section {
    max-height: 300px;
    overflow-y: auto;
}

.results-section.hidden {
    display: none;
}

.results-text {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word; /* Break long words */
    overflow-wrap: break-word; /* Modern word breaking */
    color: var(--fg-color);
    background-color: var(--bg-color);
    padding: 15px;
    border-radius: 4px;
    margin: 0;
    max-width: 100%; /* Never exceed container */
    overflow-x: auto; /* Scroll if absolutely necessary */
    box-sizing: border-box; /* Include padding in width */
}

.results-text a {
    color: var(--link-color);
    text-decoration: underline;
}

.results-text a:hover {
    color: var(--accent-hover);
}

/* Results View Banner */
.results-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    margin: 15px 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease-out;
}

.results-banner.hidden {
    display: none;
}

.banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.banner-icon {
    font-size: 1.5rem;
}

.banner-text {
    font-size: 1.1rem;
    font-weight: 600;
}

#exit-results-btn {
    padding: 8px 20px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Images Section */
.images-section {
    min-height: 300px;
    padding: 12px 15px;
}

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

.images-section h2 {
    font-size: 1rem;
    margin: 0;
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 6px;
}

.sort-controls.hidden {
    display: none;
}

.sort-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #555;
    color: #888;
    border: 2px solid #444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s;
    user-select: none;
}

.sort-btn:hover {
    border-color: #666;
    transform: translateY(-1px);
}

/* Inactive state - gray */
.sort-btn.inactive {
    background-color: #555;
    color: #888;
    border-color: #444;
}

/* Active ascending - green with up arrow */
.sort-btn.asc {
    background-color: #4a7c4e;
    color: #fff;
    border-color: #5a9c5e;
}

.sort-btn.asc::after {
    content: '↑';
    position: absolute;
    font-size: 0.65rem;
    margin-top: -10px;
    margin-left: 17px;
}

/* Active descending - blue with down arrow */
.sort-btn.desc {
    background-color: #4a6c9c;
    color: #fff;
    border-color: #5a8ccc;
}

.sort-btn.desc::after {
    content: '↓';
    position: absolute;
    font-size: 0.65rem;
    margin-top: 10px;
    margin-left: 17px;
}

/* Remove old styles */
.sort-label {
    font-weight: 500;
}

.sort-arrow {
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.sort-btn.active .sort-arrow {
    opacity: 1;
}


.sort-btn.asc .sort-arrow::before {
    content: '↑';
}

.sort-btn.desc .sort-arrow::before {
    content: '↓';
}

.sort-btn:not(.asc):not(.desc) .sort-arrow::before {
    content: '↕';
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.cards-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
}

.card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.card-wrapper:hover {
    transform: translateY(-5px);
}

.card-image {
    max-width: 300px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.2s;
}

.card-image:hover {
    box-shadow: 0 8px 16px rgba(74, 144, 226, 0.5);
}

.card-placeholder {
    min-width: 300px;
    min-height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--entry-bg);
    font-size: 0.9rem;
    animation: pulse-loading 1.5s ease-in-out infinite;
}

@keyframes pulse-loading {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.card-name {
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    max-width: 300px;
}

.card-rank {
    font-size: 0.85rem;
    color: #aaaaaa;
}

/* Status Bar */
.status-bar {
    background-color: var(--entry-bg);
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--fg-color);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--entry-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--button-hover);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .params-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Fix rank range inputs on mobile */
    .range-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }
    
    .range-box {
        width: 100%;
    }
    
    .range-box .form-control {
        width: 100%;
        max-width: 100%;
    }
    
    /* Ensure all form controls fit on mobile */
    .form-control {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .form-control.small {
        width: 100%;
        max-width: 100%;
        min-width: auto;
    }
    
    .options-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .card-image {
        max-width: 250px;
    }
    
    /* Color filter adjustments for mobile */
    .colors-row {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 10px;
    }
    
    .color-checkboxes {
        width: 100%;
        justify-content: space-between;
        margin-right: 0;
    }
    
    .color-checkbox {
        width: 45px;
        height: 45px;
    }
    
    .num-colors-container {
        width: 100%;
    }
    
    .num-colors-container .form-control {
        width: 100%;
    }
    
    .color-count-mode {
        width: 100%;
    }
    
    .color-count-mode .form-control {
        width: 100%;
    }
    
    .btn-advanced {
        margin-left: 0;
        margin-top: 4px;
    }
    
    .mode-row {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 8px;
    }
    
    .radio-group {
        flex-wrap: wrap;
        width: 100%;
    }
    
    /* Header adjustments */
    .header h1 {
        font-size: 1.3rem;
    }
    
    .logo {
        height: 32px;
    }
    
    /* Button adjustments */
    .buttons-section {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    /* Text output adjustments for mobile */
    .results-text {
        font-size: 0.75rem; /* Smaller font on mobile */
        padding: 10px;
        max-width: 100%;
        overflow-x: auto; /* Allow horizontal scroll if needed */
    }
    
    .results-text a {
        word-break: break-all; /* Break long URLs */
        display: inline-block;
        max-width: 100%;
    }
}

/* Advanced Randomizer Styles */
.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.preset-btn {
    background-color: var(--button-bg);
    color: var(--fg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.preset-btn:hover {
    background-color: var(--button-hover);
    border-color: var(--accent-bg);
}

.preset-btn:active,
.preset-btn.active {
    background-color: var(--accent-bg);
    border-color: var(--accent-bg);
}

.equation-input {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    flex: 1;
    min-height: 36px;
    resize: vertical;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.equation-display {
    display: inline-block;
    background-color: var(--entry-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #4a90e2;
}

#custom-equation {
    font-family: 'Courier New', monospace;
}

