/* 我是主角 · H5 公共样式 —— 蓝白 + 浅橙，干净青少年活动风格，移动端优先 */

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #2f7df6;
  --primary-dark: #1e63d0;
  --primary-weak: #e8f1ff;
  --accent: #ff9f43;
  --accent-weak: #fff3e3;
  --bg1: #eaf3ff;
  --bg2: #fdf3e7;
  --card: #ffffff;
  --text: #2b3445;
  --muted: #8590a3;
  --border: #e4ebf5;
  --danger: #e5484d;
  --ok: #18a058;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(47, 125, 246, 0.08);
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg2) 60%, #ffffff);
  min-height: 100vh;
  line-height: 1.6;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
}

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  text-align: center;
}
.topbar-link, a.back-link {
  color: var(--primary);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.hero { text-align: center; padding: 40px 0 20px; }
.hero-badge {
  width: 72px; height: 72px;
  margin: 0 auto 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), #6aa9ff);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; }
.hero-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.page-tip {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--primary-weak);
  border-radius: 12px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin-bottom: 16px;
}
.card h3 { font-size: 1.02rem; margin-bottom: 12px; }

/* ---------- 首页入口卡片 ---------- */
.entry-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px;
  margin-bottom: 16px;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease;
}
.entry-card:active { transform: scale(0.98); }
.entry-icon {
  width: 54px; height: 54px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem;
  flex-shrink: 0;
}
.entry-icon.blue { background: var(--primary-weak); }
.entry-icon.orange { background: var(--accent-weak); }
.entry-main { flex: 1; }
.entry-main b { font-size: 1.08rem; display: block; }
.entry-main span { font-size: 0.85rem; color: var(--muted); }
.entry-arrow { color: #c3cede; font-size: 1.2rem; }

/* ---------- 表单 ---------- */
.form-card { padding: 20px 16px 16px; }
.field { margin-bottom: 14px; }
.field > label {
  display: block;
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 6px;
}
.field > label .req { color: var(--danger); margin-left: 2px; }
.field input[type="text"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="email"],
.field input[type="password"],
.field input:not([type]) {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text);
  background: #fafcff;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus { border-color: var(--primary); background: #fff; }
.field input::placeholder { color: #b8c2d2; }

.pill-group { display: flex; gap: 10px; }
.pill { flex: 1; }
.pill input { display: none; }
.pill span {
  display: block;
  text-align: center;
  padding: 10px 0;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--muted);
  background: #fafcff;
  transition: all 0.15s;
}
.pill input:checked + span {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-weak);
  font-weight: 700;
}

/* ---------- 按钮 ---------- */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-align: center;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), #5b9bff);
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 125, 246, 0.3);
}
.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: var(--primary-weak);
  color: var(--primary);
}
.btn-danger {
  background: #fdeaea;
  color: var(--danger);
}
.btn-sm {
  width: auto;
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.88rem;
  border-radius: 10px;
}
.btn-line {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 4px 0 10px;
}
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.msg { font-size: 0.88rem; margin-top: 10px; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

.alt-entry {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 18px 0 8px;
}
.alt-entry a { color: var(--primary); text-decoration: none; font-weight: 600; }
.foot-note {
  color: #a5afbf;
  font-size: 0.76rem;
  text-align: center;
  margin-top: 18px;
  padding: 0 8px;
}

/* ---------- 标签页 ---------- */
.tabbar {
  display: flex;
  background: #eef3fb;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 16px;
}
.tabbar .tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  border-radius: 9px;
  font-size: 0.92rem;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
}
.tabbar .tab.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(47, 125, 246, 0.12);
}

/* ---------- 图文内容 ---------- */
.rich { font-size: 0.96rem; color: #3a4356; }
.rich h2 {
  font-size: 1.08rem;
  margin: 18px 0 8px;
  padding-left: 10px;
  border-left: 4px solid var(--accent);
  color: var(--text);
}
.rich h2:first-child { margin-top: 4px; }
.rich p { margin: 8px 0; }
.rich img { max-width: 100%; border-radius: 12px; display: block; margin: 10px auto; }
.rich ul, .rich ol { padding-left: 20px; }

/* ---------- 素材展示 ---------- */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 20px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: "";
  width: 4px; height: 16px;
  border-radius: 2px;
  background: var(--accent);
}
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.media-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  background: #eef2f8;
}
.video-card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}
.video-card video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 260px;
}
.video-meta {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.video-meta .v-name { flex: 1; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 40px 0;
}

/* ---------- 遮罩 / 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 50, 0.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overlay[hidden] { display: none; }
.sheet {
  background: #fff;
  border-radius: 18px;
  padding: 22px 18px;
  width: 100%;
  max-width: 360px;
}
.sheet h3 { font-size: 1.05rem; margin-bottom: 12px; text-align: center; }
.sheet .row-btns { display: flex; gap: 10px; margin-top: 16px; }
.lightbox-img { width: 100%; border-radius: 10px; display: block; }

/* ---------- Toast ---------- */
.h5-toast {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%) translateY(10px);
  background: rgba(30, 40, 60, 0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  max-width: 80vw;
}
.h5-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.h5-toast.ok { background: rgba(24, 160, 88, 0.92); }
.h5-toast.error { background: rgba(229, 72, 77, 0.92); }

/* ---------- 管理后台 ---------- */
.admin-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--muted);
}
.banner {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.84rem;
  margin-bottom: 14px;
}
.banner.warn { background: var(--accent-weak); color: #b26a1b; }
.banner.err { background: #fdeaea; color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row-between { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.row-between input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.92rem;
  outline: none;
  min-width: 0;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 640px;
}
table.data th, table.data td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.data th { color: var(--muted); font-weight: 600; background: #f7fafd; }
table.data td .act { color: var(--primary); cursor: pointer; margin-right: 8px; }
table.data td .act.del { color: var(--danger); }
.count-tip { font-size: 0.8rem; color: var(--muted); margin-bottom: 8px; }

.media-admin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.media-admin-item .thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef2f8;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.media-admin-item .m-info { flex: 1; min-width: 0; }
.media-admin-item .m-info b {
  display: block; font-size: 0.9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-admin-item .m-info span { font-size: 0.75rem; color: var(--muted); }
.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge.img { background: var(--primary-weak); color: var(--primary); }
.badge.video { background: var(--accent-weak); color: #b26a1b; }
.badge.off { background: #f0f2f6; color: var(--muted); }
.m-acts { display: flex; gap: 6px; flex-shrink: 0; }
.m-acts button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 0.76rem;
  padding: 5px 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.m-acts button.warn { color: var(--accent); }
.m-acts button.del { color: var(--danger); }

textarea#contentText {
  width: 100%;
  min-height: 260px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.88rem;
  font-family: ui-monospace, Consolas, monospace;
  line-height: 1.5;
  outline: none;
  resize: vertical;
  background: #fafcff;
}
textarea#contentText:focus { border-color: var(--primary); }
#contentPreview {
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
  background: #fff;
}

.upload-box {
  border: 1.5px dashed #bcd2f0;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  background: #fafcff;
  margin-bottom: 12px;
}
.upload-box input { display: block; margin: 8px auto 0; max-width: 100%; }

/* ============ 页面内提示条（非正式域名警告 / 会话失效等） ============ */
.notice {
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.86rem;
  line-height: 1.65;
  margin-bottom: 14px;
  word-break: break-word;
}
.notice.warn { background: var(--accent-weak); border: 1px solid #ffd9a8; color: #92550a; }
.notice.error { background: #fdeaea; border: 1px solid #f7c9ca; color: #a3242a; }
.notice.info { background: var(--primary-weak); border: 1px solid #c9dcfb; color: var(--primary-dark); }
.notice code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: rgba(0, 0, 0, 0.05);
  padding: 1px 5px;
  border-radius: 5px;
}
.notice a { color: inherit; text-decoration: underline; font-weight: 600; }
.fix-btn {
  display: inline-block;
  margin-top: 9px;
  padding: 8px 15px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.fix-btn:active { background: var(--primary-dark); }

/* 提示条内的按钮：<a> 形态需覆盖 .notice a 的下划线规则 */
.notice a.fix-btn { color: #fff; text-decoration: none; }
.fix-btn.ghost {
  background: #fff;
  color: var(--primary-dark);
  border: 1px solid #c9dcfb;
  margin-left: 8px;
}
.fix-btn.ghost:active { background: #eef4ff; }
/* 报错文案里嵌的地址：允许换行，避免撑破卡片 */
.msg code, .notice code {
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
}
