:root {
  --bg: #0b1020;
  --bg-2: #121a30;
  --panel: #16203a;
  --panel-2: #1d2a48;
  --line: #25324f;
  --text: #e8eefc;
  --muted: #93a1c4;
  --accent: #25d0c0;
  --accent-2: #3b82f6;
  --danger: #ff5d6c;
  --radius: 16px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 600px at 70% -10%, #16213f 0%, var(--bg) 60%), var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

/* 顶栏 */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 26px;
  background: linear-gradient(180deg, var(--bg-2), rgba(18, 26, 48, 0.6));
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 26px; font-weight: 800; letter-spacing: 1px; white-space: nowrap; }
.brand .logo { font-size: 30px; }
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  max-width: 720px;
}
.search-icon { font-size: 18px; opacity: 0.7; }
.search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 20px;
}
.icon-btn {
  width: 52px; height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}
.icon-btn:active { transform: scale(0.96); }

/* 布局 */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  flex: 0 0 200px;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 21px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.cat .emoji { font-size: 24px; }
.cat.active { background: linear-gradient(90deg, var(--accent-2), #2a64d8); color: #fff; }
.cat:active { transform: scale(0.98); }

.content {
  flex: 1;
  padding: 22px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Banner */
.banners { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 6px; }
.banner {
  flex: 0 0 auto;
  width: 420px;
  height: 150px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.banner h3 { margin: 0 0 6px; font-size: 24px; }
.banner p { margin: 0; opacity: 0.9; font-size: 16px; }

.sortbar { display: flex; align-items: center; justify-content: space-between; }
.sort-title { font-size: 22px; font-weight: 700; }
.sortbar select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 17px;
}

/* 网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s;
}
.card:active { transform: scale(0.98); }
.card:hover { border-color: var(--accent); }
.card-top { display: flex; gap: 14px; align-items: center; }
.card-icon { width: 64px; height: 64px; border-radius: 16px; flex: 0 0 auto; background: var(--panel-2); }
.card-name { font-size: 21px; font-weight: 700; line-height: 1.2; }
.card-dev { font-size: 14px; color: var(--muted); margin-top: 4px; }
.tag {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  background: rgba(37, 208, 192, 0.12);
  border-radius: 8px;
  padding: 3px 10px;
}
.card-info { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.stars { color: #ffce4d; }
.btn-install {
  border: none;
  border-radius: 12px;
  padding: 12px 0;
  font-size: 18px;
  font-weight: 700;
  color: #06231f;
  background: linear-gradient(90deg, var(--accent), #58e6d8);
  cursor: pointer;
}
.btn-install:active { transform: scale(0.97); }
.btn-install.downloaded { background: var(--panel-2); color: var(--muted); }

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

/* 详情弹窗 */
.modal {
  position: fixed; inset: 0;
  background: rgba(3, 7, 18, 0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 30px;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(640px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px;
  position: relative;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font-size: 20px; cursor: pointer;
}
.modal-head { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.modal-icon { width: 88px; height: 88px; border-radius: 20px; background: var(--panel-2); }
.modal-name { font-size: 28px; font-weight: 800; }
.modal-sub { font-size: 16px; color: var(--muted); margin-top: 6px; }
.modal-stats { font-size: 15px; color: var(--muted); margin-top: 8px; }
.modal-stats b { color: var(--text); }
.modal-shots { display: flex; gap: 12px; overflow-x: auto; margin-bottom: 16px; }
.modal-shots img { height: 150px; border-radius: 12px; background: var(--panel-2); }
.modal-desc { font-size: 17px; line-height: 1.7; color: #cdd7ef; }
.btn-install.big { width: 100%; margin-top: 8px; padding: 16px 0; font-size: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(20, 28, 50, 0.96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px 24px; border-radius: 14px; font-size: 18px;
  opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .sidebar { flex-basis: 150px; }
  .banner { width: 320px; }
}

/* 更新提示栏 */
.update-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.18), rgba(37, 208, 192, 0.12));
  border: 1px solid var(--accent-2);
  border-radius: 14px;
  padding: 14px 18px;
}
.update-bar[hidden] { display: none; }
.update-icon { font-size: 22px; }
.update-text { flex: 1; font-size: 19px; font-weight: 600; }
.btn-update-all {
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-2), #2a64d8);
  cursor: pointer;
}
.btn-update-all:active { transform: scale(0.97); }

/* 安装按钮状态 */
.btn-install.upd { color: #06231f; background: linear-gradient(90deg, #ffb020, #ffd166); }
.btn-install.installed {
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
}
