:root {
  color-scheme: light;
  --paper: #f4f5f7;
  --surface: #ffffff;
  --ink: #17191d;
  --muted: #69707a;
  --line: #d8dce2;
  --line-strong: #aeb5bf;
  --accent: #e5362c;
  --cyan: #16879a;
  --green: #26845d;
  --warning: #c17b16;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 25, 29, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 28px;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }

.masthead {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(460px, .95fr);
  gap: 30px;
  align-items: center;
  min-height: 116px;
  padding: 20px clamp(20px, 3vw, 42px);
  color: #f8f8f7;
  background: #17191d;
  border-bottom: 5px solid var(--accent);
}

.kicker, .section-label, .drawer-header p {
  margin: 0 0 9px;
  color: #9da5b0;
  font: 700 11px/1.2 "DIN Alternate", "Avenir Next", sans-serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font: 700 clamp(27px, 3vw, 38px)/1 "Avenir Next Condensed", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

.archive-state { margin: 10px 0 0; color: #b8bec7; font-size: 12px; }
.archive-state.online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #47c184; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid #4a4e55;
  border-bottom: 1px solid #4a4e55;
}

.summary-strip div { min-width: 0; padding: 12px 14px 11px; border-left: 1px solid #4a4e55; }
.summary-strip div:first-child { border-left: 0; }
.summary-strip strong { display: block; overflow: hidden; font: 700 clamp(18px, 2vw, 25px)/1 "DIN Alternate", monospace; text-overflow: ellipsis; white-space: nowrap; }
.summary-strip span { display: block; margin-top: 5px; color: #9da5b0; font-size: 10px; }

main { min-height: calc(100vh - 116px); }

.embedded-shell .masthead {
  min-height: 74px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 12px 20px;
  border-bottom-width: 3px;
}
.embedded-shell .brand-block { display: flex; min-width: 0; align-items: baseline; gap: 12px; }
.embedded-shell .brand-block .kicker { display: none; }
.embedded-shell .brand-block h1 { flex: none; font-size: 25px; }
.embedded-shell .archive-state { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.embedded-shell .summary-strip { width: min(420px, 42vw); }
.embedded-shell .summary-strip div { padding: 8px 10px; }
.embedded-shell .summary-strip strong { font-size: 18px; }
.embedded-shell .summary-strip span { margin-top: 3px; }
.embedded-shell main { min-height: calc(100vh - 74px); }
.embedded-shell .control-band { padding: 11px 20px 10px; }
.embedded-shell .filters-row { margin-top: 8px; }
.embedded-shell .catalog-band { padding: 16px 20px 48px; }
.embedded-shell .detail-drawer { width: min(980px, 100vw); }
.embedded-shell .drawer-header { height: 50px; padding-inline: 18px; }
.embedded-shell .detail-content { padding: 18px 18px 38px; }

.control-band {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: 15px clamp(20px, 3vw, 42px) 13px;
  background: rgba(244, 245, 247, 0.96);
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(12px);
}

.search-wrap { display: grid; grid-template-columns: 112px minmax(220px, 1fr) auto; align-items: center; border-bottom: 2px solid var(--ink); }
.search-wrap label { font-size: 12px; font-weight: 700; }
.search-wrap input { width: 100%; padding: 10px 0 11px; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 18px; }
.search-wrap input::placeholder { color: #9ca2aa; }
.search-state { min-width: 72px; color: var(--muted); font-size: 11px; text-align: right; }

.filters-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-top: 11px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend, .select-field { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }

.segmented { display: flex; height: 34px; margin-top: 5px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented button { min-width: 56px; padding: 0 12px; color: var(--muted); background: var(--surface); border: 0; border-left: 1px solid var(--line); font-size: 12px; }
.segmented button:first-child { border-left: 0; }
.segmented button.active { color: #fff; background: var(--ink); }

.select-field { display: grid; gap: 5px; }
select { height: 34px; min-width: 112px; padding: 0 30px 0 10px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 12px; }
.reset-button { height: 34px; padding: 0 14px; color: var(--accent); background: transparent; border: 1px solid currentColor; border-radius: var(--radius); font-size: 12px; font-weight: 700; }

.catalog-band { padding: 22px clamp(20px, 3vw, 42px) 60px; }
.catalog-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.section-label { color: var(--accent); }
h2 { margin: 0; font: 700 27px/1.1 "Avenir Next Condensed", "PingFang SC", sans-serif; }
.result-count { margin: 0; color: var(--muted); font-size: 12px; }

.table-shell { border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line-strong); }
.table-header, .asset-row {
  display: grid;
  grid-template-columns: minmax(320px, 2fr) minmax(120px, .72fr) 70px minmax(130px, .9fr) 90px 34px;
  gap: 18px;
  align-items: center;
}
.table-header { min-height: 38px; padding: 0 12px; color: var(--muted); border-bottom: 1px solid var(--line-strong); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.asset-row { position: relative; min-height: 86px; padding: 10px 12px; background: rgba(255, 255, 255, 0.72); border-bottom: 1px solid var(--line); outline: 0; transition: background 140ms ease, transform 140ms ease; }
.asset-row:last-child { border-bottom: 0; }
.asset-row:hover, .asset-row:focus-visible { z-index: 1; background: #fff; transform: translateX(3px); box-shadow: -3px 0 0 var(--accent); }

.asset-identity { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 13px; align-items: center; min-width: 0; }
.cover { position: relative; display: grid; width: 54px; height: 64px; place-items: center; overflow: hidden; color: #98a0ab; background: #e2e5e9; border: 1px solid #cbd0d6; border-radius: 4px; font: 800 10px/1 "DIN Alternate", monospace; }
.cover img { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #e2e5e9; }
.cover::after { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; content: ""; background: linear-gradient(135deg, transparent 49%, var(--accent) 50%); }
.asset-copy { min-width: 0; }
.asset-copy h3 { margin: 0; overflow: hidden; font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.filename, .genre { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.genre { color: var(--cyan); }

.platform-cell, .extension-cell, .vendor-cell, .size-cell { min-width: 0; color: #444a52; font-size: 12px; }
.vendor-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-cell strong { display: block; color: var(--ink); font-size: 11px; text-transform: uppercase; }
.platform-cell span { color: var(--muted); font-size: 10px; }
.format-badge { display: inline-flex; min-width: 44px; height: 25px; align-items: center; justify-content: center; color: #fff; background: var(--cyan); border-radius: 3px; font: 700 10px/1 "DIN Alternate", monospace; }
.format-badge.sis, .format-badge.sisx { background: var(--green); }
.issue-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--warning); vertical-align: middle; }
.row-action, .icon-button { display: grid; place-items: center; border: 0; }
.row-action { width: 30px; height: 30px; color: var(--ink); background: transparent; font-size: 25px; }

.empty-state { padding: 74px 20px; text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.load-more { display: block; min-width: 180px; height: 42px; margin: 24px auto 0; color: var(--ink); background: var(--surface); border: 1px solid var(--ink); border-radius: var(--radius); font-size: 12px; font-weight: 700; }

.drawer-backdrop { position: fixed; z-index: 89; inset: 0; background: rgba(23, 25, 29, .34); }
.detail-drawer { position: fixed; z-index: 90; top: 0; right: 0; width: min(480px, 100vw); height: 100vh; overflow: auto; background: var(--surface); border-left: 1px solid var(--ink); transform: translateX(102%); transition: transform 220ms ease; }
.detail-drawer.open { transform: translateX(0); }
.detail-drawer.playing { width: min(980px, 100vw); }
.drawer-header { position: sticky; z-index: 2; top: 0; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 24px; background: #17191d; }
.drawer-header p { margin: 0; }
.icon-button { width: 34px; height: 34px; color: #fff; background: transparent; font-size: 25px; }
.detail-content { padding: 26px 24px 50px; }
.detail-hero { display: grid; grid-template-columns: 116px 1fr; gap: 20px; align-items: start; padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.detail-cover { width: 116px; aspect-ratio: 4 / 5; object-fit: cover; background: #e5e7ea; border: 1px solid var(--line); border-radius: 4px; }
.cover-fallback { display: grid; place-items: center; color: #79818c; font: 800 22px/1 "DIN Alternate", monospace; }
.detail-hero h2 { overflow-wrap: anywhere; font-size: 26px; }
.detail-hero p { margin: 9px 0 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.detail-tags span { padding: 5px 7px; color: #fff; background: var(--ink); border-radius: 3px; font-size: 10px; }
.detail-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 22px 0; }
.download-button, .play-button { display: flex; width: 100%; height: 44px; align-items: center; justify-content: center; color: #fff; border: 0; border-radius: var(--radius); font-size: 13px; font-weight: 700; text-decoration: none; }
.download-button { background: var(--ink); }
.play-button { background: var(--accent); }
.inline-player-slot { scroll-margin-top: 72px; }
.inline-player { margin: 0 0 24px; overflow: hidden; background: #0e1013; border: 1px solid #2f343c; border-radius: var(--radius); }
.inline-player iframe { display: block; width: 100%; height: min(760px, calc(100dvh - 126px)); min-height: 640px; background: #0e1013; border: 0; }
.metadata-list { margin: 0; }
.metadata-list div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.metadata-list dt { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.metadata-list dd { margin: 0; overflow-wrap: anywhere; font: 12px/1.45 "Avenir Next", "PingFang SC", sans-serif; }
.error-note { margin-top: 20px; padding: 12px; color: #7f4a05; background: #fff4df; border-left: 3px solid var(--warning); font-size: 11px; line-height: 1.5; }

@media (max-width: 960px) {
  .masthead { grid-template-columns: 1fr; gap: 28px; }
  .table-header { display: none; }
  .asset-row { grid-template-columns: minmax(0, 1fr) 110px 32px; gap: 12px; }
  .extension-cell, .vendor-cell, .size-cell { display: none; }
}

@media (max-width: 640px) {
  .masthead { min-height: auto; padding: 18px 16px; }
  h1 { font-size: 29px; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-strip div:nth-child(3) { border-left: 0; border-top: 1px solid #4a4e55; }
  .summary-strip div:nth-child(4) { border-top: 1px solid #4a4e55; }
  .summary-strip strong { font-size: 25px; }
  .control-band { position: static; padding: 17px 16px; }
  .search-wrap { grid-template-columns: 1fr auto; }
  .search-wrap label { display: none; }
  .search-wrap input { font-size: 16px; }
  .filters-row { gap: 12px; }
  fieldset { width: 100%; }
  .segmented button { flex: 1; }
  .select-field { flex: 1 1 40%; }
  select { width: 100%; min-width: 0; }
  .catalog-band { padding: 25px 16px 60px; }
  .asset-row { min-height: 82px; padding: 9px 7px; grid-template-columns: minmax(0, 1fr) 28px; }
  .platform-cell { display: none; }
  .asset-identity { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; }
  .cover { width: 48px; height: 58px; }
  .detail-hero { grid-template-columns: 88px 1fr; gap: 15px; }
  .detail-cover { width: 88px; }
  .metadata-list div { grid-template-columns: 86px minmax(0, 1fr); }
  .detail-drawer.playing { width: 100vw; }
  .inline-player { margin-inline: -16px; border-right: 0; border-left: 0; border-radius: 0; }
  .inline-player iframe { height: calc(100dvh - 116px); min-height: 620px; }
  .embedded-shell .masthead { display: block; min-height: 56px; padding: 12px 16px; }
  .embedded-shell .brand-block h1 { font-size: 23px; }
  .embedded-shell .archive-state { font-size: 11px; }
  .embedded-shell .summary-strip { display: none; }
  .embedded-shell main { min-height: calc(100vh - 56px); }
  .embedded-shell .control-band { padding: 11px 16px; }
  .embedded-shell .catalog-band { padding: 16px 16px 42px; }
  .embedded-shell .detail-content { padding: 16px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
