/* ============================================================
   网易任务助手 · 结构样式
   ------------------------------------------------------------
   配色一律走 CSS 变量，四套界面方案在 static/themes.css 里覆盖。
   这里 :root 的默认值 = 方案 A「清蓝卡片」（= 改动前的观感）。
   改颜色请改 themes.css，改结构/间距/组件请改这个文件。
   ============================================================ */

:root {
  /* 画布与卡片 */
  --bg: #f4f6fb;
  --bg-soft: #f7f8fc;
  --card: #ffffff;
  --card-2: #fafbfc;

  /* 主色 */
  --primary: #5b6cff;
  --primary-dark: #4653e8;
  --primary-soft: #eef0ff;
  --primary-ink: #ffffff;

  /* 语义色 */
  --success: #22c55e;
  --success-soft: #f0fdf4;
  --success-ink: #15803d;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-ink: #b91c1c;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-ink: #d97706;
  --prize-bg: #fff7ed;
  --prize-border: #fed7aa;
  --prize-ink: #c2410c;

  /* 文字与描边 */
  --text: #1e2330;
  --text-strong: #12161f;
  --muted: #8a90a3;
  --border: #e6e9f2;
  --border-strong: #d6d9e4;

  /* 滚动条：必须比背景明显，否则用户以为那段内容滚不动（11-20 踩过） */
  --scroll-thumb: rgba(30, 35, 48, .40);
  --scroll-thumb-hover: rgba(30, 35, 48, .62);

  /* 形状 */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
  --shadow: 0 2px 12px rgba(30, 40, 80, .06);
  --shadow-lift: 0 10px 30px rgba(30, 40, 80, .10);

  /* 顶栏 */
  --topbar-bg: #ffffff;
  --topbar-shadow: 0 1px 0 var(--border);

  /* 装饰 */
  --hero: linear-gradient(120deg, #5b6cff 0%, #8b5cf6 60%, #d946ef 100%);
  --hero-ink: #ffffff;
  --hero-shadow: 0 8px 24px rgba(91, 108, 255, .25);
  --auth-bg: linear-gradient(135deg, #eef0ff 0%, #fde8f7 100%);
  --code-bg: #f7f8fc;
  --code-ink: #334155;
  --toast-bg: #23283b;
  --toast-ink: #ffffff;
  --mask: rgba(20, 24, 40, .45);
  --focus-ring: rgba(91, 108, 255, .18);
  --nav-hover: var(--bg);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
.link { font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.req { color: var(--danger); }

/* ------------------------------------------------------------
   顶栏
   ------------------------------------------------------------ */
.topbar {
  background: var(--topbar-bg);
  box-shadow: var(--topbar-shadow);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.6) blur(12px);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  font-weight: 700; font-size: 17px; color: var(--text);
  display: flex; align-items: center; gap: 8px; letter-spacing: .2px;
}
.brand-icon { font-size: 20px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-sm); color: var(--muted);
  font-size: 14px; font-weight: 500; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--nav-hover); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-chip {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600;
}

/* ------------------------------------------------------------
   布局
   ------------------------------------------------------------ */
.container {
  max-width: 1100px; margin: 24px auto 40px; padding: 0 20px;
  flex: 1; width: 100%;
}
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 24px; margin: 6px 0; color: var(--text-strong); }
.page-head p { font-size: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   卡片
   ------------------------------------------------------------ */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 16px; border: 1px solid var(--card-border, transparent);
}
.card h2 { font-size: 17px; margin-bottom: 10px; color: var(--text-strong); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 12px; }
.card-head h2 { margin-bottom: 0; }

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  background: var(--hero); border-radius: var(--radius); color: var(--hero-ink);
  padding: 30px 28px; display: flex; align-items: center; justify-content: space-between;
  gap: 20px; margin-bottom: 20px; box-shadow: var(--hero-shadow); position: relative;
  overflow: hidden;
}
.hero h1 { font-size: 22px; margin-bottom: 6px; }
.hero p { opacity: .92; font-size: 14px; line-height: 1.6; }
.hero-art { font-size: 52px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .15)); }

/* ------------------------------------------------------------
   脚本卡片
   ------------------------------------------------------------ */
.script-card { display: flex; flex-direction: column; transition: transform .18s, box-shadow .18s, border-color .18s; }
.script-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.script-icon { font-size: 34px; margin-bottom: 10px; line-height: 1; }
.script-card h3 { font-size: 16px; margin-bottom: 6px; color: var(--text-strong); }
.script-card p { font-size: 13px; flex: 1; line-height: 1.65; }
.script-actions { margin-top: 14px; }

/* ------------------------------------------------------------
   首页仪表盘：左「我的任务」/ 右「公告 + 最近运行 + 已绑定」
   ------------------------------------------------------------ */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: start;
}
.dash-main { min-width: 0; }
.dash-side {
  position: sticky; top: 80px;
  display: flex; flex-direction: column; gap: 16px;
  /* 高度由 index.html 的 fitRail() 对齐左侧 .dash-main（不用 100vh 猜） */
  min-height: 0;
  /* 对齐左侧「我的任务」标题行的高度，否则右边第一块比左边高出一截 */
  padding-top: 36px;
}
.dash-side .card { margin-bottom: 0; padding: 18px; }
/* 侧栏里只让「最近运行」吃剩余高度，别的卡（已绑定微信）按内容排 */
.dash-side > .card:not(.rail-runs) { flex: 0 0 auto; }
.dash-side .run-list { gap: 8px; }
.dash-side .run-item { padding: 10px 12px; border-radius: 10px; }
.dash-side .run-item-top { font-size: 12.5px; gap: 6px; line-height: 1.5; }
.dash-side .run-item .muted { font-size: 11.5px; }
.dash-side .run-log { max-height: 220px; font-size: 11px; }
.dash-side .prize-chip { font-size: 11px; padding: 1px 8px; }
.dash-side .empty { padding: 16px; font-size: 13px; }

/* 公告通栏：横跨整页、正文超长时在本条内滚动，不把页面顶长 */
.notice-wide { margin-bottom: 20px; padding: 18px 20px; }
/* 多条公告时整块也限高滚动，避免公告把下面的任务区一路推下去 */
.notice-wide .notice-list { gap: 8px; max-height: 208px; overflow-y: auto; padding-right: 6px; }
.notice-wide .notice-body {
  max-height: 128px; overflow-y: auto;
  padding-right: 8px; margin-top: 6px;
}

/* 最近运行：卡片定高 + 列表内部滚动。
   高度优先用 JS(fitRail) 对齐左栏；calc 只是 JS 未执行时的兜底 */
.rail-runs {
  position: relative;
  display: flex; flex-direction: column; min-height: 260px;
  /* flex:1 —— 侧栏被 fitRail() 定高后，这块要吃满剩余高度才和左栏齐平 */
  flex: 1 1 auto;
  max-height: calc(100vh - 320px);
}
.rail-runs .run-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; padding-right: 8px;
  /* 只用 ::-webkit-scrollbar 定制；一旦写 scrollbar-width/color，
     Chrome 会忽略全部 ::-webkit 规则（箭头/圆角都控不住），所以不写 */
  scrollbar-gutter: stable;
}
/* 关键：run-item 是 flex 子项，默认 flex-shrink:1 —— 父容器不够高时
   它会被「压扁」而不是溢出，overflow-y:auto 永远不触发（11-20 的 bug）。
   定死不要收缩，让内容老老实实溢出，滚动条才有意义。 */
.rail-runs .run-scroll > * { flex: 0 0 auto; }
/* 底部渐隐：只在「还能往下滚」时出现，滚到底自动消失 */
.rail-runs::after {
  content: ""; position: absolute; left: 18px; right: 26px; bottom: 18px; height: 34px;
  background: linear-gradient(to bottom, transparent, var(--card) 78%);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  pointer-events: none; opacity: 0; transition: opacity .18s;
}
.rail-runs.can-scroll::after { opacity: 1; }

.rail-runs .run-scroll::-webkit-scrollbar,
.notice-wide .notice-body::-webkit-scrollbar,
.notice-wide .notice-list::-webkit-scrollbar,
.run-log::-webkit-scrollbar { width: 8px; }
.rail-runs .run-scroll::-webkit-scrollbar-thumb,
.notice-wide .notice-body::-webkit-scrollbar-thumb,
.notice-wide .notice-list::-webkit-scrollbar-thumb,
.run-log::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: 4px;
  border: 2px solid transparent; background-clip: padding-box;
}
.rail-runs .run-scroll::-webkit-scrollbar-thumb:hover,
.notice-wide .notice-body::-webkit-scrollbar-thumb:hover,
.notice-wide .notice-list::-webkit-scrollbar-thumb:hover,
.run-log::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
.rail-runs .run-scroll::-webkit-scrollbar-track,
.notice-wide .notice-body::-webkit-scrollbar-track,
.notice-wide .notice-list::-webkit-scrollbar-track,
.run-log::-webkit-scrollbar-track { background: transparent; }
/* 去掉 Chrome 默认的上下箭头小方块，只留一条干净的滑轨 */
.rail-runs .run-scroll::-webkit-scrollbar-button,
.notice-wide .notice-body::-webkit-scrollbar-button,
.notice-wide .notice-list::-webkit-scrollbar-button,
.run-log::-webkit-scrollbar-button { display: none; height: 0; }

.section-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 2px 12px;
}
.section-head h2 { font-size: 17px; color: var(--text-strong); letter-spacing: -.2px; }

.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.rail-head h3 { font-size: 14px; font-weight: 700; color: var(--text-strong); }
/* 标题 // 条数 ……… 全部 → ：条数吃掉中间空白，右侧链接贴边 */
.rail-head #run-count { margin-left: auto; font-size: 12px; }

/* 未配置参数提示条 */
.tip-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  background: var(--prize-bg); border: 1px solid var(--prize-border);
  color: var(--prize-ink); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}

/* 提醒条整行通栏，放在两栏上面（多条时竖排，间距 12） */
.tip-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.tip-row .tip-bar { margin-bottom: 0; }

/* 永劫 token 过期后单独给红色：平时跟另外两条提醒条同款黄色，过期才升级成「必须看见」 */
.tip-bar.is-danger {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger-ink);
}

/* 设置页里的硬性约束提醒（例：金钥匙答案 18:00 截止）——比 tip-bar 更"重"，常驻不消失 */
.tip-note {
  background: var(--warning-soft); border: 1px solid var(--warning);
  color: var(--warning-ink); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; line-height: 1.7; margin: 12px 0 14px;
}
.tip-note b { color: var(--warning-ink); }
.tip-note .sub {
  display: block; margin-top: 5px;
  font-size: 12px; line-height: 1.65; opacity: .9; font-weight: 400;
}

/* 任务卡：图标 + 标题 + 描述 + 底部状态/入口，整卡可点（单列宽卡） */
.script-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.task-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  grid-template-areas: "icon title" "icon desc" "foot foot";
  gap: 3px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 16px;
  color: var(--text); box-shadow: var(--shadow); text-decoration: none;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.task-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.task-card:hover .task-go { text-decoration: underline; }
.task-icon {
  grid-area: icon; width: 52px; height: 52px; border-radius: 13px;
  background: var(--bg-soft); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 25px; line-height: 1; align-self: start;
}
.task-title {
  grid-area: title; font-size: 16px; font-weight: 700;
  color: var(--text-strong); line-height: 1.35;
}
.task-desc {
  grid-area: desc; font-size: 13px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-foot {
  grid-area: foot;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border);
}
.task-schedule { font-size: 12px; font-weight: 600; color: var(--primary); }
.task-schedule.is-off { color: var(--muted); font-weight: 500; }
.task-go { font-size: 12.5px; font-weight: 600; color: var(--primary); white-space: nowrap; }

/* ------------------------------------------------------------
   统计
   ------------------------------------------------------------ */
.stats-row { margin-bottom: 16px; }
.stat {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; text-align: center; border: 1px solid var(--card-border, transparent);
}
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ------------------------------------------------------------
   表单
   ------------------------------------------------------------ */
.field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text);
  margin: 14px 0 6px;
}
.input {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; outline: none; background: var(--card);
  color: var(--text); transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }
.input::placeholder { color: var(--muted); opacity: .75; }
.input.inline { width: auto; flex: 1; min-width: 120px; }
select.input { appearance: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: var(--radius-sm); padding: 10px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
  font-family: inherit;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 18px; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ------------------------------------------------------------
   开关
   ------------------------------------------------------------ */
.switch-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; font-size: 14px;
}
.switch { position: relative; width: 44px; height: 24px; display: inline-block; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%;
  transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ------------------------------------------------------------
   提示
   ------------------------------------------------------------ */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; }
.alert-error { background: var(--danger-soft); color: var(--danger-ink); border: 1px solid var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success-ink); border: 1px solid var(--success); }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ------------------------------------------------------------
   运行记录
   ------------------------------------------------------------ */
.run-list { display: flex; flex-direction: column; gap: 10px; }
.run-item {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; transition: border-color .15s, background .15s; background: var(--card);
}
.run-item:hover { border-color: var(--primary); }
.run-item-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.run-item .muted { font-size: 12px; margin-top: 4px; }
.run-detail { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.run-log {
  background: var(--code-bg); color: var(--code-ink); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; line-height: 1.75;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto;
}
.prize-chip {
  display: inline-block; background: var(--prize-bg); color: var(--prize-ink);
  border: 1px solid var(--prize-border); border-radius: 999px;
  padding: 2px 10px; font-size: 12px; margin: 2px 4px 2px 0;
}
.empty { color: var(--muted); text-align: center; padding: 24px; font-size: 14px; }
.tag {
  display: inline-block; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 8px; font-size: 12px; color: var(--muted);
}
.tag-admin { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.tag-ok { background: var(--success-soft); color: var(--success-ink); border-color: transparent; }
.tag-off { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }
.badge { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-failed { background: var(--danger-soft); color: var(--danger-ink); }
.badge-running { background: var(--warning-soft); color: var(--warning-ink); }

/* ------------------------------------------------------------
   运行状态区
   ------------------------------------------------------------ */
.run-now { margin-top: 14px; background: var(--bg-soft); border-radius: 12px; padding: 14px; }
.spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--primary);
  border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   用户 / 微信账号列表
   ------------------------------------------------------------ */
.user-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.user-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; flex-wrap: wrap;
}
.user-item {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  background: var(--card-2);
}
.user-item > div { flex: 1; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }

/* ------------------------------------------------------------
   登录 / 注册
   ------------------------------------------------------------ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--auth-bg); padding: 20px;
}
.auth-card {
  background: var(--card); border-radius: 20px;
  box-shadow: 0 10px 40px rgba(80, 90, 180, .12);
  padding: 38px 34px; width: 100%; max-width: 380px;
  border: 1px solid var(--card-border, transparent);
}
.auth-logo { font-size: 44px; text-align: center; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 20px; margin-bottom: 4px; color: var(--text-strong); }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg); color: var(--toast-ink);
  padding: 11px 20px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 999; max-width: 80vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }

/* ------------------------------------------------------------
   活动列表 & 弹窗
   ------------------------------------------------------------ */
.act-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.modal {
  position: fixed; inset: 0; background: var(--mask); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--card); border-radius: 16px; padding: 24px; width: 100%;
  max-width: 460px; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18); color: var(--text);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.code-text { font-family: Consolas, Monaco, monospace; letter-spacing: .5px; font-size: 14px; }

/* ------------------------------------------------------------
   公告
   ------------------------------------------------------------ */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; background: var(--card-2);
}
.notice-item.notice-pinned { background: var(--prize-bg); border-color: var(--prize-border); }
.notice-title { display: flex; align-items: center; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.notice-caret { margin-left: auto; color: var(--muted); font-size: 11px; line-height: 1; }
.notice-body { margin-top: 8px; white-space: pre-wrap; line-height: 1.75; font-size: 14px; }

/* ------------------------------------------------------------
   扫码绑定
   ------------------------------------------------------------ */
.qr-box {
  display: flex; align-items: center; justify-content: center; min-height: 240px;
  background: var(--card-2); border: 1px dashed var(--border-strong);
  border-radius: 12px; padding: 12px;
}

/* ------------------------------------------------------------
   账号时长 + 卡密兑换条（我的参数页顶部 / 到期页共用样式）
   ------------------------------------------------------------ */
.redeem-box { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 20px; }
.redeem-title { font-weight: 700; font-size: 15px; color: var(--text-strong); margin-bottom: 6px; }
.redeem-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.redeem-right {
  display: flex; gap: 10px; margin-left: auto;
  flex: 1 1 340px; max-width: 480px;
}
.redeem-right .input { flex: 1 1 auto; min-width: 0; }
.redeem-right .btn { flex: 0 0 auto; white-space: nowrap; }
.redeem-msg { flex: 1 1 100%; font-size: 12.5px; margin-top: -4px; min-height: 17px; }

/* ------------------------------------------------------------
   参数说明
   ------------------------------------------------------------ */
.param-help { font-size: 12px; color: var(--muted); line-height: 1.65; margin-top: 4px; }
.param-help b { color: var(--text); font-weight: 600; }
/* 永劫 token 剩余时间胶囊 */
.token-status {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  margin-top: 8px; padding: 5px 11px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  border-radius: 999px; border: 1px solid transparent;
}
.token-status[hidden] { display: none; }
.token-status .ts-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
  background: currentColor;
}
.token-status.is-ok      { background: var(--success-soft); color: var(--success-ink); border-color: var(--success); }
.token-status.is-soon    { background: var(--warning-soft); color: var(--warning-ink); border-color: var(--warning); }
.token-status.is-bad     { background: var(--danger-soft);  color: var(--danger-ink);  border-color: var(--danger); }
.token-status.is-unknown { background: transparent;         color: var(--muted);       border-color: var(--border); }
.task-param {
  display: flex; gap: 9px; align-items: flex-start; padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.task-param:last-child { border-bottom: 0; padding-bottom: 0; }
.task-param input[type="checkbox"] {
  flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px;
  accent-color: var(--primary); cursor: pointer;
}
.task-param .tp-body { flex: 1 1 auto; min-width: 0; }
.task-param .tp-name { font-size: 13px; font-weight: 600; cursor: pointer; }
.task-param .tp-note { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.6; }
.sub-title { font-size: 13px; font-weight: 700; color: var(--text); margin: 16px 0 4px; }
.param-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.param-table th, .param-table td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.param-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.param-table td { line-height: 1.6; }

/* ------------------------------------------------------------
   窄屏（放最后，否则被上面的 .container/.hero 覆盖）
   顶栏原来在手机上会「一个字一行」把整条撑爆，这里收成图标 + 横向滚动。
   ------------------------------------------------------------ */
@media (max-width: 1080px) {
  .dash { grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; }
}
@media (max-width: 940px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; padding-top: 0; height: auto !important; }
  /* 手机上没有「固定视口」的概念，取消定高，让它自然铺开 */
  .rail-runs { max-height: none; min-height: 0; height: auto !important; }
  .rail-runs .run-scroll { overflow: visible; }
  .rail-runs::after { display: none; }
  .notice-wide .notice-body { max-height: none; overflow: visible; }
  .notice-wide .notice-list { max-height: none; overflow: visible; }
}
@media (max-width: 720px) {
  .topbar-inner { height: 56px; gap: 8px; padding: 0 14px; }
  .brand { font-size: 0; gap: 0; }
  .brand-icon { font-size: 22px; line-height: 1; }
  .nav { gap: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { padding: 7px 10px; font-size: 13px; white-space: nowrap; }
  .topbar-user { gap: 6px; }
  .topbar-user .user-chip { display: none; }
  .topbar-user .btn { padding: 6px 10px; font-size: 12.5px; }
  /* 卡密兑换：窄屏换行，输入框和按钮各占一行的一半 */
  .redeem-right { margin-left: 0; max-width: none; flex-basis: 100%; }
  .redeem-box { gap: 10px; }
}
@media (max-width: 600px) {
  .container { padding: 0 14px; margin: 16px auto 32px; }
  .hero { padding: 22px 20px; }
  .hero-art { display: none; }
  .hero h1 { font-size: 19px; }
  .card { padding: 18px 16px; }
  .page-head h1 { font-size: 21px; }
  .script-grid { grid-template-columns: 1fr; gap: 12px; }
  .task-card { padding: 14px 15px 12px; }
}
