*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a {
  color: #fff;
}

button {
  font: inherit;
  cursor: pointer;
}

/* ------------------------------------------------------------------ Feed */

body.feed-page {
  overflow: hidden;
  height: 100dvh;
}

#feed {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

#feed::-webkit-scrollbar {
  display: none;
}

.feed-item {
  position: relative;
  height: 100dvh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.feed-item video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.paused-indicator {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72px;
  height: 72px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.feed-item.paused .paused-indicator {
  opacity: 0.8;
}

.video-name {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#sound-toggle {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 10;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.empty {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  color: #aaa;
}

/* -------------------------------------------------------- Upload / admin */

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page h1 {
  margin: 0;
  font-size: 1.5rem;
}

.page nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.link-button {
  background: none;
  border: 0;
  color: #aaa;
  text-decoration: underline;
  padding: 0;
}

.login {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
}

.login input,
.primary {
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #111;
  color: #fff;
}

.primary {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 600;
}

.name-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.name-field input {
  font: inherit;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #111;
  color: #fff;
}

.name-field input.invalid {
  border-color: #ff6b6b;
}

.error {
  color: #ff6b6b;
  min-height: 1.2em;
  margin: 0;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 240px;
  padding: 24px;
  border: 2px dashed #444;
  border-radius: 16px;
  text-align: center;
  color: #bbb;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #fff;
  background: #111;
  color: #fff;
}

.dropzone strong {
  font-size: 1.2rem;
  color: #fff;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  padding: 12px 14px;
  border-radius: 10px;
  background: #111;
}

.file-row .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.file-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .status {
  flex-shrink: 0;
  color: #aaa;
}

.file-row .status.ready {
  color: #5ee07a;
}

.file-row .status.failed {
  color: #ff6b6b;
}

.bar {
  height: 4px;
  margin-top: 8px;
  border-radius: 2px;
  background: #333;
  overflow: hidden;
}

.bar > div {
  height: 100%;
  width: 0;
  background: #fff;
  transition: width 0.2s;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.admin-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  background: #111;
  font-size: 0.85rem;
}

.admin-card video,
.admin-card .placeholder {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}

.admin-card .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
}

.admin-card .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-card .meta {
  color: #888;
}

.name-input {
  width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #000;
  color: #fff;
  transition: border-color 0.2s;
}

.name-input:focus {
  outline: none;
  border-color: #fff;
}

.name-input.saved {
  border-color: #5ee07a;
}

.name-input.invalid {
  border-color: #ff6b6b;
}

.delete {
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #5a2323;
  background: #2a1111;
  color: #ff8a8a;
}
