/* WebStoreHouse 画廊样式 —— 简洁、明快、深浅色自适应 */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1c2030;
  --ink-2: #6b7185;
  --line: #e6e8f0;
  --accent: #5b6cff;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(23, 26, 45, .05), 0 8px 24px rgba(23, 26, 45, .07);
  --shadow-lift: 0 2px 6px rgba(23, 26, 45, .08), 0 16px 40px rgba(23, 26, 45, .14);
  --radius: 16px;
}
html[data-theme="dark"] {
  --bg: #12141c;
  --card: #1b1e2a;
  --ink: #e8eaf2;
  --ink-2: #8b91a7;
  --line: #2a2e3f;
  --accent: #7c89ff;
  --accent-ink: #10122b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background .25s, color .25s;
}
main { max-width: 1200px; margin: 0 auto; padding: 0 24px 48px; }
button { font: inherit; cursor: pointer; }

/* ---------- 顶栏 ---------- */
.top {
  max-width: 1200px; margin: 0 auto;
  padding: 22px 24px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #9b6bff);
  color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: var(--shadow);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand-tag { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); font-size: 16px;
}
.icon-btn:hover { color: var(--ink); }
.auth-btn {
  height: 36px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 14px;
}
.auth-btn.authed { border-color: transparent; background: var(--accent); color: var(--accent-ink); }

/* ---------- 分类筛选 ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 0 22px; }
.chip {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); font-size: 13.5px;
}
.chip:hover { color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

/* ---------- 卡片墙 ---------- */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}
.grid > * { min-width: 0; }
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.card-cover {
  display: block; position: relative; aspect-ratio: 16 / 10;
  overflow: hidden; text-decoration: none;
  background: linear-gradient(135deg, hsl(var(--h1) 65% 62%), hsl(var(--h2) 70% 48%));
}
.card-cover iframe {
  position: absolute; inset: 0;
  width: 200%; height: 200%;
  transform: scale(.5); transform-origin: 0 0;
  border: 0; pointer-events: none; background: #fff;
}
.card-initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 52px; font-weight: 800; color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}
.card-open {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transition: opacity .18s; background: rgba(10, 12, 24, .35);
}
.card-cover:hover .card-open { opacity: 1; }
.card-open span {
  padding: 9px 22px; border-radius: 999px; background: #fff; color: #1c2030;
  font-size: 14px; font-weight: 600; box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

.card-body { padding: 13px 15px 14px; }
.card-line1 { display: flex; align-items: center; gap: 8px; }
.card-name {
  font-weight: 650; font-size: 15.5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.badge {
  flex: none; font-size: 11.5px; padding: 2.5px 9px; border-radius: 999px; font-weight: 600;
}
.badge-game     { background: #ffe9e3; color: #c2410c; }
.badge-learning { background: #e0f2fe; color: #0369a1; }
.badge-tool     { background: #dcfce7; color: #15803d; }
.badge-other    { background: #ede9fe; color: #6d28d9; }
html[data-theme="dark"] .badge-game     { background: #442019; color: #ffb59a; }
html[data-theme="dark"] .badge-learning { background: #12324a; color: #93d8ff; }
html[data-theme="dark"] .badge-tool     { background: #143726; color: #86efac; }
html[data-theme="dark"] .badge-other    { background: #2d2352; color: #c4b5fd; }

.card-desc {
  margin-top: 4px; font-size: 13px; color: var(--ink-2); min-height: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { margin-top: 6px; font-size: 12px; color: var(--ink-2); opacity: .85; }
.card-meta i { font-style: normal; margin: 0 4px; opacity: .5; }

.card-admin { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; }
.card-admin button {
  width: 30px; height: 30px; border-radius: 9px; border: 0;
  background: rgba(15, 17, 30, .55); color: #fff; font-size: 13px;
  backdrop-filter: blur(6px); opacity: 0; transition: opacity .15s;
}
.card:hover .card-admin button { opacity: 1; }
.card-admin button:hover { background: rgba(15, 17, 30, .8); }

/* 发布磁贴 */
.add-tile {
  border: 2px dashed var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 240px; color: var(--ink-2);
  background: transparent; transition: border-color .15s, color .15s;
}
.add-tile:hover { border-color: var(--accent); color: var(--accent); }
.add-plus { font-size: 34px; line-height: 1; }
.add-title { font-size: 14.5px; font-weight: 600; }
.add-hint { font-size: 12px; text-align: center; line-height: 1.6; opacity: .8; }

.empty { text-align: center; color: var(--ink-2); padding: 80px 0; font-size: 15px; }

/* ---------- 弹窗 ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 26px 26px 22px;
  background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-lift); width: min(420px, calc(100vw - 48px));
}
dialog::backdrop { background: rgba(10, 12, 24, .45); backdrop-filter: blur(3px); }
dialog h3 { margin: 0 0 6px; font-size: 18px; }
.dialog-hint { margin: 0 0 14px; font-size: 13px; color: var(--ink-2); }
dialog label { display: block; font-size: 13px; color: var(--ink-2); margin: 12px 0 0; }
dialog input[type="text"], dialog input[type="password"], dialog select {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px;
}
dialog input:focus, dialog select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.btn {
  padding: 9px 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 14px;
}
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .55; pointer-events: none; }

.pick-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.pick-name { font-size: 12.5px; color: var(--ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress { margin-top: 16px; position: relative; height: 26px; border-radius: 8px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #9b6bff); transition: width .2s; }
.progress-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; color: var(--ink); font-weight: 600;
}

/* ---------- 杂项 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 11px 22px;
  border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lift);
  z-index: 99; max-width: calc(100vw - 48px);
}
.drop-veil {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(91, 108, 255, .12); border: 3px dashed var(--accent);
}
.drop-veil span {
  padding: 14px 30px; border-radius: 14px; background: var(--card);
  font-size: 16px; font-weight: 600; box-shadow: var(--shadow-lift);
}
.foot {
  max-width: 1200px; margin: 0 auto; padding: 18px 24px 30px;
  font-size: 12.5px; color: var(--ink-2); display: flex; gap: 8px; align-items: center;
}
.foot i { font-style: normal; opacity: .5; }

@media (max-width: 560px) {
  .brand-tag { display: none; }
  main { padding: 0 16px 40px; }
  .top { padding: 16px 16px 10px; }
  .grid { gap: 16px; }
}
