/* --- General Styles & Resets --- */
        :root {
            --color-bg: #18181b; /* zinc-900 */
            --color-surface: #27272a; /* zinc-800 */
            --color-primary: #52525b; /* zinc-600 */
            --color-primary-hover: #71717a; /* zinc-500 */
            --color-secondary: #3b82f6; /* blue-500 */
            --color-secondary-hover: #2563eb; /* blue-600 */
            --color-action: #16a34a; /* green-600 */
            --color-action-hover: #15803d; /* green-700 */
            --color-discord: #5865F2; /* Discord Blurple */
            --color-discord-hover: #4f5bda;
            --color-danger: #dc2626; /* red-600 */
            --color-danger-hover: #b91c1c; /* red-700 */
            --color-text-primary: #f4f4f5; /* zinc-100 */
            --color-text-secondary: #a1a1aa; /* zinc-400 */
            --color-text-muted: #71717a; /* zinc-500 */
            --color-border: #3f3f46; /* zinc-700 */
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: var(--color-bg);
            color: var(--color-text-primary);
            margin: 0;
            padding: 1rem;
            transition: background-color 0.5s ease;
        }

        /* --- Scrollbar Styling --- */
        ::-webkit-scrollbar {
            width: 8px;
        }
        ::-webkit-scrollbar-track {
            background: var(--color-surface);
            border-radius: 10px;
        }
        ::-webkit-scrollbar-thumb {
            background: var(--color-text-muted);
            border-radius: 10px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--color-text-secondary);
        }

        /* --- Layout & Container --- */
        .container {
            max-width: 1280px;
            margin-left: auto;
            margin-right: auto;
        }

        .card {
            background-color: var(--color-surface);
            border-radius: 1rem;
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            padding: 1.5rem;
            transition: background-color 0.5s ease;
        }

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

        .grid-container-two-col {
            display: grid;
            grid-template-columns: 1fr; /* Default for small screens */
            gap: 1.5rem;
            align-items: start; /* ensure both columns align to the top */
        }

        @media (min-width: 1024px) {
            .grid-container-two-col {
                grid-template-columns: 1fr 1fr; /* Two columns for larger screens */
            }
        }

        .dropdowns-column {
            display: flex;
            flex-direction: column;
            gap: 1rem; /* Space between dropdowns and color options */
            align-items: stretch; /* let header and box fill column width so header centers like others */
            padding-top: 0; /* remove extra top padding so header aligns with left column */
        }

        /* Ensure the right column header sits flush with the top like other section headers */
        .dropdowns-column > .io-label {
            margin-top: 0;
        }

        /* Boxed appearance for the List Options area to match other sections */
        .options-box {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid var(--color-border);
            border-radius: 0.5rem;
            background-color: rgba(255,255,255,0.02);
            box-sizing: border-box;
        }
        /* Nudge the options box up slightly to align with the input box top */
        .dropdowns-column > .options-box {
            margin-top: -15px; /* raised an additional ~5px */
        }
        /* Left-align content inside options box */
        .options-box, .options-box * {
            text-align: left;
        }
        .color-options { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.5rem; }
        .color-options label { margin-right: 0.5rem; }

        /* --- Header --- */
        .header {
            margin-bottom: 0.5rem;
            text-align: center;
        }
        .header h1 {
            font-size: 1.875rem;
            font-weight: 700;
            color: #fff;
            margin: 0;
        }
        .header p {
            color: var(--color-text-secondary);
            margin-top: 0.5rem;
            margin-bottom: 0;
        }

        /* --- Input/Output Boxes --- */
        .io-label {
            font-size: 1.125rem;
            font-weight: 600;
            color: var(--color-text-secondary);
            margin-bottom: 0.5rem;
            display: block;
            text-align: center;
        }
        .io-box {
            width: 100%;
            height: 450px;
            padding: 1rem;
            background-color: var(--color-bg);
            border: 1px solid var(--color-border);
            border-radius: 0.5rem;
            color: var(--color-text-primary);
            font-size: 0.875rem;
            overflow: auto;
            transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
            box-sizing: border-box;
        }
        #inputText {
            resize: none;
        }
        #inputText:focus {
            outline: none;
            box-shadow: 0 0 0 2px var(--color-action);
            border-color: var(--color-action);
        }
        #unabbreviatedOutput, #compactedOutput {
            white-space: pre-wrap;
            word-break: break-all;
        }
        
        /* --- Column Footer (Char Count & Buttons) --- */
        .column-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 0.5rem;
        }
        .char-count {
            font-size: 0.75rem;
            color: var(--color-text-muted);
            padding-right: 0.25rem;
        }
        .button-group {
            display: flex;
            gap: 0.5rem;
        }

        /* --- Buttons --- */
        .btn {
            color: #fff;
            font-weight: 700;
            border-radius: 0.5rem;
            border: none;
            cursor: pointer;
            transition: all 200ms;
            font-size: 0.875rem;
            padding: 0.5rem 1rem;
        }
        .btn:focus {
            outline: none;
            box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.5); /* blue-300 equivalent */
        }
        .btn-primary {
            background-color: var(--color-action);
        }
        .btn-primary:hover {
            background-color: var(--color-action-hover);
        }
        .btn-discord {
            background-color: var(--color-discord);
        }
        .btn-discord:hover {
            background-color: var(--color-discord-hover);
        }
        .btn-danger {
            background-color: var(--color-danger);
        }
        .btn-danger:hover {
            background-color: var(--color-danger-hover);
        }
        .btn-copy {
            background-color: var(--color-secondary);
        }
        .btn-copy:hover {
            background-color: var(--color-secondary-hover);
        }
        .btn-copied {
            background-color: var(--color-text-muted);
        }

        /* --- Changelog Section --- */
        .changelog-section {
            margin-top: 2rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--color-border);
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
        }
        .changelog-section h2 {
            text-align: center;
            font-size: 1.5rem;
            margin-top: 0;
            margin-bottom: 1rem;
            color: #fff;
        }
        .changelog-entry h4 {
            font-size: 1.125rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }
        .changelog-entry p {
            color: var(--color-text-secondary);
            margin: 0;
        }

        .changelog-entry.roadmap {
            margin-top: 0;
        }

        .changelog-version-entry h5 {
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 0.25rem;
        }

        .changelog-entry ul {
            list-style-type: disc;
            padding-left: 1.5rem;
            margin: 0;
            color: var(--color-text-secondary);
        }

        .changelog-entry li {
            margin-bottom: 0.25rem;
        }

        /* --- App Footer / Feedback --- */
        .app-footer {
            text-align: center;
            margin-bottom: 1.5rem;
            font-size: 0.875rem;
            color: var(--color-text-secondary);
        }
        .app-footer p {
            margin: 0;
        }
        .app-footer a {
            color: var(--color-discord);
            text-decoration: none;
            font-weight: 600;
        }
        .app-footer a:hover {
            color: var(--color-discord-hover);
            text-decoration: underline;
        }

        /* --- Media Queries for Responsive Layout --- */
        @media (min-width: 640px) {
            .card { padding: 2rem; }
            .header h1 { font-size: 2.25rem; }
        }
        @media (min-width: 1024px) {
            .grid-container { grid-template-columns: repeat(3, 1fr); }
        }

        .copy-popup {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background-color: #28a745;
            color: white;
            padding: 10px 20px;
            border-radius: 8px;
            z-index: 1000;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.5s, visibility 0.5s, bottom 0.5s;
            box-shadow: 0 4px 8px rgba(0,0,0,0.2);
        }
        .copy-popup.show {
            opacity: 1;
            visibility: visible;
            bottom: 50px;
        }

        /* --- New Markdown Preview Box --- */
        .markdown-preview {
            background-color: #282c34; /* Darker background for code-like appearance */
            font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace; /* Monospace font */
            white-space: pre-wrap; /* Preserve whitespace and wrap text */
            word-break: break-all; /* Break long words */
            padding: 1rem;
            border: 1px solid var(--color-border);
            border-radius: 0.5rem;
            color: var(--color-text-primary);
            font-size: 0.875rem;
            overflow: auto;
            height: 450px; /* Match other io-box heights */
            box-sizing: border-box;
        }

#outputFormatSelect {
    color: var(--color-text-primary) !important; /* Ensure visibility on dark background */
}

/* Styling for select elements within labels, similar to input boxes */
div[style*="margin-bottom: 0.5rem;"] > label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%; /* Ensure label takes full width */
}

/* Checkbox labels that should have the checkbox directly after the text */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Ensure checkbox-label doesn't get stretched by the generic label rule and sits to the right */
div[style*="margin-bottom: 0.5rem;"] > label.checkbox-label {
    display: inline-flex !important;
    justify-content: flex-start !important;
    width: auto !important;
    margin-left: auto; /* push the label+switch to the right side of the row */
}

/* Toggle switch styling */
.checkbox-label { white-space: nowrap; }
.switch-input { 
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    position: relative;
    margin: 0;
    padding: 0;
    background: transparent;
}
.switch-slider {
    width: 44px;
    height: 24px;
    background: var(--color-border);
    border-radius: 999px;
    display: inline-block;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.25);
    transition: background 150ms ease;
}
.switch-slider::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 150ms ease;
}
.switch-input:checked + .switch-slider {
    background: var(--color-action);
}
.switch-input:checked + .switch-slider::after {
    transform: translateX(20px);
}
.checkbox-label input[type="checkbox"] { display: none; }

/* Ensure checkbox inputs align to the right within labels */
div[style*="margin-bottom: 0.5rem;"] > label > input[type="checkbox"] {
    margin-left: 0.5rem;
    width: auto;
}

div[style*="margin-bottom: 0.5rem;"] > label > select {
    width: 70%; /* Adjust width as needed */
    padding: 0.5rem;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    color: var(--color-text-primary);
    font-size: 0.875rem;
    box-sizing: border-box;
    -webkit-appearance: none; /* Remove default browser styling for dropdowns */
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

div[style*="margin-bottom: 0.5rem;"] > label > select:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-action);
    border-color: var(--color-action);
}