:root {
  --bg: #0b0916;
  --panel: #151126;
  --panel-2: #1b1630;
  --line: rgba(255, 255, 255, 0.07);
  --text: #ece9f7;
  --muted: #8f88ad;
  --accent: #8b6cff;
  --accent-2: #b9a8ff;
  --green: #5ee6a0;
  --red: #ff8095;
  --orange: #ffb45e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[v-cloak] { display: none; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app {
  max-width: 820px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.loading {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  letter-spacing: 2px;
}

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(600px 400px at 80% 0%, rgba(139, 108, 255, 0.25), transparent 60%),
    radial-gradient(500px 400px at 0% 100%, rgba(255, 120, 180, 0.12), transparent 60%),
    var(--bg);
}

.login-orb {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(139, 108, 255, 0.18);
  filter: blur(2px);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.emblem {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(145deg, #9b7dff, #6a4bff);
  box-shadow: 0 18px 50px rgba(139, 108, 255, 0.45);
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 6px;
}

.login-card .muted { margin: 10px 0 26px; }

.input, .textarea, select {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  font-size: 15px;
}

.field input, .field select, .field textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  font-size: 14px;
  color-scheme: dark;
}

.input:focus, .textarea:focus, select:focus {
  border-color: rgba(139, 108, 255, 0.65);
}

.textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.btn.primary { background: linear-gradient(135deg, #9b7dff, #724fff); color: #fff; }
.btn.ghost { background: rgba(255, 255, 255, 0.05); color: #c8c1e3; border: 1px solid var(--line); }
.btn.danger { background: rgba(255, 90, 110, 0.12); color: #ff9aa8; border: 1px solid rgba(255, 90, 110, 0.25); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn:disabled { opacity: 0.6; }

.login-card .btn { margin-top: 16px; padding: 14px; font-size: 16px; letter-spacing: 6px; }

.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11, 9, 22, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--accent-2);
  background: rgba(139, 108, 255, 0.14);
  border: 1px solid rgba(139, 108, 255, 0.2);
}

.pill.owner { color: #ffd28a; background: rgba(255, 180, 94, 0.12); border-color: rgba(255, 180, 94, 0.24); }

.main { padding: 16px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 2px 12px;
}

.section-head h2, .section-head h3 { margin: 0; font-size: 20px; }
.section-head h3 { font-size: 16px; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}

.intro {
  color: #b9b2d0;
  font-size: 13px;
  line-height: 1.65;
  margin: 8px 0 14px;
}

.stats { display: flex; gap: 12px; }
.stat { flex: 1; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }

.guild-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guild-card { cursor: pointer; margin: 0; }
.guild-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.guild-card h3 { margin: 0; font-size: 19px; }
.guild-hero { margin-bottom: 14px; }
.guild-hero-head { display: flex; justify-content: space-between; align-items: baseline; }
.guild-hero h2 { margin: 0; font-size: 24px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; }
.tab {
  flex: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #b9b2d0;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
}
.tab.active { background: var(--accent); color: #fff; border-color: transparent; }

.module-head { display: flex; justify-content: space-between; align-items: baseline; }
.module-head h3 { margin: 0; font-size: 22px; }
.module-stats { display: flex; flex-wrap: wrap; gap: 14px; color: #b9b2d0; font-size: 13px; margin-top: 10px; }
.module-actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.module-actions .delta { margin-right: auto; }

.list-card { padding: 8px 14px; }
.list-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
  cursor: pointer;
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #9a94b5;
  background: rgba(255, 255, 255, 0.04);
}
.rank-no.r1 { background: #ffcf6e; color: #3b2a00; }
.rank-no.r2 { background: #dfe4f5; color: #30364a; }
.rank-no.r3 { background: #e7a46b; color: #3a1c00; }
.guild-tag { flex: none; font-size: 10px; padding: 2px 6px; border-radius: 5px; color: #fff; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rank-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.prev { display: block; }
.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 108, 255, 0.22);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
}

.delta { font-size: 12px; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.delta.up { color: var(--green); background: rgba(94, 230, 160, 0.1); }
.delta.down { color: var(--red); background: rgba(255, 128, 149, 0.1); }
.delta.flat { color: var(--muted); background: rgba(255, 255, 255, 0.04); }
.delta.new { color: var(--orange); background: rgba(255, 180, 94, 0.1); }

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

.member-note {
  margin: 4px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: #9f97bd;
  background: rgba(139, 108, 255, 0.07);
  border: 1px solid rgba(139, 108, 255, 0.14);
}
.member-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 0; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.member-row:last-child { border-bottom: 0; }
.member-rank { width: 26px; text-align: center; font-size: 12px; color: #9a94b5; }
.member-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reward-check {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
.reward-check.on { background: #34c77b; border-color: #34c77b; }
.member-missed { flex: none; width: 44px; text-align: right; line-height: 1.05; }
.member-missed b { display: block; font-size: 16px; color: #6f688b; }
.member-missed small { font-size: 10px; color: var(--muted); }
.member-missed.has b { color: #ff9aa8; }
.clear-reward { margin-top: 8px; }

.member-hero { padding: 6px 4px 14px; }
.member-hero h2 { margin: 8px 0 4px; font-size: 28px; }

.form-card { padding: 12px 16px; }
.field { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.field:last-of-type { border-bottom: 0; }
.field > span { flex: none; width: 52px; font-size: 13px; color: var(--muted); }
.field > input, .field > select, .field > textarea { flex: 1; }
.field > textarea { min-height: 70px; }
.field > b { flex: 1; font-weight: 400; }
.readonly { color: #c8c1e3; }

.recent-card { padding: 16px; }
.recent-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.recent-value { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.recent-value small { font-size: 12px; color: var(--muted); margin-left: 4px; }

.chart-card { padding: 8px 6px 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: #c9b8ff; stroke: #0b0916; stroke-width: 2; }
.chart .axis { fill: #7f799e; font-size: 11px; }
.chart .last-value { fill: #e8e3ff; font-size: 12px; }

.part-grid { display: flex; gap: 4px; }
.part-cell { flex: 1; min-width: 0; text-align: center; }
.part-mark {
  height: 30px;
  line-height: 30px;
  border-radius: 8px;
  font-size: 13px;
  color: #5d5878;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.part-cell.on .part-mark { color: var(--green); background: rgba(94, 230, 160, 0.14); border-color: rgba(94, 230, 160, 0.34); }
.part-label { margin-top: 4px; font-size: 9px; color: var(--muted); white-space: nowrap; }

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.history-row:last-child { border-bottom: 0; }
.history-row b { display: block; }
.history-right { text-align: right; }
.history-right b { font-variant-numeric: tabular-nums; }

.record-stats { display: flex; text-align: center; }
.record-stats > div { flex: 1; }
.record-stats b { display: block; font-size: 19px; }
.record-stats span { font-size: 11px; color: var(--muted); }
.bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.05); overflow: hidden; min-width: 40px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #8b6cff, #b9a8ff); }

.seg { display: flex; gap: 8px; margin: 12px 0; }
.seg button { flex: 1; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--muted); border-radius: 10px; padding: 9px; }
.seg button.active { color: #fff; border-color: rgba(139, 108, 255, 0.5); background: rgba(139, 108, 255, 0.16); }

.edit-row { display: flex; gap: 8px; margin-bottom: 8px; }
.edit-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 10px;
  outline: none;
  font-size: 14px;
}
.edit-row input[type="number"] { max-width: 120px; }

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: #151126;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}
.modal h3 { margin: 0 0 8px; }

.pc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.pc-row b { margin-right: 6px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pc-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pc-form h4 { margin: 0 0 10px; }
.pc-form .input { margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.guild-form { padding: 8px 0 16px; border-bottom: 1px solid var(--line); }
.guild-form:last-child { border-bottom: 0; }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 820px;
  display: flex;
  background: rgba(18, 14, 34, 0.96);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(16px);
  z-index: 30;
}
.tabbar button {
  flex: 1;
  border: 0;
  background: transparent;
  color: #7d7796;
  font-size: 12px;
  padding: 6px 2px;
  border-radius: 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tabbar button.active { color: var(--accent-2); background: rgba(139, 108, 255, 0.1); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  max-width: 80vw;
  padding: 9px 16px;
  border-radius: 10px;
  background: rgba(30, 24, 55, 0.96);
  border: 1px solid var(--line);
  color: #e8e3ff;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 520px) {
  .guild-cards { grid-template-columns: 1fr; }
  .main { padding: 12px; }
  .rank-row { gap: 7px; font-size: 13px; }
  .rank-value { font-size: 13px; }
  .prev { display: none; }
  .module-stats { gap: 8px; font-size: 12px; }
  .member-missed { width: 40px; }
}
