/* ============================================================
   2FA 验证码工具 —— QQ 邮箱风格
   经典元素：蓝色渐变顶栏、浅灰底、白卡片细边框、左侧文件夹栏、
   圆角蓝色按钮、蓝色文字链接点缀
   ============================================================ */

:root {
  --qq-blue: #1e88e5;
  --qq-blue-deep: #1565c0;
  --qq-header-a: #2f9de8;
  --qq-header-b: #1867c0;
  --qq-bg: #eef1f5;
  --qq-card: #ffffff;
  --qq-border: #d9dee5;
  --qq-text: #2b3a4a;
  --qq-text-sub: #7b8794;
  --qq-link: #1e6bd6;
  --qq-success: #1aa034;
  --qq-warn: #e6702a;
  --qq-code: #0f6bd8;
  --radius: 4px;
  --shadow: 0 1px 3px rgba(31, 56, 88, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--qq-text);
  background: var(--qq-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: #fff; color: var(--qq-link); padding: 6px 12px; z-index: 99;
}
.skip-link:focus { left: 8px; }

/* ---------- 顶栏：QQ 邮箱经典蓝渐变 ---------- */
.qq-header {
  background: linear-gradient(180deg, var(--qq-header-a) 0%, var(--qq-header-b) 100%);
  border-bottom: 1px solid #1356a4;
  box-shadow: 0 2px 6px rgba(19, 86, 164, 0.25);
}
.qq-header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 20px;
  height: 58px; display: flex; align-items: center; justify-content: space-between;
}
.qq-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 8px;
  background: #fff; color: var(--qq-header-b);
  font-weight: 800; font-size: 14px; letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -2px 0 rgba(21, 101, 192, .15);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { color: #fff; font-size: 16px; }
.brand-text small { color: rgba(255, 255, 255, .82); font-size: 12px; }
.qq-header-nav { display: flex; align-items: center; gap: 12px; }
.header-env {
  color: rgba(255,255,255,.9); font-size: 12px; letter-spacing: 2px;
  border: 1px solid rgba(255,255,255,.45); border-radius: 999px; padding: 3px 12px;
}
.header-menu-btn {
  display: none; background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.4); border-radius: var(--radius);
  font-size: 16px; width: 34px; height: 30px; cursor: pointer;
}

/* ---------- 主体两栏布局 ---------- */
.qq-layout {
  flex: 1;
  max-width: 1280px; width: 100%;
  margin: 14px auto 18px; padding: 0 20px;
  display: grid; grid-template-columns: 220px 1fr; gap: 14px;
  align-items: start;
}

/* ---------- 左侧栏：QQ 邮箱“文件夹”列表 ---------- */
.qq-sidebar {
  background: var(--qq-card);
  border: 1px solid var(--qq-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky; top: 12px;
}
.sidebar-caption {
  padding: 10px 14px; font-size: 12px; color: var(--qq-text-sub);
  background: #f6f8fb; border-bottom: 1px solid var(--qq-border);
  letter-spacing: 1px;
}
.qq-menu { list-style: none; padding: 6px 0; }
.qq-menu-item {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 8px; padding: 9px 10px;
  color: var(--qq-text); text-decoration: none;
  border-radius: var(--radius); border-left: 3px solid transparent;
  transition: background .15s;
}
.qq-menu-item:hover { background: #eef5fd; }
.qq-menu-item.active {
  background: #e3f0fd; color: var(--qq-link);
  border-left-color: var(--qq-blue); font-weight: 700;
}
.menu-ico { width: 18px; text-align: center; flex: none; }
.menu-badge {
  margin-left: auto; min-width: 20px; padding: 0 6px; text-align: center;
  background: var(--qq-blue); color: #fff; border-radius: 10px;
  font-size: 11px; line-height: 18px; font-weight: 700;
}
.sidebar-note {
  margin: 8px 10px 12px; padding: 10px 12px;
  background: #f2f9f2; border: 1px solid #cde8cd; border-radius: var(--radius);
}
.sidebar-note strong { color: var(--qq-success); font-size: 12px; }
.sidebar-note p { margin-top: 4px; color: #4d6a4f; font-size: 12px; line-height: 1.6; }

/* ---------- 主内容 ---------- */
.qq-main { min-width: 0; }
.stage-heading {
  background: var(--qq-card);
  border: 1px solid var(--qq-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px; margin-bottom: 14px;
  border-top: 3px solid var(--qq-blue);
}
.kicker {
  display: inline-block; font-size: 11px; letter-spacing: 2px;
  color: var(--qq-blue); font-weight: 700; margin-bottom: 6px;
}
.stage-heading h1 { font-size: 22px; margin-bottom: 6px; }
.stage-heading p { color: var(--qq-text-sub); line-height: 1.7; }

.work-grid { display: grid; grid-template-columns: 5fr 6fr; gap: 14px; }

.task-card {
  background: var(--qq-card);
  border: 1px solid var(--qq-border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.task-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid #e8edf3;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f6fa 100%);
}
.task-title-group { display: flex; align-items: center; gap: 12px; }
.step-index {
  width: 34px; height: 34px; flex: none; border-radius: 8px;
  background: var(--qq-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.step-index.output-step { background: var(--qq-header-b); }
.card-kicker { display: block; font-size: 11px; color: var(--qq-text-sub); letter-spacing: 1px; }
.task-title-group h3 { font-size: 16px; margin-top: 2px; }
.task-count { font-size: 12px; color: var(--qq-text-sub); white-space: nowrap; }
.task-count span { color: var(--qq-link); font-weight: 700; }

.task-card-copy {
  padding: 12px 18px 0; color: var(--qq-text-sub); line-height: 1.7; font-size: 13px;
}
.task-card-copy code {
  background: #eef3f9; border: 1px solid #dbe5f0; border-radius: 3px;
  padding: 1px 6px; color: var(--qq-link); font-family: Consolas, Monaco, monospace;
}

.field { padding: 14px 18px 6px; }
.field label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.field label span { font-weight: 700; }
.field label small { color: var(--qq-text-sub); font-size: 12px; }
textarea, input.qq-input {
  width: 100%; border: 1px solid #c5cdd8; border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; color: var(--qq-text);
  font-family: Consolas, Monaco, "Courier New", monospace;
  background: #fdfefe; resize: vertical; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input.qq-input:focus {
  border-color: var(--qq-blue);
  box-shadow: 0 0 0 3px rgba(30, 136, 229, .12);
}

.input-tip {
  margin: 8px 18px; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  background: #f0f7fd; border: 1px solid #cfe6f8; border-radius: var(--radius);
  color: #4a6b88; font-size: 12px;
}
.tip-ico { flex: none; }

.task-action-bar {
  margin-top: auto;
  padding: 12px 18px 16px; display: flex; gap: 10px;
  border-top: 1px dashed #e3e9f0;
}

/* ---------- QQ 风格按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius); cursor: pointer; font-size: 14px;
  border: 1px solid transparent; padding: 7px 18px;
  transition: filter .15s, background .15s, box-shadow .15s;
  user-select: none;
}
.btn-large { padding: 9px 26px; font-size: 15px; }
.btn-primary {
  background: linear-gradient(180deg, #3d9ef0 0%, var(--qq-blue) 55%, var(--qq-blue-deep) 100%);
  color: #fff; border-color: #1565c0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(21,101,192,.3);
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { filter: brightness(.95); box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }
.btn-plain {
  background: #fff; color: #55637a; border-color: #c5cdd8;
}
.btn-plain:hover { border-color: var(--qq-blue); color: var(--qq-link); background: #f6faff; }

/* ---------- 输出区 ---------- */
.output-head { align-items: center; }
.live-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--qq-text-sub);
  padding: 3px 10px; border: 1px solid #dfe6ee; border-radius: 999px; background: #f7fafc;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #b6c2ce; display: inline-block; }
.live-status.active { color: var(--qq-success); border-color: #bfe3c6; background: #f2faf3; }
.live-status.active .live-dot { background: var(--qq-success); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.output-meta {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 18px; color: var(--qq-text-sub); font-size: 13px;
  border-bottom: 1px solid #eef2f7;
}
#countdown-wrap { color: var(--qq-warn); font-size: 12px; white-space: nowrap; }
#countdown-wrap b { font-size: 15px; }
.hidden { display: none !important; }

.totp-output-surface {
  padding: 16px 18px; flex: 1; min-height: 260px;
  background: #fafbfd;
}
.totp-output-surface.has-results { background: #fff; }

.totp-placeholder {
  min-height: 230px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--qq-text-sub); text-align: center;
  border: 1px dashed #cdd8e4; border-radius: var(--radius); background: #f7fafd;
}
.placeholder-code {
  font-family: Consolas, Monaco, monospace; font-size: 34px; font-weight: 700;
  color: #c3cfdd; letter-spacing: 4px;
}
.totp-placeholder strong { color: #8a97a8; font-size: 15px; }
.totp-placeholder p { font-size: 12px; }

.totp-list { display: flex; flex-direction: column; gap: 10px; }
.totp-code-card {
  border: 1px solid #dbe5f0; border-radius: var(--radius); background: #fff;
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; box-shadow: 0 1px 2px rgba(31,56,88,.05);
  transition: border-color .15s, box-shadow .15s;
}
.totp-code-card:hover { border-color: var(--qq-blue); box-shadow: 0 2px 6px rgba(30,136,229,.12); }
.totp-card-head { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.totp-card-head small {
  color: var(--qq-text-sub); font-size: 12px; font-family: Consolas, Monaco, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.totp-code-value {
  border: none; background: none; cursor: pointer; padding: 2px 4px;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 28px; font-weight: 800; letter-spacing: 3px; color: var(--qq-code);
}
.totp-code-value:hover { color: var(--qq-blue-deep); }
.totp-error { color: #d43d3d; font-size: 12px; }
.btn-copy {
  font-size: 12px; padding: 4px 12px;
  background: #fff; color: var(--qq-link); border: 1px solid #a9cdf3; border-radius: var(--radius);
  cursor: pointer;
}
.btn-copy:hover { background: #e9f4fe; border-color: var(--qq-blue); }
.code-hint { display: flex; align-items: center; gap: 4px; color: #9aa8b8; font-size: 11px; }

.refresh-footer { padding: 12px 18px 16px; border-top: 1px solid #eef2f7; }
.refresh-track {
  height: 6px; border-radius: 3px; background: #e6ecf3; overflow: hidden;
}
.refresh-track i {
  display: block; height: 100%;
  background: linear-gradient(90deg, #4aa8f0, var(--qq-blue));
  border-radius: 3px; transition: width 1s linear;
}
.refresh-footer p { margin-top: 8px; color: var(--qq-text-sub); font-size: 12px; }

/* ---------- 使用提示条 ---------- */
.usage-strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-top: 14px; scroll-margin-top: 14px;
}
.usage-strip article {
  background: var(--qq-card); border: 1px solid var(--qq-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.usage-ico {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: #e3f0fd; color: var(--qq-link);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.usage-strip strong { display: block; margin-bottom: 3px; font-size: 13px; }
.usage-strip p { color: var(--qq-text-sub); font-size: 12px; line-height: 1.6; }

/* ---------- 关于卡片 ---------- */
.about-card {
  margin-top: 14px; scroll-margin-top: 14px;
  background: var(--qq-card); border: 1px solid var(--qq-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px;
}
.about-card h3 { font-size: 15px; color: var(--qq-link); margin-bottom: 8px; }
.about-card p { color: var(--qq-text-sub); line-height: 1.8; font-size: 13px; }

/* ---------- 页脚 ---------- */
.qq-footer {
  text-align: center; padding: 16px 12px 20px;
  color: #8b98a8; font-size: 12px;
}
.foot-dot { margin: 0 8px; }

/* ---------- Toast 提示 ---------- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translate(-50%, -12px);
  background: rgba(43, 58, 74, .95); color: #fff;
  padding: 9px 22px; border-radius: 4px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 99; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: rgba(26, 130, 60, .95); }
.toast.error { background: rgba(196, 46, 46, .95); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .work-grid { grid-template-columns: 1fr; }
  .usage-strip { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .qq-layout { grid-template-columns: 1fr; }
  .header-menu-btn { display: block; }
  .qq-sidebar { display: none; }
  .qq-sidebar.open { display: block; position: fixed; top: 62px; left: 12px; right: 12px; z-index: 50; }
}
