/* Xblock 社区网站 — 沿用插件 popup 的配色，light/dark 自适应 */

:root {
  color-scheme: light;
  --blue: #1d9bf0;
  --blue-hover: #1677c5;
  --blue-soft: #e8f4fd;
  --red: #f4212e;
  --red-soft: #fff0f1;
  --mint: #12a87a;
  --mint-soft: #e7f8f2;
  --text: #101418;
  --gray: #53616d;
  --muted: #7b8792;
  --border: #e6ebf0;
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-raised: #fbfcfd;
  --hover: rgba(16, 20, 24, 0.045);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --blue: #3ba7f5;
    --blue-hover: #62baf7;
    --blue-soft: #0d2b3e;
    --red: #ff4d59;
    --red-soft: #321014;
    --mint: #2fd39d;
    --mint-soft: #0f2d24;
    --text: #edf1f4;
    --gray: #a1abb4;
    --muted: #7e8892;
    --border: #252c33;
    --bg: #080a0c;
    --surface: #101418;
    --surface-raised: #151a1f;
    --hover: rgba(237, 241, 244, 0.07);
    --shadow: none;
  }
}

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

.hidden { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

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

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

header.site {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
header.site .brand { font-weight: 700; font-size: 16px; color: var(--text); }
header.site nav { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--gray); }

.language-picker { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.language-picker-button {
  display: inline-flex; align-items: center; gap: 6px; max-width: 150px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-raised); color: var(--text); font: inherit; cursor: pointer;
}
.language-picker-button:hover { background: var(--hover); }
.language-picker-button:focus-visible,
.language-option:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.language-picker-button-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.language-picker-chevron { flex: none; font-size: 14px; line-height: 1; transition: transform .15s ease; }
.language-picker-button[aria-expanded="true"] .language-picker-chevron { transform: rotate(180deg); }
.language-menu {
  position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; z-index: 30;
  width: max-content; min-width: 210px; max-width: calc(100vw - 32px);
  max-height: min(420px, calc(100dvh - 96px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 6px; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  scrollbar-gutter: stable; -webkit-overflow-scrolling: touch;
}
.language-menu[hidden] { display: none; }
.language-option {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text);
  font: inherit; text-align: start; white-space: nowrap; cursor: pointer;
}
.language-option:hover, .language-option:focus-visible { background: var(--hover); }
.language-option[aria-selected="true"] { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.language-option-check { flex: 0 0 14px; text-align: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue); color: #fff; border: none; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--blue-hover); text-decoration: none; }
.btn.secondary { background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--hover); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.hero { padding: 36px 0 20px; }
.hero h1 { font-size: 22px; margin-bottom: 6px; }
.hero p { color: var(--gray); font-size: 13px; }

.search { display: flex; gap: 8px; margin: 18px 0; }
.search input {
  flex: 1; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13px;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 10px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
}
.card .avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue-soft);
  color: var(--blue); display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.card .avatar img { width: 100%; height: 100%; object-fit: cover; }
.card .meta { flex: 1; min-width: 0; }
.card .meta .handle { font-weight: 600; }
.card .meta .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card .count { font-weight: 700; color: var(--blue); font-size: 15px; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 13px; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; margin: 20px 0;
}
.panel h2 { font-size: 15px; margin-bottom: 12px; }

.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 28px;
  text-align: center; color: var(--muted); cursor: pointer; font-size: 13px;
}
.dropzone.dragover { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.status-line { font-size: 13px; color: var(--gray); margin-top: 10px; }
.status-line.error { color: var(--red); }
.status-line.ok { color: var(--mint); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { background: var(--hover); border-radius: 999px; padding: 4px 10px; font-size: 12px; }

footer.site {
  text-align: center; color: var(--muted); font-size: 12px; padding: 30px 20px;
}

.notice {
  background: var(--red-soft); color: var(--red); border-radius: 10px;
  padding: 10px 14px; font-size: 12px; margin: 14px 0;
}
.notice a { color: inherit; font-weight: 700; text-decoration: underline; }
.notice a:hover { text-decoration-thickness: 2px; }

.list-entries { margin-top: 16px; }
.list-entries .entry {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.list-entries .entry:last-child { border-bottom: none; }

@media (max-width: 520px) {
  header.site { align-items: flex-start; gap: 12px; }
  header.site nav { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .language-picker-button { max-width: 122px; }
}
