:root {
  --bg: #070b12;
  --bg-2: #0c1220;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.1);
  --text: #e8eefc;
  --muted: #8b98b4;
  --accent: #38e0a8;
  --accent-2: #35b8ff;
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 12% -10%, #14324a 0%, transparent 60%),
              radial-gradient(900px 600px at 92% 0%, #10382f 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overflow-y: auto; }

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

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: rgba(7, 11, 18, 0.72);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .5px;
  color: #04140f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(56, 224, 168, .25);
}

.logo.lg { width: 48px; height: 48px; border-radius: 13px; font-size: 16px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; letter-spacing: .3px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: border-color .18s, background .18s;
}
.search-wrap:focus-within { border-color: rgba(56, 224, 168, .55); background: var(--panel-2); }
.search-wrap .ico { width: 18px; height: 18px; fill: var(--muted); flex: 0 0 auto; }
.search-wrap input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: none;
  color: var(--text); font-size: 14px; padding: 0 10px;
}
.search-wrap input::placeholder { color: #6a7794; }
.search-wrap .clear {
  border: 0; background: none; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .12s, filter .18s, background .18s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  color: #04140f;
  background: linear-gradient(135deg, var(--accent), #22c9d6);
  box-shadow: 0 8px 22px rgba(56, 224, 168, .22);
}
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { padding: 6px 12px; font-size: 12px; }
.btn.block { width: 100%; padding: 13px; font-size: 14.5px; margin-top: 6px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.user { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  color: #04140f;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
#userName { font-size: 13px; color: var(--text); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 布局 ---------- */

.layout {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 26px;
  padding: 24px 28px 48px;
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar { position: sticky; top: 84px; align-self: start; }

.side-block { margin-bottom: 24px; }
.side-block h3 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #6f7d99;
  font-weight: 700;
}

.nav { list-style: none; margin: 0; padding: 0; }
.nav li {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: #b9c4da;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.nav li:hover { background: var(--panel); color: var(--text); }
.nav li.active {
  background: linear-gradient(90deg, rgba(56, 224, 168, .16), rgba(53, 184, 255, .07));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(56, 224, 168, .22);
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.segmented button {
  flex: 1;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  padding: 7px 4px;
  border-radius: 8px;
  cursor: pointer;
}
.segmented button.on { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 600; }

.side-stats {
  font-size: 12px;
  color: #6f7d99;
  line-height: 1.7;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.content { min-width: 0; }

.content-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.content-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: .3px; }
.content-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: #b9c4da;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}
.chip.on { color: #04140f; background: var(--accent); border-color: transparent; font-weight: 600; }

/* ---------- 卡片 ---------- */

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

.card {
  position: relative;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .025));
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 224, 168, .45);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .42);
}

.card .thumb {
  height: 190px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(420px 160px at 50% 12%, rgba(56, 224, 168, .16), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(0, 0, 0, .18));
  border-bottom: 1px solid var(--line);
}
.card canvas { height: 168px; width: auto; image-rendering: pixelated; }

.card .info { padding: 10px 12px 12px; }
.card .name {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card .sub {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--muted); margin-top: 5px;
}
.badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  background: rgba(4, 12, 10, .68);
  border: 1px solid rgba(56, 224, 168, .35);
  color: #9ff0d2;
}
.badge.user { border-color: rgba(53, 184, 255, .45); color: #a9dcff; }

.suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.suggest-lead { font-size: 13px; color: var(--muted); }
.suggest .chip { cursor: pointer; }

.empty { padding: 70px 0; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 6px; font-size: 15px; color: #c8d2e6; }
.empty span { font-size: 12.5px; }

.load-more-wrap { display: flex; justify-content: center; margin-top: 26px; }

/* ---------- 弹层 ---------- */

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(3, 6, 11, .72);
  backdrop-filter: blur(10px);
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-card {
  position: relative;
  width: min(920px, 100%);
  background: linear-gradient(180deg, #131b29, #0b1020);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 26px;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0 } to { transform: none; opacity: 1 } }

.modal-x {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px; border-radius: 9px;
  border: 0; background: rgba(255, 255, 255, .06);
  color: #b9c4da; font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-x:hover { background: rgba(255, 255, 255, .13); color: #fff; }

/* 详情 */
.modal-card.detail { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; }
.detail-left {
  border-radius: 14px;
  background: radial-gradient(320px 220px at 50% 0%, rgba(56, 224, 168, .18), transparent 70%), rgba(255, 255, 255, .03);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  padding: 14px;
}
#detailCanvas { height: 330px; width: auto; image-rendering: pixelated; }
.detail-right h2 { margin: 6px 0 10px; font-size: 22px; }
.meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.tags span {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: rgba(56, 224, 168, .12); color: #a7f0d6;
  border: 1px solid rgba(56, 224, 168, .22);
}
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { margin: 18px 0 0; font-size: 12px; color: #6f7d99; line-height: 1.6; }

/* 登录（微软式居中卡片 + 分步） */
.modal.auth .auth-card { width: min(440px, 100%); padding: 34px 34px 26px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .logo { margin: 0 auto 14px; }
.auth-head h2 { margin: 0 0 6px; font-size: 21px; }
.auth-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; font-size: 12px; color: #93a0bb; margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .13);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .16s, background .16s;
}
.field input:focus, .field select:focus {
  border-color: rgba(56, 224, 168, .6);
  background: rgba(56, 224, 168, .06);
}
.field select { appearance: none; }

.who {
  font-size: 13px; color: #cfe0ff;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(53, 184, 255, .08);
  border: 1px solid rgba(53, 184, 255, .18);
  margin-bottom: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.auth-switch {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 16px; font-size: 12.5px;
}
.auth-switch a { color: #7fd9ff; text-decoration: none; cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

.err { color: var(--danger); font-size: 12.5px; margin: 0 0 10px; }

/* 上传 */
.modal-card.upload { width: min(520px, 100%); }
.modal-card.upload h2 { margin: 0 0 6px; font-size: 20px; }
.modal-card.upload .sub { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); }

.drop {
  position: relative;
  height: 190px;
  border-radius: 14px;
  border: 1.5px dashed rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .03);
  display: grid; place-items: center;
  cursor: pointer;
  margin-bottom: 18px;
  overflow: hidden;
  transition: border-color .16s, background .16s;
}
.drop.over { border-color: var(--accent); background: rgba(56, 224, 168, .08); }
.drop canvas { height: 160px; width: auto; image-rendering: pixelated; }
.drop-tip { font-size: 12.5px; color: var(--muted); padding: 0 16px; text-align: center; }
.drop.has-file .drop-tip { display: none; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(10, 18, 30, .95);
  border: 1px solid rgba(56, 224, 168, .35);
  color: #d8f7ea;
  font-size: 13px;
  padding: 11px 20px;
  border-radius: 12px;
  z-index: 99;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
}

/* 横屏窄高时压缩间距，保证一屏可读 */
@media (max-height: 560px) {
  .topbar { padding: 10px 20px; }
  .layout { padding: 16px 20px 32px; }
  .card .thumb { height: 150px; }
  .card canvas { height: 132px; }
  #detailCanvas { height: 250px; }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; }
  .brand-text { display: none; }
  .layout { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .sidebar { position: static; display: flex; gap: 18px; overflow-x: auto; padding-bottom: 4px; }
  .side-block { margin: 0; flex: 0 0 auto; }
  .side-block h3 { display: none; }
  .side-stats { display: none; }
  .nav { display: flex; gap: 6px; }
  .nav li { white-space: nowrap; }
  .modal-card.detail { grid-template-columns: 1fr; }
  #detailCanvas { height: 220px; }
}
