:root {
  color-scheme: dark;
  --bg: #151616;
  --panel: #202222;
  --fg: #f5f2eb;
  --muted: #afafaa;
  --line: #383b39;
  --accent: #d1dfbe;
  --dark-accent: #222b1e;
  --gap: 12px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 26px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button { color: inherit; font: inherit; cursor: pointer; }
:where(a, button, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.top, main, footer { width: min(92%, 1360px); margin-inline: auto; }
.top { min-height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand, .top > a:last-child, footer { font-size: 11px; letter-spacing: .13em; }
.brand { font-weight: 760; display: inline-flex; align-items: center; gap: 9px; }
.dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.top > a:last-child, footer { color: var(--muted); }
.top > a:hover, footer a:hover { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: 7px; padding: 22px 0 32px; }
nav a, .category-nav a { border: 1px solid var(--line); border-radius: 99px; }
nav a { padding: 7px 13px; font-weight: 740; background: var(--panel); }
nav a:hover, .category-nav a:hover { color: var(--accent); border-color: #829075; }
.project { padding-bottom: clamp(48px, 6vw, 88px); }
.project-head { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 26px; border-top: 1px solid var(--line); }
.title-row { display: flex; gap: 15px; align-items: baseline; }
.number, .carousel-position { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); }
.number { color: var(--accent); }
h1 { margin: 0; font-size: clamp(36px, 5vw, 70px); font-weight: 550; letter-spacing: -.069em; line-height: 1.04; }
.status { display: inline-block; margin-top: 9px; color: var(--accent); text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 650; }
.store-card, .stores { display: flex; align-items: center; gap: 8px; }
.store-card { padding: 7px; border-radius: 16px; background: #292e26; border: 1px solid #484f43; }
.app-icon { width: 46px; height: 46px; object-fit: scale-down; border-radius: 11px; flex: none; }
.store-link { display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 11px; border-radius: 10px; color: var(--dark-accent); background: var(--accent); font-size: 13px; font-weight: 730; white-space: nowrap; }
.store-link:hover { background: #e5f0d8; }
.store-arrow { margin-left: 3px; color: #4d5b43; }
.category-nav { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 22px; }
.category-nav a { padding: 5px 11px; font-size: 12px; color: var(--muted); }
.category { margin-top: 25px; min-width: 0; }
.category-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; min-height: 34px; }
.category-head:has(.carousel-controls):not(:has(h2)) { justify-content: end; }
.category h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.gallery.sheets, .gallery.pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery.pairs { max-width: 1000px; }
.gallery.level { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
.tile { display: flex; align-items: center; justify-content: center; position: relative; width: 100%; height: clamp(175px, 22vw, 295px); padding: 12px; min-width: 0; border-radius: 12px; border: 1px solid #ffffff14; background: var(--surface, var(--panel)); overflow: hidden; }
.tile img { display: block; width: auto; height: auto; max-width: min(100%, var(--native-width)); max-height: 100%; object-fit: contain; }
.tile.wide { grid-column: span 2; }
:is(.pairs, .sheets, .level) .tile { grid-column: auto; }
.pairs .tile { height: clamp(205px, 33vw, 400px); }
.level .tile { height: clamp(190px, 25vw, 300px); }
.tile:hover { border-color: #ffffff70; }
.tile:focus-visible { outline-offset: -4px; }
.tile-action, .play { position: absolute; display: grid; place-items: center; color: white; background: #141616e8; border: 1px solid #ffffff45; }
.tile-action { right: 9px; bottom: 9px; border-radius: 99px; padding: 3px 9px; font-size: 10px; font-weight: 650; }
.expand { width: 28px; height: 28px; padding: 0; font-size: 14px; }
.play { width: 44px; height: 44px; padding-left: 2px; border-radius: 50%; }
@media (hover: hover) {
  .expand { opacity: 0; transition: opacity .18s; }
  .tile:hover .expand, .tile:focus-visible .expand { opacity: 1; }
}
.gallery.carousel { display: grid; position: relative; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * var(--gap)) / 4); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: #5d665b var(--panel); padding-bottom: 8px; }
.gallery.sheets.carousel { grid-auto-columns: calc((100% - var(--gap)) / 2); }
.carousel .tile { scroll-snap-align: start; grid-column: auto; }
.carousel:not(.sheets) .tile.wide { grid-column: span 2; }
.carousel-controls { display: flex; align-items: center; gap: 6px; }
.carousel-controls[hidden] { display: none; }
.carousel-position { white-space: nowrap; margin-right: 5px; }
.carousel-controls button, .viewer-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); }
.carousel-controls button:hover { border-color: var(--accent); color: var(--accent); }
.carousel-controls button[aria-disabled="true"] { opacity: .38; cursor: default; }
.rail-prev svg { transform: rotate(180deg); }
footer { border-top: 1px solid var(--line); padding: 26px 0; display: flex; justify-content: space-between; gap: 15px; }
.viewer-open { overflow: hidden; scrollbar-gutter: stable; }
#viewer { width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; background: transparent; color: var(--fg); }
#viewer[open] { display: grid; place-items: center; }
#viewer::backdrop { background: rgb(8 9 9 / 90%); }
#viewer-media { position: relative; width: 100%; height: 100%; display: grid; place-items: center; padding: 3dvh 3vw; }
.zoom-image { display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: zoom-out; }
.zoom-image img { display: block; width: auto; height: auto; max-width: 94vw; max-height: 94dvh; object-fit: contain; }
#viewer-media video { display: block; max-width: 92vw; max-height: 86dvh; background: #000; }
.viewer-close { position: absolute; top: 14px; right: 14px; font-size: 22px; }
@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery.carousel { grid-auto-columns: calc((100% - 2 * var(--gap)) / 3); }
}
@media (max-width: 650px) {
  :root { --gap: 8px; }
  .top { min-height: 60px; }
  nav { padding: 16px 0 23px; }
  nav a { padding: 6px 10px; font-size: 12px; }
  .project-head { flex-direction: column; align-items: flex-start; gap: 14px; padding-top: 20px; }
  .store-card { padding: 5px; gap: 6px; }
  .stores { gap: 5px; }
  .store-link { padding: 0 8px; gap: 5px; font-size: 12px; }
  .store-arrow { margin-left: 0; }
  .app-icon { width: 40px; height: 40px; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery.carousel { grid-auto-columns: 62%; }
  .gallery.sheets.carousel { grid-auto-columns: 86%; }
  .carousel:not(.sheets) .tile.wide { grid-column: auto; }
  .gallery.level { grid-template-columns: minmax(0, 1fr); }
  .level .tile { height: clamp(150px, 55vw, 240px); }
  .tile { padding: 8px; border-radius: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .expand { transition: none; }
}
