* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0e1520;
  --bg2: #151f2e;
  --card: #1c2a3d;
  --card2: #22334a;
  --line: #2e425e;
  --text: #e6eef7;
  --muted: #8ba3bf;
  --gold: #ffc94d;
  --diamond: #59d6ff;
  --green: #3ddc84;
  --red: #ff5d5d;
  --blue: #4d9fff;
  --accent: #6ea8ff;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 800px at 50% -10%, #1b2c44 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }

/* 卡片与按钮 */
.card {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.btn {
  display: inline-block; border: none; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: var(--accent); color: #0a1220; transition: .15s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.gold { background: var(--gold); color: #3a2a00; }
.btn.green { background: var(--green); color: #062b17; }
.btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

input, select {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  font-size: 15px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 5px; }

/* 顶部资源栏 */
.topbar {
  background: linear-gradient(180deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 16px; margin-bottom: 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.res { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; }
.res .ico { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.ico-gold { background: var(--gold); }
.ico-diamond { background: var(--diamond); }
.ico-wood { background: #b98a5a; }
.ico-steel { background: #9aa7b5; }
.ico-food { background: #ffb06b; }
.ico-crystal { background: #c68bff; }
.ico-energy { background: #7cffb0; }
.ico-water { background: #6fc8ff; }
.ico-medicine { background: #ff8f9e; }

.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.badge-vip {
  background: linear-gradient(135deg,#ffd76a,#ff9a3d); color:#3a2400;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
}

/* 网格 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* 标题 */
.h { font-size: 18px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.h small { font-size: 13px; color: var(--muted); font-weight: 400; }

/* 庇护所 */
.shelter-stage {
  position: relative; text-align: center; padding: 30px 10px 10px;
  background: linear-gradient(180deg, #16283e, #0f1a29);
  border-radius: 12px; border: 1px solid var(--line); overflow: hidden;
}
.shelter-level {
  font-size: 52px; font-weight: 800; color: var(--gold);
  text-shadow: 0 0 24px rgba(255,201,77,.35);
}
.shelter-sub { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }
.shelter-bar {
  height: 16px; background: var(--bg2); border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); margin-top: 14px;
}
.shelter-bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .4s; }
.cost-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; font-size: 14px; }
.cost-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.cost-item b { display: block; font-size: 16px; }
.ok { color: var(--green); } .no { color: var(--red); }

/* 产出动画区 */
.idle-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.idle-rate { color: var(--muted); font-size: 14px; }

/* 任务 */
.task-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg2); margin-bottom: 8px; gap: 10px;
}
.task-info { flex: 1; min-width: 0; }
.task-name { font-weight: 600; font-size: 14px; }
.task-desc { font-size: 12px; color: var(--muted); margin: 2px 0; }
.task-bar { height: 7px; background: #0d1622; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.task-bar > div { height: 100%; background: var(--diamond); }
.task-reward { font-size: 12px; color: var(--gold); white-space: nowrap; }
.done .task-name { color: var(--green); }

/* 兑换 */
.ex-rows { display: flex; flex-direction: column; gap: 10px; }
.ex-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
.rate-note { font-size: 12px; color: var(--muted); margin: 10px 0; }

/* 登录页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tabs .btn { flex: 1; }
.tab-active { background: var(--gold); color: #3a2a00; }
.logo-title { text-align: center; font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.logo-sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.tip { font-size: 12px; color: var(--muted); margin-top: 12px; text-align: center; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* 弹窗/提示 */
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  padding: 12px 22px; border-radius: 10px; background: var(--card2);
  border: 1px solid var(--line); color: var(--text); font-size: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.4); z-index: 99; opacity: 0; transition: .25s;
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }

.modal-mask { position: fixed; inset: 0; background: rgba(5,10,18,.7); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; }
.modal { width: 100%; max-width: 460px; }
.modal .h { margin-top: 0; }
.code-output { background: #0d1622; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; font-family: monospace; font-size: 13px; max-height: 180px; overflow: auto; word-break: break-all; white-space: pre-wrap; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin: 30px 0 10px; }
