/* ============================================================
   片屿 pianyu-site  /  assets/pianyu.css
   Independent site styles. Dark "island / ocean" theme.
   ============================================================ */

:root {
  --ink: #0b1220;
  --ink-2: #0f1a2e;
  --panel: #131f37;
  --panel-2: #1a2942;
  --line: #24344f;
  --text: #e8eef8;
  --text-2: #c6d3e6;
  --muted: #93a4bf;
  --accent: #35d0c0;
  --accent-2: #2b9fe0;
  --on-accent: #05121a;
  --danger: #ef5a6f;
  --thumb-1: #1b2b47;
  --thumb-2: #0d1729;
  --hdr-bg: rgba(11, 18, 32, 0.82);
  --ok-bg: #102a26; --ok-bd: #1d534a; --ok-fg: #bff3ea;
  --err-bg: #2a1621; --err-bd: #4a2130; --err-fg: #ffd7dd;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ---------------- 浅色模式 ---------------- */
html[data-theme='light'] {
  --ink: #eef4fa;
  --ink-2: #e5eef8;
  --panel: #ffffff;
  --panel-2: #f3f7fc;
  --line: #d7e1ee;
  --text: #14243a;
  --text-2: #3a4d68;
  --muted: #5d7089;
  --accent: #0e9c8e;
  --accent-2: #1d7cbe;
  --on-accent: #ffffff;
  --danger: #d63a52;
  --thumb-1: #dbe7f4;
  --thumb-2: #c3d5e8;
  --hdr-bg: rgba(255, 255, 255, 0.84);
  --ok-bg: #e6f6f2; --ok-bd: #a9dfd4; --ok-fg: #10635a;
  --err-bg: #fdecef; --err-bd: #f3bcc6; --err-fg: #8e1f31;
  --shadow: 0 10px 30px rgba(24, 48, 82, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 600px at 15% -10%, var(--ink-2) 0%, var(--ink) 55%) fixed;
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: var(--hdr-bg);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; }
.brand .sub { font-size: 12px; color: var(--muted); letter-spacing: 0; font-weight: 400; margin-left: 2px; }
.spacer { flex: 1; }

/* ---------------- search + chips ---------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 22px 0 8px; }
.input, .select, .textarea {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 92px; resize: vertical; font-family: inherit; }
.search { flex: 1; min-width: 220px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.on { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; font-weight: 600; }

/* ---------------- buttons ---------------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--err-fg); border-color: var(--err-bd); background: var(--err-bg); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { padding: 6px 10px; font-size: 13px; }

/* ---------------- grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  margin: 22px 0 60px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.14s ease, border-color 0.14s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--thumb-1), var(--thumb-2));
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .thumb .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 30px; }
.card .dur {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,0.72); color: #fff; font-size: 12px;
  padding: 2px 7px; border-radius: 6px;
}
.card .body { padding: 12px 13px 15px; display: flex; flex-direction: column; gap: 8px; }
.card .title { font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--text); }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--accent); background: rgba(53,208,192,0.10); border: 1px solid rgba(53,208,192,0.28); padding: 2px 8px; border-radius: 999px; }

.empty { color: var(--muted); text-align: center; padding: 70px 0; }

/* ---------------- watch page ---------------- */
.player-wrap { margin: 22px 0 0; background: #000; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.player-wrap video, .player-wrap iframe { width: 100%; display: block; aspect-ratio: 16 / 9; border: 0; background: #000; }
.watch-title { font-size: 22px; font-weight: 700; margin: 18px 0 6px; }
.watch-meta { color: var(--muted); font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.watch-desc { color: var(--text-2); line-height: 1.7; white-space: pre-wrap; margin: 10px 0 40px; }

/* ---------------- admin ---------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.panel h2 { margin: 0 0 14px; font-size: 17px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item { display: flex; gap: 12px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.admin-item .t { flex: 1; min-width: 0; }
.admin-item .t .n { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-item .t .u { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin: 10px 0; }
.notice.err { background: var(--err-bg); border: 1px solid var(--err-bd); color: var(--err-fg); }
.notice.ok { background: var(--ok-bg); border: 1px solid var(--ok-bd); color: var(--ok-fg); }

footer.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 22px 0 34px; margin-top: 40px; }
footer.site-footer .wrap { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

@media (max-width: 560px) {
  .row2 { grid-template-columns: 1fr; }
  .brand .sub { display: none; }
}

/* ---------------- nav ---------------- */
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.nav a.on { color: var(--on-accent); background: linear-gradient(120deg, var(--accent), var(--accent-2)); font-weight: 600; }

/* ---------------- 定点屿论 (danmaku) ---------------- */
.player-wrap { position: relative; }
.dm-layer {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 62%;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}
.dm-item {
  position: absolute;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  animation-name: dm-fly;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes dm-fly {
  from { left: 100%; }
  to { left: 0; transform: translateX(-100%); }
}
.dm-bar { display: flex; gap: 8px; align-items: center; margin: 10px 0 4px; flex-wrap: wrap; }
.dm-bar .input { flex: 1; min-width: 200px; }
.dm-hint { font-size: 12px; color: var(--muted); }

/* ---------------- 屿论 (comments) ---------------- */
.yulun h2 { font-size: 17px; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.yulun .count { color: var(--muted); font-size: 13px; font-weight: 400; }
.cm-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cm-form .row { display: flex; gap: 8px; }
.cm-form .row .input { flex: 1; }
.cm-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 40px; }
.cm-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
}
.cm-head { display: flex; gap: 10px; align-items: center; margin-bottom: 5px; }
.cm-head .who { font-weight: 600; font-size: 14px; color: var(--accent); }
.cm-head .when { font-size: 12px; color: var(--muted); margin-left: auto; }
.cm-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; display: block; flex: none; }
.cm-text { font-size: 14px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

/* ---------------- 岛图 (site map) ---------------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin: 24px 0 60px; }
.map-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  transition: border-color 0.14s ease, transform 0.14s ease;
  display: block;
}
.map-card:hover { border-color: var(--accent); transform: translateY(-3px); text-decoration: none; }
.map-card .ic { font-size: 26px; }
.map-card .nm { font-size: 16px; font-weight: 700; margin: 8px 0 6px; color: var(--text); }
.map-card .ds { font-size: 13px; color: var(--muted); line-height: 1.65; }
.map-title { font-size: 24px; font-weight: 700; margin: 26px 0 4px; }
.map-sub { color: var(--muted); font-size: 14px; }

/* ============================================================
   头部右侧：深浅模式切换 + 岛民头像
   ============================================================ */
.hdr-right { display: flex; align-items: center; gap: 8px; }

.theme-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.theme-btn:hover { border-color: var(--accent); }

.user-wrap { position: relative; }
.avatar-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.avatar-btn:hover { border-color: var(--accent); }
.avatar-btn img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: block; }
.avatar-btn .fb {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent); font-weight: 700; font-size: 13px;
  flex: none;
}
.avatar-btn .nm { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  border: 0; border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  text-decoration: none;
}
.login-btn:hover { text-decoration: none; filter: brightness(1.06); }

.menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.menu.hide { display: none; }
.menu .hd { padding: 9px 11px 7px; }
.menu .hd .n { font-size: 14px; font-weight: 600; color: var(--text); }
.menu .hd .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0;
  color: var(--text);
  font-size: 14px; font-family: inherit;
  padding: 9px 11px; border-radius: 8px;
  cursor: pointer; text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--panel-2); text-decoration: none; }

/* ---------------- 个人主页 / 设置 ---------------- */
.page-title { font-size: 24px; font-weight: 700; margin: 28px 0 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

.profile-head {
  display: flex; gap: 18px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 22px 0 18px;
  flex-wrap: wrap;
}
.profile-head .big {
  width: 76px; height: 76px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--line); flex: none;
}
.profile-head .big.fb {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent); font-size: 30px; font-weight: 700; border: 0;
}
.profile-head .who { flex: 1; min-width: 180px; }
.profile-head .who .n { font-size: 21px; font-weight: 700; }
.profile-head .who .u { font-size: 13px; color: var(--muted); margin-top: 3px; }
.profile-head .who .b { font-size: 14px; color: var(--text-2); margin-top: 8px; line-height: 1.6; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid rgba(53, 208, 192, 0.35);
  background: rgba(53, 208, 192, 0.12);
  color: var(--accent); margin-left: 8px; vertical-align: middle;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 20px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.stat .v { font-size: 22px; font-weight: 700; color: var(--accent); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 3px; }

.tabs { display: flex; gap: 6px; margin: 8px 0 14px; flex-wrap: wrap; }
.tab {
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.on { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent; font-weight: 600; }

.act-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 50px; }
.act {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 14px;
}
.act .top { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.act .vd { font-size: 13px; font-weight: 600; color: var(--accent); }
.act .when { font-size: 12px; color: var(--muted); }
.act .tx { font-size: 14px; line-height: 1.65; color: var(--text-2); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.act .at { font-size: 12px; color: var(--muted); margin-top: 4px; }

.gate { text-align: center; padding: 70px 20px; }
.gate .ic { font-size: 40px; }
.gate h2 { margin: 12px 0 8px; font-size: 19px; }
.gate p { color: var(--muted); font-size: 14px; margin: 0 0 20px; line-height: 1.7; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button {
  background: var(--panel); border: 0; color: var(--muted);
  padding: 9px 16px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); font-weight: 600; }

@media (max-width: 560px) {
  .avatar-btn .nm { display: none; }
  .avatar-btn { padding: 4px; }
}
