:root {
    --bg: #e5e5e1;
    --panel: #f0f0ec;
    --panel-2: #ebebe6;
    --line: #c9c9c2;
    --line-soft: #d3d3cc;
    --text: #171717;
    --muted: #66675f;
    --red: #c93a45;
    --yellow: #d4b33c;
    --blue: #3d6eb2;
    --green: #4f8f67;
    --shadow: 0 10px 22px rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 6px 14px rgba(0, 0, 0, 0.04);
    --brick-depth: 0 3px 0 rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
}

body {
    font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.55) 0 4px, rgba(220, 220, 214, 0.95) 4.2px 7px, rgba(205, 205, 198, 0.95) 7.1px 7.8px, transparent 8px) 0 0 / 38px 38px,
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.55) 0 1.4px, transparent 1.6px) 0 0 / 38px 38px,
        linear-gradient(#e7e7e3, #e2e2dd);
    background-position: 0 0, 19px 19px, 0 0;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.32) 0 0.9px, transparent 1.1px) 0 0 / 38px 38px,
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.03));
    opacity: 0.65;
}

.container {
    width: min(1260px, calc(100% - 84px));
    margin-inline: auto;
}

.page {
    padding: 18px 0 56px;
}

.floaters {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.fl {
    position: absolute;
    opacity: 0.09;
    filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.08));
    transform-origin: center;
    animation: drift 16s ease-in-out infinite alternate;
}

.fl.a {
    left: 4%;
    top: 18%;
    animation-duration: 19s;
}

.fl.b {
    right: 7%;
    top: 26%;
    animation-duration: 17s;
}

.fl.c {
    left: 5%;
    bottom: 10%;
    animation-duration: 21s;
}

.fl.d {
    right: 11%;
    bottom: 16%;
    animation-duration: 18s;
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) rotate(-9deg);
    }
    to {
        transform: translate3d(0, -8px, 0) rotate(-5deg);
    }
}

.top-rail {
    height: 10px;
    border-bottom: 1px solid #c8c8c1;
    background: linear-gradient(90deg, var(--red) 0 11%, var(--yellow) 11% 22%, var(--blue) 22% 33%, var(--green) 33% 44%, #d9d9d3 44% 100%);
    position: relative;
}

.top-rail::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 10px 5px, rgba(255, 255, 255, 0.45) 0 1.6px, transparent 1.8px) 0 0 / 20px 10px;
    opacity: 0.8;
}

.header-wrap {
    margin-top: 14px;
}

.header {
    background: rgba(241, 241, 236, 0.95);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    padding: 14px 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.brand-badge {
    width: 34px;
    height: 34px;
    background: linear-gradient(#d44752, #bf3641);
    border: 1px solid #a92d37;
    box-shadow: var(--brick-depth);
    position: relative;
}

.brand-badge::before,
.brand-badge::after {
    content: "";
    position: absolute;
    top: -5px;
    width: 10px;
    height: 5px;
    background: #c53a45;
    border: 1px solid #a92d37;
    border-bottom: 0;
}

.brand-badge::before {
    left: 5px;
}

.brand-badge::after {
    right: 5px;
}

.brand h1 {
    margin: 0;
    font-size: 15px;
    line-height: 1;
    letter-spacing: -0.02em;
}

.brand p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.search {
    height: 44px;
    background: #f5f5f1;
    border: 1px solid var(--line);
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 0 8px 0 12px;
}

.search input {
    border: 0;
    outline: 0;
    background: transparent;
    width: 100%;
    font: inherit;
}

.search-tabs {
    display: flex;
    border: 1px solid var(--line);
    background: #ecece7;
}

.search-tabs button {
    border: 0;
    background: transparent;
    padding: 6px 10px;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
}

.search-tabs .active {
    background: #f9f9f6;
    color: var(--text);
}

.upload-btn {
    height: 44px;
    padding: 0 16px;
    border: 1px solid #ae9639;
    background: linear-gradient(#e0c354, #ccaf3e);
    color: #231e0b;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--brick-depth);
    position: relative;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.upload-btn::before,
.upload-btn::after {
    content: "";
    position: absolute;
    top: -5px;
    width: 13px;
    height: 5px;
    background: #d2b344;
    border: 1px solid #ae9639;
    border-bottom: 0;
}

.upload-btn::before {
    left: 16px;
}

.upload-btn::after {
    right: 16px;
}

.panel {
    position: relative;
    background: rgba(240, 240, 235, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 34px;
    overflow: visible;
}

.panel.has-cap {
    margin-top: 18px;
}

.panel.has-cap > .capbar,
.card.has-cap > .capbar {
    position: absolute;
    left: 0;
    right: 0;
    top: -18px;
    height: 18px;
    pointer-events: none;
}

.capbar .cap-front {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10px;
    border: 1px solid var(--cap-border);
    border-bottom: 0;
    background: var(--cap-main);
}

.capbar .cap-top {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 9px;
    background: linear-gradient(90deg, transparent 0 12px, var(--cap-top) 12px 34px, transparent 34px 84px) 0 0 / 96px 9px repeat-x;
}

.cap-yellow {
    --cap-main: linear-gradient(#d8ba47, #caaa32);
    --cap-top: #d6b53a;
    --cap-border: #b99f3a;
}

.cap-blue {
    --cap-main: linear-gradient(#4a78ba, #3969ac);
    --cap-top: #4473b8;
    --cap-border: #315d98;
}

.cap-red {
    --cap-main: linear-gradient(#cf4a54, #b73b45);
    --cap-top: #c8454f;
    --cap-border: #a0353d;
}

.cap-green {
    --cap-main: linear-gradient(#5d9f76, #4b8b63);
    --cap-top: #589670;
    --cap-border: #447d59;
}

.hero {
    margin-top: 28px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: start;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: #f6f6f2;
    padding: 6px 10px;
    color: #55564f;
    font-size: 12px;
    margin: 0 0 16px;
}

.eyebrow i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4f8f67;
    box-shadow: 0 0 0 2px rgba(79, 143, 103, 0.12);
}

.hero h2 {
    font-size: 62px;
    line-height: 0.97;
    letter-spacing: -0.05em;
    margin: 0 0 16px;
    max-width: 10ch;
}

.hero p {
    margin: 0 0 24px;
    color: var(--muted);
    max-width: 54ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.btn {
    position: relative;
    height: 48px;
    padding: 0 18px;
    border: 1px solid #bdbdb7;
    background: #f6f6f2;
    color: #171717;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--brick-depth);
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.brick {
    padding-top: 1px;
}

.btn.brick::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
    background: linear-gradient(90deg, transparent 0 14px, var(--btn-top) 14px 33px, transparent 33px 76px) 0 0 / 86px 8px repeat-x;
    border: 1px solid var(--btn-border);
    border-bottom: 0;
}

.btn.brick::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.08);
}

.btn.primary {
    --btn-top: #c84650;
    --btn-border: #a2353d;
    background: linear-gradient(#cd4a54, #b83b45);
    border-color: #a2353d;
    color: #fff;
}

.btn.blue {
    --btn-top: #4472b8;
    --btn-border: #315c97;
    background: linear-gradient(#4a77bb, #3a69ad);
    border-color: #315c97;
    color: #fff;
}

.btn.yellow {
    --btn-top: #d6b53a;
    --btn-border: #b39a38;
    background: linear-gradient(#dcc04d, #c9ab36);
    border-color: #b39a38;
    color: #201a09;
}

.btn.ghost {
    --btn-top: #ecece6;
    --btn-border: #bdbdb7;
    background: #f7f7f4;
    color: #171717;
}

.blueprint-stage {
    min-height: 420px;
    border: 1px solid var(--line-soft);
    background:
        radial-gradient(circle at 19px 19px, rgba(255, 255, 255, 0.42) 0 3px, rgba(212, 212, 205, 0.86) 3.2px 5.4px, transparent 5.6px) 0 0 / 38px 38px,
        linear-gradient(#ecece7, #e7e7e2);
    position: relative;
    overflow: hidden;
}

.blueprint-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 38px 38px,
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 38px 38px;
    opacity: 0.45;
}

.stage-badge {
    position: absolute;
    right: 18px;
    top: 18px;
}

.stage-badge .btn {
    height: 40px;
    padding: 0 14px;
    font-size: 13px;
}

.blueprint-stage svg {
    position: absolute;
    inset: 56px 30px 30px 30px;
    width: calc(100% - 60px);
    height: calc(100% - 86px);
}

.layout {
    margin-top: 34px;
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 28px;
    align-items: start;
}

.filters {
    padding: 22px 18px 18px;
}

.filters .title {
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.group {
    border: 1px solid var(--line);
    background: #f6f6f2;
    margin-bottom: 14px;
}

.group h4 {
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.group .body {
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    border: 1px solid #c0c5cf;
    background: #eef2f8;
    color: #284e90;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
}

.filters .tag {
    text-decoration: none;
}

.filters .tag.is-active {
    background: #4a77bb;
    color: #fff;
    border-color: #315c97;
}

.tag.gray {
    background: #f0f0ea;
    color: #41423d;
    border-color: #cdcdc5;
}

.tag.green {
    background: #edf4ee;
    color: #34684a;
    border-color: #bcd1c3;
}

.filter-reset {
    width: 100%;
    margin-top: 4px;
}

.main-col {
    display: grid;
    gap: 22px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
}

.toolbar h3 {
    margin: 0;
    font-size: 16px;
}

.tabs {
    display: flex;
    border: 1px solid var(--line);
    background: #edede8;
}

.tabs button {
    border: 0;
    background: transparent;
    padding: 10px 14px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}

.tabs .active {
    background: #f8f8f4;
    color: var(--text);
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.card {
    position: relative;
    background: rgba(242, 242, 238, 0.97);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    padding: 18px;
}

.card.has-cap {
    margin-top: 18px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pill {
    font-weight: 800;
    font-size: 11px;
    padding: 5px 8px;
    border: 1px solid;
}

.pill.blue {
    background: #eaf0fb;
    color: #27579a;
    border-color: #bfceed;
}

.pill.yellow {
    background: #f7f0d3;
    color: #856900;
    border-color: #dece8e;
}

.pill.green {
    background: #e7f2eb;
    color: #2f6c4d;
    border-color: #bfd7c8;
}

.pill.red {
    background: #f9e3e5;
    color: #8e2d35;
    border-color: #e6b3b8;
}

.dots {
    display: flex;
    gap: 5px;
}

.dots i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d2d2cb;
    display: block;
}

.dots i.on.r {
    background: #c94a54;
}

.dots i.on.y {
    background: #ccb145;
}

.dots i.on.b {
    background: #4a74b8;
}

.preview {
    height: 150px;
    border: 1px solid var(--line-soft);
    background:
        radial-gradient(circle at 19px 19px, rgba(255, 255, 255, 0.38) 0 2.6px, rgba(212, 212, 205, 0.84) 2.8px 4.7px, transparent 4.9px) 0 0 / 38px 38px,
        linear-gradient(#ecece7, #e7e7e2);
    position: relative;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    overflow: hidden;
}

.preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 38px 38px,
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 38px 38px;
    opacity: 0.45;
}

.preview .type {
    position: absolute;
    right: 8px;
    top: 8px;
    background: #f8f8f4;
    border: 1px solid var(--line);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 6px;
    z-index: 1;
}

.preview svg {
    width: 74%;
    height: 72%;
    color: #6f6e67;
}

.preview img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.preview.has-image {
    background: #0b0b0b;
}

.preview.has-image::before {
    opacity: 0;
}

.card h4 {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

.meta {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
}

.card-tags span {
    font-size: 11px;
    border: 1px solid var(--line);
    background: #eeeee9;
    padding: 5px 7px;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.card-actions .btn {
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
}

.cards.mode-compact {
    grid-template-columns: 1fr 1fr;
}

.cards.mode-blueprint .card {
    background:
        linear-gradient(90deg, rgba(61, 110, 178, 0.07) 1px, transparent 1px) 0 0 / 20px 20px,
        linear-gradient(rgba(61, 110, 178, 0.07) 1px, transparent 1px) 0 0 / 20px 20px,
        rgba(242, 242, 238, 0.97);
}

.cards.mode-blueprint .card-actions {
    grid-template-columns: 1fr;
}

.cards.mode-blueprint .card-actions .btn:first-child {
    display: none;
}

.pagination {
    margin-top: -6px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-link {
    min-width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: #f6f6f2;
    color: #121315;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.page-link.current {
    background: #4a77bb;
    border-color: #315c97;
    color: #fff;
}

.page-link.disabled {
    opacity: 0.45;
}

.footer {
    margin-top: 34px;
}

.footer .panel {
    padding: 22px 24px 18px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 0.8fr auto;
    gap: 20px;
    align-items: start;
}

.footer h5 {
    margin: 0 0 8px;
    font-size: 13px;
}

.footer p,
.footer li {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.footer .mark {
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 4px;
}

.socials {
    display: flex;
    gap: 8px;
}

.socials a {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: #f6f6f2;
    display: grid;
    place-items: center;
    text-decoration: none;
    color: var(--text);
}

.detail {
    width: min(1000px, calc(100% - 84px));
    margin: 22px auto 48px;
}

.back-link {
    display: inline-flex;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 10px;
}

.detail-card {
    position: relative;
    background: rgba(242, 242, 238, 0.97);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
    gap: 16px;
}

.detail-preview {
    height: 270px;
    border: 1px solid var(--line-soft);
    background:
        radial-gradient(circle at 19px 19px, rgba(255, 255, 255, 0.38) 0 2.6px, rgba(212, 212, 205, 0.84) 2.8px 4.7px, transparent 4.9px) 0 0 / 38px 38px,
        linear-gradient(#ecece7, #e7e7e2);
    overflow: hidden;
}

.stl-viewer {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    background: linear-gradient(#e9e9e4, #dfdfd9);
}

.stl-viewer-canvas {
    min-height: 218px;
}

.stl-viewer-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line-soft);
    background: #f3f3ee;
    padding: 7px 8px;
}

.viewer-btn {
    border: 1px solid var(--line);
    background: #f8f8f4;
    color: #1c1d1f;
    font-weight: 700;
    font-size: 12px;
    padding: 5px 8px;
    cursor: pointer;
}

.viewer-btn.is-active {
    background: #4a77bb;
    color: #fff;
    border-color: #315c97;
}

.viewer-status {
    margin-left: auto;
    font-size: 11px;
    color: #4b4e53;
}

.detail-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-cover-placeholder {
    width: 100%;
    height: 100%;
}

.detail-content h1 {
    margin: 8px 0 10px;
    font-size: 42px;
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.model-category {
    margin: 0;
    color: #27579a;
    font-weight: 700;
}

.detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-meta span {
    font-size: 11px;
    border: 1px solid var(--line);
    background: #eeeee9;
    padding: 5px 7px;
}

.detail-description {
    color: var(--muted);
}

.download-link {
    margin-top: 10px;
    height: 42px;
    padding: 0 12px;
    font-size: 14px;
    position: relative;
    border: 1px solid #315c97;
    background: linear-gradient(#4a77bb, #3a69ad);
    color: #fff;
    box-shadow: var(--brick-depth);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.download-link::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -8px;
    height: 8px;
    background: linear-gradient(90deg, transparent 0 14px, #4472b8 14px 33px, transparent 33px 76px) 0 0 / 86px 8px repeat-x;
    border: 1px solid #315c97;
    border-bottom: 0;
}

@media (max-width: 1180px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .layout {
        grid-template-columns: 1fr;
    }

    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .container,
    .detail {
        width: min(1260px, calc(100% - 28px));
    }

    .header {
        grid-template-columns: 1fr;
    }

    .search {
        grid-template-columns: 18px 1fr;
        height: auto;
        padding: 10px 12px;
    }

    .search-tabs {
        grid-column: 1 / -1;
        width: max-content;
    }

    .hero h2 {
        font-size: 42px;
    }

    .panel {
        padding: 22px;
    }

    .cards,
    .cards.mode-compact {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .detail-card {
        grid-template-columns: 1fr;
    }
}
