:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f2630;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --success: #2ea043;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: #79c0ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.container-narrow {
  max-width: 520px;
  margin: 2.5rem auto;
  padding: 0 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

.card h1, .card h2, .card h3 {
  margin-top: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}

.media-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.media-thumb {
  aspect-ratio: 16 / 9;
  background: #090c10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

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

.media-thumb .file-icon {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem;
  text-align: center;
  word-break: break-all;
}

.media-body {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.media-title {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.badge-public { border-color: rgba(46, 160, 67, 0.5); color: #56d364; }
.badge-unlisted { border-color: rgba(88, 101, 242, 0.6); color: #a5b4fc; }
.badge-private { border-color: rgba(210, 153, 34, 0.5); color: #e3b341; }
.badge-failed { border-color: rgba(248, 81, 73, 0.5); color: #ff7b72; }

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="url"],
select {
  width: 100%;
  padding: 0.62rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: #29323f;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: rgba(248, 81, 73, 0.14);
  border-color: rgba(248, 81, 73, 0.4);
  color: #ff7b72;
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.25);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.actions-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.flash-error { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.12); color: #ffa198; }
.flash-success { border-color: rgba(46, 160, 67, 0.5); background: rgba(46, 160, 67, 0.12); color: #7ee787; }
.flash-info { border-color: rgba(88, 101, 242, 0.5); background: rgba(88, 101, 242, 0.12); color: #b4c0ff; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  margin-bottom: 1rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(88, 101, 242, 0.08);
}

.progress-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  margin: 0.5rem 0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #79c0ff);
  transition: width 0.25s ease;
}

.player-stage {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 78vh;
}

.player-stage video,
.player-stage img {
  max-width: 100%;
  max-height: 78vh;
  display: block;
}

.qr-box {
  background: #fff;
  display: inline-block;
  padding: 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.code-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  word-break: break-all;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.text-viewer {
  margin: 0;
  padding: 1rem 1.15rem;
  background: #0b0f14;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 75vh;
  overflow: auto;
}
