.crafting-recipes-page {
    --craft-surface: rgba(15, 23, 42, 0.86);
    --craft-surface-strong: rgba(2, 6, 23, 0.72);
    --craft-border: rgba(148, 163, 184, 0.2);
    --craft-green: #34d399;
    --craft-gold: #facc15;
    --craft-blue: #38bdf8;
    max-width: 1500px;
}

.crafting-hero {
    border: 1px solid var(--craft-border);
    background:
        radial-gradient(circle at 18% 18%, rgba(52, 211, 153, 0.18), transparent 28%),
        radial-gradient(circle at 84% 10%, rgba(56, 189, 248, 0.14), transparent 24%),
        linear-gradient(135deg, rgba(12, 18, 32, 0.98), rgba(30, 41, 59, 0.94));
    border-radius: 1rem;
    overflow: hidden;
}

.crafting-workbench {
    display: grid;
    gap: 1.25rem;
    align-items: start;
}

.crafting-index,
.crafting-detail {
    border: 1px solid var(--craft-border);
    border-radius: 1rem;
    background: var(--craft-surface);
    box-shadow: 0 22px 70px rgba(2, 6, 23, 0.18);
}

.crafting-search {
    width: 100%;
    min-height: 48px;
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(2, 6, 23, 0.5);
    color: #f8fafc;
    outline: none;
}

.crafting-search:focus {
    border-color: rgba(52, 211, 153, 0.72);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.crafting-filter,
.crafting-chip {
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.64);
    color: #cbd5e1;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.crafting-filter {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-radius: 0.75rem;
}

.crafting-chip {
    min-height: 32px;
    border-radius: 999px;
}

.crafting-filter:hover,
.crafting-chip:hover,
.crafting-filter.is-active,
.crafting-chip.is-active {
    border-color: rgba(52, 211, 153, 0.62);
    background: rgba(52, 211, 153, 0.14);
    color: #ecfdf5;
}

.crafting-filter-count {
    min-width: 2.2rem;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.42);
    padding: 0.12rem 0.45rem;
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
}

.crafting-list {
    display: flex;
    max-height: min(72vh, 820px);
    flex-direction: column;
    gap: 0.45rem;
    overflow: auto;
    padding-right: 0.25rem;
}

.crafting-list-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.crafting-list-heading {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.96);
    padding: 0.5rem 0.25rem 0.45rem;
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 800;
}

.crafting-list-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    min-height: 62px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 0.75rem;
    background: rgba(2, 6, 23, 0.35);
    padding: 0.55rem 0.65rem;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.crafting-list-item:hover,
.crafting-list-item.is-active {
    border-color: rgba(52, 211, 153, 0.55);
    background: rgba(15, 23, 42, 0.92);
}

.crafting-list-item:hover {
    transform: translateY(-1px);
}

.crafting-list-icon,
.crafting-material-icon,
.crafting-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0.65rem;
    background: rgba(2, 6, 23, 0.44);
}

.crafting-list-icon {
    width: 42px;
    height: 42px;
}

.crafting-list-copy,
.crafting-list-meta {
    min-width: 0;
}

.crafting-list-copy strong,
.crafting-material-main strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #f8fafc;
    font-size: 0.9rem;
}

.crafting-list-copy small,
.crafting-material-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #94a3b8;
    font-size: 0.72rem;
}

.crafting-list-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 800;
}

.crafting-empty {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.75rem;
    background: rgba(2, 6, 23, 0.36);
}

.crafting-detail-inner {
    min-height: 620px;
}

.crafting-detail-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
}

.crafting-detail-head h2 {
    margin: 0;
    overflow-wrap: anywhere;
    color: #ffffff;
    font-size: clamp(1.35rem, 2vw, 2rem);
    font-weight: 900;
    line-height: 1.15;
}

.crafting-detail-head p {
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
    color: #94a3b8;
    font-size: 0.78rem;
}

.crafting-detail-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.crafting-detail-tags span,
.crafting-materials-head span {
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.12);
    padding: 0.3rem 0.65rem;
    color: #bbf7d0;
    font-size: 0.72rem;
    font-weight: 800;
}

.crafting-table {
    display: grid;
    grid-template-columns: auto 52px auto;
    gap: 1.25rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1rem;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 38%),
        rgba(2, 6, 23, 0.48);
    padding: clamp(1rem, 2.8vw, 2rem);
}

.crafting-page-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.crafting-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 0.75rem;
    background: rgba(52, 211, 153, 0.14);
    padding: 0.65rem 1rem;
    color: #d1fae5;
    font-size: 0.9rem;
    font-weight: 900;
}

.crafting-page-button:hover {
    border-color: rgba(52, 211, 153, 0.72);
    background: rgba(52, 211, 153, 0.2);
    color: #ffffff;
}

.crafting-table-board,
.crafting-output {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.9rem;
    background: rgba(15, 23, 42, 0.62);
    padding: 0.7rem;
}

.crafting-grid {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(3, 44px);
    gap: 4px;
    width: max-content;
}

.crafting-grid--large {
    grid-template-columns: repeat(3, 72px);
    grid-template-rows: repeat(3, 72px);
    gap: 6px;
}

.crafting-slot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1f2937;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 42%),
        #475569;
    box-shadow:
        inset 2px 2px 0 rgba(255, 255, 255, 0.2),
        inset -2px -2px 0 rgba(0, 0, 0, 0.36);
}

.crafting-slot:focus-visible,
.crafting-result-icon:focus-visible {
    outline: 3px solid rgba(52, 211, 153, 0.5);
    outline-offset: 2px;
}

.crafting-slot.is-empty {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 44%),
        #263241;
}

.crafting-slot img,
.crafting-result-icon img,
.crafting-list-icon img,
.crafting-material-icon img,
.crafting-alt-icon,
.crafting-tooltip-icon img {
    display: block;
    width: 72%;
    height: 72%;
    object-fit: contain;
    image-rendering: pixelated;
}

.crafting-grid--large .crafting-slot img {
    width: 74%;
    height: 74%;
}

.crafting-result-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 0.75rem;
    background: rgba(2, 6, 23, 0.42);
}

.crafting-result-icon--large {
    width: 82px;
    height: 82px;
}

.crafting-count {
    position: absolute;
    right: 4px;
    bottom: 3px;
    min-width: 14px;
    font-size: 0.75rem;
    line-height: 1;
    color: white;
    text-align: right;
    text-shadow: 1px 1px 0 #111827, -1px 1px 0 #111827, 1px -1px 0 #111827;
}

.crafting-tag-dot {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--craft-gold);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.84);
}

.crafting-arrow {
    color: #cbd5e1;
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
}

.crafting-materials {
    margin-top: 1.35rem;
}

.crafting-materials-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.crafting-materials-head h3 {
    margin: 0;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 900;
}

.crafting-material-list {
    display: grid;
    gap: 0.75rem;
}

.crafting-material {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.85rem;
    background: rgba(2, 6, 23, 0.28);
    padding: 0.75rem;
}

.crafting-material-main {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.crafting-material-icon {
    width: 44px;
    height: 44px;
}

.crafting-material-main a {
    color: #6ee7b7;
    font-size: 0.82rem;
    font-weight: 800;
}

.crafting-alternatives {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.crafting-alt {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 0.45rem;
    align-items: center;
    min-height: 38px;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.25rem 0.45rem;
    color: #dbeafe;
    font-size: 0.78rem;
    font-weight: 700;
}

.crafting-alt span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crafting-alt:hover {
    border-color: rgba(52, 211, 153, 0.42);
    background: rgba(52, 211, 153, 0.1);
}

.crafting-alt-icon {
    width: 28px;
    height: 28px;
}

.crafting-tooltip {
    position: fixed;
    z-index: 80;
    width: min(360px, calc(100vw - 24px));
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 0.85rem;
    background: rgba(2, 6, 23, 0.96);
    box-shadow: 0 22px 70px rgba(2, 6, 23, 0.38);
    padding: 0.85rem;
    pointer-events: none;
}

.crafting-tooltip[hidden] {
    display: none;
}

.crafting-tooltip-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
}

.crafting-tooltip strong {
    display: block;
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1.25;
}

.crafting-tooltip small {
    display: block;
    margin-top: 0.2rem;
    overflow-wrap: anywhere;
    color: #94a3b8;
    font-size: 0.72rem;
}

.crafting-tooltip p {
    margin: 0.7rem 0 0;
    color: #cbd5e1;
    font-size: 0.82rem;
    line-height: 1.55;
}

.crafting-recipe-page {
    max-width: 1180px;
}

.crafting-recipe-content {
    display: grid;
    gap: 1rem;
}

.crafting-recipe-article {
    border: 1px solid var(--craft-border);
    border-radius: 1rem;
    background: var(--craft-surface);
    box-shadow: 0 22px 70px rgba(2, 6, 23, 0.16);
}

.crafting-recipe-article-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    padding-bottom: 1rem;
}

.crafting-recipe-article-head h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 900;
}

.crafting-recipe-article-head p {
    margin-top: 0.35rem;
    overflow-wrap: anywhere;
    color: #94a3b8;
    font-size: 0.78rem;
}

.crafting-recipe-article-head > span {
    flex: 0 0 auto;
    border: 1px solid rgba(56, 189, 248, 0.32);
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    padding: 0.35rem 0.7rem;
    color: #bae6fd;
    font-size: 0.72rem;
    font-weight: 900;
}

.crafting-recipe-sections {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.crafting-text-recipe,
.crafting-image-recipe {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 0.9rem;
    background: rgba(2, 6, 23, 0.32);
    padding: 1rem;
}

.crafting-text-recipe h3,
.crafting-image-recipe h3 {
    margin: 0 0 0.8rem;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 900;
}

.crafting-text-recipe ol {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding-left: 1.25rem;
    color: #cbd5e1;
    line-height: 1.65;
}

.crafting-image-recipe .crafting-table {
    margin-top: 0;
}

@media (min-width: 1120px) {
    .crafting-workbench {
        grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
    }

    .crafting-index,
    .crafting-detail {
        position: sticky;
        top: 5rem;
    }
}

@media (min-width: 960px) {
    .crafting-recipe-sections {
        grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
        align-items: start;
    }
}

@media (max-width: 760px) {
    .crafting-detail-head {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .crafting-detail-tags {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .crafting-table {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .crafting-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 560px) {
    .crafting-grid--large {
        grid-template-columns: repeat(3, 58px);
        grid-template-rows: repeat(3, 58px);
    }

    .crafting-result-icon--large {
        width: 72px;
        height: 72px;
    }

    .crafting-list {
        max-height: 62vh;
    }
}
