:root {
    --bg-body: #121212;
    --bg-surface: #1e1e1e;
    --bg-input: #2d2d2d;
    --bg-hover: #2a2a2a;

    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;

    --primary-color: #3b82f6;
    --primary-hover: #2563eb;

    --border-color: #333;
    --border-radius: 8px;
    --spacing-unit: 16px;
    --ad-height: 90px;


    --diff-add-bg: #1c4a25;
    --diff-add-text: #86efac;
    --diff-del-bg: #5c1818;
    --diff-del-text: #fca5a5;
}

[data-theme="light"] {
    --bg-body: #f3f4f6;
    /* Light Gray background */
    --bg-surface: #ffffff;
    /* White cards */
    --bg-input: #f9fafb;
    /* Very light gray inputs */
    --bg-hover: #f3f4f6;

    --text-main: #1f2937;
    /* Dark Gray text */
    --text-muted: #6b7280;
    /* Medium Gray */

    --primary-color: #2563eb;
    /* Slightly darker blue for contrast */
    --primary-hover: #1d4ed8;

    --border-color: #e5e7eb;
    /* Light gray border */

    /* Diff Colors - Light */
    --diff-add-bg: #dcfce7;
    --diff-add-text: #166534;
    --diff-del-bg: #fee2e2;
    --diff-del-text: #991b1b;
}

[data-theme="light"] .seo-content h3 {
    color: #000000;
    /* Force black text */
    border-bottom: 1px solid var(--border-color);
    /* Optional: Adds a nice wiki-style underline */
    padding-bottom: 4px;
}

/* 2. Fix Brand Name (Remove white gradient, make it solid dark) */
[data-theme="light"] .brand-name {
    background: none;
    /* Remove the gradient */
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: initial;
    /* Reset text fill */
    color: #000000;
    /* Force black text */
}

/* Theme Toggle Button Styling */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.2rem;
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    aspect-ratio: 1;
}

.theme-toggle:hover {
    background-color: var(--bg-surface);
    color: var(--primary-color);
    border-color: var(--primary-color);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
.brand-name {
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.brand-name {
    font-size: 2.5rem;
    background: linear-gradient(90deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

a {
    text-decoration: none;
    color: inherit;
}


.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--spacing-unit);
    flex: 1;
}

header {
    text-align: center;
    margin: 40px 0;
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}


.ad-banner {
    width: 100%;
    height: var(--ad-height);
    background-color: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    overflow: hidden;
}




button {
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-size: 0.95rem;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-input);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: var(--spacing-unit);
    flex-wrap: wrap;
}


input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px;
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    font-size: 1rem;
    appearance: none;

    -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}


select {
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23a0a0a0%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 12px auto;
    padding-right: 30px;

    cursor: pointer;
}


textarea {
    min-height: 120px;
    resize: vertical;
    display: block;
}




.input-grid textarea {
    height: 300px;
    font-family: 'Courier New', Courier, monospace;

    font-size: 14px;
    line-height: 1.5;
}


@media (max-width: 768px) {
    .input-grid textarea {
        height: 200px;

    }
}


.controls-wrapper {
    margin-bottom: 30px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

/* Row 1: Search */
.search-container {
    margin-bottom: 20px;
    width: 100%;
}

/* Row 2: Filters + Sort Container */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    /* Allows wrapping on mobile */
    align-items: center;
    justify-content: space-between;
    /* Pushes Sort to the right */
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    /* Separator line */
}

/* Filter Buttons Group */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    /* Fix: Use body background for contrast against surface */
    background-color: var(--bg-body);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    /* Slightly tighter radius */
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--text-main);
    background-color: var(--bg-hover);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: #1e1e1e;
    border-color: var(--primary-color);
}

/* Sort Dropdown */
.sort-container select {
    background-color: var(--bg-body);
    /* Dark background */
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.sort-container select:focus {
    border-color: var(--primary-color);
}

.search-input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    font-size: 1.1rem;
    background-color: var(--bg-surface);
    border-radius: 50px;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    fill: var(--text-muted);
    pointer-events: none;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}


.tool-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, background-color 0.2s, border-color 0.2s;
    height: 100%;


    display: grid;
    grid-template-columns: max-content 1fr;

    grid-template-rows: auto 1fr;

    column-gap: 15px;

}

.tool-card:hover {
    transform: translateY(-3px);
    background-color: var(--bg-hover);
    border-color: var(--primary-color);
}

.tool-icon {

    grid-column: 1;
    grid-row: 1;
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0;

    display: flex;
    align-items: center;
}

.tool-title {

    grid-column: 2;
    grid-row: 1;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;

    line-height: 1.2;
}

.tool-desc {

    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.no-results {
    text-align: center;
    color: var(--text-muted);
    grid-column: 1 / -1;
    display: none;
}


.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.input-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
}

textarea.diff-input {
    width: 100%;
    height: 300px;
    padding: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    resize: vertical;
}


.diff-result {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: var(--spacing-unit);
    display: none;
}

.diff-result.active {
    display: block;
}

.diff-line {
    display: flex;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.diff-line:last-child {
    border-bottom: none;
}

.line-num {
    width: 50px;
    text-align: right;
    padding: 4px 8px;
    user-select: none;
    color: var(--text-muted);
    background-color: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.line-content {
    padding: 4px 16px;
    white-space: pre-wrap;
    word-break: break-all;
    width: 100%;
}

.type-del {
    background-color: var(--diff-del-bg);
    color: var(--diff-del-text);
}

.type-add {
    background-color: var(--diff-add-bg);
    color: var(--diff-add-text);
}


.ad-banner {
    width: 100%;

    min-height: 100px;
    background-color: var(--bg-surface);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    position: relative;
    overflow: hidden;
}


.ad-banner::before {
    content: 'Advertisement';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: var(--text-muted);
    background-color: var(--bg-body);
    padding: 0 8px;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 10;
}


.ad-banner.placeholder {
    border: 1px dashed var(--border-color);
}


.editor-container {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    position: relative;
    overflow: hidden;
}


canvas#editorCanvas {
    max-width: 100%;
    cursor: grab;
    touch-action: none;

    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

canvas#editorCanvas:active {
    cursor: grabbing;
}


.upload-zone {
    text-align: center;
    border: 2px dashed var(--text-muted);
    padding: 40px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}


.slider-container {
    width: 100%;
    max-width: 400px;
    margin: 20px auto;
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0.5;
    pointer-events: none;

}

.slider-container.active {
    opacity: 1;
    pointer-events: all;
}

input[type=range] {
    width: 100%;
    cursor: pointer;
}


.seo-content a {
    text-decoration: underline;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px 10px;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.2;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}


.status-bar {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    display: none;

}

.status-success {
    background-color: rgba(28, 74, 37, 0.5);
    color: #86efac;
    border: 1px solid #1c4a25;
}

.status-error {
    background-color: rgba(92, 24, 24, 0.5);
    color: #fca5a5;
    border: 1px solid #5c1818;
}


textarea#jsonOutput {
    background-color: #1a1a1a;
}




.password-box {
    background-color: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    transition: border-color 0.2s;
}

.password-box:hover {
    border-color: var(--text-muted);
}

.password-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    word-break: break-all;
    min-height: 1.5em;

}


.strength-container {
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    margin: 15px 0 10px 0;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s, background-color 0.3s;
}


.strength-weak {
    background-color: #ef4444;
    width: 33%;
}

.strength-medium {
    background-color: #eab308;
    width: 66%;
}

.strength-strong {
    background-color: #22c55e;
    width: 100%;
}


.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.checkbox-wrapper:hover {
    border-color: var(--primary-color);
}

.checkbox-wrapper input {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}


.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.button-grid button {
    width: 100%;
    padding: 12px;
    font-size: 0.9rem;

    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.button-grid button:hover {
    background-color: var(--bg-hover);
    border-color: var(--primary-color);
}

button.case-convert-btn {
    color: #a0a0a0 !important;
}

.case-convert-btn:hover {
    background-color: var(--bg-hover);
    border-color: var(--primary-color);
}




.result-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    display: none;

}


.preview-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    margin: 15px 0;
    background-image:
        linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
        linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border: 1px solid var(--border-color);
}


.size-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-family: monospace;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.size-original {
    color: var(--text-muted);
    text-decoration: line-through;
}

.size-new {
    color: #86efac;
    font-weight: 700;
}

.size-saving {
    background-color: rgba(134, 239, 172, 0.1);
    color: #86efac;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    align-self: center;
}


.seo-content {
    max-width: 800px;

    margin: 40px auto;
    padding: 0 20px;
    color: var(--text-main);
}

.seo-content h2 {
    font-size: 1.8rem;
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.seo-content h3 {
    font-size: 1.4rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: #fff;
}

.seo-content p {
    margin-bottom: 20px;
    color: var(--text-muted);
    line-height: 1.7;

    font-size: 1.05rem;
}

.seo-content ul {
    margin-bottom: 20px;
    padding-left: 20px;
    color: var(--text-muted);
}

.seo-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}


.faq-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
}

.faq-question {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
    display: block;
}

.faq-answer {
    color: var(--text-muted);
    font-size: 0.95rem;
}




.timestamp-hero {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.current-time-label {
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.big-timestamp {
    font-family: 'Courier New', Courier, monospace;
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}


.ref-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9rem;
}

.ref-table th,
.ref-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.ref-table th {
    color: var(--text-muted);
    font-weight: 600;
}

.ref-table code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #86efac;
}

.tab-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.tab-group button {
    flex: 1;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.tab-group button.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.stats-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.stats-pill.visible {
    opacity: 1;
}

.stats-good {
    background-color: rgba(134, 239, 172, 0.1);
    color: #86efac;
    border: 1px solid rgba(134, 239, 172, 0.2);
}

.qr-container {
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* The actual QR image/canvas */
#qrPlaceholder {
    background-color: white;
    /* Mandatory for scanning */
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

/* WiFi Inputs Grid */
.wifi-grid {
    display: none;
    /* Hidden by default */
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.wifi-grid.active {
    display: grid;
}

/* =========================================
   PAGE SPECIFIC: COLOR PICKER
   ========================================= */

/* The Info Panel (Swatch + Values) */
.color-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    display: none;
    /* Hidden until image loaded */
    grid-template-columns: 100px 1fr;
    gap: 20px;
    align-items: center;
}

/* The Big Color Square */
.color-swatch {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--bg-input);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    background-color: #000;
}

/* The Value Grid */
.color-values {
    display: grid;
    gap: 10px;
    width: 100%;
}

.value-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.value-label {
    width: 40px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* The Magnifier Lens (Follows Mouse) */
.magnifier {
    position: absolute;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: none;
    pointer-events: none;
    /* Let mouse clicks pass through */
    width: 100px;
    height: 100px;
    overflow: hidden;
    display: none;
    background-color: var(--bg-body);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

/* Crosshair inside magnifier */
.magnifier::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: rgba(255, 0, 0, 0.5);
    /* Semi-transparent red dot */
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

/* The Favorites Section (Hidden by default) */
.favorites-section {
    display: none;
    /* JS will show this if favorites exist */
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.favorites-header {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* The Star Button */
.star-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--border-color);
    /* Gray by default */
    transition: transform 0.2s, color 0.2s;
    z-index: 10;
    /* Ensure it sits on top of the link */
    padding: 0.5rem;
}

.star-btn:hover {
    transform: scale(1.2);
}

/* Tool card needs relative position for absolute star */
.tool-card {
    position: relative;
}

/* Active State (Starred) */
.tool-card.is-favorite .star-btn {
    color: #eab308;
    /* Gold color */
}

/* Animation for moving cards */
@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.tool-card {
    animation: popIn 0.3s ease-out forwards;
}


:root {
    --jwt-header: #ef4444;
    /* Red */
    --jwt-payload: #a855f7;
    /* Purple */
    --jwt-signature: #3b82f6;
    /* Blue */
}

.jwt-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .jwt-container {
        grid-template-columns: 1fr;
    }
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-options {
    margin: 20px 0;
}

.input-section textarea {
    height: 400px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    word-break: break-all;
}

.output-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.jwt-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.jwt-card-header {
    padding: 10px 15px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
}

.header-color {
    border-left: 5px solid var(--jwt-header);
    color: var(--jwt-header);
}

.payload-color {
    border-left: 5px solid var(--jwt-payload);
    color: var(--jwt-payload);
}

.signature-color {
    border-left: 5px solid var(--jwt-signature);
    color: var(--jwt-signature);
}

.small-label {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: normal;
    text-transform: uppercase;
}

.code-block {
    padding: 15px;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-main);
    background-color: var(--bg-input);
}

.signature-block {
    color: var(--jwt-signature);
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* =========================================
   PAGE SPECIFIC: CSS SHADOW GENERATOR
   ========================================= */

.shadow-generator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .shadow-generator-container {
        grid-template-columns: 1fr;
    }
}

/* Controls Section */
.shadow-controls {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.slider-header span {
    color: var(--primary-color);
    font-family: monospace;
}

/* Color and Inset Row */
.color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.color-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.color-input-wrapper label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 50px;
    height: 30px;
    background: none;
    cursor: pointer;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Preview Section */
.shadow-preview-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-canvas {
    background-color: #fff;
    /* White canvas for neutral preview */
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;

    height: 350px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark theme adjustment for canvas if preferred, 
   but white usually works best for shadow visibility. 
   Optionally, you can leave it white to ensure contrast. */

.preview-box {
    width: 150px;
    height: 150px;
    background-color: #3b82f6;
    /* Default Blue Box */
    border-radius: 12px;
    transition: all 0.1s;
}

/* Code Output Area */
.code-output {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    position: relative;
}

.code-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 700;
}

.code-output code {
    display: block;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-main);
    margin-bottom: 15px;
    word-break: break-all;
}

.copy-btn {
    width: 100%;
}

.copy-msg {
    text-align: center;
    color: #86efac;
    font-size: 0.85rem;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.copy-msg.visible {
    opacity: 1;
}

/* =========================================
   PAGE SPECIFIC: CSV/JSON CONVERTER
   ========================================= */

.converter-grid {
    display: grid;
    /* Changed 100px to auto so it expands to fit the text */
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 40px;
    align-items: stretch;
}

.io-column {
    display: flex;
    flex-direction: column;
}

.io-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.io-header label {
    font-weight: 700;
    color: var(--primary-color);
}

.io-actions {
    display: flex;
    gap: 5px;
}

/* Small utility buttons */
.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
}

.btn-xs:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Input Areas */
.io-column textarea {
    flex: 1;
    /* Grow to fill height */
    min-height: 500px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
}

/* Middle Control Column */
.io-controls {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 15px;
}

.io-controls button {
    white-space: nowrap;
    width: 100%;
}

/* =========================================
   PAGE SPECIFIC: IMAGE TO PDF
   ========================================= */

.pdf-preview-area {
    margin-top: 30px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background-color: var(--bg-body);
}

.preview-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-thumb {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.remove-thumb:hover {
    background-color: #ef4444;
}

/* =========================================
   PAGE SPECIFIC: LIST CLEANER
   ========================================= */

.count-badge {
    background-color: var(--bg-input);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    margin-left: 5px;
}

.control-group-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 5px;
    text-align: center;
    width: 100%;
}

/* Ensure textarea styling is consistent for lists */
#inputText,
#outputText {
    white-space: pre;
    overflow-x: auto;
}

/* =========================================
   PAGE SPECIFIC: COLOR SCHEMES
   ========================================= */

.scheme-input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
}

.input-group {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-input-wrapper-lg {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Large Color Picker Override */
.color-input-wrapper-lg input[type="color"] {
    width: 60px;
    height: 48px;
    /* Matches standard input height */
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
}

.base-preview {
    width: 100%;
    max-width: 400px;
    height: 80px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    /* Will need to adapt contrast for light colors ideally */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

.palettes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.palette-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.palette-card h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.palette-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    height: 3em;
    /* Fixed height for alignment */
}

.swatch-row {
    display: flex;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.swatch {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: flex 0.2s;
    font-size: 0.75rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    opacity: 0.9;
}

.swatch:hover {
    flex: 2;
    /* Expand on hover */
    opacity: 1;
}

.swatch span {
    opacity: 0;
    /* Hide text by default */
    transition: opacity 0.2s;
}

.swatch:hover span {
    opacity: 1;
    /* Show hex on hover */
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .converter-grid {
        grid-template-columns: 1fr;
        /* Stack vertically */
    }

    .io-controls {
        flex-direction: row;
        /* Buttons horizontal on mobile */
        flex-wrap: wrap;
    }

    .io-controls button {
        width: auto;
        flex: 1;
    }

    .io-column textarea {
        min-height: 300px;
    }
}

/* =========================================
   PAGE SPECIFIC: GRADIENT GENERATOR
   ========================================= */

.gradient-generator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 900px) {
    .gradient-generator-container {
        grid-template-columns: 1fr;
    }
}

.gradient-controls {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* Color Stops UI */
.stops-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stops-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.stops-header label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stop-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-input);
    padding: 8px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.stop-row input[type="color"] {
    width: 30px;
    height: 30px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    flex-shrink: 0;
}

.stop-slider {
    flex-grow: 1;
}

.stop-val {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 35px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.btn-remove:hover {
    color: #ef4444;
}

.btn-remove:disabled {
    opacity: 0.2;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
    margin-top: 5px;
}

/* Preview Area */
.preview-canvas-lg {
    width: 100%;
    height: 350px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-image:
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: white;
    /* Fallback */
    /* Gradient applied via JS inline */
}

/* =========================================
   PAGE SPECIFIC: SVG TO PNG
   ========================================= */

#workspace {
    display: none;
    /* Toggled by JS */
    gap: 30px;
    margin-top: 20px;
    align-items: flex-start;
}

@media (min-width: 768px) {
    #workspace {
        flex-direction: row;
    }
}

@media (max-width: 767px) {
    #workspace {
        flex-direction: column-reverse;
    }
}

.svg-controls {
    flex: 1;
    max-width: 300px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
    width: 100%;
}

.canvas-wrapper {
    flex: 2;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    width: 100%;
    overflow: hidden;
}

.control-header {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.dimensions-grid {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.dim-input {
    flex: 1;
}

.dim-input label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.dim-separator {
    padding-bottom: 10px;
    color: var(--text-muted);
}

.preview-label {
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Canvas Styling */
#previewCanvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    /* Checkerboard background for transparency */
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: white;
}

/* =========================================
   PAGE SPECIFIC: SQL FORMATTER
   ========================================= */

/* Ensure dropdowns fill the center column width */
.full-select {
    width: 100%;
    margin-bottom: 10px;
    background-color: var(--bg-surface);
}

/* Ensure font is monospaced for code editing */
#sqlInput,
#sqlOutput {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* =========================================
   PAGE SPECIFIC: URL SLUG
   ========================================= */

/* Ensure labels in the control panel are legible */
.checkbox-wrapper label {
    font-size: 0.85rem;
    cursor: pointer;
    user-select: none;
    line-height: 1.2;
}

/* Ensure the output is easy to read */
#slugOutput {
    color: var(--primary-color);
    font-family: monospace;
}

/* =========================================
   PAGE SPECIFIC: FILE HASH TOOL
   ========================================= */

.hash-tool-container {
    max-width: 800px;
    margin: 0 auto 40px auto;
}

.progress-container {
    width: 100%;
    height: 10px;
    background-color: var(--bg-input);
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.2s;
}

.results-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.hash-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hash-label {
    width: 80px;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.hash-row input {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    color: var(--primary-color);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
}

/* =========================================
   PAGE SPECIFIC: EXIF VIEWER
   ========================================= */

.exif-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
}

@media (max-width: 800px) {
    .exif-grid {
        grid-template-columns: 1fr;
    }
}

.image-preview-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#imgPreview {
    width: 100%;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.image-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    background-color: var(--bg-input);
    padding: 10px;
    border-radius: var(--border-radius);
}

.meta-data-col h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.meta-table th,
.meta-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.meta-table th {
    background-color: var(--bg-input);
    font-weight: 700;
    position: sticky;
    top: 0;
}

.meta-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
   PAGE SPECIFIC: HTML ENCODER
   ========================================= */

.ref-section {
    margin-top: 40px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.ref-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary-color);
}

/* Reusing .table-wrapper and .ref-table from earlier if they exist, 
   otherwise defining them here specifically for this tool */

.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ref-table th,
.ref-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.ref-table th {
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.ref-table tr:hover {
    background-color: var(--bg-hover);
}

.ref-table code {
    background-color: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--primary-color);
}

/* =========================================
   PAGE SPECIFIC: CIDR CALCULATOR
   ========================================= */

.cidr-container {
    max-width: 800px;
    margin: 0 auto 40px auto;
}

.cidr-inputs {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 600px) {
    .cidr-inputs {
        grid-template-columns: 1fr;
    }
}

.cidr-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.cidr-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.cidr-table .label {
    font-weight: 700;
    color: var(--text-muted);
    width: 40%;
}

.cidr-table .value {
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1.1rem;
}

.cidr-table .value.highlight {
    color: var(--primary-color);
}

.cidr-table tr:last-child td {
    border-bottom: none;
}

.binary-box {
    margin-top: 30px;
    background-color: var(--bg-input);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.binary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.binary-row:last-child {
    margin-bottom: 0;
}

.binary-row span {
    color: var(--text-muted);
    font-weight: 600;
}

.binary-row code {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
}

/* =========================================
   PAGE SPECIFIC: ASPECT RATIO
   ========================================= */

.ratio-tool-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 800px) {
    .ratio-tool-container {
        grid-template-columns: 1fr;
    }
}

.ratio-controls {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
}

.presets-row {
    margin-bottom: 20px;
}

.presets-row label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-group-xs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-group-xs button {
    padding: 4px 10px;
    font-size: 0.8rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-group-xs button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.calc-row {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
}

.input-col {
    flex: 1;
}

.input-col label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 700;
}

.symbol {
    font-size: 1.5rem;
    color: var(--text-muted);
    padding-bottom: 10px;
    font-weight: 300;
}

.divider {
    border: 0;
    border-top: 1px dashed var(--border-color);
    margin: 20px 0;
}

.hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
    margin-left: 28px;
    /* Align with text of checkbox */
}

/* Preview Column */
.ratio-preview-col {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.preview-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    text-align: center;
}

.preview-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    padding: 20px;
}

.ratio-box {
    background-color: var(--primary-color);
    width: 100%;
    max-width: 300px;
    /* Aspect ratio is set via JS inline */
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* =========================================
   PAGE SPECIFIC: STRING GENERATOR
   ========================================= */

.settings-panel {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.row-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group-sm {
    display: flex;
    flex-direction: column;
}

.input-group-sm label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.divider-sm {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Ensure output area is monospaced for alignment */
#outputText {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre;
    line-height: 1.5;
}

/* =========================================
   PAGE SPECIFIC: STRING ESCAPER
   ========================================= */

#inputText,
#outputText {
    font-family: 'Courier New', Courier, monospace;
    white-space: pre;
    /* Important for seeing line breaks in input */
    line-height: 1.5;
}

/* =========================================
   PAGE SPECIFIC: QR SCANNER
   ========================================= */

.qr-tool-container {
    max-width: 600px;
    margin: 0 auto 40px auto;
}

/* Tabs */
.tab-header {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* View Panels */
.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Camera Viewport */
.scanner-viewport {
    width: 100%;
    height: 400px;
    /* Fixed height for consistency */
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
}

#scanCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Keeps aspect ratio */
}

.cam-loading {
    position: absolute;
    color: #fff;
    z-index: 10;
    text-align: center;
}

.cam-controls {
    margin-top: 15px;
    text-align: center;
}

/* Result Box */
.result-box {
    margin-top: 30px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.type-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    color: white;
    font-weight: 700;
}

.result-box textarea {
    height: 100px;
    margin-bottom: 15px;
    font-family: monospace;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.result-actions>* {
    flex: 1;
}

/* =========================================
   PAGE SPECIFIC: IMAGE SPLITTER
   ========================================= */

.splitter-container {
    max-width: 1000px;
    margin: 0 auto 40px auto;
}

.splitter-controls {
    flex: 0 0 300px;
    /* Fixed width sidebar */
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
}

.splitter-preview {
    flex: 1;
    overflow: auto;
    /* Allows scrolling if image is huge */
    max-height: 800px;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: white;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Align top so we can see 0,0 */
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Ensure canvas doesn't stretch weirdly */
.splitter-preview canvas {
    max-width: none;
    /* Allow full resolution */
    width: auto;
    height: auto;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    .splitter-preview canvas {
        max-width: 100%;
        /* On mobile, fit to screen */
    }
}

@media (max-width: 768px) {

    /* Stack the left/right columns on mobile */
    .converter-grid {
        flex-direction: column;
    }

    .io-column {
        flex: 1 1 auto !important;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .hash-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        margin-bottom: 10px;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 10px;
    }

    .hash-row input {
        width: 100%;
    }

    .hash-row button {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .color-panel {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .color-swatch {
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .input-grid {
        grid-template-columns: 1fr;
    }

    textarea.diff-input {
        height: 200px;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Adjustment */
@media (max-width: 768px) {
    .toolbar-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .sort-container {
        width: 100%;
    }

    .sort-container select {
        width: 100%;
    }
}