:root {
  color-scheme: dark;
  --pink: #fb7299;
  --black: #000;
  --panel: #111318;
  --line: #323641;
  --text: #fff;
  --muted: #aeb5c2;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", sans-serif;
}

button { font: inherit; }

.app {
  width: min(100vw, 600px);
  height: min(100vh, 600px);
  margin: auto;
  padding: 16px 20px;
}

.screen {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.hidden { display: none; }

header,
.player-head,
.feed-head,
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header {
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--pink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

h1 {
  display: inline;
  margin: 0 0 0 10px;
  font-size: 28px;
  line-height: 1;
}

.status {
  color: var(--pink);
  font-size: 12px;
  font-weight: 800;
}

#categories {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.category,
#back,
.retry,
.refresh-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
}

.category {
  min-width: 62px;
  padding: 8px 10px;
  font-size: 14px;
}

.category.active {
  border-color: var(--pink);
  background: #28161d;
  color: var(--text);
}

.feed-head {
  min-height: 35px;
}

.feed-head strong { font-size: 18px; }
.feed-head span,
footer,
.player-hint { color: var(--muted); }
.feed-head span { font-size: 12px; }

.feed-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.refresh-btn {
  padding: 6px 11px;
  color: var(--text);
  font-size: 13px;
}

.video-grid {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  overflow: hidden auto;
  scrollbar-width: none;
}

.video-grid::-webkit-scrollbar { display: none; }

.video-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.cover {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #181b21;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration {
  position: absolute;
  right: 6px;
  bottom: 5px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgb(0 0 0 / 78%);
  font-size: 11px;
}

.card-copy {
  display: block;
  padding: 8px 9px 9px;
}

.card-title {
  display: -webkit-box;
  min-height: 34px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 17px;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta {
  display: flex;
  margin-top: 5px;
  justify-content: space-between;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.card-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focusable {
  outline: none;
  transition: border-color 140ms ease-out, background 140ms ease-out, transform 140ms ease-out;
}

.focusable:focus {
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
  transform: scale(.985);
}

.message {
  display: grid;
  grid-column: 1 / -1;
  min-height: 250px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.retry { padding: 10px 20px; }

footer {
  min-height: 30px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.player-head { height: 66px; }

#back {
  min-width: 104px;
  padding: 10px 16px;
  color: var(--text);
}

#now-playing {
  max-width: 400px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

#player {
  width: 100%;
  height: 100%;
  border: 0;
}

.player-hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 14px;
}

@media (max-width: 420px), (max-height: 420px) {
  .app { padding: 10px 12px; }
  .feed-head span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .focusable { transition: none; }
}
