:root{
  --bg:#f4f6f8;
  --surface:#ffffff;
  --surface-2:#eef2f5;
  --ink:#111318;
  --ink-2:#2c3138;
  --muted:#717984;
  --muted-2:#98a0a9;
  --line:#e1e6eb;
  --line-strong:#d6dce2;
  --dark:#17191d;
  --radius:18px;
  --shadow-sm:0 6px 20px rgba(24,31,39,.055);
  --shadow-md:0 16px 44px rgba(24,31,39,.10);
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
button,input,textarea,select{font:inherit}
img{max-width:100%}
main{min-height:calc(100vh - 146px)}
.container{width:min(1320px,calc(100% - 48px));margin:0 auto}

/* Header */
.site-header{height:74px;position:sticky;top:0;z-index:50;border-bottom:1px solid rgba(214,220,226,.85);background:rgba(250,251,252,.90);backdrop-filter:blur(18px)}
.header-inner{height:100%;width:min(1320px,calc(100% - 48px));margin:0 auto;display:flex;align-items:center;justify-content:space-between;gap:24px}
.brand{display:inline-flex;align-items:center;gap:11px;min-width:0}
.brand-mark{width:38px;height:38px;border-radius:12px;display:grid;place-items:center;background:var(--dark);color:#fff;font-size:17px;font-weight:850;letter-spacing:-.04em;box-shadow:0 6px 14px rgba(18,20,24,.15)}
.brand-copy{display:flex;flex-direction:column;line-height:1.05}
.brand-copy b{font-size:14px;letter-spacing:-.015em}
.brand-copy small{font-size:10px;color:var(--muted);margin-top:3px;font-weight:600}
.site-nav{display:flex;align-items:center;gap:6px}
.nav-link{font-size:13px;font-weight:650;padding:9px 12px;border-radius:10px;color:var(--ink-2)}
.nav-link:hover{background:#e9edf1}
.nav-muted{color:var(--muted)}

/* Home */
.home-page{padding-bottom:72px}
.home-hero{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(360px,.8fr);gap:70px;align-items:end;padding:72px 0 50px;border-bottom:1px solid var(--line)}
.hero-copy{max-width:720px}
.eyebrow{display:inline-flex;align-items:center;gap:8px;margin-bottom:17px;font-size:10px;line-height:1;font-weight:800;letter-spacing:.17em;color:#8a929c}
.eyebrow:before{content:"";width:22px;height:1px;background:#afb5bc}
.home-hero h1{margin:0;font-size:clamp(48px,5.45vw,78px);line-height:.91;letter-spacing:-.065em;font-weight:830}
.home-hero h1 span{color:#535a63}
.home-hero p{max-width:620px;margin:20px 0 0;color:var(--muted);font-size:15px;line-height:1.65}
.hero-tools{width:100%;max-width:500px;justify-self:end}
.home-search{height:56px;display:flex;align-items:center;gap:8px;padding:6px 6px 6px 16px;background:#fff;border:1px solid var(--line);border-radius:16px;box-shadow:var(--shadow-sm)}
.home-search>svg{width:18px;height:18px;flex:0 0 auto;fill:none;stroke:#939ba5;stroke-width:1.8;stroke-linecap:round}
.home-search input{width:100%;min-width:0;border:0;outline:0;background:transparent;color:var(--ink);font-size:13px;padding:0 3px}
.home-search input::placeholder{color:#9ca3ab}
.search-clear{width:28px;height:28px;display:grid;place-items:center;flex:0 0 auto;border-radius:50%;color:#747c85;font-size:18px}
.search-clear:hover{background:#f0f2f4}
.search-submit{height:42px;flex:0 0 auto;border:0;border-radius:11px;padding:0 18px;background:var(--dark);color:#fff;font-size:12px;font-weight:750;cursor:pointer}
.search-submit:hover{background:#2b2e34}
.hero-stat{display:flex;align-items:baseline;gap:8px;margin:13px 2px 0;color:var(--muted)}
.hero-stat strong{font-size:13px;color:var(--ink-2)}
.hero-stat span{font-size:11px}
.library-section{padding-top:31px}
.library-head{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:18px}
.library-head h2{margin:0 0 5px;font-size:19px;letter-spacing:-.025em}
.library-head p{margin:0;font-size:12px;color:var(--muted)}
.models-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px}
.model-card{min-width:0;display:flex;flex-direction:column;overflow:hidden;background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow-sm);transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease}
.model-card:hover{transform:translateY(-3px);border-color:#d8dee4;box-shadow:var(--shadow-md)}
.model-preview{position:relative;display:block;padding:12px 12px 0}
.preview-stage{height:232px;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:14px;background:linear-gradient(145deg,#edf1f4 0%,#f7f9fa 100%);border:1px solid #edf0f2}
.preview-stage img{width:100%;display:block;object-fit:contain;object-position:center;transition:transform .25s ease;filter:drop-shadow(0 14px 12px rgba(20,27,34,.08))}
.model-card:hover .preview-stage img{transform:scale(1.025)}
.thumb-placeholder{display:flex;flex-direction:column;align-items:center;gap:6px;color:#b3bac2}
.thumb-placeholder span{font-size:46px;font-weight:900;letter-spacing:-.08em}
.thumb-placeholder small{font-size:10px;font-weight:650;letter-spacing:.04em;text-transform:uppercase}
.format-badge{position:absolute;left:24px;top:24px;z-index:2;border:1px solid rgba(255,255,255,.2);border-radius:999px;padding:5px 8px;background:rgba(24,27,31,.78);backdrop-filter:blur(8px);color:#fff;font-size:9px;font-weight:750;letter-spacing:.02em}
.open-overlay{position:absolute;right:24px;bottom:12px;z-index:2;display:flex;align-items:center;gap:7px;padding:7px 9px;border:1px solid rgba(0,0,0,.05);border-radius:9px;background:rgba(255,255,255,.94);box-shadow:0 6px 14px rgba(0,0,0,.07);color:#363b42;font-size:10px;font-weight:700;opacity:0;transform:translateY(5px);transition:.2s}
.model-card:hover .open-overlay{opacity:1;transform:translateY(0)}
.model-card-content{display:flex;flex:1;flex-direction:column;padding:16px}
.model-card-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.model-card-heading h3{min-width:0;margin:0;font-size:16px;line-height:1.3;letter-spacing:-.02em;font-weight:760}
.model-card-heading h3 a{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.model-type-dot{width:7px;height:7px;margin-top:7px;flex:0 0 auto;border-radius:50%;background:#57a46d;box-shadow:0 0 0 3px #e9f4ec}
.model-meta{display:flex;align-items:center;gap:7px;margin-top:8px;min-height:18px;color:#8a929b;font-size:10.5px;white-space:nowrap;overflow:hidden}
.model-meta span{overflow:hidden;text-overflow:ellipsis}
.model-meta i{width:3px;height:3px;flex:0 0 auto;border-radius:50%;background:#c2c7cc}
.model-actions{display:grid;grid-template-columns:1fr 42px;gap:8px;margin-top:16px;padding-top:14px;border-top:1px solid #edf0f2}
.action-primary,.action-download{height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:750;transition:.18s}
.action-primary{justify-content:space-between;padding:0 14px;background:var(--dark);color:#fff}
.action-primary:hover{background:#2a2d32}
.action-primary b{font-size:14px}
.action-download{border:1px solid var(--line-strong);background:#fff;color:#292d33}
.action-download:hover{background:#f0f3f5;border-color:#cbd2d9}
.action-download svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.home-empty{padding:70px 24px;text-align:center;background:#fff;border:1px dashed #d5dbe1;border-radius:20px}
.empty-icon{width:54px;height:54px;margin:0 auto 15px;border-radius:15px;display:grid;place-items:center;background:#eef2f5;color:#99a1aa;font-size:15px;font-weight:850}
.home-empty h3{margin:0 0 6px;font-size:18px}
.home-empty p{margin:0 auto 18px;color:var(--muted);font-size:13px}

/* Buttons / shared admin UI */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;padding:9px 14px;border:1px solid var(--line-strong);border-radius:11px;background:#fff;color:var(--ink);font-size:12px;font-weight:700;cursor:pointer;transition:.16s}
.btn:hover{background:#f2f4f6}
.btn.dark{border-color:var(--dark);background:var(--dark);color:#fff}
.btn.dark:hover{background:#2a2d32}
.btn.danger{border-color:#efc2be;color:#ad2721;background:#fff}
.btn.danger:hover{background:#fff3f2}
.admin-wrap{width:min(1120px,calc(100% - 48px));margin:42px auto 72px}
.admin-head{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-bottom:20px}
.admin-head h1{margin:0;font-size:34px;letter-spacing:-.045em}
.panel{overflow:hidden;padding:22px;background:#fff;border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow-sm)}
.table{width:100%;border-collapse:collapse}
.table th,.table td{text-align:left;padding:14px 10px;border-bottom:1px solid #edf0f2;font-size:12px;vertical-align:middle}
.table th{font-size:10px;color:#8b939c;text-transform:uppercase;letter-spacing:.08em;font-weight:800}
.table tbody tr:last-child td{border-bottom:0}
.actions{display:flex;flex-wrap:wrap;gap:7px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.field{display:flex;flex-direction:column;gap:7px}
.field.full{grid-column:1/-1}
.field label{font-size:11px;font-weight:780}
.field input:not([type=checkbox]),.field textarea,.field select{width:100%;border:1px solid #d8dee4;border-radius:11px;padding:11px 12px;background:#fff;color:var(--ink);outline:0}
.field input:focus,.field textarea:focus,.field select:focus{border-color:#9ca4ad;box-shadow:0 0 0 3px rgba(18,20,24,.05)}
.field textarea{min-height:120px;resize:vertical}
.help{font-size:11px;color:var(--muted);line-height:1.45}
.alert{padding:12px 14px;border-radius:11px;margin-bottom:18px;font-size:12px}
.alert.error{background:#fff1f0;color:#a8071a;border:1px solid #ffccc7}
.alert.ok{background:#f0fff4;color:#166534;border:1px solid #bbf7d0}
.login{width:min(430px,calc(100% - 32px));margin:82px auto}
.login h1{margin:0 0 8px;letter-spacing:-.035em}
.login p{color:var(--muted);margin:0 0 22px}
.empty{padding:60px 0;text-align:center;color:var(--muted)}

/* Model page shared positioning */
.model-shell{height:100vh;position:relative;overflow:hidden;background:#eef2f5}
.model-top-actions{position:absolute;z-index:8;right:18px;top:18px;display:flex;gap:8px;align-items:center}
.model-back,.model-download{height:38px;display:flex;align-items:center;border-radius:10px;padding:0 12px;font-size:11px;font-weight:750;backdrop-filter:blur(12px);box-shadow:0 6px 20px rgba(20,25,30,.08)}
.model-back{background:rgba(255,255,255,.94);border:1px solid rgba(0,0,0,.07)}
.model-download{background:#17191d;color:#fff;border:1px solid #17191d}
.model-download:hover{background:#2a2d32}
.model-info-strip{position:absolute;z-index:6;left:322px;top:18px;display:flex;gap:7px;pointer-events:none}
.model-info-strip span{padding:7px 10px;border:1px solid rgba(0,0,0,.06);border-radius:999px;background:rgba(255,255,255,.88);backdrop-filter:blur(10px);color:#5d6670;font-size:10px}

/* Footer */
.site-footer{height:72px;border-top:1px solid var(--line);background:#f8fafb;color:#8b939c}
.footer-inner{height:100%;width:min(1320px,calc(100% - 48px));margin:0 auto;display:flex;align-items:center;justify-content:space-between;gap:20px;font-size:10px}

@media(max-width:1180px){
  .models-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .home-hero{gap:42px}
}
@media(max-width:900px){
  .container,.header-inner,.footer-inner{width:min(100% - 32px,1320px)}
  .home-hero{grid-template-columns:1fr;gap:30px;padding-top:48px}
  .hero-tools{max-width:none;justify-self:stretch}
  .models-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .admin-wrap{width:calc(100% - 32px)}
  .form-grid{grid-template-columns:1fr}
  .field.full{grid-column:auto}
  .model-info-strip{display:none}
}
@media(max-width:620px){
  .site-header{height:66px}
  .brand-copy small{display:none}
  .site-nav{gap:2px}
  .nav-link{padding:8px 9px;font-size:12px}
  .home-hero{padding:40px 0 36px}
  .home-hero h1{font-size:48px}
  .home-hero p{font-size:14px}
  .library-section{padding-top:24px}
  .models-grid{grid-template-columns:1fr}
  .preview-stage{height:260px}
  .open-overlay{display:none}
  .footer-inner{justify-content:center}
  .footer-inner span:last-child{display:none}
  .admin-head{align-items:flex-start;flex-direction:column}
  .panel{padding:16px}
  .table{display:block;overflow-x:auto;white-space:nowrap}
  .model-top-actions{left:10px;right:10px;top:10px;justify-content:flex-end}
  .model-back,.model-download{height:34px;padding:0 9px;font-size:10px}
}
