* {
    box-sizing: border-box;
}

:root {
    --site-shell-max-width: 1100px;
    --site-page-gutter: clamp(12px, 2.4vw, 22px);
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #6631e1 0%, #ffffff 100%);
    color: #1a202c;
    min-height: 100vh;
    padding: var(--site-page-gutter);
}

.page-shell {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    max-width: var(--site-shell-max-width);
    margin: 0 auto;
    padding: clamp(24px, 3vw, 36px) clamp(16px, 3vw, 32px) clamp(22px, 2.8vw, 32px);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.24);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #4a5568;
    margin-bottom: 18px;
}

.breadcrumbs a {
    color: #5b46d8;
    text-decoration: none;
    font-weight: 600;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

h1 {
    margin: 0;
    font-size: 34px;
    line-height: 1.2;
    color: #1a202c;
}

.page-intro {
    margin: 12px 0 0;
    font-size: 15px;
    line-height: 1.7;
    color: #334155;
}

.page-grid {
    margin-top: 26px;
    display: grid;
    gap: 18px;
}

.page-grid > .card + .card {
    margin-top: 2px;
}

.card {
    background: #f8fbff;
    border: 1px solid #dbe5f1;
    border-radius: 16px;
    padding: 20px;
}

.tool-trust-note {
    border-color: #c8d7f0;
    background: #f4f8ff;
}

.page-grid .ad-inline-slot {
    margin: 0;
    max-width: 100%;
}

.tool-primary-card {
    border-color: #c6d7f2;
    box-shadow: 0 8px 24px rgba(48, 76, 132, 0.08);
}

.support-notes {
    background: #f9fbff;
}

.support-notes .file-list {
    margin-top: 6px;
}

.support-notes .file-list li {
    line-height: 1.65;
    color: #334155;
}

.card h2 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #273469;
}

.card p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
}

.tool-form {
    display: grid;
    gap: 12px;
}

.tool-native-hidden-select {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.tool-segmented-wrap {
    display: grid;
    gap: 8px;
}

.tool-segmented-label {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #273469;
}

.tool-segmented-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-segmented-btn {
    background: #eef3ff;
    color: #273469;
    border: 1px solid #c3d4ed;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.tool-segmented-btn:hover {
    background: #e2eaff;
}

.tool-segmented-btn.is-active {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4338ca;
}

.tool-form-inline {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label {
    font-size: 13px;
    font-weight: 600;
    color: #273469;
}

input,
textarea,
select,
button {
    font: inherit;
}

input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1.5px solid #b9c9df;
    background: white;
    color: #1f2937;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    border: 1.5px solid #9fb3d7;
    border-radius: 4px;
    accent-color: #4f46e5;
    background: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
}

.compact-textarea {
    min-height: 84px;
}

button {
    border: 0;
    border-radius: 10px;
    padding: 11px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

button.secondary {
    background: #334155;
}

button.ghost {
    background: #e2e8f0;
    color: #1f2937;
}

button:hover {
    filter: brightness(1.03);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tool-preset-btn.is-active {
    background: #2f3f86;
    color: #ffffff;
    border-color: #26346d;
    box-shadow: 0 6px 14px rgba(37, 56, 107, 0.28);
}

.tool-checkbox-card {
    border: 1px solid #d5e0f2;
    border-radius: 12px;
    background: #f8fbff;
    padding: 10px 12px;
}

.tool-checkbox-label {
    margin: 0;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
}

.tool-checkbox-copy {
    display: grid;
    gap: 2px;
}

.tool-checkbox-title {
    font-size: 13px;
    font-weight: 700;
    color: #22386d;
    line-height: 1.4;
}

.tool-checkbox-hint {
    font-size: 12px;
    color: #475569;
    line-height: 1.4;
}

.result-heading {
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1e3a8a;
    text-transform: uppercase;
}

.result-primary-card {
    margin-top: 4px;
    border-radius: 12px;
    border: 1px solid #96b1db;
    background: linear-gradient(180deg, #f4f8ff 0%, #ebf3ff 100%);
    padding: 12px 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.result-primary-card.is-revealed {
    border-color: #7f9fce;
    box-shadow: 0 8px 20px rgba(42, 71, 126, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.74);
    transform: translateY(-1px);
}

.result-primary-label {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #1e3a8a;
}

.result-primary-value {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 16px;
    line-height: 1.5;
    color: #111827;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.result-secondary-heading {
    margin: 10px 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #475569;
}

.result-details-box {
    margin-top: 4px;
    border-radius: 12px;
    border: 1px solid #d2deee;
    background: #f8fbff;
    padding: 12px 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
    color: #334155;
    transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.result-details-box.is-revealed {
    border-color: #c2d3ea;
    box-shadow: 0 6px 16px rgba(57, 80, 120, 0.1);
    transform: translateY(-1px);
}

.result-box {
    margin-top: 4px;
    border-radius: 12px;
    border: 1px solid #bfcfe8;
    background: linear-gradient(180deg, #f4f8ff 0%, #ecf3ff 100%);
    padding: 14px;
    min-height: 52px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.result-box.is-revealed {
    border-color: #96b1db;
    box-shadow: 0 8px 20px rgba(42, 71, 126, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.72);
    transform: translateY(-1px);
}

.result-box--raw {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.status-line {
    margin: 6px 0 0;
    font-size: 13px;
    color: #475569;
}

.status-line.processing {
    color: #1d4ed8;
    font-weight: 600;
}

.status-line.error {
    color: #b91c1c;
    font-weight: 600;
}

.tool-action-bar {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-action-btn {
    padding: 9px 13px;
    font-size: 13px;
    border-radius: 9px;
    box-shadow: 0 4px 10px rgba(24, 33, 54, 0.12);
}

.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    border: 1px solid #d7e3f3;
    background: #f9fbff;
    border-radius: 12px;
    padding: 12px 14px;
}

.faq-item h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #22386d;
}

.faq-item p {
    margin: 0;
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

.tool-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.tool-links a {
    color: #4c1d95;
    text-decoration: none;
    font-weight: 600;
}

.tool-links a:hover {
    text-decoration: underline;
}

.tool-directory-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.directory-controls-card {
    background: #f6f9ff;
    border-color: #cfdcf3;
}

.directory-controls-card h2 {
    margin-bottom: 8px;
}

.directory-controls-row {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
}

.directory-controls-row input[type="search"] {
    min-height: 44px;
    border-width: 1.8px;
    border-color: #9eb4de;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.directory-controls-row input[type="search"]:focus {
    outline: none;
    border-color: #546ddf;
    box-shadow: 0 0 0 3px rgba(84, 109, 223, 0.16);
}

.directory-count {
    margin: 0;
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}

#toolsDirectoryEmptyState {
    margin-top: 10px;
    color: #475569;
}

.tool-directory-card[hidden] {
    display: none !important;
}

.tool-directory-card {
    display: block;
    border: 1px solid #d9e4f4;
    border-radius: 14px;
    padding: 14px;
    background: #f9fbff;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.tool-directory-card:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 8px 16px rgba(20, 39, 88, 0.1);
    border-color: #c4d3ee;
    background: #f5f9ff;
}

.tool-directory-card:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 2px;
}

.tool-directory-card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: #312e81;
}

.tool-directory-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.tool-directory-card-head h3 {
    margin: 0;
    flex: 1;
}

.tool-priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #c9d6ef;
    background: #eef3ff;
    color: #374151;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 3px 7px;
    flex-shrink: 0;
}

.tool-directory-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: #334155;
}

.footer-links {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid #d7e3f3;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
}

.footer-links a {
    color: #5b46d8;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.footer-links a:hover {
    text-decoration: underline;
}

.helper-note {
    margin: 6px 0 0;
    font-size: 13px;
    color: #475569;
}

.output-download {
    margin-top: 10px;
}

.output-download a {
    color: #1e40af;
    font-weight: 600;
    text-decoration: none;
}

.output-download a:hover {
    text-decoration: underline;
}

.preview-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.preview-grid img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d7e3f3;
    background: white;
}

.file-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.category-nav {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-nav a {
    color: #312e81;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    background: #eef3ff;
    border: 1px solid #d2dcf3;
    border-radius: 999px;
    padding: 6px 10px;
}

.category-nav a:hover {
    background: #e0eaff;
}

@media (max-width: 900px) {
    .page-shell {
        border-radius: 20px;
        padding: 24px 18px 22px;
    }

    h1 {
        font-size: 28px;
    }

    .page-grid {
        gap: 14px;
    }

    .card {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .page-shell {
        border-radius: 18px;
        padding: 22px 14px 18px;
    }

    .tool-form-inline,
    .tool-directory-grid {
        grid-template-columns: 1fr;
    }

    .directory-controls-row {
        grid-template-columns: 1fr;
    }
}
