:root {
  color-scheme: dark;
  --md-sys-color-primary: #d0bcff;
  --md-sys-color-surface-tint: #d0bcff;
  --md-sys-color-on-primary: #381e72;
  --md-sys-color-primary-container: #4f378b;
  --md-sys-color-on-primary-container: #eaddff;
  --md-sys-color-secondary: #ccc2dc;
  --md-sys-color-on-secondary: #332d41;
  --md-sys-color-secondary-container: #4a4458;
  --md-sys-color-on-secondary-container: #e8def8;
  --md-sys-color-tertiary: #efb8c8;
  --md-sys-color-on-tertiary: #633b48;
  --md-sys-color-tertiary-container: #7d5260;
  --md-sys-color-on-tertiary-container: #ffd8e4;
  --md-sys-color-error: #f2b8b5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8c1d18;
  --md-sys-color-on-error-container: #f9dedc;
  --md-sys-color-surface-dim: #141218;
  --md-sys-color-surface: #141218;
  --md-sys-color-surface-bright: #3b383e;
  --md-sys-color-surface-container-lowest: #0f0d13;
  --md-sys-color-surface-container-low: #1d1b20;
  --md-sys-color-surface-container: #211f26;
  --md-sys-color-surface-container-high: #2b2930;
  --md-sys-color-surface-container-highest: #36343b;
  --md-sys-color-on-surface: #e6e0e9;
  --md-sys-color-on-surface-variant: #cac4d0;
  --md-sys-color-outline: #938f99;
  --md-sys-color-outline-variant: #49454f;
  --md-sys-color-inverse-surface: #e6e0e9;
  --md-sys-color-inverse-on-surface: #322f35;
  --md-sys-color-scrim: #000;
  --md-sys-color-shadow: #000;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: Roboto, system-ui, sans-serif;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  background: var(--md-sys-color-surface-container);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none;
  color: var(--md-sys-color-on-surface); font-size: 22px; font-weight: 500; }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.search { flex: 1; max-width: 560px; margin: 0 auto; }
.spacer { flex: 1; }
#whoami { color: var(--md-sys-color-on-surface-variant); }
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 96px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.cardlink { text-decoration: none; color: inherit; }
.m3card {
  background: var(--md-sys-color-surface-container-highest);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
}
.m3card .media { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #000; display: block; }
.m3card .meta { padding: 12px 16px 16px; }
.m3card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; line-height: 1.4; }
.m3card small { color: var(--md-sys-color-on-surface-variant); }
.player-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; outline: none; }
.player-wrap:focus-visible { outline: 2px solid var(--md-sys-color-primary); }
.player-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.spin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; }
.bigplay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; }
.gesture { position: absolute; top: 0; bottom: 72px; width: 35%; z-index: 2; touch-action: manipulation; }
.gesture.left { left: 0; }
.gesture.right { right: 0; }
.seek-flash { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; background: rgba(0,0,0,.72); color: #fff; border-radius: 16px; padding: 8px 18px; font-size: 20px; font-weight: 500; pointer-events: none; }
.controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; padding: 2px 10px 8px; background: linear-gradient(transparent, rgba(0,0,0,.78)); transition: opacity .25s; }
.player-wrap.hide .controls { opacity: 0; pointer-events: none; }
.player-wrap.hide { cursor: none; }
#seek { width: 100%; margin: 0; }
.ctrl-row { display: flex; align-items: center; gap: 2px; }
.ctrl-row .time { font-size: 13px; color: #fff; white-space: nowrap; margin: 0 4px; }
.ctrl-row .vol { max-width: 110px; min-width: 64px; }
.ctrl-row md-icon-button, .ctrl-row md-text-button { --md-icon-button-icon-color: #fff; --md-text-button-label-text-color: #fff; }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand { font-size: 18px; }
  .brand img { width: 32px; height: 32px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  #whoami { display: none; }
  main { padding: 12px 12px 96px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .m3card .meta { padding: 8px 12px 12px; }
  .m3card h3 { font-size: 14px; }
  .player-wrap { border-radius: 0; margin: 0 -12px; width: calc(100% + 24px); }
  .ctrl-row .vol { display: none; }
  .ctrl-row .time { font-size: 12px; }
  .fab { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
#drop {
  border: 1px dashed var(--md-sys-color-outline);
  border-radius: 12px; padding: 48px 24px; text-align: center;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
}
#drop.over { border-color: var(--md-sys-color-primary); }
.field { width: 100%; margin: 8px 0; }
.fab { position: fixed; right: 24px; bottom: 24px; z-index: 5; }
.center { text-align: center; margin: 24px 0; }
.muted { color: var(--md-sys-color-on-surface-variant); }
md-linear-progress { width: 100%; margin: 12px 0; }
.comment-card { margin: 8px 0; padding: 12px 16px; }
