/* 熙云宇宙 — 界面样式
 * 东方科幻配色：青碧（科技）/ 赭石（土地）/ 黛紫（晦蚀）/ 鎏金（文明）
 */
:root {
  --ink: #0b0f14;
  --ink2: #121821;
  --ink3: #1b2430;
  --line: #26313f;
  --text: #d8e2ec;
  --dim: #7f8f9f;
  --jade: #3fbfa8;
  --jade-d: #1f7d6d;
  --ochre: #c9a227;
  --purple: #7b5ea7;
  --gold: #e0b64a;
  --red: #c8503c;
  --green: #4fae6a;
  --panel: rgba(12, 17, 23, 0.94);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px; line-height: 1.5;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ================= 布局 ================= */

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

#topbar {
  flex: none; height: 46px; display: flex; align-items: center; gap: 10px;
  padding: 0 10px; background: var(--ink2); border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden; white-space: nowrap;
}
#topbar::-webkit-scrollbar { height: 0; }

.brand { font-weight: 700; color: var(--jade); letter-spacing: 1px; flex: none; }
.brand small { color: var(--dim); font-weight: 400; margin-left: 4px; letter-spacing: 0; }

.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 12px; background: var(--ink3);
  border: 1px solid var(--line); font-size: 12px; color: var(--dim);
}
.chip b { color: var(--text); font-weight: 600; }
.chip.jade b { color: var(--jade); }
.chip.gold b { color: var(--gold); }
.chip.purple b { color: var(--purple); }
.chip.red b { color: var(--red); }

.spacer { flex: 1 1 auto; min-width: 4px; }

.tbtn {
  flex: none; height: 30px; padding: 0 11px; border-radius: 15px;
  background: var(--ink3); border: 1px solid var(--line); color: var(--text);
  font-size: 12px;
}
.tbtn:hover { border-color: var(--jade-d); }
.tbtn.on { background: var(--jade-d); border-color: var(--jade); color: #fff; }
.tbtn.danger:hover { border-color: var(--red); color: var(--red); }

#stage { flex: 1 1 auto; position: relative; overflow: hidden; background: #070a0e; }
#cv { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

/* ================= 底部标签栏 ================= */

#tabbar {
  flex: none; height: 52px; display: flex; background: var(--ink2);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: none; border: none; color: var(--dim); font-size: 11px;
  border-top: 2px solid transparent;
}
.tab .ic { font-size: 17px; line-height: 1; }
.tab.on { color: var(--jade); border-top-color: var(--jade); background: rgba(63,191,168,.07); }

/* ================= 抽屉面板 ================= */

#drawer {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 62%;
  background: var(--panel); border-top: 1px solid var(--jade-d);
  border-radius: 14px 14px 0 0; display: none; flex-direction: column;
  backdrop-filter: blur(8px); z-index: 20;
}
#drawer.show { display: flex; }
.dhead {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 8px; border-bottom: 1px solid var(--line);
}
.dhead h3 { margin: 0; font-size: 14px; color: var(--jade); font-weight: 600; }
.dclose {
  margin-left: auto; width: 26px; height: 26px; border-radius: 13px;
  background: var(--ink3); border: 1px solid var(--line); color: var(--dim); font-size: 14px;
}
.dbody { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; }
.card {
  padding: 8px 9px; border-radius: 9px; background: var(--ink3);
  border: 1px solid var(--line); text-align: left; color: var(--text); font-size: 12px;
}
.card:hover { border-color: var(--jade-d); }
.card.on { border-color: var(--jade); background: rgba(63,191,168,.13); }
.card.off { opacity: .42; }
.card .cn { font-weight: 600; font-size: 13px; }
.card .cd { color: var(--dim); font-size: 11px; margin-top: 3px; line-height: 1.35; }
.card .cc { color: var(--ochre); font-size: 11px; margin-top: 3px; }

.row {
  display: flex; align-items: center; gap: 8px; padding: 8px 2px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.row:last-child { border-bottom: none; }
.row .k { color: var(--dim); font-size: 12px; }
.row .v { margin-left: auto; font-weight: 600; }

.bar { height: 5px; border-radius: 3px; background: var(--ink); overflow: hidden; flex: 1; }
.bar i { display: block; height: 100%; border-radius: 3px; }

.tag {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  font-size: 11px; background: var(--ink); border: 1px solid var(--line); color: var(--dim);
}
.tag.g { color: var(--green); border-color: #2c5c3a; }
.tag.r { color: var(--red); border-color: #5c2c2c; }
.tag.y { color: var(--gold); border-color: #5c4c2c; }
.tag.p { color: var(--purple); border-color: #463a5c; }

.note { color: var(--dim); font-size: 12px; line-height: 1.7; }
.note b { color: var(--text); }

.sec-t { color: var(--jade); font-size: 12px; font-weight: 600; margin: 12px 0 6px; }
.sec-t:first-child { margin-top: 2px; }

.logline { font-size: 12px; color: var(--dim); padding: 3px 0; border-bottom: 1px dashed var(--line); }
.logline b { color: var(--text); }

/* ================= 天机盘 ================= */

.orrery { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#orreryCv { flex: none; width: 168px; height: 168px; }

.act {
  display: block; width: 100%; margin-top: 7px; padding: 9px 10px;
  border-radius: 9px; background: var(--ink3); border: 1px solid var(--line);
  color: var(--text); font-size: 13px; text-align: left;
}
.act:hover { border-color: var(--jade-d); }
.act:disabled { opacity: .4; cursor: not-allowed; }
.act .an { font-weight: 600; }
.act .ad { color: var(--dim); font-size: 11px; margin-top: 2px; }

/* ================= 弹窗 ================= */

#modal {
  position: fixed; inset: 0; background: rgba(4, 7, 10, .82);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px;
  backdrop-filter: blur(3px);
}
#modal.show { display: flex; }
.mbox {
  width: 100%; max-width: 380px; max-height: 88vh; overflow-y: auto;
  background: var(--ink2); border: 1px solid var(--jade-d);
  border-radius: 14px; padding: 18px;
}
.mbox h2 { margin: 0 0 4px; font-size: 19px; color: var(--jade); letter-spacing: 1px; }
.mbox .sub { color: var(--dim); font-size: 12px; margin-bottom: 14px; line-height: 1.6; }

.frow { margin-top: 10px; }
.frow label { display: block; color: var(--dim); font-size: 12px; margin-bottom: 4px; }
.fin {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--ink); border: 1px solid var(--line); color: var(--text); font-size: 14px;
  outline: none;
}
.fin:focus { border-color: var(--jade-d); }
.fin::placeholder { color: #55636f; }

.finline { display: flex; gap: 8px; }
.finline .fin { flex: 1; }
.fbtn {
  flex: none; height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--ink3); border: 1px solid var(--jade-d); color: var(--jade); font-size: 12px;
  white-space: nowrap;
}
.fbtn:hover { background: rgba(63,191,168,.12); }

.submit {
  width: 100%; height: 44px; margin-top: 16px; border: none; border-radius: 22px;
  background: linear-gradient(135deg, var(--jade-d), var(--jade)); color: #04120f;
  font-size: 15px; font-weight: 700; letter-spacing: 2px;
}
.submit:disabled { opacity: .5; }
.submit.ghost {
  background: none; border: 1px solid var(--line); color: var(--dim);
  font-weight: 400; letter-spacing: 0; height: 38px; font-size: 13px;
}

.tabs2 { display: flex; gap: 8px; margin-bottom: 6px; }
.tab2 {
  flex: 1; height: 34px; border-radius: 17px; background: var(--ink);
  border: 1px solid var(--line); color: var(--dim); font-size: 13px;
}
.tab2.on { background: var(--jade-d); border-color: var(--jade); color: #fff; font-weight: 600; }

.msg { font-size: 12px; margin-top: 9px; min-height: 16px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.msg.dim { color: var(--dim); }

/* 验证码 */
.cap { display: flex; gap: 8px; align-items: center; }
.cap .q {
  flex: none; padding: 0 12px; height: 40px; line-height: 40px; border-radius: 10px;
  background: var(--ink); border: 1px dashed var(--jade-d); color: var(--gold);
  font-size: 15px; font-weight: 700; letter-spacing: 1px; white-space: nowrap;
}

/* ================= 提示 ================= */

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%);
  max-width: 88%; padding: 9px 15px; border-radius: 10px;
  background: rgba(20, 28, 36, .96); border: 1px solid var(--jade-d);
  color: var(--text); font-size: 13px; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .22s;
  text-align: center;
}
#toast.show { opacity: 1; }

/* ================= 开场 ================= */

#intro {
  position: fixed; inset: 0; z-index: 70; background: var(--ink);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#intro.hide { display: none; }
.ibox { max-width: 420px; text-align: center; }
.ibox h1 {
  font-size: 30px; margin: 0 0 6px; letter-spacing: 6px; color: var(--jade);
  text-shadow: 0 0 22px rgba(63,191,168,.32);
}
.ibox .isub { color: var(--dim); font-size: 13px; letter-spacing: 2px; margin-bottom: 20px; }
.ibox .idesc {
  color: var(--dim); font-size: 13px; line-height: 2; text-align: left;
  background: var(--ink2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 18px;
}
.ibox .idesc b { color: var(--text); }
.ibox .idesc .hl { color: var(--gold); }

@media (max-width: 420px) {
  .ibox h1 { font-size: 25px; letter-spacing: 4px; }
  #orreryCv { width: 132px; height: 132px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
}
