:root {
    --bg: #f7f8fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #92003b;
    --primary-dark: #6d002c;
    --success: #059669;
    --warning: #d97706;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}

.site-nav a {
    font-weight: 600;
}

.hero {
    padding: 3.5rem 0 2.5rem;
    background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
}

.hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 4vw, 3rem);
}

.hero-lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 1.1rem;
}

.search-wrap {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#tool-search {
    flex: 1;
    padding: 0.95rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    font-size: 1rem;
    background: var(--surface);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#tool-search:focus {
    outline: none;
    border-color: rgba(146, 0, 59, 0.35);
    box-shadow: 0 0 0 4px rgba(146, 0, 59, 0.08);
}

.tool-count {
    color: var(--muted);
    white-space: nowrap;
}

.tools-listing {
    padding-bottom: 4rem;
}

.tool-category {
    margin-bottom: 3rem;
}

.tool-category-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.tool-category h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.tool-category-count {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 600;
}

.tool-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.tool-card-link {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.25rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tool-card-link::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #c026d3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tool-card-link:hover {
    border-color: rgba(146, 0, 59, 0.25);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
    transform: translateY(-3px);
    text-decoration: none;
}

.tool-card-link:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(146, 0, 59, 0.12);
}

.tool-card-link:hover::before {
    opacity: 1;
}

.tool-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.tool-icon svg {
    width: 22px;
    height: 22px;
}

.tool-icon--image { background: #dbeafe; color: #2563eb; }
.tool-icon--code { background: #ede9fe; color: #7c3aed; }
.tool-icon--color { background: #fce7f3; color: #db2777; }
.tool-icon--text { background: #fef3c7; color: #d97706; }
.tool-icon--calculator { background: #dcfce7; color: #16a34a; }
.tool-icon--converter { background: #cffafe; color: #0891b2; }
.tool-icon--generator { background: #ffedd5; color: #ea580c; }
.tool-icon--marketing { background: #e0e7ff; color: #4f46e5; }
.tool-icon--network { background: #ccfbf1; color: #0d9488; }
.tool-icon--document { background: #f3f4f6; color: #4b5563; }
.tool-icon--accessibility { background: #fae8ff; color: #a21caf; }
.tool-icon--finance { background: #ecfccb; color: #65a30d; }
.tool-icon--commerce { background: #fee2e2; color: #dc2626; }
.tool-icon--tool { background: #f3f4f6; color: #374151; }

.tool-name {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.tool-desc {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.tool-action-arrow {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.tool-card-link:hover .tool-action-arrow {
    transform: translateX(2px);
}

.status-complete.tool-action {
    background: #ecfdf5;
    color: #047857;
}

.status-pending.tool-action,
.status-scaffold.tool-action {
    background: #fef3c7;
    color: #92400e;
}

.status-missing.tool-action {
    background: #f3f4f6;
    color: #6b7280;
}

.tool-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: fit-content;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-scaffold {
    background: #e0e7ff;
    color: #3730a3;
}

.status-complete {
    background: #d1fae5;
    color: #065f46;
}

.no-results {
    text-align: center;
    color: var(--muted);
}

.tool-page {
    padding: 0 0 4rem;
}

.tool-detail .site-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
}

.tool-hero {
    background: linear-gradient(135deg, #fff 0%, #fdf2f8 45%, #eef2ff 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.75rem 0 2rem;
    margin-bottom: 2rem;
}

.tool-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 1.25rem;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.tool-breadcrumb a {
    color: var(--muted);
    text-decoration: none;
}

.tool-breadcrumb a:hover {
    color: var(--primary);
    text-decoration: none;
}

.tool-breadcrumb-sep {
    color: #cbd5e1;
}

.tool-breadcrumb-current {
    color: var(--text);
}

.tool-hero-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.tool-hero-main {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
    min-width: 0;
}

.tool-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    flex-shrink: 0;
}

.tool-hero-icon svg {
    width: 28px;
    height: 28px;
}

.tool-hero-content h1 {
    margin: 0.35rem 0 0.65rem;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.tool-hero-desc {
    margin: 0;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.65;
    max-width: 720px;
}

.tool-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(146, 0, 59, 0.08);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.95rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-back-link svg {
    width: 16px;
    height: 16px;
}

.tool-back-link:hover {
    border-color: rgba(146, 0, 59, 0.25);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    text-decoration: none;
}

.tool-body {
    display: grid;
    gap: 1.5rem;
}

.tool-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    padding: 1.75rem;
}

.tool-panel + .tool-panel {
    margin-top: 0;
}

.tool-toolbar,
.tool-panel > .control-row:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    margin: -0.25rem 0 1.25rem;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: linear-gradient(180deg, #fafbfc 0%, #f8fafc 100%);
}

.tool-panel > .tool-toolbar:first-child,
.tool-panel > .control-row:first-child {
    margin-top: 0;
}

.tool-panel textarea:not(.tool-textarea),
.tool-panel input[type="text"],
.tool-panel input[type="number"],
.tool-panel input[type="email"],
.tool-panel input[type="search"],
.tool-panel select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-panel textarea:not(.tool-textarea) {
    min-height: 180px;
    line-height: 1.55;
    resize: vertical;
}

.tool-panel textarea[readonly] {
    background: #f8fafc;
}

.tool-panel label strong {
    font-weight: 600;
}

#tool-root {
    display: grid;
    gap: 0.25rem;
}

.tool-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-field label,
.tool-inline-field {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}

.tool-inline-field {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-input,
.tool-select {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-input-sm {
    width: 110px;
}

.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
    outline: none;
    border-color: rgba(146, 0, 59, 0.35);
    box-shadow: 0 0 0 4px rgba(146, 0, 59, 0.08);
}

.tool-io-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.tool-input-grid {
    margin-bottom: 0.5rem;
}

.tool-field-card {
    background: #fafbfc;
}

.tool-result-highlight {
    background: linear-gradient(180deg, #fff7fb 0%, #fff 100%);
    border-color: rgba(146, 0, 59, 0.12);
}

.tool-results .result-card {
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.breadcrumb {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.tool-header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
}

.tool-header p {
    margin: 0 0 2rem;
    color: var(--muted);
    max-width: 720px;
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone.dragover,
.dropzone:hover {
    border-color: var(--primary);
    background: #fff7fb;
}

.dropzone input[type="file"] {
    display: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    border-radius: 999px;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #eef2ff;
    color: #312e81;
}

.btn-secondary:hover {
    background: #e0e7ff;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(146, 0, 59, 0.15);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tool-controls {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.control-row label {
    font-weight: 600;
}

.control-row input[type="range"] {
    flex: 1;
    min-width: 180px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: #fcfcfd;
}

.result-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.preview-box {
    width: 100%;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.preview-box img {
    max-width: 100%;
    max-height: 180px;
}

.stat {
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-muted {
    color: var(--muted);
    font-size: 0.95rem;
}

.alert {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 2rem 0;
    color: var(--muted);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
}

.footer-brand {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.footer-note {
    margin: 0;
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0;
}

@media (max-width: 640px) {
    .search-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .tool-hero-inner {
        flex-direction: column;
    }

    .tool-back-link {
        align-self: flex-start;
    }

    .tool-io-grid {
        grid-template-columns: 1fr;
    }

    .tool-panel {
        padding: 1.25rem;
    }
}

.tool-textarea {
    width: 100%;
    margin-top: 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    resize: vertical;
    min-height: 180px;
    background: #fff;
    line-height: 1.55;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tool-textarea[readonly] {
    background: #f8fafc;
}

.tool-textarea.mono {
    font-family: Consolas, Monaco, monospace;
}

.text-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.diff-output {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.diff-line-added {
    background: rgba(16, 185, 129, 0.25);
    display: block;
}

.diff-line-removed {
    background: rgba(239, 68, 68, 0.25);
    display: block;
}

.diff-line-same {
    display: block;
    color: #94a3b8;
}

.diff-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tag {
    background: #eef2ff;
    color: #312e81;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.tailwind-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: var(--surface);
}

.tailwind-panel-header {
    background: #0f172a;
    color: #fff;
    padding: 0.85rem 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.tailwind-panel-body {
    padding: 1.25rem;
}

.tailwind-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
}

.tailwind-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.tailwind-field input[type="text"] {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

.tailwind-color-input {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tailwind-color-input input[type="color"] {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
}

.tailwind-color-input input[type="text"] {
    flex: 1;
    font-family: Consolas, Monaco, monospace;
    text-transform: lowercase;
}

.tailwind-swatches {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.tailwind-swatch {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.65rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.tailwind-swatch:hover {
    transform: scale(1.03);
    z-index: 1;
}

.tailwind-swatch small {
    display: block;
    font-size: 0.72rem;
    opacity: 0.9;
    font-family: Consolas, Monaco, monospace;
}

.tailwind-config-code {
    background: #111827;
    color: #e5e7eb;
    padding: 1rem 1.25rem;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    margin: 0;
    min-height: 180px;
}

@media (max-width: 900px) {
    .tailwind-controls {
        grid-template-columns: 1fr;
    }

    .tailwind-swatches {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .tailwind-swatches {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
