:root {
  --bg: #121214;
  --bg-elevated: #1c1c1f;
  --border: #2c2c30;
  --text: #f0f0f2;
  --text-muted: #9a9aa2;
  --accent: #ff5a5f;
  --accent-hover: #e8484d;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
.site-header h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.5px;
}
.logo-link { text-decoration: none; color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { color: var(--text); border-color: var(--text-muted); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.video-card {
  text-decoration: none;
  color: var(--text);
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.video-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.thumb-placeholder {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2a2a2e, #1a1a1d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-muted);
}
.thumb-img {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  display: block;
  background: #1a1a1d;
}

.video-card-info { padding: 12px 14px; }
.video-card-info h3 {
  font-size: 15px;
  margin: 0 0 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  margin-top: 64px;
  font-size: 15px;
}

/* モーダル */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 440px;
}
.modal-box h2 { margin-top: 0; font-size: 18px; }

.modal-box label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.modal-box input[type="text"],
.modal-box textarea,
.modal-box input[type="file"] {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.modal-box textarea { resize: vertical; min-height: 60px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.error-msg {
  color: var(--accent);
  font-size: 13px;
  min-height: 18px;
}
.file-count-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin: -8px 0 14px;
}
.upload-status {
  font-size: 13px;
  color: #6fd18f;
  min-height: 18px;
}

#progressWrap {
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  height: 20px;
  margin-bottom: 14px;
}
#progressBar {
  background: var(--accent);
  height: 100%;
  width: 0%;
  color: white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.15s ease;
}

/* カテゴリフィルター */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.category-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.category-chip:hover { color: var(--text); }
.category-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.category-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 4px;
}

/* 通報フォーム */
.btn-small { padding: 6px 14px; font-size: 13px; }
.report-area { margin-top: 18px; }
.report-form {
  margin-top: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.report-form textarea {
  width: 100%;
  min-height: 70px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
}
.report-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.report-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* 管理画面 */
.admin-login {
  max-width: 320px;
  margin: 60px auto;
  text-align: center;
}
.admin-login label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.admin-login input {
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}
.admin-section { margin-bottom: 36px; }
.admin-section h2 { font-size: 17px; margin-bottom: 12px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: 2px 0 6px;
}
.admin-thumb {
  width: 96px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #1a1a1d;
}
.admin-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  background: linear-gradient(135deg, #2a2a2e, #1a1a1d);
}
.admin-item-main {
  flex: 1;
  min-width: 0;
}
.admin-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.admin-edit-form {
  width: 100%;
}
.admin-edit-form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.admin-edit-form input,
.admin-edit-form textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.admin-edit-form textarea { min-height: 60px; resize: vertical; }
.admin-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
.edit-msg {
  color: var(--accent);
  font-size: 12px;
  min-height: 16px;
  margin: 6px 0 0;
}

/* 広告枠(実際の広告タグを貼るまでは点線プレースホルダーとして表示) */
.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.ad-slot-banner {
  max-width: 1200px;
  margin: 0 auto 24px;
  min-height: 90px;
}
.ad-slot-inline {
  margin-top: 32px;
  min-height: 120px;
}
.ad-slot-label {
  letter-spacing: 1px;
}

/* 年齢確認モーダル */
.site-body-hidden { display: none; }

.age-gate-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.age-gate-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 420px;
  text-align: center;
}
.age-gate-box h2 {
  margin-top: 0;
  font-size: 20px;
}
.age-gate-box p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
.age-gate-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 16px;
}
.age-gate-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}
.ad-slot-agegate {
  margin: 16px 0 0;
  min-height: 60px;
}

/* プレロール広告 */
.player-wrap {
  position: relative;
  width: 100%;
}
.preroll-overlay {
  position: absolute;
  inset: 0;
  background: #000;
  border-radius: var(--radius);
  z-index: 5;
  display: flex;
  flex-direction: column;
}
.preroll-overlay.real-ad-playing {
  background: transparent;
  pointer-events: none; /* 動画自体の操作を邪魔しない */
}
.preroll-overlay.real-ad-playing .preroll-controls {
  pointer-events: auto; /* スキップボタンだけは押せるようにする */
}
.preroll-ad-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  margin: 12px;
  border-radius: 8px;
}
.preroll-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0,0,0,0.6);
}
#prerollTimer {
  color: var(--text-muted);
  font-size: 13px;
}
#prerollSkip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 再生ページ */
.watch-main { max-width: 900px; }
#player {
  width: 100%;
  border-radius: var(--radius);
  background: black;
  max-height: 70vh;
  aspect-ratio: 16 / 9;
  display: block;
}
#videoTitle { margin: 16px 0 6px; font-size: 20px; }
.video-meta { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.video-desc { font-size: 14px; line-height: 1.6; color: #d0d0d4; white-space: pre-wrap; }
