/* ============================================================
   iOS 租号转码提取终端 —— 前台样式
   精简直角风格：无圆角、无动效装饰、单一强调色
   ============================================================ */
:root {
  --bg: #101214;
  --panel: #17191c;
  --panel2: #1d2023;
  --line: #272b30;
  --line2: #33383e;
  --text: #e7e9eb;
  --muted: #8b929b;
  --accent: #2f6bff;
  --accent-d: rgba(47, 107, 255, .14);
  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --mono: ui-monospace, "SF Mono", Consolas, Menlo, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; border-radius: 0 !important; }
html { height: 100%; }
body {
  min-height: 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 20px 24px;
  background: var(--bg);
}
::selection { background: rgba(47, 107, 255, .35); color: #fff; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2c3136; }
::-webkit-scrollbar-thumb:hover { background: #3a4046; }

/* ---------- 品牌区 ---------- */
.brand { text-align: center; margin-bottom: 28px; width: 100%; max-width: 460px; }
.brand h1 {
  font-size: 20px; font-weight: 700; letter-spacing: 1px; margin-bottom: 8px;
}
.brand .subtitle { font-size: 13px; color: var(--muted); }
.brand-desc { margin-top: 10px; }
.brand-desc p { font-size: 12px; color: var(--muted); line-height: 1.8; }

/* ---------- 公告 ---------- */
.notice {
  width: 100%; max-width: 460px; margin-bottom: 14px;
  background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--warn);
  color: var(--text); font-size: 12.5px; line-height: 1.8; padding: 10px 14px;
}

/* ---------- 主卡片 ---------- */
.panel {
  width: 100%; max-width: 460px; background: var(--panel);
  border: 1px solid var(--line); padding: 24px;
}
.panel-title {
  font-size: 14px; font-weight: 600; margin-bottom: 18px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}

/* ---------- 卡密信息条 ---------- */
.card-info { display: none; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 10px 14px; margin-bottom: 16px; }
.ci-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.ci-item { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.ci-label { color: var(--muted); }
.ci-value { color: var(--text); font-weight: 600; }
.ci-value.count { color: var(--ok); }
.ci-value.warn { color: var(--warn); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field-row { display: flex; gap: 8px; align-items: stretch; }
.field-row input, .select {
  flex: 1; min-width: 0; height: 40px; background: var(--panel2); border: 1px solid var(--line2);
  color: var(--text); padding: 0 12px; font-size: 13px; outline: none; font-family: inherit;
  transition: border-color .15s;
}
.field-row input:focus, .select:focus { border-color: var(--accent); }
.field-row input::placeholder { color: #5c636b; }
.select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.select option { background: var(--panel2); color: var(--text); }
.field-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; }
.field-foot .chk { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.field-foot .chk input { width: 13px; height: 13px; accent-color: var(--accent); }
.field-foot a { color: var(--accent); text-decoration: none; }
.field-foot a:hover { text-decoration: underline; }

.mini {
  flex-shrink: 0; height: 40px; padding: 0 12px; background: transparent;
  border: 1px solid var(--line2); color: var(--muted); font-size: 12px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s;
}
.mini:hover { border-color: var(--accent); color: var(--text); }

.actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-main {
  flex: 1; height: 42px; background: var(--accent); color: #fff; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: filter .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-main:hover { filter: brightness(1.12); }
.btn-main:disabled { opacity: .55; cursor: not-allowed; }
.btn-main .btn-spinner { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50% !important; animation: spin .7s linear infinite; display: none; }
.btn-main.loading .btn-spinner { display: inline-block; }
.btn-main.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-sub { flex-shrink: 0; height: 42px; padding: 0 18px; background: transparent; border: 1px solid var(--line2); color: var(--text); font-size: 13px; cursor: pointer; font-family: inherit; transition: border-color .15s; }
.btn-sub:hover { border-color: var(--accent); }

/* ---------- 结果区 ---------- */
.result { width: 100%; max-width: 460px; margin-top: 14px; display: none; }
.result.show { display: block; }
.result-card { background: var(--panel); border: 1px solid var(--line); padding: 16px; }
.result-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.result-card textarea {
  width: 100%; min-height: 75px; background: var(--panel2); border: 1px solid var(--line2);
  color: var(--text); padding: 10px; font-size: 12px; resize: vertical; outline: none;
  font-family: var(--mono); line-height: 1.6; word-break: break-all; transition: border-color .15s;
}
.result-card textarea:focus { border-color: var(--accent); }
.result-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
/* 一键上号：结果区主操作，整行醒目按钮 */
.btn-launch { display: block; width: 100%; height: 46px; margin-top: 12px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 3px; cursor: pointer; font-family: inherit; transition: filter .15s; }
.btn-launch:hover { filter: brightness(1.12); }
.btn-launch:active { filter: brightness(.94); }
.btn-launch:disabled { opacity: .5; cursor: not-allowed; }
.launch-tip { color: var(--muted); font-size: 11.5px; line-height: 1.7; margin-top: 7px; }
.result-btns button {
  flex: 1; min-width: 80px; height: 36px; background: transparent; border: 1px solid var(--line2);
  color: var(--text); font-size: 12.5px; cursor: pointer; font-family: inherit; transition: border-color .15s;
}
.result-btns button:hover { border-color: var(--accent); }
.result-btns button.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); font-weight: 600; }
.result-btns button.primary:hover { filter: brightness(1.12); }

.qr-wrap { margin-top: 14px; text-align: center; }
.qr-wrap canvas { max-width: 190px; width: 100%; background: #fff; padding: 8px; border: 1px solid var(--line2); }
.qr-tip { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- 转码元信息 ---------- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.meta-pill { background: var(--panel2); border: 1px solid var(--line); padding: 8px 10px; min-height: 50px; }
.meta-pill span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.meta-pill b { display: block; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 滑块验证提示 ---------- */
.verify-box { margin-top: 12px; padding: 12px; background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--warn); }
.verify-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.verify-tip { font-size: 12px; color: var(--muted); line-height: 1.7; margin-bottom: 8px; }
#verifyUrl { width: 100%; min-height: 52px; background: var(--bg); border: 1px solid var(--line2); color: var(--text); padding: 8px; font-size: 11px; resize: vertical; outline: none; font-family: var(--mono); word-break: break-all; }

.parse-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.parse-detail .acc-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#accResult { width: 100%; min-height: 55px; background: var(--panel2); border: 1px solid var(--line2); color: var(--text); padding: 10px; font-size: 11px; resize: vertical; outline: none; font-family: var(--mono); line-height: 1.6; word-break: break-all; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--panel2); border: 1px solid var(--line2); color: var(--text);
  padding: 9px 18px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); color: #ffa198; }

/* ---------- 弹窗 ---------- */
.modal-mask { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal-mask.show { display: flex; }
.modal { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line2); padding: 24px; }
.modal h3 { font-size: 15px; margin-bottom: 14px; font-weight: 600; }
.modal ol { padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 2; }
.modal .close { margin-top: 16px; width: 100%; height: 40px; background: var(--accent); border: none; font-weight: 600; cursor: pointer; color: #fff; font-size: 13px; font-family: inherit; }
.modal .close:hover { filter: brightness(1.12); }

/* ---------- 底部 ---------- */
.desc-footer { margin-top: auto; text-align: center; padding-top: 28px; padding-bottom: 6px; color: var(--muted); font-size: 11px; line-height: 2; }
.desc-footer h2 { font-size: 12px; margin-bottom: 4px; font-weight: 600; }
.desc-footer p { color: #6b7280; font-size: 11px; }

/* 设备绑定提示行：卡密绑定了设备时显示，可自助解绑时附带按钮 */
.ci-device {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.ci-device .ci-device-warn { color: var(--warn); }
.ci-device button.mini { flex: none; }

/* 教程弹窗内容（后台自定义，前台按极简格式渲染） */
.help-body { font-size: 13px; line-height: 1.9; color: var(--text); }
.help-body h4 { margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.help-body h4:first-child { margin-top: 0; }
.help-body p { margin: 0 0 8px; }
.help-body ul, .help-body ol { margin: 0 0 10px; padding-left: 20px; }
.help-body li { margin: 2px 0; }
.help-body b { font-weight: 600; }
.help-body a { color: var(--accent); text-decoration: underline; word-break: break-all; }

/* 订单信息（转码后展示，tencnet 风格；全直角、单一强调色）
   注意：宽度必须与 .panel/.result/.history 完全一致，否则左右边框对不齐 */
.order-box { width: 100%; max-width: 460px; margin-top: 14px; background: var(--panel); border: 1px solid var(--line); padding: 14px 16px; }
.ob-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.ob-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ob-cell { background: var(--panel2); border: 1px solid var(--line); padding: 10px 12px; min-width: 0; }
.ob-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ob-value { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.5; word-break: break-all; }
@media (max-width: 520px) { .ob-grid { grid-template-columns: 1fr; } }

/* 转码记录（浏览器本地保存，解锁码 → 转码结果）
   默认折叠成一条按钮；展开后每条记录两行——解锁码 / 结果（单行省略，点一下即复制） */
.history { width: 100%; max-width: 460px; margin-top: 14px; background: var(--panel); border: 1px solid var(--line); }
.history-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none; color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600; text-align: left;
  padding: 12px 16px; cursor: pointer; transition: color .15s;
}
.history-toggle:hover { color: #fff; }
.ht-title { flex: none; }
.ht-count { flex: none; font-size: 11px; font-weight: 400; color: var(--accent); border: 1px solid var(--line2); line-height: 17px; padding: 0 6px; }
.ht-arrow {
  margin-left: auto; width: 7px; height: 7px; flex: none;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg); transition: transform .15s;
}
.history.open .ht-arrow { transform: rotate(-135deg); }
.history-body { border-top: 1px solid var(--line); padding: 12px 16px 14px; }
.history-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.history-foot { margin-top: 10px; }
.history-foot .mini { width: 100%; height: 34px; }

.h-item { border: 1px solid var(--line); background: var(--panel2); padding: 9px 11px; }
.h-head { display: flex; align-items: center; gap: 8px; }
.h-time { flex: none; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.h-tag { flex: 1; min-width: 0; font-size: 11.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-acts { flex: none; margin-left: auto; display: flex; gap: 6px; }
.h-acts .mini { height: 24px; padding: 0 9px; font-size: 11px; line-height: 22px; }
.h-line { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; min-width: 0; }
.h-k { flex: none; font-size: 11px; color: var(--muted); }
.h-v {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.h-v:hover { color: var(--accent); }
