/* Hallmark · v2.0.0 · genre: atmospheric · theme: Darkroom (amber) · shape: app screen · signature: playable video stills */
/* Critique: the archive begins with an actual playable item, with search and sort on the next row. */
:root {
  color-scheme: dark;
  --paper: #111110;
  --well: #191917;
  --surface: #23221e;
  --ink: #f2efe8;
  --muted: #ada99f;
  --rule: #34322d;
  --accent: #f4b663;
  --accent-hover: #ffd08c;
  --accent-ink: #1a1209;
  --danger: #ff9b87;
  --disabled-fill: #201f1b;
  --disabled-ink: #8f8a80;
  --scrim-strong: rgb(10 10 9 / 84%);
  --scrim-mid: rgb(10 10 9 / 54%);
  --scrim-low: rgb(10 10 9 / 0%);
  --badge: rgb(15 14 12 / 86%);
  --overlay: rgb(0 0 0 / 77%);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --container: 78rem;
  --gap: clamp(0.8rem, 2vw, 1.55rem);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.65 var(--font); }
body:has(dialog[open]) { overflow-y: hidden; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; background: var(--disabled-fill); color: var(--disabled-ink); border-color: var(--rule); }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, video:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { min-width: 0; overflow-wrap: break-word; line-height: 1.2; }
h1, h2 { text-wrap: balance; }
.frame { width: min(calc(100% - 5rem), var(--container)); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--rule); }
.topbar-inner { min-height: 4.6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; min-height: 44px; font-weight: 720; font-size: 1.15rem; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; inline-size: 2.1rem; block-size: 2.1rem; background: var(--accent); color: var(--accent-ink); }
.play-icon { display: inline-block; position: relative; inline-size: 0; block-size: 0; margin-inline-start: 0.12rem; border-block: 0.36rem solid transparent; border-inline-start: 0.57rem solid currentColor; flex: none; }
nav { display: flex; gap: clamp(0.85rem, 3vw, 2rem); align-items: stretch; align-self: stretch; }
nav a { display: flex; align-items: center; padding-inline: 0.2rem; border-block-end: 2px solid transparent; white-space: nowrap; color: var(--muted); font-size: 0.92rem; }
nav a:hover, nav a[aria-current] { color: var(--ink); }
nav a[aria-current] { border-block-end-color: var(--accent); }
.feature { position: relative; isolation: isolate; display: grid; align-items: end; min-height: clamp(22rem, 36vw, 31.5rem); margin-top: 1.9rem; background: var(--well); overflow: clip; }
.feature-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 24%; z-index: -2; }
.feature::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--scrim-strong), var(--scrim-mid) 40%, var(--scrim-low) 79%), linear-gradient(0deg, var(--scrim-strong), var(--scrim-low) 48%); }
.feature-copy { padding: clamp(1.4rem, 4vw, 3.65rem); max-inline-size: 48rem; }
.feature-source { display: inline-flex; padding: 0.2rem 0.55rem; margin-bottom: 0.9rem; border: 1px solid var(--rule); background: var(--badge); color: var(--accent); font-size: 0.82rem; overflow-wrap: anywhere; max-inline-size: 100%; }
.feature h1 { font-size: clamp(2.4rem, 6vw, 5rem); font-weight: 760; letter-spacing: 0.015em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: clip; }
.feature-caption { margin-top: 0.85rem; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: clip; }
.primary, .secondary { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.65rem; padding: 0.48rem 1rem; font-weight: 650; border: 1px solid var(--rule); white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary:active:not(:disabled) { background: var(--accent); }
.secondary { background: var(--well); color: var(--ink); }
.secondary:hover:not(:disabled) { background: var(--surface); }
.feature .primary { margin-top: 1.35rem; }
.feature-time, .duration { color: var(--ink); background: var(--badge); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.feature-time { position: absolute; inset: auto 1.2rem 1.2rem auto; padding: 0.2rem 0.55rem; }
.feature-time:empty, .duration:empty { display: none; }
.library { padding-block: 2.7rem 4rem; scroll-margin-block-start: 1rem; min-height: 26rem; }
.library-header, .manage-list-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-block-end: 1.3rem; }
.library h2, .manage-list-header h2 { font-size: clamp(1.65rem, 3.2vw, 2rem); }
.subtle, .message { color: var(--muted); font-size: 0.91rem; overflow-wrap: anywhere; }
.library-header .subtle, .manage-header .subtle { margin-top: 0.25rem; }
.controls { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.search, .sort { position: relative; display: flex; align-items: center; background: var(--well); }
.search-icon { position: absolute; margin-inline-start: 0.9rem; width: 0.82rem; height: 0.82rem; border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; top: 0.58rem; left: 0.57rem; width: 0.36rem; height: 1.5px; background: var(--muted); transform: rotate(45deg); transform-origin: left; }
.search input, .sort select, .add-row input { border: 1px solid var(--rule); background: var(--well); min-height: 44px; font-size: 1rem; }
.search input { width: min(16rem, 100%); padding: 0.4rem 0.8rem 0.4rem 2.3rem; }
input::placeholder { color: var(--muted); }
.sort select { appearance: none; padding: 0.4rem 1.95rem 0.4rem 0.8rem; }
.sort::after { content: ""; position: absolute; inset: 0.99rem 0.85rem auto auto; width: 0.42rem; height: 0.42rem; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.25rem, 2.5vw, 2.05rem) var(--gap); }
.card { display: block; min-width: 0; }
.card:hover h3 { color: var(--accent); }
.thumb { position: relative; background: var(--surface); aspect-ratio: 16 / 9; overflow: clip; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb .duration { position: absolute; inset: auto 0.5rem 0.5rem auto; padding: 0.1rem 0.4rem; }
.card h3 { margin-block-start: 0.7rem; font-size: 1.06rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .subtle { margin-block-start: 0.2rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.7rem; }
.card .subtle time { font-variant-numeric: tabular-nums; }
.managed-card { min-width: 0; }
.visibility-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-block-start: 0.5rem; }
.managed-card .message:empty { display: none; }
.age-gate { margin-block: 0.5rem 1.5rem; }
#player-age { margin-block: 0 1rem; }
.empty { padding: 2.5rem 1rem; border-block: 1px solid var(--rule); color: var(--muted); }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-block-start: 1.75rem; }
.footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.86rem; padding: 1.25rem 0; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.35rem 1rem; }
.player { width: min(58rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); background: var(--well); color: var(--ink); border: 1px solid var(--rule); padding: 0; }
.player::backdrop { background: var(--overlay); }
.player-top { display: flex; justify-content: space-between; gap: 0.75rem; align-items: start; padding: 1rem; }
.player-top h2 { font-size: 1.35rem; overflow-wrap: anywhere; }
.player-top p { margin-block-start: 0.3rem; }
.close { display: block; min-width: 44px; min-height: 44px; border: 1px solid var(--rule); background: var(--surface); font-size: 1.5rem; line-height: 1; }
.close:hover { color: var(--accent); }
.player video { display: block; width: 100%; max-height: 66dvh; background: var(--paper); }
.player-caption { padding: 1rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.player-caption:empty { display: none; }
.management { max-width: 55rem; padding-block: 3rem; }
.manage-header h1 { font-size: clamp(2.15rem, 4vw, 3.35rem); }
.add-channel { margin: 1.9rem 0 2.65rem; padding: 1.2rem; border: 1px solid var(--rule); background: var(--well); }
.add-channel label { display: inline-block; font-weight: 650; margin-block-end: 0.4rem; }
.add-row { display: flex; gap: 0.6rem; }
.add-row input { padding-inline: 0.65rem; min-width: 0; flex: 1; }
.message:not(:empty) { margin-top: 0.65rem; }
.message[data-kind="error"] { color: var(--danger); }
.worker-state:not(:empty) { margin-block: -0.7rem 0.75rem; }
.channel-row { border-block-start: 1px solid var(--rule); padding-block: 1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem 0.75rem; align-items: start; }
.channel-row:last-child { border-block-end: 1px solid var(--rule); }
.channel-row h3 { font-size: 1.07rem; overflow-wrap: anywhere; }
.channel-row p { grid-column: 1 / -1; }
.channel-status { color: var(--accent); font-size: 0.9rem; }
.channel-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem; flex-wrap: wrap; }
.channel-row h3 { align-self: center; }
.remove-channel { min-height: 44px; padding: 0.3rem 0.6rem; background: var(--well); color: var(--danger); border: 1px solid var(--rule); white-space: nowrap; font-size: 0.9rem; }
.remove-channel:hover:not(:disabled) { background: var(--surface); }
#remove-feedback:not(:empty) { margin-bottom: 0.6rem; }
.remove-dialog { width: min(26rem, calc(100% - 1.75rem)); padding: 1.2rem; border: 1px solid var(--rule); background: var(--well); color: var(--ink); }
.remove-dialog::backdrop { background: var(--overlay); }
.remove-dialog h2 { font-size: 1.35rem; }
.remove-name { margin-block: 0.7rem 0.35rem; font-weight: 650; overflow-wrap: anywhere; }
.remove-actions { margin-top: 1.1rem; display: flex; justify-content: flex-end; gap: 0.55rem; }
.danger-button { min-height: 44px; padding: 0.48rem 0.8rem; border: 1px solid var(--danger); background: var(--danger); color: var(--accent-ink); font-weight: 650; }
.danger-button:hover:not(:disabled) { border-color: var(--ink); }
@media (max-width: 35rem) {
  .channel-actions { gap: 0.35rem; }
  .channel-status { font-size: 0.82rem; }
}
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: clip; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 54rem) {
  .frame { width: calc(100% - 2.5rem); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 35rem) {
  .frame { width: calc(100% - 1.75rem); }
  .topbar-inner { min-height: 3.8rem; gap: 0.3rem; }
  .brand { font-size: 0.95rem; gap: 0.38rem; }
  .brand-mark { inline-size: 1.6rem; block-size: 1.6rem; }
  nav { gap: 0.65rem; }
  nav a { font-size: 0.83rem; }
  .feature { min-height: 22rem; margin-top: 0.85rem; }
  .feature-image { object-position: 58% center; }
  .feature::after { background: linear-gradient(0deg, var(--scrim-strong) 5%, var(--scrim-mid) 44%, var(--scrim-low) 75%); }
  .feature-copy { padding: 1.2rem; }
  .feature-time { inset: 0.65rem 0.65rem auto auto; }
  .library { padding-block: 1.75rem 2.6rem; }
  .library-header { align-items: stretch; flex-direction: column; }
  .controls { flex-wrap: nowrap; }
  .search { flex: 1; min-width: 0; }
  .search input { width: 100%; min-width: 0; }
  .grid { gap: 1rem 0.65rem; }
  .card .subtle { font-size: 0.8rem; }
  .management { padding-block: 1.6rem; }
  .add-channel { padding: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

.admin-nav { margin-block: -1.1rem 1.6rem; border-bottom: 1px solid var(--rule); gap: 1.5rem; }
.admin-nav a { min-height: 44px; }
.analytics { max-width: 68rem; }
.statistics-header { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.8rem; }
.stats-switch, .stats-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; margin-top: 1rem; }
.stats-switch button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.stats-filter input { min-height: 44px; min-width: 0; max-width: 100%; padding: 0.45rem 0.65rem; background: var(--well); border: 1px solid var(--rule); }
.stats-filter label { font-weight: 650; }
.stats-status { margin-block: 0.8rem 1rem; min-height: 1.5rem; }
.stats-summary, .device-stats { display: grid; gap: 0.7rem; margin: 0; }
.stats-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats-summary > div, .device-stats > div { min-width: 0; }
.stats-summary > div { padding: 0.85rem 1rem; background: var(--well); border: 1px solid var(--rule); }
.stats-summary dt, .device-stats dt { color: var(--muted); font-size: 0.9rem; }
.stats-summary dd, .device-stats dd { margin: 0.2rem 0 0; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1.2; }
.stats-summary dd { font-size: clamp(1.2rem, 3vw, 2rem); overflow-wrap: anywhere; }
.stats-section { margin-top: 2rem; }
.stats-section h2 { margin-bottom: 0.75rem; font-size: 1.35rem; }
.device-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.device-stats > div { border-block-start: 1px solid var(--rule); padding: 0.55rem 0; }
.device-stats dd { font-size: 1.35rem; }
.visitor-table-wrap { width: 100%; }
.visitor-table { border-collapse: collapse; width: 100%; table-layout: fixed; text-align: left; }
.visitor-table th, .visitor-table td { padding: 0.65rem 0.55rem; border-block-end: 1px solid var(--rule); overflow-wrap: anywhere; }
.visitor-table th { font-weight: 550; font-size: 0.87rem; color: var(--muted); background: var(--well); }
.visitor-table td { font-size: 0.91rem; }
.visitor-table th:first-child { width: 26%; }
.visitor-table th:nth-child(4) { width: 25%; }
.history-table th:first-child { width: 29%; }
.history-table th:nth-child(4) { width: 10%; }
.history-table th:nth-child(5) { width: 19%; }
.history-addresses { list-style: none; margin: 0; padding: 0; }
.history-addresses li { display: flex; flex-wrap: wrap; column-gap: 0.55rem; }
.history-addresses li + li { margin-top: 0.3rem; }
.visitor-address, .visitor-duration { font-variant-numeric: tabular-nums; }
.geo-credit { margin-top: 1.25rem; }
.geo-credit a { text-decoration: underline; text-underline-offset: 0.18em; }
.geo-credit a:hover { color: var(--accent); }

@media (max-width: 40rem) {
  .admin-nav { margin-block: -0.55rem 1.1rem; }
  .stats-summary { gap: 0.4rem; }
  .stats-summary > div { padding: 0.65rem 0.45rem; }
  .stats-summary dt, .device-stats dt { font-size: 0.8rem; }
  .stats-section { margin-top: 1.6rem; }
  .visitor-table, .visitor-table tbody { display: block; }
  .visitor-table thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: clip; clip-path: inset(50%); }
  .visitor-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-block-end: 1px solid var(--rule); padding: 0.55rem 0; }
  .visitor-table tr:first-child { border-block-start: 1px solid var(--rule); }
  .visitor-table td { border: 0; padding: 0.35rem 0.35rem 0.35rem 0; }
  .visitor-table td:first-child { grid-column: 1 / -1; }
  .visitor-table td::before { content: attr(data-label); display: block; margin-bottom: 0.05rem; color: var(--muted); font-size: 0.8rem; }
}
