:root {
  --bg: #f4f7fb;
  --bg-strong: #e9eef8;
  --surface: #ffffffcc;
  --surface-solid: #ffffff;
  --text: #1a2633;
  --muted: #5d6c7c;
  --primary: #006d77;
  --primary-2: #1b9aaa;
  --border: #d9e3ef;
  --danger: #b42318;
  --shadow: 0 12px 30px rgba(15, 29, 44, 0.1);
}

body.dark {
  --bg: #0d1720;
  --bg-strong: #0f1c29;
  --surface: #1a2a3bcc;
  --surface-solid: #182735;
  --text: #e7f0fb;
  --muted: #9fb2c7;
  --primary: #41c2c7;
  --primary-2: #7ae0f0;
  --border: #2f4254;
  --danger: #f97066;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Sora", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 12%, rgba(27, 154, 170, 0.2), transparent 32%),
    radial-gradient(circle at 85% 8%, rgba(0, 109, 119, 0.2), transparent 28%),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-strong) 100%);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px;
}

.content {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(13px);
  box-shadow: var(--shadow);
  min-height: calc(100vh - 36px);
  max-width: 1200px;
  margin: 18px auto;
  padding: 18px;
}

.topbar {
  margin-bottom: 14px;
  text-align: center;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  letter-spacing: 0.02em;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(0.9rem, 1.6vw, 1rem);
}

.direct-players {
  display: grid;
  gap: 20px;
  justify-items: center;
}

.direct-players h2 {
  margin: 0;
  width: 100%;
  max-width: 800px;
  text-align: center;
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.direct-players video {
  width: 100%;
  max-width: 800px;
  border-radius: 12px;
  background: #000;
  justify-self: center;
  box-shadow: var(--shadow);
}

.grid {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(280px, 460px));
  justify-content: center;
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-solid);
  transition: transform 0.25s ease, border-color 0.25s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 0.42s ease forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
}

.preview {
  aspect-ratio: 16 / 9;
  background: linear-gradient(130deg, rgba(27, 154, 170, 0.15), rgba(0, 109, 119, 0.07));
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 6px;
}

.player-shell {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.preview img,
.preview video {
  width: 100%;
  height: 100%;
}

.preview video {
  object-fit: contain;
  background: #000;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px;
  color: #eaf6ff;
  font-size: 0.84rem;
  background: linear-gradient(180deg, rgba(10, 20, 32, 0.55), rgba(10, 20, 32, 0.72));
  z-index: 3;
}

.file-type {
  color: var(--muted);
  font-size: 0.77rem;
  font-family: "JetBrains Mono", monospace;
}

.info {
  padding: 12px;
}

.name {
  margin: 0;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.info {
  text-align: center;
}

.player-status {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--primary);
}

.player-status.error {
  color: var(--danger);
}

.skeleton {
  height: 250px;
  border-radius: 14px;
  background: linear-gradient(110deg, rgba(128, 151, 174, 0.16) 20%, rgba(128, 151, 174, 0.3) 40%, rgba(128, 151, 174, 0.16) 60%);
  background-size: 200% 100%;
  animation: loading 1.1s linear infinite;
}

@keyframes loading {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 200% 0;
  }
}

.empty {
  margin-top: 20px;
  text-align: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

.toast-wrap {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1000;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 210px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow);
}

.toast.error {
  border-left-color: var(--danger);
}

@media (max-width: 980px) {
  .content {
    min-height: auto;
    margin: 12px;
    padding: 14px;
  }

  .grid {
    grid-template-columns: repeat(1, minmax(260px, 620px));
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .content {
    margin: 8px;
    padding: 12px;
    border-radius: 14px;
  }

  .topbar h1 {
    font-size: 1.35rem;
  }

  .topbar p {
    font-size: 0.9rem;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

}
