/* 外部样式文件：从 index.php 迁移而来 */
:root {
  --red: #e32626;
  --border: 2px solid var(--red);
  --gap: 32px;
  --page-max: 1200px;
  --radius: 6px;
  --shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
  --shadow-hover: 0 8px 20px rgba(226, 38, 38, 0.12);
  --bg-base: #ffffff;
  --bg-accent: #fff5f5;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Microsoft YaHei',
    sans-serif;
  color: #333;
  background:
    radial-gradient(1200px 400px at 10% -20%, var(--bg-accent) 0%, transparent 40%),
    linear-gradient(var(--bg-base), var(--bg-base));
}

#bgVideoContainer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bgVideoContainer video { width: 100%; height: 100%; object-fit: cover; filter: blur(36px) saturate(120%) brightness(1.05) contrast(1.05); transform: scale(1.06); opacity: 0.5; }
.page { position: relative; z-index: 1; }

.page {
  max-width: var(--page-max);
  padding: 16px;
  margin: 0 auto;
}

/* 顶部菜单条 */
.menu {
  position: sticky;
  top: 0;
  z-index: 100;
  border: var(--border);
  background: rgba(255,255,255,0.95);
  min-height: 60px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: var(--gap);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(226, 38, 38, 0.08);
}

.menu__logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.5px;
}

.menu__nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.menu__link {
  display: inline-block;
  text-decoration: none;
  color: var(--red);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--red);
  background: rgba(255,255,255,0.92);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.menu__link:hover,
.menu__link:focus-visible {
  background: #fff1f1;
  outline: none;
  box-shadow: 0 6px 14px rgba(226, 38, 38, 0.15);
}

.menu__link.is-active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 6px 14px rgba(226, 38, 38, 0.18);
}

/* 三列区域 */
.content {
  display: grid;
  grid-template-columns: clamp(180px, 22%, 240px) 1fr clamp(220px, 26%, 300px);
  gap: var(--gap);
}

.panel {
  border: var(--border);
  border-radius: var(--radius);
  background: #fff;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--red);
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.panel:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* 讨论区固定高度并使用内部滚动，不让页面无限增长 */
#discussion.panel {
  align-items: stretch;
  justify-content: flex-start;
  height: 380px; /* 与其他面板保持一致高度 */
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(226, 38, 38, 0.1);
}

/* 响应式：窄屏改为纵向排列 */
@media (max-width: 992px) {
  .content { grid-template-columns: 1fr; }
  .panel { min-height: 220px; }
  #discussion.panel { height: 240px; }
}

/* ===== 视频区域样式 ===== */
.video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 4px; /* 边距缩小，减少白边 */
}

#video.panel { position: relative; }
#video.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: var(--radius);
  background: conic-gradient(
    var(--red) 0deg,
    var(--red) calc(var(--progress, 0) * 1deg),
    rgba(226, 38, 38, 0.18) calc(var(--progress, 0) * 1deg),
    rgba(226, 38, 38, 0.18) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* 视频面板固定高度，独立于图片面板的高度变化 */
#video.panel { align-items: stretch; justify-content: flex-start; height: 380px; overflow: hidden; }

/* 菜单栏中的“包含本地”控件样式 */
.menu__controls {
  background: #f6f6f6;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
  user-select: none;
}
.menu__controls input[type="checkbox"] { vertical-align: middle; margin-right: 6px; }

.menu__stats {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
}
.menu__stats .stat {
  background: #fff;
  border: 1px solid var(--red);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.menu__stats .stat__label { opacity: .8; margin-right: 4px; }
.menu__stats .stat__value { font-weight: 600; }

video#player {
  width: 100%;
  flex: 1 1 auto;
  height: 100%; /* 使视频充满可用高度，被“框”包裹 */
  display: block;
  border-radius: 6px; /* 圆角减小，进一步减少四角的白边显著程度 */
  background: #000;
  object-fit: contain; /* 保持原视频比例 */
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}
video#player.visible { opacity: 1; }

/* 顶部提示气泡已移除 */

/* 工具栏与按钮已移除，根据用户需求隐藏相关样式占位 */

/* ===== 讨论区样式 ===== */
.discussion-wrap {
  width: 100%;
  height: 100%;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--red) #fff1f1; /* 滑块红 / 轨道浅红 */
}
/* Webkit 内核滚动条 */
.discussion-wrap::-webkit-scrollbar {
  width: 8px;
}
.discussion-wrap::-webkit-scrollbar-track {
  background: #fff1f1;
  border-radius: 4px;
}
.discussion-wrap::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 4px;
}
.discussion-wrap::-webkit-scrollbar-thumb:hover {
  background: #c53030;
}

.bubble {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 92%;
  animation: fadeIn 0.25s ease;
}
.bubble.right { flex-direction: row-reverse; margin-left: auto; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: 0 0 36px;
  object-fit: cover;
  border: 2px solid var(--red);
}

.bubble__text {
  background: #fff1f1;
  border: 1px solid var(--red);
  color: #a81515;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(226, 38, 38, 0.08);
  font-size: 14px;
  line-height: 1.5;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 图片区域样式 ===== */
#gallery.panel { align-items: stretch; justify-content: flex-start; position: relative; }
#gallery.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 2px;
  border-radius: var(--radius);
  background: conic-gradient(
    var(--red) 0deg,
    var(--red) calc(var(--pic-progress, 0) * 1deg),
    rgba(226, 38, 38, 0.18) calc(var(--pic-progress, 0) * 1deg),
    rgba(226, 38, 38, 0.18) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.picture-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 4px; /* 同步减少图片区的白边 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#pictureImg {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 6px; /* 圆角减小以减少角部白边 */
  box-shadow: 0 10px 22px rgba(226, 38, 38, 0.08);
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}
#pictureImg.visible { opacity: 1; }

@media (max-width: 992px) {
  #gallery.panel { height: 240px; }
  #video.panel { height: 240px; }
}

/* 移除对视频框悬停效果的覆盖，恢复默认面板的上浮动画 */

/* ===== 投稿（上传）页面通用样式 ===== */
.upload-container {
  max-width: 980px;
  margin: 24px auto;
  padding: 0 16px;
}
.upload-container h1 {
  font-size: 20px;
  color: var(--red);
  margin: 0 0 16px;
  font-weight: 600;
}

.upload-title {
  margin: 0 0 16px;
  font-size: 22px;
}

.upload-grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-grid.video {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 880px) {
  .upload-grid.two { grid-template-columns: 1fr; }
  .upload-grid.video { grid-template-columns: 1fr; }
}

.card {
  border: var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dropzone {
  border: 2px dashed var(--red);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  background: #fff1f1;
  color: var(--red);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.dropzone.dragging,
.dropzone:hover { background: #ffeaea; border-color: #c11; box-shadow: var(--shadow-hover); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color .2s ease;
}
.field input[type="text"]:focus {
  border-color: #c53030;
  outline: none;
}

.preview-img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: #fafafa;
}
.video-preview {
  width: 100%;
  height: 220px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #000;
}
.meta {
  font-size: 12px;
  color: var(--red);
  margin-top: 8px;
}
.errors { color: var(--red); font-size: 13px; min-height: 18px; }
.tips { color: var(--red); opacity: .8; font-size: 13px; }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.btn {
  background: linear-gradient(135deg, var(--red) 0%, #c53030 100%);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: opacity .25s ease, transform .2s ease;
}
.btn:hover {
  opacity: .92;
  transform: translateY(-1px);
}
.btn[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-block;
  text-decoration: none;
  color: var(--red);
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--red);
  background: #fff;
  font-size: 14px;
  transition: background .25s ease, transform .2s ease;
}
.btn-ghost:hover {
  background: #fff1f1;
  transform: translateY(-1px);
}

.hidden-input { position: absolute; left: -9999px; }
