:root {
  --ink: #0b1220;
  --muted: #697386;
  --line: #e3e7ee;
  --paper: #f7f9fc;
  --white: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --mint: #10b981;
  --danger: #b42318;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.site-header { height: 76px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.nav-wrap, .nav { height: 100%; display: flex; align-items: center; }
.nav-wrap { justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--ink); color: white; font-size: 17px; }
.nav { gap: 25px; color: var(--muted); font-size: 14px; font-weight: 600; }
.nav a:hover, .nav-button:hover, .back-link:hover { color: var(--accent); }
.nav-button, .inline-form { border: 0; background: transparent; color: inherit; padding: 0; }
.nav-login { color: var(--ink); }
.main-content { min-height: calc(100vh - 148px); padding-top: 72px; padding-bottom: 90px; }
.hero { max-width: 780px; padding: 24px 0 82px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.065em; }
h1 em { color: var(--accent); font-style: normal; }
h2 { margin-bottom: 0; font-size: 27px; letter-spacing: -.04em; }
h3 { letter-spacing: -.025em; }
.hero-copy { max-width: 530px; margin-bottom: 32px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.search-form, .admin-search { display: flex; gap: 10px; max-width: 670px; }
.search-form input, .admin-search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 15px 17px; background: var(--white); color: var(--ink); outline: none; box-shadow: 0 3px 12px rgba(15,23,42,.03); }
.search-form input:focus, .admin-search input:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.search-form button, .admin-search button { border: 0; border-radius: 11px; padding: 0 22px; background: var(--ink); color: white; font-weight: 750; }
.section-head, .admin-head, .toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-head { margin-bottom: 22px; }
.result-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
.subtitle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.project-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.project-card, .admin-project-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.project-card:hover, .admin-project-card:hover { transform: translateY(-3px); border-color: #c6d4f5; box-shadow: 0 14px 32px rgba(29,78,216,.09); }
.project-cover { display: block; aspect-ratio: 3 / 4; overflow: hidden; background: #e9eef7; }
.project-cover img, .project-admin-cover img, .project-hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.project-cover.small { aspect-ratio: 3 / 2; }
.project-card-body, .admin-project-card-body { padding: 18px; }
.project-card h3, .admin-project-card h3 { margin: 0 0 7px; font-size: 18px; line-height: 1.25; }
.project-card h3 a:hover, .admin-project-card h3 a:hover { color: var(--accent); }
.project-card .card-bottom, .admin-project-card .card-bottom { margin-top: 22px; padding-top: 14px; }
.cover-placeholder { display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(145deg, #0b1220, #2563eb); color: white; font-size: 42px; font-weight: 850; }
.cover-placeholder.large { font-size: 72px; }
.subtitle-card { display: flex; min-height: 188px; flex-direction: column; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.subtitle-card:hover { transform: translateY(-3px); border-color: #c6d4f5; box-shadow: 0 14px 32px rgba(29,78,216,.09); }
.card-top, .card-bottom, .info-line, .detail-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.format-tag { display: inline-flex; width: fit-content; border-radius: 7px; padding: 5px 8px; background: #eff6ff; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.visibility-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.visibility-dot::before { width: 6px; height: 6px; border-radius: 50%; background: #94a3b8; content: ""; }
.visibility-dot.public::before { background: var(--mint); }
.visibility-dot.private::before { background: #f59e0b; }
.subtitle-card h3 { margin: 22px 0 7px; font-size: 19px; line-height: 1.25; }
.subtitle-card h3 a:hover, .table-title:hover { color: var(--accent); }
.meta, .card-bottom, .muted { color: var(--muted); }
.meta { margin-bottom: auto; font-size: 13px; }
.card-bottom { padding-top: 20px; border-top: 1px solid #edf0f5; font-size: 12px; }
.empty-state { margin-top: 22px; padding: 76px 20px; border: 1px dashed #cbd5e1; border-radius: var(--radius); text-align: center; background: rgba(255,255,255,.45); }
.empty-state.compact { padding: 62px 20px; }
.empty-icon { display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%; background: var(--ink); color: white; font-size: 23px; }
.empty-state h3 { margin-bottom: 8px; font-size: 20px; }
.empty-state p { color: var(--muted); }
.auth-shell { display: grid; place-items: center; min-height: 640px; }
.auth-card { width: min(100%, 440px); padding: 38px; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: 0 18px 50px rgba(15,23,42,.06); }
.auth-card h1 { margin: 13px 0 10px; font-size: 42px; }
.stack-form, .upload-card { display: flex; flex-direction: column; gap: 10px; }
.stack-form { margin-top: 27px; }
.stack-form label, .upload-card label { margin-top: 8px; color: #344054; font-size: 13px; font-weight: 750; }
.stack-form input, .upload-card input, .upload-card select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: var(--white); color: var(--ink); outline: none; }
.stack-form input { margin-bottom: 6px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 16px; width: fit-content; border: 0; border-radius: 10px; padding: 13px 18px; background: var(--accent); color: white; font-size: 14px; font-weight: 750; }
.primary-button:hover { background: var(--accent-dark); }
.stack-form .primary-button { width: 100%; margin-top: 10px; }
.primary-button span { font-size: 18px; line-height: 0; }
.alert { margin: 22px 0; border-radius: 10px; padding: 13px 15px; font-size: 13px; line-height: 1.45; }
.alert-error { border: 1px solid #fecdca; background: #fff5f4; color: var(--danger); }
.alert-success { border: 1px solid #a6f4c5; background: #ecfdf3; color: #067647; }
.alert-link { display: flex; align-items: center; gap: 12px; border: 1px solid #bfdbfe; background: #eff6ff; color: #1e40af; }
.alert-link input { flex: 1; min-width: 0; border: 1px solid #bfdbfe; border-radius: 7px; padding: 7px 9px; background: white; color: #1e3a8a; font-size: 12px; }
.back-link { display: inline-block; margin-bottom: 26px; color: var(--muted); font-size: 13px; font-weight: 700; }
.project-hero { padding-bottom: 38px; }
.project-hero-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: center; gap: 30px; }
.project-hero-cover { width: 210px; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 18px; background: #e9eef7; box-shadow: 0 20px 40px rgba(15,23,42,.12); }
.project-hero-copy h1 { margin: 13px 0 12px; font-size: clamp(40px, 6vw, 64px); }
.source-link { color: var(--accent); font-size: 13px; font-weight: 700; }
.source-link:hover { color: var(--accent-dark); text-decoration: underline; }
.subtitle-list { display: flex; flex-direction: column; gap: 10px; }
.subtitle-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.subtitle-row strong { display: block; margin-bottom: 5px; font-size: 14px; }
.compact-button { padding: 9px 13px; font-size: 12px; }
.project-admin-summary { display: grid; grid-template-columns: 88px minmax(0, 1fr) 180px; align-items: center; gap: 18px; margin-bottom: 38px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.project-admin-cover { width: 88px; height: 112px; overflow: hidden; border-radius: 9px; background: #e9eef7; }
.project-admin-summary strong { display: block; margin-bottom: 5px; font-size: 14px; }
.project-files-head { margin-bottom: 16px; }
.detail-hero { padding-bottom: 28px; }
.detail-layout { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.detail-layout h1 { margin: 13px 0 9px; font-size: clamp(40px, 6vw, 64px); }
.detail-subtitle { margin: 0; color: var(--muted); font-size: 17px; }
.detail-format { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 22px; background: var(--ink); color: white; font-size: 25px; font-weight: 800; }
.detail-card { max-width: 840px; border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; background: var(--white); }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.field-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-grid strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.detail-actions { justify-content: flex-start; padding-top: 25px; }
.checksum { overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-head { align-items: center; margin-bottom: 38px; }
.admin-head h1 { margin: 12px 0 8px; font-size: 48px; }
.toolbar { align-items: center; margin-bottom: 16px; }
.admin-search { max-width: 470px; }
.admin-search input { padding: 11px 13px; }
.admin-search button { padding: 0 18px; }
.admin-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.admin-table { width: 100%; min-width: 700px; border-collapse: collapse; text-align: left; }
.admin-table th { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.admin-table th, .admin-table td { padding: 16px 20px; border-bottom: 1px solid #edf0f5; }
.admin-table tr:last-child td { border-bottom: 0; }
.table-title, .table-sub { display: block; }
.table-title { margin-bottom: 4px; font-size: 14px; font-weight: 750; }
.table-sub { color: var(--muted); font-size: 11px; }
.row-actions { display: flex; gap: 11px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 750; }
.text-button.danger { color: var(--danger); }
.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 18px; }
.upload-card, .info-panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; background: var(--white); }
.upload-card input[type=file] { padding: 10px; }
.help { margin: 2px 0 7px; color: var(--muted); font-size: 12px; }
.required { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px 14px; margin: 5px 0 14px; }
.form-grid > div { display: flex; flex-direction: column; gap: 7px; }
.form-grid .wide { grid-column: 1 / -1; }
.info-panel { background: var(--ink); color: white; }
.info-icon { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 24px; border-radius: 50%; background: #d1fae5; color: #047857; font-weight: 800; }
.info-panel h3 { margin-bottom: 9px; font-size: 20px; }
.info-panel p { color: #a8b4c8; font-size: 13px; line-height: 1.6; }
.info-line { padding-top: 14px; margin-top: 14px; border-top: 1px solid #27354b; color: #a8b4c8; font-size: 11px; }
.info-line strong { color: white; font-size: 12px; }
.site-footer { border-top: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 11px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding: 20px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .subtitle-grid, .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-layout { grid-template-columns: 1fr; }
  .project-hero-layout { grid-template-columns: 150px minmax(0, 1fr); gap: 22px; }
  .project-hero-cover { width: 150px; }
  .project-admin-summary { grid-template-columns: 76px minmax(0, 1fr); }
  .project-admin-summary > :last-child { grid-column: 2; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 28px, 1120px); }
  .site-header { height: 66px; }
  .nav { gap: 13px; font-size: 12px; }
  .main-content { padding-top: 44px; }
  .hero { padding-bottom: 56px; }
  h1 { font-size: 48px; }
  .search-form { flex-direction: column; }
  .search-form button { min-height: 46px; }
  .subtitle-grid, .project-grid { grid-template-columns: 1fr; }
  .section-head, .admin-head, .toolbar, .detail-layout { align-items: flex-start; flex-direction: column; }
  .project-hero-layout { grid-template-columns: 1fr; }
  .project-hero-cover { width: 150px; }
  .subtitle-row { align-items: flex-start; flex-direction: column; }
  .subtitle-row .primary-button { width: 100%; }
  .project-admin-summary { grid-template-columns: 76px minmax(0, 1fr); }
  .project-admin-summary > :last-child { grid-column: 1 / -1; }
  .admin-head { gap: 20px; }
  .admin-head .primary-button { width: 100%; }
  .admin-head h1 { font-size: 42px; }
  .detail-format { width: 64px; height: 64px; border-radius: 16px; font-size: 18px; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-actions { align-items: flex-start; flex-direction: column; }
  .detail-actions .primary-button { width: 100%; }
  .alert-link { align-items: stretch; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
}
