/* 童视 · 仿抖音儿童视频播放站 样式 */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
               "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  background: #000;
  color: #fff;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  /* 让移动浏览器允许全屏 */
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

/* ========== 启动加载层 ========== */
.splash {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #16182c 0%, #0b0d18 100%);
  z-index: 9999;
}
.splash-inner { text-align: center; }
.splash-logo {
  font-size: 56px; font-weight: 800;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.splash-tip {
  margin-top: 16px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
}

/* ========== 主应用容器 ========== */
.app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: #0b0d18;
}

/* ========== 顶部栏 ========== */
.topbar {
  position: relative; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(11, 13, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-top: max(12px, env(safe-area-inset-top));
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-title {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.icon-btn {
  width: 36px; height: 36px;
  border: none; background: rgba(255,255,255,0.08);
  color: #fff; font-size: 20px; border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.icon-btn:active { background: rgba(255,255,255,0.2); }
.back-btn { font-size: 26px !important; font-weight: 300; }

/* ========== 主区域 ========== */
.main {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.page {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.page-feed { background: #000; }

/* ========== 视频流空状态 ========== */
.empty {
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px;
  text-align: center;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: 0.6; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-tip { font-size: 14px; color: rgba(255,255,255,0.55); margin-bottom: 24px; line-height: 1.6; }

/* ========== 按钮 ========== */
.btn-primary {
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
  color: #fff; border: none;
  padding: 12px 24px; border-radius: 24px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}
.btn-primary:active { transform: scale(0.97); opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: rgba(255,255,255,0.08);
  color: #fff; border: none;
  padding: 10px 16px; border-radius: 8px;
  font-size: 14px; cursor: pointer;
}
.btn-secondary:active { background: rgba(255,255,255,0.18); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }
.btn-text {
  background: transparent; color: rgba(255,255,255,0.45); border: none;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  align-self: flex-start;
}

/* ========== 表单页 ========== */
.form {
  padding: 20px;
}
.form-title {
  font-size: 22px; font-weight: 700;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.form-label {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin: 16px 0 8px;
}
.form-input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: inherit;
  resize: none;
}
.form-input:focus {
  outline: none;
  border-color: rgba(255, 91, 141, 0.5);
  background: rgba(255,255,255,0.08);
}
select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23ffffff' fill-opacity='0.5' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.parse-status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
}
.parse-status.loading { background: rgba(91, 141, 255, 0.15); color: #b9ceff; }
.parse-status.success { background: rgba(78, 199, 110, 0.15); color: #b5eec3; }
.parse-status.error   { background: rgba(255, 91, 91, 0.15); color: #ffb5b5; }

.parse-tips {
  margin-top: 28px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
}
.tips-title { font-size: 13px; color: rgba(255,255,255,0.55); margin-bottom: 10px; }
.parse-tips ul { list-style: none; }
.parse-tips li { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.8; }
.parse-tips code {
  background: rgba(255,255,255,0.08);
  padding: 1px 6px; border-radius: 4px;
  font-size: 12px;
}

/* ========== 管理列表 ========== */
.manage-list {
  padding: 16px;
}
.manage-item {
  display: flex; gap: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  align-items: center;
}
.manage-cover {
  width: 64px; height: 96px; object-fit: cover; border-radius: 8px;
  background: rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.manage-info { flex: 1; min-width: 0; }
.manage-title {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.4; margin-bottom: 6px;
}
.manage-meta {
  font-size: 12px; color: rgba(255,255,255,0.45);
  display: flex; gap: 8px;
}
.manage-actions { display: flex; flex-direction: column; gap: 6px; }
.manage-del {
  background: rgba(255, 91, 91, 0.15);
  color: #ffb5b5;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.manage-del:active { background: rgba(255, 91, 91, 0.3); }

/* ========== 设置页 ========== */
.settings {
  padding: 16px;
}
.settings-section {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 4px 16px;
  margin-bottom: 16px;
}
.settings-section-title {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 0 8px;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.settings-row:first-of-type { border-top: none; }
.settings-row-stack { flex-direction: column; align-items: stretch; gap: 10px; }
.settings-label-main { font-size: 15px; }
.settings-label-sub  { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 2px; }

/* Switch */
.switch { position: relative; display: inline-block; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { display: none; }
.switch-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.15);
  border-radius: 28px;
  transition: background 0.2s;
  cursor: pointer;
}
.switch-slider::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.switch input:checked + .switch-slider {
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.password-edit, .device-id {
  display: flex; gap: 8px; align-items: center;
}
.password-input {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  letter-spacing: 4px;
}
.password-input:focus {
  outline: none;
  border-color: rgba(255, 91, 141, 0.5);
}
.device-id code {
  flex: 1;
  padding: 10px 12px;
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  font-size: 12px;
  word-break: break-all;
  color: #ffd097;
  font-family: "SF Mono", Consolas, monospace;
}

.settings-stat {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, #ff5b8d, #ff9159);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.settings-about {
  padding: 14px 0 16px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.7);
}
.muted { color: rgba(255,255,255,0.4); font-size: 12px; }

/* ========== 视频播放器层 ========== */
.player {
  position: fixed; inset: 0;
  z-index: 1000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
.player-stage {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
}
.player-item {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #000;
  opacity: 0;
  transition: opacity 0.3s;
}
.player-item.active { opacity: 1; }
.player-item video, .player-item iframe {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  border: none;
}
.player-item.embed iframe {
  width: 100%; height: 100%;
}
.player-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.7);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
}
.player-meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.7));
  color: #fff;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.player-meta-title {
  font-size: 15px; font-weight: 500;
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.player-meta-author {
  font-size: 13px; color: rgba(255,255,255,0.7);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.player-pager {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 6px;
  background: rgba(0,0,0,0.4);
  padding: 6px 10px;
  border-radius: 18px;
  font-size: 11px; color: rgba(255,255,255,0.8);
  pointer-events: none;
}
.player-pager b { color: #ffd097; }
.player-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 40px; height: 40px;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
}

/* ========== 弹窗 ========== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.modal-card {
  background: #1a1d2e;
  border-radius: 16px;
  padding: 24px;
  width: 100%; max-width: 320px;
  text-align: center;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.modal-tip { font-size: 13px; color: rgba(255,255,255,0.55); margin-bottom: 16px; }
.modal-password {
  text-align: center; font-size: 22px;
  letter-spacing: 8px;
}
.modal-actions {
  display: flex; gap: 10px;
  margin-top: 16px;
}
.modal-actions button { flex: 1; }
.modal-error {
  margin-top: 10px;
  font-size: 12px; color: #ff8a8a;
}

/* ========== 提示 ========== */
.toast {
  position: fixed;
  left: 50%; bottom: 80px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 18px;
  font-size: 13px;
  z-index: 3000;
  white-space: nowrap;
  max-width: 80vw;
  animation: toastIn 0.2s;
}
@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ========== 响应式适配（桌面） ========== */
@media (min-width: 768px) {
  body { background: #111; }
  .app {
    width: 420px;
    height: 90vh;
    max-height: 900px;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.06);
  }
  .player {
    width: 420px;
    height: 90vh;
    max-height: 900px;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 32px;
    overflow: hidden;
  }
  .modal { background: rgba(0,0,0,0.5); }
}
