/* 主题色与动画沿用 参考界面/照片墙.html，去掉 Tailwind / Font Awesome CDN 依赖 */

:root {
  --bg-a: #0f172a;
  --bg-b: #1e293b;
  --card: rgba(30, 41, 59, 0.75);
  --line: #334155;
  --border: #475569;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --accent: #0284c7;
  --accent-dark: #0369a1;
  --sky: #38bdf8;
  --sky-soft: #bae6fd;
  --warn: #fbbf24;
  --danger: #f87171;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 组件里用了 display:flex 的容器会盖掉 UA 的 [hidden]，必须显式压回来 */
[hidden] {
  display: none !important;
}

body {
  background: linear-gradient(135deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
  color: var(--text);
  font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 40px;
}

/* 星空垫在最底层：负 z-index 排在根背景之上、正文之下，卡片是半透明的，星星能透出来一点 */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

button {
  font-family: inherit;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

.icon-lg {
  width: 34px;
  height: 34px;
  stroke-width: 1.6;
}

/* ---------- 导航 ---------- */
.nav-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 16px;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: var(--line);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
  font-size: 14px;
}

.nav-btn:hover {
  background: var(--border);
}

.nav-btn.active {
  background: var(--accent);
}

.nav-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--soft);
}

.role-badge {
  font-size: 12px;
  color: var(--sky-soft);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

/* ---------- 页面容器 ---------- */
.page {
  display: none;
  padding: 16px;
}

.page.active {
  display: block;
}

.page-title {
  text-align: center;
  font-size: 26px;
  color: var(--sky-soft);
  font-weight: 700;
}

.card,
.upload-card {
  max-width: 480px;
  margin: 30px auto;
  background: var(--card);
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.upload-card {
  max-width: 560px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
}

.card-sub {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin: 8px 0 20px;
}

/* ---------- 表单 ---------- */
.form-item {
  margin-bottom: 16px;
}

.form-item label {
  display: block;
  margin-bottom: 5px;
  color: var(--soft);
  font-size: 14px;
}

.form-item input,
.form-item textarea {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-a);
  color: #fff;
  outline: none;
  font-size: 14px;
}

.form-item input:focus {
  border-color: #0ea5e9;
}

.submit-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  transition: 0.2s;
}

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

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.submit-admin {
  background: var(--line);
}

.submit-admin:hover {
  background: var(--border);
}

.login-tabs {
  display: flex;
  gap: 6px;
  margin: 18px 0 16px;
  padding: 4px;
  background: var(--bg-a);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.login-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.login-tab:hover {
  color: var(--text);
}

.login-tab.active {
  background: var(--accent);
  color: #fff;
}

.login-tab:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- 时间轴 ---------- */
.timeline-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 16px 8px;
  scroll-behavior: smooth;
}

.timeline-wrap::-webkit-scrollbar {
  height: 5px;
}

.timeline-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.timeline-wrap::-webkit-scrollbar-track {
  background: transparent;
}

/* 时间轴下面一个贯穿整条轴宽度的向右箭头：往右 = 时间往后走 */
.timeline-axis {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: -6px;
  padding: 0 8px 10px;
  color: var(--muted);
}

.timeline-axis::before {
  content: '';
  flex: 1;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--border) 18%);
}

.timeline-axis .icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.timeline {
  display: flex;
  gap: 32px;
  min-width: max-content;
  align-items: center;
  position: relative;
  padding: 8px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  width: 100%;
  background: var(--line);
  z-index: 0;
}

.time-item {
  position: relative;
  z-index: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: 0.3s;
  border: none;
  background: none;
  padding: 0;
}

.time-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sky);
  margin-bottom: 6px;
  border: 2px solid var(--bg-a);
}

.time-item.active .time-dot {
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn);
}

.time-label {
  font-size: 12px;
  color: var(--soft);
  white-space: nowrap;
}

/* ---------- 媒体展示 ---------- */
.media-view {
  min-height: 42vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.media-card {
  position: absolute;
  max-width: 85%;
  max-height: 70vh;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.media-card img,
.media-card video {
  display: block;
  width: 100%;
  max-width: 85vw;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 16px;
  background: #020617;
}

.media-card video {
  background: #000;
}

.view-empty,
.view-error {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 40px 16px;
}

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

/* ---------- 控制条 ---------- */
.control-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 14px 8px;
  flex-wrap: wrap;
}

.btn {
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: var(--line);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
  font-size: 14px;
}

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

.btn-primary {
  background: var(--accent);
  min-width: 96px;
}

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

.btn-danger {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

.btn-mini {
  padding: 5px 12px;
  font-size: 13px;
}

.info-text {
  text-align: center;
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  min-height: 21px;
}

/* ---------- 留言 ---------- */
.comment-wrap {
  max-width: 700px;
  margin: 16px auto 0;
  background: rgba(30, 41, 59, 0.65);
  border-radius: 16px;
  padding: 14px;
}

.comment-title {
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--sky-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-count {
  color: var(--muted);
  font-size: 12px;
  margin-left: auto;
}

.comment-meta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.comment-meta-row input,
.comment-content {
  padding: 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-a);
  color: #fff;
  outline: none;
  font-size: 14px;
}

.comment-meta-row input:focus,
.comment-content:focus {
  border-color: #0ea5e9;
}

.comment-name {
  flex: 1;
  min-width: 0;
}

/* 留言框单独占一行：宽度跟着留言区走，高度可拖大 */
.comment-content {
  display: block;
  width: 100%;
  min-height: 132px;
  margin-bottom: 8px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}

.comment-send {
  flex-shrink: 0;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

.comment-send:hover {
  background: var(--accent-dark);
}

.comment-send:disabled {
  opacity: 0.6;
  cursor: wait;
}

.comment-list {
  max-height: 260px;
  overflow-y: auto;
}

.comment-list::-webkit-scrollbar {
  width: 4px;
}

.comment-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.comment-item {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.comment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 4px;
  gap: 8px;
}

.comment-author {
  color: #7dd3fc;
}

.comment-time {
  color: var(--muted);
  font-size: 12px;
}

.comment-del {
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  background: none;
  border: none;
}

.comment-text {
  font-size: 14px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.comment-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 上传 ---------- */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  color: var(--soft);
  font-size: 14px;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.05);
}

.upload-area p {
  margin-top: 12px;
  line-height: 1.7;
}

.preview-box {
  margin-top: 14px;
  max-height: 220px;
  overflow: hidden;
  border-radius: 12px;
  text-align: center;
  background: #020617;
}

.preview-box img,
.preview-box video {
  max-width: 100%;
  max-height: 220px;
  border-radius: 12px;
}

.file-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.resume-bar {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde68a;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.resume-bar span {
  flex: 1;
  min-width: 140px;
}

.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.upload-actions .submit-btn {
  flex: 1;
}

.progress {
  margin: 16px 0;
}

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sky), var(--accent));
  transition: width 0.2s ease;
}

.progress-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.stats {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
}

.stats b {
  color: var(--soft);
  font-weight: 600;
}

/* ---------- 动画（与参考界面一致） ---------- */
@keyframes flyInLeft {
  from { transform: translateX(-120vw) scale(0.7); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes flyOutRight {
  from { transform: translateX(0) scale(1); opacity: 1; }
  to { transform: translateX(120vw) scale(0.7); opacity: 0; }
}
@keyframes flyInTop {
  from { transform: translateY(-100vh) scale(0.7); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes flyOutBottom {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to { transform: translateY(100vh) scale(0.7); opacity: 0; }
}
@keyframes rotateIn {
  from { transform: rotate(-180deg) scale(0.4); opacity: 0; }
  to { transform: rotate(0deg) scale(1); opacity: 1; }
}
@keyframes rotateOut {
  from { transform: rotate(0deg) scale(1); opacity: 1; }
  to { transform: rotate(180deg) scale(0.4); opacity: 0; }
}
@keyframes scaleIn {
  from { transform: scale(0.1); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes scaleOut {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.1); opacity: 0; }
}
@keyframes splitIn {
  0% { transform: translate(-50px, -50px) skewX(15deg); opacity: 0; }
  100% { transform: translate(0) skewX(0deg); opacity: 1; }
}
@keyframes splitOut {
  0% { transform: translate(0) skewX(0deg); opacity: 1; }
  100% { transform: translate(50px, 50px) skewX(-15deg); opacity: 0; }
}

.ani-fly-in-left { animation: flyInLeft 0.8s ease forwards; }
.ani-fly-out-right { animation: flyOutRight 0.8s ease forwards; }
.ani-fly-in-top { animation: flyInTop 0.8s ease forwards; }
.ani-fly-out-bottom { animation: flyOutBottom 0.8s ease forwards; }
.ani-rotate-in { animation: rotateIn 0.9s ease forwards; }
.ani-rotate-out { animation: rotateOut 0.9s ease forwards; }
.ani-scale-in { animation: scaleIn 0.7s ease forwards; }
.ani-scale-out { animation: scaleOut 0.7s ease forwards; }
.ani-split-in { animation: splitIn 0.8s ease forwards; }
.ani-split-out { animation: splitOut 0.8s ease forwards; }

@media (prefers-reduced-motion: reduce) {
  .ani-fly-in-left, .ani-fly-out-right, .ani-fly-in-top, .ani-fly-out-bottom,
  .ani-rotate-in, .ani-rotate-out, .ani-scale-in, .ani-scale-out,
  .ani-split-in, .ani-split-out {
    animation-duration: 0.01s !important;
  }
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}

@media (max-width: 640px) {
  .page-title {
    font-size: 22px;
  }
  .media-card,
  .media-card img,
  .media-card video {
    max-width: 94vw;
  }
}
