* {
    box-sizing: border-box;
}

:root {
    --background: #f7f8fa;
    --surface: #ffffff;
    --surface-secondary: #f0f2f5;
    --text: #15171a;
    --text-secondary: #6b7280;
    --border: #e2e5e9;
    --accent: #15171a;
    --accent-hover: #32363c;
    --danger-background: #fff2f2;
    --danger-border: #f3cccc;
    --danger-text: #9b2525;
    --radius: 16px;
    --radius-small: 10px;
    --container: 1180px;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

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

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

.site-header {
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -0.7px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
}

.button {
    display: inline-flex;
    min-height: 46px;
    padding: 0 20px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-small);
    background: var(--accent);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.button:hover {
    background: var(--accent-hover);
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.45;
    cursor: default;
}

.button-small {
    min-height: 38px;
    padding: 0 15px;
    font-size: 14px;
}

.button-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.button-secondary:hover {
    background: var(--surface-secondary);
}

.button-full {
    width: 100%;
}

.hero {
    padding: 96px 0 110px;
}

.hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.9fr);
    gap: 80px;
    align-items: center;
}

.hero-content {
    max-width: 650px;
}

.eyebrow {
    margin-bottom: 17px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-size: clamp(50px, 6vw, 80px);
    line-height: 0.98;
    letter-spacing: -0.055em;
}

.hero h1 span {
    display: block;
    color: var(--text-secondary);
}

.hero-description {
    max-width: 600px;
    margin: 30px 0 0;
    color: var(--text-secondary);
    font-size: 19px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 12px;
    margin-top: 36px;
}

.hero-preview {
    width: 100%;
}

.viewer-placeholder {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: linear-gradient(145deg, #ffffff, #e8ebef);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-grid {
    position: absolute;
    inset: 0;
    opacity: 0.45;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
    background-size: 36px 36px;
}

.viewer-object {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--text);
    color: #ffffff;
    font-size: 52px;
    font-weight: 800;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.viewer-label {
    position: absolute;
    left: 22px;
    bottom: 22px;
    padding: 9px 13px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-secondary);
    font-size: 13px;
    backdrop-filter: blur(10px);
}

.section {
    padding: 100px 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.section-heading {
    max-width: 600px;
}

.section-heading h2 {
    margin: 0;
    font-size: 44px;
    letter-spacing: -0.04em;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 50px;
}

.step {
    padding: 30px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.step-number {
    margin-bottom: 50px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.step h3 {
    margin: 0 0 12px;
    font-size: 21px;
}

.step p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.site-footer {
    padding: 28px 0;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
}

/* Auth */

.auth-body {
    min-height: 100vh;
    background: #f4f5f7;
}

.auth-shell {
    width: min(calc(100% - 32px), 460px);
    margin: 0 auto;
    padding: 48px 0 70px;
}

.auth-logo {
    display: inline-block;
    margin-bottom: 38px;
}

.auth-card {
    padding: 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
    margin: 0;
    font-size: 34px;
    letter-spacing: -0.04em;
}

.auth-description {
    margin: 10px 0 28px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field > span {
    font-size: 13px;
    font-weight: 650;
}

.field input {
    width: 100%;
    height: 46px;
    padding: 0 13px;
    border: 1px solid #d8dce2;
    border-radius: 9px;
    outline: none;
    background: #ffffff;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
    border-color: #8a919c;
    box-shadow: 0 0 0 3px rgba(21, 23, 26, 0.07);
}

.field small {
    color: var(--text-secondary);
    font-size: 12px;
}

.form-error {
    margin-bottom: 20px;
    padding: 12px 13px;
    border: 1px solid var(--danger-border);
    border-radius: 9px;
    background: var(--danger-background);
    color: var(--danger-text);
    font-size: 13px;
    line-height: 1.45;
}

.auth-switch {
    margin: 24px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}

.auth-switch a {
    color: var(--text);
    font-weight: 650;
}

/* App */

.app-body {
    min-height: 100vh;
    background: #f6f7f9;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.app-account {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.app-account form {
    margin: 0;
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.text-button:hover {
    text-decoration: underline;
}

.app-layout {
    min-height: 100vh;
    padding-top: 64px;
    display: grid;
    grid-template-columns: 220px 1fr;
}

.sidebar {
    padding: 24px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    padding: 11px 13px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-nav a:hover:not(.disabled) {
    background: var(--surface-secondary);
}

.sidebar-nav a.active {
    background: var(--surface-secondary);
    color: var(--text);
}

.sidebar-nav a.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.app-main {
    padding: 42px;
}

.app-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
}

.app-page-header h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -0.035em;
}

.app-page-header p {
    margin: 7px 0 0;
    color: var(--text-secondary);
}

.empty-state {
    min-height: 430px;
    margin-top: 32px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.empty-icon {
    width: 74px;
    height: 74px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    background: var(--text);
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
}

.empty-state h2 {
    margin: 0;
    font-size: 22px;
}

.empty-state p {
    max-width: 500px;
    margin: 10px 0 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (max-width: 900px) {
    .hero {
        padding-top: 60px;
    }

    .hero-inner {
        grid-template-columns: 1fr;
        gap: 50px;
    }

    .hero-preview {
        max-width: 600px;
    }

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

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

    .sidebar {
        display: none;
    }

    .app-main {
        padding: 30px 20px;
    }
}

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

    .header-nav > a:first-child {
        display: none;
    }

    .hero {
        padding: 48px 0 70px;
    }

    .hero h1 {
        font-size: 48px;
    }

    .hero-description {
        font-size: 17px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .button {
        width: 100%;
    }

    .section {
        padding: 70px 0;
    }

    .section-heading h2 {
        font-size: 36px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 10px;
    }

    .auth-shell {
        padding-top: 26px;
    }

    .auth-card {
        padding: 26px 20px;
    }

    .app-page-header {
        flex-direction: column;
    }

    .app-account > span {
        display: none;
    }
}

/* Email verification */

.form-success {
    margin: 0 0 22px;
    padding: 13px 14px;
    border: 1px solid #bfe3cd;
    border-radius: 9px;
    background: #effaf3;
    color: #24653b;
    font-size: 14px;
    line-height: 1.5;
}

.status-icon {
    width: 62px;
    height: 62px;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--surface-secondary);
    font-size: 27px;
    font-weight: 750;
}

.status-icon-success {
    background: #eaf8ef;
    color: #277342;
}

.status-icon-error {
    background: var(--danger-background);
    color: var(--danger-text);
}

.auth-card-centered {
    text-align: center;
}

.auth-card-centered .status-icon {
    margin-left: auto;
    margin-right: auto;
}

.resend-form {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.resend-inline {
    margin-top: 18px;
    text-align: center;
}

/* Models */
.notice {
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
}
.notice-error {
    border-color: #e9b4b4;
    background: #fff7f7;
    color: #8f2525;
}
.upload-panel {
    margin-top: 28px;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.upload-panel[hidden] { display: none; }
.upload-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}
.upload-panel-header h2 { margin: 0 0 6px; font-size: 22px; }
.upload-panel-header p { margin: 0; color: var(--text-secondary); line-height: 1.5; }
.form-field { display: grid; gap: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.form-field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    outline: none;
}
.form-field input:focus { border-color: #9aa0a8; }
.file-drop {
    min-height: 150px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    border: 1px dashed #b9bec6;
    border-radius: 12px;
    background: var(--background);
    cursor: pointer;
}
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-drop strong { font-size: 16px; }
.file-drop span { color: var(--text-secondary); font-size: 13px; }
.upload-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.upload-progress { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.upload-progress[hidden] { display: none; }
.upload-progress-bar { flex: 1; height: 8px; overflow: hidden; border-radius: 999px; background: #e8eaed; }
.upload-progress-bar > div { width: 0; height: 100%; border-radius: inherit; background: var(--text); transition: width .1s linear; }
.upload-progress-text { min-width: 46px; text-align: right; color: var(--text-secondary); font-size: 13px; }
.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-top: 32px;
}
.model-card {
    min-width: 0;
    padding: 10px;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.model-card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.07); }
.model-card-preview {
    position: relative;
    width: 88px;
    height: 88px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #f3f4f6, #e6e9ed);
    border-radius: 10px;
}
.model-card-preview span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--text);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}
.model-card-preview-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.model-card-preview-image[hidden] { display: none; }
.model-card-body { min-width: 0; padding: 2px 4px 2px 0; }
.model-card-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-card-meta { margin-top: 6px; color: var(--text-secondary); font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 20px; color: var(--text-secondary); font-size: 14px; }

.model-detail-shell {
    width: min(100%, 900px);
}

.model-simple-header h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -.035em;
}

.model-overview-card {
    margin-top: 24px;
    padding: 18px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.model-detail-preview {
    position: relative;
    width: 300px;
    aspect-ratio: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #f3f4f6, #e6e9ed);
    border-radius: 12px;
}

.model-detail-preview > span {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--text);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.model-detail-preview > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.model-detail-preview > img[hidden] { display: none; }

.model-overview-content {
    min-width: 0;
    padding: 4px 12px 4px 0;
}

.model-overview-top h2 {
    margin: 0;
    font-size: 21px;
}

.model-overview-top p {
    max-width: 430px;
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.model-facts {
    margin: 0 0 24px;
}

.model-facts > div {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.model-facts > div:first-child { border-top: 1px solid var(--border); }
.model-facts dt { color: var(--text-secondary); font-size: 13px; }
.model-facts dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; }
.model-primary-actions { display: flex; }
.model-primary-actions .button { min-width: 150px; }

.model-delete-row {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

.model-delete-row form { margin: 0; }
.danger-button { min-height: 42px; border: 1px solid #e1b2b2; border-radius: 9px; background: #fff7f7; color: #9a2d2d; font-weight: 600; cursor: pointer; }
.danger-button:hover { background: #ffeded; }
.danger-button-compact { width: auto; padding: 0 16px; }

@media (max-width: 820px) {
    .model-overview-card {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 22px;
    }
    .model-detail-preview { width: 220px; }
}

@media (max-width: 620px) {
    .model-overview-card {
        grid-template-columns: 1fr;
        padding: 14px;
        gap: 20px;
    }
    .model-detail-preview {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
    }
    .model-overview-content { padding: 0 2px 4px; }
    .model-primary-actions .button { width: 100%; }
    .model-delete-row { justify-content: stretch; }
    .model-delete-row form { width: 100%; }
    .danger-button-compact { width: 100%; }
}

@media (max-width: 520px) {
    .models-grid { grid-template-columns: 1fr; }
    .model-card { grid-template-columns: 72px minmax(0, 1fr); }
    .model-card-preview { width: 72px; height: 72px; }
}
