:root {
  --bg-main: #090b10;
  --bg-surface: rgba(20, 24, 34, 0.78);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f4f6fb;
  --text-secondary: #94a3b8;
  --accent: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Google Sans Flex', 'Noto Sans JP', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ヘッダー */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(9, 11, 16, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand svg {
  width: 36px;
  height: 36px;
}

.brand span em {
  font-style: normal;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* コンテナ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 一覧グリッド */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-bottom: 42px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.15);
}

.thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #131722;
  overflow: hidden;
}

.thumb-box.square {
  aspect-ratio: 1 / 1;
}

.thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.card:hover .thumb-box img {
  transform: scale(1.04);
}

.badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.badge.shorts { background: var(--accent-grad); border: none; }
.badge.img { background: #2563eb; border: none; }

.card-body {
  padding: 14px 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
}

.card-meta {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* 視聴ページ（watch.html）専用レイアウト */
.watch-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1060px;
  margin: 0 auto;
}

/* 16:9 動画コンテナ */
.player-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

/* 1:1 ショート動画コンテナ */
.player-shorts {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  overflow: hidden;
  background: #000;
  border: 2px solid rgba(139, 92, 246, 0.55);
  box-shadow: 0 20px 50px rgba(139, 92, 246, 0.22);
}

.player-video iframe,
.player-shorts iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* 画像ビューアコンテナ */
.viewer-img {
  max-width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  padding: 12px;
  text-align: center;
}

.viewer-img img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
}

.watch-info {
  width: 100%;
  margin-top: 20px;
  padding: 20px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
}

.watch-info h1 {
  font-size: 1.35rem;
  margin-bottom: 8px;
}

.debug-box {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.82rem;
  color: #93c5fd;
  word-break: break-all;
}

/* カスタムURL生成ツール */
.generator-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
}

.generator-bar select,
.generator-bar input {
  background: #10141f;
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
}

.generator-bar input { flex: 1; min-width: 220px; }

.generator-bar button {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: 'Outfit', 'Google Sans Flex', 'Noto Sans JP', sans-serif;
}

.generator-bar button:hover {
  opacity: 0.9;
}
/* =========================================
   NexTube 独自カスタムプレイヤー UI
   ========================================= */
.nt-player {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nt-player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

/* 1:1ショート時は画面いっぱいにフィット */
.player-shorts .nt-player video {
  object-fit: cover;
}

/* 中央の大きな再生/一時停止アニメーションアイコン */
.nt-center-feedback {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(15, 18, 28, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nt-center-feedback.show {
  opacity: 1;
  transform: scale(1);
}

/* ローディングスピナー */
.nt-spinner {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: ntSpin 0.8s linear infinite;
  display: none;
  pointer-events: none;
}

.nt-player.buffering .nt-spinner {
  display: block;
}

@keyframes ntSpin {
  to { transform: rotate(360deg); }
}

/* 下部コントロールオーバーレイ */
.nt-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 16px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.45) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.nt-player:hover .nt-controls,
.nt-player.paused .nt-controls,
.nt-player.controls-visible .nt-controls {
  opacity: 1;
}

/* カスタムシークバー */
.nt-progress-area {
  position: relative;
  width: 100%;
  height: 14px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.nt-progress-bg {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 99px;
  transition: height 0.15s ease;
}

.nt-progress-area:hover .nt-progress-bg {
  height: 6px;
}

.nt-buffer-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 99px;
}

.nt-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: var(--accent-grad);
  border-radius: 99px;
}

.nt-progress-thumb {
  position: absolute;
  top: 50%;
  right: -6px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.9);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
}

.nt-progress-area:hover .nt-progress-thumb {
  transform: translateY(-50%) scale(1);
}

/* 下段ボタン群 */
.nt-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nt-left-btns,
.nt-right-btns {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nt-btn {
  background: none;
  border: none;
  color: #f4f6fb;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.nt-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.nt-btn:active {
  transform: scale(0.92);
}

.nt-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* 音量スライダー */
.nt-vol-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nt-vol-slider {
  width: 68px;
  accent-color: #8b5cf6;
  cursor: pointer;
}

/* 時間表示 */
.nt-time {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: #e2e8f0;
  margin-left: 4px;
}

/* 倍速セレクタ */
.nt-speed-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.nt-speed-btn:hover {
  background: rgba(139, 92, 246, 0.35);
}
/* =========================================
   ローカルファイルアップロードエリア
   ========================================= */
.upload-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  padding: 18px 20px;
  background: var(--bg-surface);
  border: 1px dashed rgba(139, 92, 246, 0.55);
  border-radius: 16px;
}

.upload-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.upload-text span {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.upload-actions select {
  background: #10141f;
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
}

.upload-label {
  background: var(--accent-grad);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.upload-label:hover {
  opacity: 0.9;
}

#fileInput {
  display: none;
}