*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    --header-height: 64px;
}

body {
    margin: 0;
    background: #F8FAFC;
    color: #18181B;
    font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

a {
    color: #4F46E5;
}

a:hover {
    color: #4338CA;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 40;
    padding: 8px 12px;
    border-radius: 8px;
    background: #4F46E5;
    color: #FFFFFF;
    text-decoration: none;
}

.skip-link:focus {
    top: 8px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--header-height);
    background: #F8FAFC;
    border-bottom: 1px solid #E5E7EB;
}

.header-bar {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 20px;
    padding: 0 20px 0 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.logo__image {
    display: block;
    height: 36px;
    width: auto;
    max-width: min(200px, 52vw);
    object-fit: contain;
}

.primary-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.primary-nav a {
    color: #3F3F46;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.primary-nav a[aria-current="page"] {
    color: #4F46E5;
}

.primary-nav a.button-primary,
.primary-nav a.button-primary:hover {
    color: #FFFFFF;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.icon-button,
.button,
.button-small,
.search-clear,
.favorite-button,
.order-controls button {
    cursor: pointer;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #FFFFFF;
    color: #3F3F46;
}

.button,
.button-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.button {
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
}

.button-primary {
    background: #4F46E5;
    color: #FFFFFF;
}

.button-primary:hover {
    background: #4338CA;
    color: #FFFFFF;
}

.button-small {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #FFFFFF;
    color: #3F3F46;
}

.button-small[aria-pressed="true"] {
    border-color: transparent;
    background: #EEF2FF;
    color: #4F46E5;
}

.hero {
    padding: 36px 0 28px;
    text-align: center;
}

.hero h1,
.page-intro h1,
.prose h1 {
    margin: 0 0 12px;
    color: #18181B;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.hero p,
.page-intro p {
    margin: 0;
    color: #71717A;
    font-size: 16px;
}

.hero p {
    margin-bottom: 24px;
}

.search-form {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    color: #71717A;
    transform: translateY(-50%);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 56px;
    padding: 0 76px 0 48px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    color: #18181B;
    font-size: 16px;
}

.search-input:focus {
    border-color: #4F46E5;
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.search-input::-webkit-search-cancel-button {
    display: none;
}

.search-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #71717A;
    font-size: 14px;
    font-weight: 600;
    transform: translateY(-50%);
}

.search-clear:hover {
    color: #18181B;
}

.search-status,
.result-count,
.section-note {
    margin: 12px 0 0;
    color: #71717A;
    font-size: 13px;
}

.page-search {
    padding-top: 24px;
}

.browse-main .page-search {
    padding-top: 0;
    margin-bottom: 30px;
}

.page-search .search-form {
    max-width: none;
    margin: 0;
}

.browse-main .page-search .search-form {
    width: max(calc(50% + 30px), 500px);
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
}

.page-intro {
    padding: 8px 0 20px;
}

.browse-hero {
    margin: 0 0 16px;
    text-align: center;
}

.browse-hero h1 {
    margin: 0 0 6px;
    color: #18181B;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.browse-hero p {
    margin: 0;
    color: #71717A;
    font-size: 15px;
}

.browse-layout {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 0;
    align-items: start;
    width: 100%;
    margin: 0;
    padding: 0 0 0 3px;
}

.browse-main {
    min-width: 0;
    padding: 16px 30px 0;
    container-type: inline-size;
}

.category-nav {
    position: sticky;
    top: var(--header-height);
    z-index: 16;
    width: 44px;
    max-height: calc(100vh - var(--header-height) - 8px);
    margin: 0;
    overflow: visible;
}

.category-nav ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 44px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #F8FAFC;
    border-radius: 0 12px 12px 0;
    transition: width 0.16s ease;
}

.category-nav:hover ul,
.category-nav:focus-within ul {
    width: 220px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 40px;
    height: 40px;
    margin: 0 auto;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #3F3F46;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    text-decoration: none;
}

.category-nav:hover .chip,
.category-nav:focus-within .chip {
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0 12px;
}

.chip-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
}

.chip-copy {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.category-nav:hover .chip-copy,
.category-nav:focus-within .chip-copy {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

.chip-label {
    color: #18181B;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.category-nav:hover .chip:hover,
.category-nav:focus-within .chip:hover {
    background: #EEF2FF;
    color: #4338CA;
}

.chip[aria-current="true"] {
    border-color: transparent;
    background: #EEF2FF;
    color: #4F46E5;
}

.category-nav:hover .chip[aria-current="true"]:hover,
.category-nav:focus-within .chip[aria-current="true"]:hover {
    background: #E0E7FF;
    color: #4338CA;
}

.chip[aria-current="true"] .chip-label {
    color: #4F46E5;
}

.category-section,
.quick-access,
#search,
#browse {
    margin-bottom: 32px;
    scroll-margin-top: calc(var(--header-height) + 12px);
}

#search,
#browse {
    margin-bottom: 0;
}

.browse-main #search {
    margin-bottom: 30px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.section-head h2,
.prose h2 {
    margin: 0;
    color: #18181B;
    font-size: 20px;
    font-weight: 600;
}

.more-link {
    color: #4F46E5;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.more-link:hover {
    color: #4338CA;
}

.more-link::after {
    content: " →";
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
    gap: 12px;
}

/* Avoid flash of 10 cards before JS fits to 2 rows: show at most 6 until fitted. */
body[data-page="home"] .category-section .tool-grid:not(.is-fitted) .tool-card:nth-child(n + 7) {
    display: none !important;
}

.tool-card {
    position: relative;
    min-width: 0;
    min-height: 84px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tool-card:hover {
    border-color: #C7D2FE;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.tool-card.is-drop-target {
    outline: 2px dashed #4F46E5;
    outline-offset: 2px;
}

.tool-card__link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 84px;
    padding: 12px 52px 12px 12px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}

.tool-card__detail {
    position: absolute;
    top: 40px;
    right: 8px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
    padding: 0 4px;
    border-radius: 6px;
    color: #4F46E5;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.tool-card__detail:hover {
    background: #EEF2FF;
    text-decoration: none;
}

.tool-card.is-editable .tool-card__link {
    padding-left: 40px;
}

.tool-logo {
    display: inline-flex;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #EEF2FF;
    color: #4338CA;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
}

.tool-logo--image {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    padding: 0;
}

.tool-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-card__body {
    min-width: 0;
}

.tool-card__title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tool-card__name {
    overflow: hidden;
    color: #3F3F46;
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tool-card__tagline {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 2px;
    color: #71717A;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.badge {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 6px;
    background: #EEF2FF;
    color: #4338CA;
    font-size: 11px;
    font-weight: 700;
}

.favorite-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #71717A;
}

.favorite-button:hover,
.favorite-button[aria-pressed="true"] {
    color: #4F46E5;
}

.favorite-button svg {
    fill: none;
    stroke: currentColor;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.favorite-button[aria-pressed="true"] svg {
    fill: currentColor;
}

.order-controls {
    position: absolute;
    top: 50%;
    left: 6px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transform: translateY(-50%);
}

.order-controls button {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    background: #FFFFFF;
    color: #3F3F46;
    font-size: 12px;
    line-height: 1;
}

.order-controls button:disabled {
    cursor: default;
    opacity: 0.35;
}

.empty-state {
    margin: 8px 0 32px;
    padding: 28px 20px;
    border: 1px dashed #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    text-align: center;
}

.empty-state p {
    margin: 0 0 16px;
    color: #3F3F46;
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.prose {
    max-width: 720px;
    padding: 32px 0 48px;
}

.prose p {
    color: #3F3F46;
    font-size: 16px;
    line-height: 1.6;
}

.prose h2,
.prose h3 {
    margin: 28px 0 8px;
}

.prose ul,
.prose ol {
    margin: 0 0 16px;
    padding-left: 1.25em;
    color: #3F3F46;
    line-height: 1.6;
}

.prose blockquote {
    margin: 16px 0;
    padding: 8px 14px;
    border-left: 3px solid #C7D2FE;
    color: #52525B;
}

.prose pre,
.prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.prose pre {
    overflow: auto;
    padding: 12px 14px;
    border-radius: 8px;
    background: #F4F4F5;
}

.prose a {
    color: #4F46E5;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 16px 0;
    border-radius: 8px;
}

.prose table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
    font-size: 15px;
}

.prose th,
.prose td {
    padding: 10px 12px;
    border: 1px solid #E4E4E7;
    text-align: left;
    vertical-align: top;
}

.prose th {
    background: #F4F4F5;
    font-weight: 600;
    color: #18181B;
}

.prose tbody tr:nth-child(even) td {
    background: #FAFAFA;
}

.tool-logo--lg {
    flex-basis: 72px;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    font-size: 22px;
}

.tool-detail {
    padding: 28px 0 48px;
}

.tool-detail__header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
}

.tool-detail__heading {
    min-width: 0;
}

.tool-detail__heading h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.03em;
}

.tool-detail__tagline {
    margin: 8px 0 0;
    color: #71717A;
    font-size: 16px;
    line-height: 1.5;
}

.tool-detail__actions {
    margin: 16px 0 0;
}

.tool-detail__body {
    margin-bottom: 24px;
}

.tool-detail__description.prose {
    max-width: none;
    padding: 0;
}

.tool-detail__back {
    margin: 0;
}

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

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

.site-footer {
    margin-top: 16px;
    padding: 24px 0 32px;
    border-top: 1px solid #E5E7EB;
    color: #71717A;
    font-size: 13px;
}

.footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
}

.footer-bar p {
    margin: 0;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-nav a {
    color: #3F3F46;
    text-decoration: none;
}

.footer-nav a:hover {
    color: #4F46E5;
}

:focus-visible {
    outline: 2px solid #4F46E5;
    outline-offset: 2px;
}

@media (min-width: 640px) {
    .container {
        width: min(1200px, calc(100% - 48px));
    }
}

@media (min-width: 1024px) {
    .browse-hero h1 {
        font-size: 32px;
    }
}

@media (max-width: 639px) {
    .browse-layout {
        gap: 0;
        padding-right: 0;
    }

    .browse-hero h1 {
        font-size: 24px;
    }
}

.submit-tool-page {
    padding: 28px 0 64px;
    background:
        radial-gradient(ellipse 80% 50% at 10% -10%, rgba(79, 70, 229, 0.10), transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 0%, rgba(56, 189, 248, 0.08), transparent 50%),
        #F8FAFC;
}

.submit-tool-page .submit-tool {
    width: min(920px, 100%);
    margin: 0 auto;
}

.submit-tool-page .submit-tool__hero {
    max-width: 560px;
    margin: 0 0 24px;
}

.submit-tool-page .submit-tool__eyebrow {
    margin: 0 0 10px;
    color: #4F46E5;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.submit-tool-page .submit-tool__hero h1 {
    margin: 0 0 10px;
    font-size: 32px;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.submit-tool-page .submit-tool__lead {
    margin: 0;
    color: #52525B;
    font-size: 16px;
    line-height: 1.55;
}

.submit-tool-page .submit-tool__flash,
.submit-tool-page .submit-tool__error {
    display: block;
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 12px;
}

.submit-tool-page .submit-tool__flash {
    border: 1px solid #A7F3D0;
    background: #ECFDF5;
    color: #047857;
}

.submit-tool-page .submit-tool__flash strong {
    display: block;
    margin-bottom: 4px;
}

.submit-tool-page .submit-tool__flash span {
    display: block;
    font-size: 14px;
    line-height: 1.45;
}

.submit-tool-page .submit-tool__error {
    border: 1px solid #FECACA;
    background: #FEF2F2;
    color: #991B1B;
}

.submit-tool-page .submit-tool__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.submit-tool-page .submit-tool__panel,
.submit-tool-page .submit-tool__aside {
    display: block;
    padding: 24px;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    background: #FFFFFF;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.submit-tool-page .submit-tool__form {
    display: block;
    margin: 0;
}

.submit-tool-page .submit-tool__hp {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.submit-tool-page .submit-tool__field {
    display: block;
    width: 100%;
    margin: 0 0 18px;
}

.submit-tool-page .submit-tool__label {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    color: #3F3F46;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.submit-tool-page .submit-tool__control {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #FFFFFF;
    color: #18181B;
    font: inherit;
    line-height: 1.4;
    vertical-align: top;
}

.submit-tool-page .submit-tool__textarea {
    min-height: 140px;
    resize: vertical;
}

.submit-tool-page .submit-tool__control::placeholder {
    color: #A1A1AA;
}

.submit-tool-page .submit-tool__control:hover {
    border-color: #C7D2FE;
}

.submit-tool-page .submit-tool__control:focus {
    outline: none;
    border-color: #818CF8;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.submit-tool-page .submit-tool__field-error {
    display: block;
    margin: 6px 0 0;
    color: #DC2626;
    font-size: 13px;
}

.submit-tool-page .submit-tool__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-top: 4px;
}

.submit-tool-page .submit-tool__submit {
    min-width: 148px;
}

.submit-tool-page .submit-tool__note {
    margin: 0;
    color: #71717A;
    font-size: 13px;
}

.submit-tool-page .submit-tool__aside {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

.submit-tool-page .submit-tool__aside-title {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.submit-tool-page .submit-tool__steps {
    display: block;
    margin: 0;
    padding: 0;
}

.submit-tool-page .submit-tool__step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 16px;
}

.submit-tool-page .submit-tool__step:last-child {
    margin-bottom: 0;
}

.submit-tool-page .submit-tool__step-num {
    display: inline-flex;
    flex: 0 0 28px;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #EEF2FF;
    color: #4F46E5;
    font-size: 12px;
    font-weight: 700;
}

.submit-tool-page .submit-tool__step-body {
    min-width: 0;
    flex: 1 1 auto;
}

.submit-tool-page .submit-tool__step-body strong {
    display: block;
    margin: 0 0 4px;
    font-size: 14px;
}

.submit-tool-page .submit-tool__step-body p {
    margin: 0;
    color: #71717A;
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 799px) {
    .submit-tool-page .submit-tool__hero h1 {
        font-size: 28px;
    }

    .submit-tool-page .submit-tool__layout {
        grid-template-columns: 1fr;
    }

    .submit-tool-page .submit-tool__panel,
    .submit-tool-page .submit-tool__aside {
        padding: 20px 16px;
    }
}
