* { box-sizing: border-box; }
:root {
  --bg: #f6f7f9; --card: #fff; --ink: #111827; --sub: #6b7280;
  --line: #e7e9ee; --brand: #4f46e5; --brand-d: #4338ca; --brand-2: #7c3aed;
  --soft: #f3f3fd; --ok: #059669; --err: #dc2626; --warn: #d97706;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
}
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -.2px; }
.brand-zh { color: var(--brand); font-weight: 700; margin-left: 2px; }

/* 语言选择 */
.lang-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.lang-row label { font-weight: 600; font-size: 14px; }
#langSelect {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; background: #fff; cursor: pointer; min-width: 150px;
}
#langSelect:focus { border-color: var(--brand); outline: none; }
.lang-hint { font-size: 12.5px; color: var(--sub); }
.userbar { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.quota { color: var(--sub); }
.quota b { color: var(--ink); font-weight: 700; }
.quota .buy { color: var(--brand); margin-left: 6px; font-size: 13px; }
.who { font-weight: 600; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 14px; }

main, .auth { max-width: 760px; margin: 22px auto; padding: 0 16px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 14px; font-size: 16px; }

/* auth */
.auth.card { max-width: 380px; margin-top: 8vh; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tab {
  flex: 1; padding: 9px; border: 1px solid var(--line); background: #fafbfe;
  border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--sub);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
#authForm { display: flex; flex-direction: column; gap: 12px; }
input {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; outline: none;
}
input:focus { border-color: var(--brand); }
button.primary {
  padding: 11px; background: var(--brand); color: #fff; border: none;
  border-radius: 9px; font-size: 15px; cursor: pointer; font-weight: 600;
}
button.primary:hover { background: var(--brand-d); }
button.primary:disabled { opacity: .6; cursor: default; }

/* dropzone */
.dropzone {
  border: 1.5px dashed #cbd0db; border-radius: 14px; padding: 40px 18px;
  text-align: center; cursor: pointer; transition: .15s; color: var(--sub);
  background: #fcfcfe;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--soft); }
.dz-icon { font-size: 30px; margin-bottom: 6px; }
.dz-inner > div:nth-child(2) { color: var(--ink); font-weight: 600; }
.hint { font-size: 12.5px; margin-top: 8px; }

/* jobs */
.jobs { display: flex; flex-direction: column; gap: 12px; }
.empty { color: var(--sub); font-size: 14px; }
.job {
  border: 1px solid var(--line); border-radius: 11px; padding: 14px;
}
.job-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.job-name { font-weight: 600; word-break: break-all; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.queued { background: #eef0f6; color: var(--sub); }
.badge.running { background: #e7eeff; color: var(--brand-d); }
.badge.done { background: #e2f6ec; color: var(--ok); }
.badge.failed { background: #fde7e9; color: var(--err); }
.bar { height: 7px; background: #eef0f6; border-radius: 6px; margin: 10px 0 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .5s ease; }
.bar.live > i {
  background-image: linear-gradient(90deg, var(--brand) 0%, #6f86ff 50%, var(--brand) 100%);
  background-size: 200% 100%; animation: barflow 1.2s linear infinite;
}
@keyframes barflow { from { background-position: 200% 0; } to { background-position: 0 0; } }
.job-msg { font-size: 12.5px; color: var(--sub); white-space: pre-wrap; }
.job-msg.err { color: var(--err); }
.job-actions { margin-top: 10px; }
.dl {
  display: inline-block; padding: 7px 16px; background: var(--ok); color: #fff;
  border-radius: 8px; text-decoration: none; font-size: 14px; font-weight: 600;
}
.dl:hover { filter: brightness(.95); }

/* 充值弹窗 */
.modal {
  position: fixed; inset: 0; background: rgba(15,23,41,.5);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 26px; width: 380px; max-width: 92vw;
  position: relative; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.modal-box h3 { margin: 0 0 16px; font-size: 17px; }
.modal-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 24px; color: var(--sub); cursor: pointer; line-height: 1;
}
.pack-list { display: flex; flex-direction: column; gap: 12px; }
.pack {
  display: flex; align-items: center; justify-content: space-between;
  border: 1.5px solid var(--line); border-radius: 11px; padding: 16px 18px;
  background: #fff; cursor: pointer; transition: .15s;
}
.pack:hover { border-color: var(--brand); background: #f5f8ff; }
.pack-pages { font-weight: 700; font-size: 16px; }
.pack-price { font-weight: 800; font-size: 20px; color: var(--brand-d); }
.pay-qr { text-align: center; }
.pay-qr img { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 10px; }
.pay-tip { margin: 12px 0 4px; font-size: 14px; }
.pay-state { font-size: 14px; color: var(--sub); margin: 8px 0 12px; }
.pay-state.ok { color: var(--ok); font-weight: 600; }
.pay-state.err { color: var(--err); }

/* 兑换码 */
.redeem-box { margin-top: 18px; }
.redeem-or { text-align: center; color: var(--sub); font-size: 12.5px; margin: 4px 0 12px; position: relative; }
.redeem-or:before, .redeem-or:after {
  content: ""; position: absolute; top: 50%; width: 28%; height: 1px; background: var(--line);
}
.redeem-or:before { left: 0; } .redeem-or:after { right: 0; }
.redeem-row { display: flex; gap: 8px; }
#redeemInput {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 14px; outline: none; text-transform: uppercase;
}
#redeemInput:focus { border-color: var(--brand); }
#redeemMsg { margin-top: 8px; }

/* 充值记录 */
.orders-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow: auto; }
.order-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.order-meta { color: var(--sub); font-size: 12.5px; }
.os.paid { color: var(--ok); }
.os.pending { color: var(--warn); }
.os.failed { color: var(--sub); }

/* 邀请有礼 */
.link.invite { color: #c2410c; font-weight: 600; }
.ref-rule { font-size: 14px; color: var(--ink); margin-bottom: 16px; line-height: 1.6; }
.ref-rule .hl { color: var(--brand-d); }
.ref-linkbox { display: flex; gap: 8px; margin-bottom: 16px; }
#refLink {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; color: var(--sub); background: #fafbfe;
}
.btn-copy {
  padding: 10px 18px; background: var(--brand); color: #fff; border: none;
  border-radius: 9px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-copy:hover { background: var(--brand-d); }
.ref-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.ref-stats > div {
  flex: 1; text-align: center; background: var(--soft, #f5f7ff);
  border: 1px solid var(--line); border-radius: 11px; padding: 14px 6px;
}
.ref-stats b { display: block; font-size: 22px; color: var(--brand-d); font-weight: 800; }
.ref-stats span { font-size: 12.5px; color: var(--sub); }
.ref-tip { font-size: 12.5px; color: var(--sub); }
.ref-hint {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px;
}

.msg { font-size: 13.5px; min-height: 18px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.msg.warn { color: var(--warn); }
