:root {
  color-scheme: dark;
  --background: #101419;
  --surface: #192128;
  --control: #202a32;
  --border: #394953;
  --text: #eef4f6;
  --subtle: #adbec7;
  --accent: #89e7cf;
  font: 16px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(ellipse at 80% 0, #1d352f 0, transparent 38rem), var(--background);
}
main { width: min(1016px, calc(100% - 2rem)); margin: clamp(1.15rem, 4vw, 3rem) auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: clamp(1.15rem, 4vw, 2rem);
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); letter-spacing: -.04em; }
h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
button, input { font: inherit; }
button, input, .player-actions a {
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: .55rem;
  padding: .55rem .75rem;
  background-color: var(--control);
  color: var(--text);
}
button { cursor: pointer; white-space: nowrap; }
button:disabled { cursor: default; opacity: .5; }
button:hover:not(:disabled) { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: transparent; color: #0e2720; font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account { display: flex; gap: .4rem; }
.account button { font-size: .88rem; }
.login { max-width: 24rem; margin: 10vh auto; border: 1px solid var(--border); border-radius: .9rem; background: var(--surface); padding: 1.3rem; }
.login h2 { margin-bottom: 1rem; }
.login form, #password-form { display: grid; gap: .75rem; }
label { display: grid; gap: .3rem; color: var(--subtle); font-size: .88rem; }
input { width: 100%; min-width: 0; background: #11191f; color: var(--text); font-size: 1rem; }
input[readonly] { color: var(--subtle); }
.status { color: var(--subtle); font-size: .9rem; }
.status:empty { display: none; }
#search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; }
#search-status { margin: .9rem 0; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: .8rem; }
.result { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: .75rem; }
.result button {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-align: left;
  white-space: normal;
  background: transparent;
}
.result button:focus-visible { outline-offset: -2px; }
.cover { display: grid; place-items: center; aspect-ratio: 16 / 9; background: #11191f; }
.cover img { grid-area: 1/1; width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.play-glyph {
  grid-area: 1/1;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.65rem;
  aspect-ratio: 1;
  border: 1px solid #ffffff70;
  border-radius: 50%;
  padding-left: .12rem;
  background: #10191ccc;
  color: #fff;
}
.result h2 { padding: .7rem .8rem .2rem; font-size: 1rem; }
.result p { padding: .1rem .8rem .7rem; color: var(--subtle); overflow-wrap: anywhere; font-size: .8rem; }
.pagination, .player-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.pagination { justify-content: center; margin: 1rem 0; }
dialog {
  width: min(53rem, calc(100% - 1rem));
  max-height: calc(100dvh - 1rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: .9rem;
  background: var(--surface);
  color: var(--text);
  padding: clamp(.7rem, 3vw, 1.2rem);
}
dialog::backdrop { background: #0a0d10e6; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .65rem; }
video { display: block; width: 100%; aspect-ratio: 16/9; max-height: 66dvh; background: #090d10; border-radius: .5rem; }
video:fullscreen { max-height: none; }
.player-actions { margin-top: .65rem; }
.player-actions a { display: inline-flex; align-items: center; color: var(--accent); text-decoration: none; }
#media-status:not(:empty) { margin-top: .5rem; }
#password-dialog { max-width: 26rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 460px) {
  .top { align-items: flex-start; }
  .account { max-width: 100%; }
  .results { grid-template-columns: 1fr; }
  .login { margin-top: 4vh; }
}
