/* 精选视频 · 样式 */
:root {
  --bg: #fbf6ee;
  --ink: #221f1c;
  --ink-soft: #6e655c;
  --line: #e7dccd;
  --card: #ffffff;
  --accent: #f2633b;
  --accent-deep: #e4552d;
  --teal: #1fa98f;
  --amber: #f2b33d;
  --shadow: 0 10px 30px rgba(74, 52, 32, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, -apple-system,
    "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 6% -12%, #ffe9d6 0%, rgba(255, 233, 214, 0) 60%),
    radial-gradient(900px 520px at 100% -6%, #e2f6f0 0%, rgba(226, 246, 240, 0) 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100dvh;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid rgba(242, 99, 59, 0.5);
  outline-offset: 2px;
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(242, 99, 59, 0.22);
}

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

.btn-soft {
  background: #f5ede2;
  color: var(--ink);
}

.btn-soft:hover {
  background: #efe4d5;
}

.btn-danger {
  background: #fdecec;
  color: #c23b3b;
}

.btn-danger:hover {
  background: #fbdcdc;
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  height: 52px;
  margin-top: 18px;
}

.btn.is-done {
  background: #e6f7f3;
  color: var(--teal);
  box-shadow: none;
}

.icon-btn {
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.icon-btn:hover {
  background: #f1e8db;
  color: var(--ink);
}

/* ---------- 登录 ---------- */
.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: 100dvh;
  padding: 36px 20px 46px;
}

.gate-top {
  text-align: center;
}

.gate-logo {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px rgba(242, 99, 59, 0.28);
}

.gate-top h1 {
  margin: 0 0 6px;
  font-size: 34px;
  letter-spacing: -0.03em;
}

.gate-top p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14.5px;
}

.gate-card {
  width: min(400px, 100%);
  padding: 26px;
  border: 1px solid rgba(231, 220, 205, 0.7);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  border-radius: 14px;
  background: #f4ede3;
}

.seg-btn {
  padding: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.seg-btn.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(74, 52, 32, 0.1);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

.pin-input {
  width: 100%;
  height: 54px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fcfaf6;
  color: var(--ink);
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.pin-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(242, 99, 59, 0.12);
}

.gate-note {
  margin: 16px 0 0;
  color: #9a8f82;
  font-size: 12.5px;
  text-align: center;
}

.gate-foot {
  margin: 0;
  color: #a2937f;
  font-size: 12.5px;
}

/* ---------- 外壳 / 顶栏 ---------- */
.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 56px;
}

.shell-wide {
  max-width: 1080px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
  background: rgba(251, 246, 238, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* ---------- 孩子端片单 ---------- */
.wall-head {
  padding: 16px 0 8px;
}

.wall-head h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -0.03em;
}

.wall-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.shelf {
  margin-top: 40px;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.shelf-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.01em;
}

.shelf-count {
  padding: 2px 9px;
  border-radius: 999px;
  background: #f0e6d8;
  color: var(--ink-soft);
  font-size: 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 22px 18px;
}

.video-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(135deg, #f4e4d2, #eadbc8);
  box-shadow: 0 6px 18px rgba(74, 52, 32, 0.08);
}

.card-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.video-card:hover .card-cover img {
  transform: scale(1.04);
}

.card-cover.is-blank::after {
  content: "▷";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(34, 31, 28, 0.22);
  font-size: 28px;
}

.card-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(20, 18, 16, 0.72);
  color: #fff;
  font-size: 11.5px;
}

.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: 10px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  transition: color 0.18s ease;
}

.video-card:hover .card-title {
  color: var(--accent);
}

.card-meta {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.site-foot {
  margin-top: 60px;
  text-align: center;
}

.site-foot a {
  color: #a2937f;
  font-size: 12.5px;
  text-decoration: none;
}

.site-foot a:hover {
  color: var(--ink-soft);
}

/* ---------- 空态 / 加载 ---------- */
.empty {
  padding: 70px 20px;
  text-align: center;
}

.empty-emoji {
  margin-bottom: 12px;
  font-size: 40px;
}

.empty-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
}

.empty-text {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 14px;
}

.wall-loading,
.play-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 60px 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.14);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 播放页 ---------- */
body.is-play {
  background: #0e1116;
}

.play {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.play-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
}

.play-back {
  padding: 9px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #edeff2;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.play-back:hover {
  background: rgba(255, 255, 255, 0.15);
}

.play-badge {
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #a7afba;
  font-size: 12.5px;
}

.play-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 24px 48px;
}

.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.player-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.play-meta {
  padding: 22px 4px 0;
  color: #e8eaee;
}

.play-meta h1 {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.play-meta p {
  margin: 0;
  color: #98a2af;
  font-size: 14px;
}

.dot {
  margin: 0 8px;
}

.play-fullscreen {
  margin-top: 16px;
}

.play-loading {
  justify-content: center;
  min-height: 70vh;
  padding: 0;
  color: #98a2af;
}

.play-loading .spinner {
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
}

.empty-dark .empty-title {
  color: #fff;
}

.empty-dark .empty-text {
  color: #98a2af;
}

/* ---------- 家长端 ---------- */
.topbar-admin {
  flex-wrap: wrap;
  gap: 12px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #f1e8db;
}

.tab-btn {
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.tab-btn.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 7px rgba(74, 52, 32, 0.1);
}

.admin-main {
  padding-top: 8px;
}

.panel {
  margin-bottom: 22px;
  padding: 26px 26px 30px;
  border: 1px solid rgba(231, 220, 205, 0.65);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.panel-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.search-row,
.theme-add {
  display: flex;
  gap: 10px;
}

.search-row input,
.theme-add input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: #fcfaf6;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search-row input:focus,
.theme-add input:focus,
.paste-form textarea:focus,
.theme-name:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(242, 99, 59, 0.1);
}

.target-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.target-row select,
.paste-actions select,
.select-sm {
  height: 38px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fcfaf6;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
}

.hint {
  color: #9a8f82;
  font-size: 12.5px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: 14px;
  transition: background 0.16s ease;
}

.result-item:hover {
  background: #fbf6ef;
}

.result-cover {
  position: relative;
  flex: none;
  width: 132px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 10px;
  background: #efe4d5;
}

.result-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-body {
  flex: 1;
  min-width: 0;
}

.result-body h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 0 0 5px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
}

.result-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.result-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #fbf6ef;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.result-note.is-error {
  background: #fdecec;
  color: #b23b3b;
}

.paste-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fcfaf6;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

/* 视频库 */
.lib-group {
  margin-top: 22px;
}

.lib-group-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.lib-group-head h3 {
  margin: 0;
  font-size: 15px;
}

.lib-group-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

.lib-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border-top: 1px solid #f3ebe0;
  border-radius: 14px;
}

.lib-row:hover {
  background: #fbf6ef;
}

.lib-row.is-hidden {
  opacity: 0.55;
}

.lib-thumb {
  flex: none;
  width: 96px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 9px;
  background: #efe4d5;
}

.lib-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lib-main {
  flex: 1;
  min-width: 0;
}

.lib-title {
  overflow: hidden;
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

/* 主题 */
.theme-add {
  margin-bottom: 18px;
}

.theme-list {
  display: flex;
  flex-direction: column;
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid #f3ebe0;
}

.theme-name {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  outline: none;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.theme-name:hover {
  background: #fbf6ef;
}

.theme-count {
  flex: none;
  color: var(--ink-soft);
  font-size: 12.5px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 100;
  max-width: calc(100vw - 40px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #26221e;
  color: #fff;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind="error"] {
  background: #b3342e;
}

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .shell {
    padding: 0 16px 40px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
  }

  .admin-tabs {
    order: 3;
    width: 100%;
  }

  .tab-btn {
    flex: 1;
    padding: 9px 6px;
    text-align: center;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px 12px;
  }

  .card-title {
    font-size: 13.5px;
  }

  .panel {
    padding: 20px 18px 24px;
    border-radius: 18px;
  }

  .result-cover {
    width: 104px;
  }

  .lib-row {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .lib-main {
    flex-basis: calc(100% - 110px);
  }

  .lib-row .select-sm {
    margin-left: auto;
    max-width: 46%;
  }

  .theme-add {
    flex-wrap: wrap;
  }

  .theme-add input {
    flex-basis: 100%;
  }

  .play-main {
    padding: 0 12px 32px;
  }

  .play-bar {
    padding: 12px 14px;
  }

  .player-shell {
    border-radius: 10px;
  }

  .play-meta {
    padding-top: 16px;
  }
}
