/* ============================================================
   MockupHub — shared styles
   ============================================================ */

:root {
    color-scheme: dark;

    --bg: #0d1117;
    --bg-elev: #161b22;
    --bg-elev-2: #1f252e;
    --border: #2b323d;
    --border-strong: #3a4350;
    --text: #d6dde8;
    --dim: #8b96a7;
    --bright: #f3f6fa;
    --accent: #4ec9b0;
    --accent-ink: #06231d;
    --accent-soft: rgba(78, 201, 176, 0.12);
    --danger: #f0736d;
    --danger-soft: rgba(240, 115, 109, 0.12);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    --radius: 14px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;
    --shell-h: 58px;
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;

        --bg: #f4f6f9;
        --bg-elev: #ffffff;
        --bg-elev-2: #eef1f6;
        --border: #dde2ea;
        --border-strong: #c6ceD9;
        --text: #2d3748;
        --dim: #6b7688;
        --bright: #0f151d;
        --accent: #0f9b82;
        --accent-ink: #ffffff;
        --accent-soft: rgba(15, 155, 130, 0.1);
        --danger: #cf4a45;
        --danger-soft: rgba(207, 74, 69, 0.08);
        --shadow: 0 18px 40px rgba(20, 30, 50, 0.12);
    }
}

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

html, body { margin: 0; padding: 0; }

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--bright); }

h1, h2, h3, p { margin: 0; }

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

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------
   Navigation
   ------------------------------------------------------------ */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 28px;
    height: 60px;
    padding: 0 max(24px, calc((100% - 1120px) / 2));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.logo {
    font-size: 1.08rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--bright);
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 6px; }

.nav-links a {
    padding: 6px 13px;
    border-radius: 8px;
    color: var(--dim);
    font-size: 0.9rem;
}

.nav-links a:hover { color: var(--bright); background: var(--bg-elev-2); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 24px 64px;
    flex: 1;
}

.container.wide { max-width: 1280px; }

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 22px max(24px, calc((100% - 1120px) / 2));
    border-top: 1px solid var(--border);
    color: var(--dim);
    font-size: 0.8rem;
}

.dim { color: var(--dim); }
.small-text { font-size: 0.82rem; }

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.9rem;
    font-weight: 650;
    cursor: pointer;
    transition: filter 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; }

.btn.ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn.ghost:hover {
    border-color: var(--border-strong);
    background: var(--bg-elev-2);
    color: var(--bright);
}

.btn.small { padding: 6px 11px; font-size: 0.8rem; border-radius: 7px; }

.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* ------------------------------------------------------------
   Home
   ------------------------------------------------------------ */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
    padding: 46px 0 42px;
}

.hero h1 {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    line-height: 1.14;
    letter-spacing: -0.03em;
    color: var(--bright);
    font-weight: 760;
}

.hero-copy p {
    max-width: 560px;
    margin-top: 16px;
    color: var(--dim);
    font-size: 0.98rem;
}

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

.section-head h2 {
    font-size: 1rem;
    font-weight: 650;
    color: var(--bright);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

.project-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    box-shadow: var(--shadow);
    color: inherit;
}

.cover {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--bg-elev-2);
    overflow: hidden;
}

.cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.project-card:hover .cover img { transform: scale(1.025); }

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 120% at 20% 10%, hsl(var(--h, 170) 42% 26% / 0.95), transparent 60%),
        linear-gradient(135deg, hsl(calc(var(--h, 170) + 40) 34% 16%), #0b1015);
}

.cover-placeholder span {
    font-size: 3.4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.82);
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.version-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(8, 12, 16, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #eef5f2;
    font-family: var(--mono);
    font-size: 0.72rem;
    backdrop-filter: blur(8px);
}

.card-body { padding: 17px 18px 18px; display: flex; flex-direction: column; gap: 7px; }

.card-body h3 {
    font-size: 1.03rem;
    font-weight: 650;
    color: var(--bright);
    letter-spacing: -0.01em;
}

.card-desc {
    color: var(--dim);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    color: var(--dim);
    font-size: 0.76rem;
}

/* ------------------------------------------------------------
   Empty states
   ------------------------------------------------------------ */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 56px 24px;
    text-align: center;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    color: var(--dim);
}

.empty.small { padding: 36px 20px; }
.empty.tall { padding: 96px 24px; }

.empty h3 { color: var(--bright); font-size: 1.02rem; }
.empty p { font-size: 0.88rem; max-width: 380px; }
.empty .btn { margin-top: 10px; }

.empty-mark {
    font-family: var(--mono);
    font-size: 1.6rem;
    color: var(--accent);
    opacity: 0.9;
}

/* ------------------------------------------------------------
   Project page
   ------------------------------------------------------------ */

.back-link { color: var(--dim); font-size: 0.85rem; }
.back-link:hover { color: var(--accent); }

.project-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin: 22px 0 10px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.project-head h1 {
    font-size: clamp(1.7rem, 3.4vw, 2.5rem);
    line-height: 1.16;
    letter-spacing: -0.025em;
    color: var(--bright);
}

.project-slug {
    margin-top: 6px;
    color: var(--dim);
    font-family: var(--mono);
    font-size: 0.78rem;
}

.project-desc {
    max-width: 700px;
    margin-top: 12px;
    color: var(--dim);
    font-size: 0.92rem;
}

.project-head-meta { display: flex; gap: 26px; flex-shrink: 0; }

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--dim);
    font-size: 0.75rem;
}
.stat strong { font-size: 1.3rem; color: var(--bright); font-weight: 650; }

.version-list {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.version-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.version-row:last-child { border-bottom: none; }
.version-row:hover { background: var(--bg-elev-2); color: inherit; }

.version-pill {
    flex-shrink: 0;
    min-width: 46px;
    padding: 3px 9px;
    text-align: center;
    border-radius: 8px;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 600;
}

.version-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }

.version-note {
    font-size: 0.92rem;
    font-weight: 550;
    color: var(--bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-note em { font-style: normal; font-weight: 400; }

.version-meta {
    color: var(--dim);
    font-size: 0.76rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tag.latest { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }

.chevron { color: var(--dim); font-size: 0.9rem; }

/* ------------------------------------------------------------
   Shell / iframe preview
   ------------------------------------------------------------ */

.shell-body {
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.shell-bar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10;
    height: var(--shell-h);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 0 18px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
}

.shell-back {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    color: var(--dim);
    font-size: 0.88rem;
}
.shell-back:hover { color: var(--bright); }

.shell-arrow { color: var(--accent); flex-shrink: 0; }

.shell-project {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: var(--bright);
}

.shell-version { display: flex; align-items: center; gap: 10px; }

.shell-current {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.8rem;
    font-weight: 600;
}

.shell-version select {
    max-width: 340px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev-2);
    color: var(--text);
    font-size: 0.82rem;
}

.shell-open {
    justify-self: end;
    color: var(--dim);
    font-size: 0.82rem;
    white-space: nowrap;
}
.shell-open span { color: var(--accent); }
.shell-open:hover { color: var(--bright); }

.shell-frame {
    position: fixed;
    top: var(--shell-h);
    left: 0;
    display: block;
    width: 100%;
    height: calc(100vh - var(--shell-h));
    border: 0;
    background: #fff;
}

/* ------------------------------------------------------------
   Admin
   ------------------------------------------------------------ */

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 20px 0 26px;
}
.admin-top h1 { font-size: 1.55rem; letter-spacing: -0.02em; color: var(--bright); }
.admin-top p { font-size: 0.85rem; margin-top: 3px; }

.admin-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.admin-side { display: flex; flex-direction: column; gap: 20px; }

.panel {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.panel h2 {
    margin-bottom: 15px;
    font-size: 0.98rem;
    font-weight: 650;
    color: var(--bright);
}

.admin-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 13px;
    color: var(--dim);
    font-size: 0.8rem;
}

.form input,
.form textarea,
.gate-card input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elev-2);
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form input:focus,
.form textarea:focus,
.gate-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form textarea { resize: vertical; min-height: 60px; }

.form input[type="file"] { padding: 7px 9px; font-size: 0.8rem; cursor: pointer; }

.form input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elev);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
}

.form .btn { width: 100%; }

.hint {
    margin-top: 12px;
    color: var(--dim);
    font-size: 0.75rem;
    line-height: 1.65;
}

.admin-projects { display: flex; flex-direction: column; gap: 3px; }

.admin-project {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.admin-project:hover { background: var(--bg-elev-2); }
.admin-project.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 32%, transparent); }

.ap-name { font-size: 0.9rem; font-weight: 600; color: var(--bright); }
.ap-meta { color: var(--dim); font-size: 0.72rem; }

.detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.detail-head h2 { font-size: 1.35rem; letter-spacing: -0.02em; color: var(--bright); }
.detail-head .link { display: inline-block; margin-top: 4px; font-size: 0.8rem; }
.detail-head .link:hover { color: var(--accent); }

.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.actions.wrap { flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

.detail-cols {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr);
    gap: 20px;
}

.cover-preview {
    aspect-ratio: 16 / 10;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-elev-2);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { color: var(--dim); font-size: 0.82rem; }

.progress-wrap { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.progress { height: 8px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; }
.progress > div { height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width 0.2s; }
#progress-text { font-size: 0.75rem; }

.admin-versions { display: flex; flex-direction: column; }

.admin-version {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 2px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.admin-version:last-child { border-bottom: none; }

.admin-version .actions { margin-left: auto; }
.admin-version .btn { color: var(--text); }

/* ------------------------------------------------------------
   Token gate
   ------------------------------------------------------------ */

.gate {
    min-height: calc(100vh - 260px);
    display: grid;
    place-items: center;
    padding: 30px 0;
}

.gate-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 34px 30px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    text-align: center;
}

.gate-mark {
    margin: 0 auto 2px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 1.3rem;
}

.gate-card h1 { font-size: 1.3rem; color: var(--bright); letter-spacing: -0.02em; }
.gate-card p { font-size: 0.84rem; margin-bottom: 4px; }
.gate-card .btn { width: 100%; }

.error-text { min-height: 18px; color: var(--danger); font-size: 0.8rem; }

/* ------------------------------------------------------------
   Modals
   ------------------------------------------------------------ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 7, 10, 0.68);
    backdrop-filter: blur(4px);
}

.modal-card {
    width: min(920px, 100%);
    max-height: min(86vh, 900px);
    overflow: auto;
    padding: 20px 22px 22px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.modal-card.narrow { width: min(460px, 100%); }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.modal-head h3 { font-size: 1rem; color: var(--bright); }

.icon-btn {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--dim);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--bright); }

.cover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.cover-grid button {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg-elev-2);
    color: var(--dim);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.cover-grid button:hover { border-color: var(--accent); transform: translateY(-1px); }

.cover-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--bg);
}

.cover-grid span {
    padding: 6px 8px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 200;
    max-width: min(90vw, 460px);
    padding: 11px 18px;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
    border-radius: 10px;
    background: var(--bg-elev);
    color: var(--bright);
    font-size: 0.86rem;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, 14px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); color: var(--danger); }

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 960px) {
    .admin-grid { grid-template-columns: 1fr; }
    .admin-side { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
    .detail-cols { grid-template-columns: 1fr; }
    .hero { grid-template-columns: 1fr; align-items: start; padding-top: 32px; }
    .hero .btn { justify-self: start; }
}

@media (max-width: 700px) {
    .site-nav { padding: 0 16px; gap: 14px; }
    .container { padding: 20px 16px 52px; }
    .site-footer { padding: 18px 16px; }
    .project-grid { grid-template-columns: 1fr; }
    .admin-side { grid-template-columns: 1fr; }
    .project-head { flex-direction: column; align-items: flex-start; gap: 18px; }
    .project-head-meta { gap: 22px; }
    .version-row { flex-wrap: wrap; gap: 10px; }
    .version-row .version-main { flex-basis: calc(100% - 70px); }
    .version-row .chevron { display: none; }
    .shell-bar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 0 12px; }
    .shell-version { justify-self: end; }
    .shell-open { display: none; }
    .shell-version select { max-width: 150px; }
    .shell-current { display: none; }
    .detail-head { flex-direction: column; }
    .admin-version .actions { margin-left: 0; }
    .modal { padding: 12px; }
}
