:root {
  color-scheme: dark;
  --surface: #151713;
  --panel: #1c1f1a;
  --border: #353a30;
  --text: #f3f4ee;
  --muted: #b0b6a8;
  --accent: #e4f298;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.site-header { border-bottom: 1px solid var(--border); }
.header-inner, .page { width: min(1280px, calc(100% - 80px)); margin-inline: auto; }
.header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-size: 1.05rem; font-weight: 700; }
.brand-subtitle { color: var(--muted); font-weight: 500; }
.brand-icon { width: 26px; height: 26px; flex: none; position: relative; }
.brand-icon::before, .brand-icon::after { content: ""; position: absolute; width: 15px; height: 15px; border: 1.5px solid var(--accent); border-radius: 4px; }
.brand-icon::before { inset: 2px auto auto 2px; }
.brand-icon::after { inset: auto 2px 2px auto; background: #151713; }
.share-button { color: var(--text); min-height: 42px; padding: .5rem .9rem; border: 1px solid #4b5244; border-radius: 9px; background: transparent; font-size: .875rem; font-weight: 600; }
.share-button:hover { background: #2b3026; }

.page { padding-block: clamp(2rem, 5vw, 4.25rem) 3.5rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.3rem, 5.5vw, 4.2rem); line-height: 1.04; letter-spacing: -.065em; font-weight: 700; }
.group-description { margin-top: .8rem; color: var(--muted); max-width: 60ch; }
.group-description:empty { display: none; }
.page-status { margin-top: 1.5rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: minmax(0, 2.45fr) minmax(265px, 1fr); gap: clamp(18px, 2.6vw, 36px); align-items: start; margin-top: clamp(1.5rem, 3.3vw, 2.8rem); }

.view-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.view-controls label, .model-actions label { color: var(--muted); font-size: .875rem; }
.view-controls select, .model-actions select { border: 1px solid #4b5244; border-radius: 9px; margin-left: 4px; min-height: 42px; padding: 4px 8px; background: var(--panel); color: var(--text); }
.view-controls select:disabled { opacity: .65; }
.view-hint { margin-top: .45rem; color: var(--muted); font-size: .875rem; }
.stage { position: relative; isolation: isolate; height: clamp(380px, 54vw, 610px); border-radius: 22px; border: 1px solid #3b4035; overflow: hidden; background: radial-gradient(ellipse at 48% 44%, #41493a 0, #30372b 48%, #22271f 100%); }
.stage::before { position: absolute; inset: 0; content: ""; opacity: .34; pointer-events: none; background-image: radial-gradient(circle, #9fa88c 1px, transparent 1.2px); background-size: 25px 25px; mask-image: radial-gradient(ellipse, transparent 20%, black 85%); z-index: -1; }
model-viewer { display: block; width: 100%; height: 100%; --poster-color: transparent; }
.ar-button { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); min-height: 46px; max-width: calc(100% - 24px); padding: .6rem 1.1rem; border: 0; border-radius: 10px; background: var(--accent); color: #1a2111; font-weight: 700; }
.ar-button:hover { background: #f0ffad; }
.stage-status { position: absolute; z-index: 1; left: 14px; bottom: 14px; max-width: calc(100% - 28px); padding: .35rem .65rem; border-radius: 7px; background: #171914eb; color: var(--text); font-size: .875rem; pointer-events: none; }
.stage-status:empty { display: none; }
.model-caption { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 12px 18px; padding: 1.15rem .15rem 0; }
.model-caption h2 { font-size: clamp(1.25rem, 2.7vw, 1.75rem); letter-spacing: -.035em; }
.model-caption p { color: var(--muted); margin-top: .2rem; }
.model-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.collection { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); padding: 18px; }
.collection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .85rem; }
.collection-heading h2 { font-size: 1.125rem; font-weight: 650; letter-spacing: -.02em; }
.model-count { color: var(--muted); font-size: .875rem; }
.model-list { padding: 0; margin: 0; list-style: none; display: grid; gap: 8px; }
.model-choice { width: 100%; display: flex; align-items: center; gap: 11px; min-height: 74px; padding: 6px 10px 6px 6px; text-align: left; color: var(--text); background: #242820; border: 1px solid transparent; border-radius: 11px; line-height: 1.32; font-size: .9rem; font-weight: 600; }
.model-choice:hover { background: #30362a; }
.model-choice[aria-pressed="true"] { border-color: #a1ad6f; background: #343d29; color: #f2f8d8; }
.model-choice img { width: 60px; height: 60px; object-fit: contain; flex: none; border-radius: 7px; background: radial-gradient(ellipse, #505b45, #353d2e); }

dialog { width: min(430px, calc(100% - 32px)); padding: 24px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 15px; }
dialog::backdrop { background: #0009; }
dialog form { display: grid; gap: 14px; }
dialog label { font-weight: 650; }
dialog input { width: 100%; background: #242820; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
dialog button { justify-self: end; }
.downloads-context { color: var(--muted); }
.downloads-list { list-style: none; margin: 8px 0 18px; padding: 0; display: grid; gap: 6px; }
.downloads-list a { display: block; padding: 8px 10px; border-radius: 8px; background: #2b3026; color: var(--text); text-decoration: none; }
.downloads-list a:hover { background: #373f31; }
.downloads-list small { display: block; color: var(--muted); font-size: .875rem; }
#downloads-content h3 { margin: 16px 0 0; font-size: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

@media (max-width: 780px) {
  .header-inner, .page { width: calc(100% - 32px); }
  .header-inner { min-height: 64px; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .stage { height: clamp(290px, 68vw, 460px); border-radius: 16px; }
  .collection { padding: 14px; }
}

@media (max-width: 540px) {
  .view-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .view-controls select { display: block; width: 100%; margin: 4px 0 0; }
}

@media (max-width: 375px) {
  .brand { gap: 6px; font-size: .9rem; }
  .share-button { padding-inline: .55rem; }
}
