:root {
  --primary: #4F46E5; --primary-deep: #3730A3; --primary-soft: #EEF0FE;
  --bg: #F5F6FA; --card: #FFFFFF; --line: #E5E7F0;
  --text: #191D28; --text-2: #5B6172; --text-3: #8A90A3;
  --blue: #2B4ACB; --blue-bg: #E8EEFB;
  --teal: #0E7C5A; --teal-bg: #E3F5EF;
  --purple: #6D28D9; --purple-bg: #EFEBFB;
  --danger: #C62828; --danger-bg: #FDECEC;
  --success: #0E7C41; --success-bg: #E6F5EC;
  --warn: #B45309; --warn-bg: #FDF3E3;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 24, 40, .06), 0 6px 20px rgba(20, 24, 40, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; }
.hidden { display: none !important; }
/* 触屏优化：去掉点按高亮与 300ms 双击缩放延迟 */
button, .btn, .cat-btn, .stage-btn, .stepper button, .tab { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.brand small { color: var(--text-3); font-weight: 400; margin-left: 6px; }
.track-tag { font-size: 12.5px; color: var(--primary-deep); background: var(--primary-soft); padding: 3px 10px; border-radius: 99px; font-weight: 500; }
.topbar .spacer { flex: 1; }
.badge { font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 99px; }
.badge.open { color: var(--success); background: var(--success-bg); }
.badge.closed { color: var(--danger); background: var(--danger-bg); }

main { max-width: 760px; margin: 0 auto; padding: 22px 16px 60px; }
main.wide { max-width: 1080px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 16px; }

h1 { font-size: 21px; font-weight: 600; }
h2 { font-size: 17px; font-weight: 600; }
.sub { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }

/* ===== 表单 ===== */
.field { margin-top: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  outline: none; transition: border-color .15s; background: #fff; color: var(--text);
}
.input:focus { border-color: var(--primary); }
textarea.input { resize: vertical; min-height: 76px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 22px; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--text); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.btn.ok { background: var(--success); }
.err { color: var(--danger); font-size: 13.5px; margin-top: 10px; min-height: 20px; }

/* ===== 评委端 ===== */
.team-list { display: grid; gap: 12px; margin-top: 14px; }
.team-item {
  display: block; padding: 15px 16px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow); border: 1.5px solid transparent;
  transition: border-color .15s;
}
.team-item:hover { border-color: var(--primary); }
.team-item .tname { font-weight: 600; font-size: 16px; }
.team-item .tmeta { font-size: 12.5px; color: var(--text-3); }
.stage-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stage-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%;
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff;
  transition: border-color .15s, background .15s;
}
.stage-btn:hover { border-color: var(--primary); }
.stage-btn .stage-name { font-weight: 700; font-size: 14.5px; color: var(--text); }
.stage-btn .stage-st { font-size: 12px; color: var(--text-3); }
.stage-btn.none { background: #FAFBFF; }
.stage-btn.none .stage-st { color: var(--primary); font-weight: 600; }
.stage-btn.done { border-color: #BFE3CD; background: var(--success-bg); }
.stage-btn.done .stage-st { color: var(--success); font-weight: 600; }
.stage-btn.closed { opacity: .55; }
.stage-btn.closed .stage-st { color: var(--danger); }
.stage-tag { font-size: 12px; font-weight: 600; color: var(--teal); background: var(--teal-bg); padding: 2px 9px; border-radius: 99px; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.pill.none { color: var(--text-3); background: #F0F1F6; }
.pill.done { color: var(--success); background: var(--success-bg); }
.pill.draft { color: var(--warn); background: var(--warn-bg); }

.progress-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.progress-line .bar { flex: 1; height: 8px; border-radius: 99px; background: #EDEEF4; overflow: hidden; }
.progress-line .bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }

/* ===== 打分表单 ===== */
.total-box {
  position: sticky; top: var(--topbar-h, 57px); z-index: 10; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 18px; margin: 14px 0; display: flex; align-items: center; gap: 14px;
}
.total-box .num { font-size: 30px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.total-box .num small { font-size: 14px; color: var(--text-3); font-weight: 500; }
.total-box .bar { flex: 1; height: 10px; border-radius: 99px; background: #EDEEF4; overflow: hidden; }
.total-box .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #7C6FF0); border-radius: 99px; transition: width .25s; }
.total-box .hint { font-size: 12px; color: var(--text-3); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.group { margin-top: 18px; }
.group-head { display: flex; align-items: baseline; gap: 10px; padding: 0 4px 10px; }
.group-head .gname { font-size: 16.5px; font-weight: 600; }
.group-head .gmax { font-size: 13px; color: var(--text-2); }
.group-head .gsum { margin-left: auto; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.group.blue .group-head .gname { color: var(--blue); }
.group.teal .group-head .gname { color: var(--teal); }
.group.purple .group-head .gname { color: var(--purple); }

.item { background: var(--card); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.item + .item { margin-top: 10px; }
.item-head { display: flex; align-items: baseline; gap: 8px; }
.item-name { font-weight: 600; font-size: 15px; flex: 1; }
.item-max { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.item-tip { font-size: 12.5px; color: var(--text-2); background: #F7F8FC; border-left: 3px solid var(--line); padding: 7px 10px; border-radius: 0 8px 8px 0; margin-top: 8px; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 9px; background: #F0F1F6; font-size: 18px; font-weight: 600;
  color: var(--text-2); display: inline-flex; align-items: center; justify-content: center;
}
.stepper button:hover { background: var(--primary-soft); color: var(--primary); }
.stepper input {
  width: 72px; height: 34px; text-align: center; border: 1.5px solid var(--line); border-radius: 9px;
  font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; outline: none;
}
.stepper input:focus { border-color: var(--primary); }
.item.readonly .stepper input { background: #F7F8FC; color: var(--text-2); }

details.refs { margin-top: 18px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; }
details.refs summary { cursor: pointer; font-weight: 600; font-size: 14.5px; color: var(--text-2); }
details.refs ol { margin: 10px 0 0 20px; color: var(--text-2); font-size: 13.5px; }
details.refs li { margin-top: 5px; }

/* ===== 评委类别选择 ===== */
.cat-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat-btn {
  padding: 13px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  font-weight: 700; font-size: 15px; text-align: center; color: var(--text);
  transition: border-color .15s, background .15s;
}
.cat-btn:hover { border-color: var(--primary); }
.cat-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
@media (max-width: 560px) { .cat-picker { grid-template-columns: repeat(3, 1fr); } }
.phase-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.phase-picker .cat-btn { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.phase-picker small { font-size: 11.5px; font-weight: 500; opacity: .75; }

/* ===== 赛道选择 ===== */
#trackPicker { grid-template-columns: repeat(2, 1fr); }
#trackPicker .track-btn { padding: 15px 12px; font-size: 15.5px; }
.track-info { margin-top: 10px; }
.track-line {
  font-size: 13.5px; line-height: 1.65; color: var(--text-2);
  background: var(--primary-soft); border-radius: 10px; padding: 10px 12px;
}
.track-line.sub { margin-top: 6px; background: transparent; padding: 0 2px; font-size: 12.5px; color: var(--text-3); }

/* ===== 赛道切换（管理端） ===== */
.track-switch-card { padding: 14px 16px; }
.track-switch { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.track-btn2 {
  text-align: left; padding: 13px 16px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .15s, background .15s;
}
.track-btn2 b { font-size: 15.5px; color: var(--text); }
.track-btn2 span { font-size: 12.5px; color: var(--text-3); }
.track-btn2:hover { border-color: var(--primary); }
.track-btn2.active { border-color: var(--primary); background: var(--primary-soft); }
.track-btn2.active b { color: var(--primary-deep); }
.track-btn2.active span { color: var(--primary-deep); opacity: .75; }
@media (max-width: 620px) { .track-switch { grid-template-columns: 1fr; } }

/* ===== 打分页补充 ===== */
.type-tag { font-size: 12px; font-weight: 600; color: var(--primary-deep); background: var(--primary-soft); padding: 2px 9px; border-radius: 99px; }
.focus-box { margin-top: 14px; border-left: 3px solid var(--primary); }
.focus-box b { font-size: 14px; }
.focus-box p { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.checks { list-style: none; margin: 8px 0 0; padding: 0; }
.checks li {
  position: relative; font-size: 12.5px; color: var(--text-2); padding: 3px 0 3px 20px; line-height: 1.5;
}
.checks li::before {
  content: '✓'; position: absolute; left: 2px; top: 3px; color: var(--success); font-weight: 700; font-size: 12px;
}

/* ===== 提交结果 ===== */
.result-hero { text-align: center; padding: 26px 0 8px; }
.result-hero .big { font-size: 46px; font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums; }
.result-hero .lbl { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.result-rows { margin-top: 18px; }
.result-row { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.result-row:last-child { border-bottom: none; }
.result-row b { font-variant-numeric: tabular-nums; }

/* ===== 管理端 ===== */
.admin-login { max-width: 400px; margin: 60px auto; }
.tabs { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.tab { padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text-2); background: #fff; border: 1.5px solid var(--line); }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 12.5px; color: var(--text-3); font-weight: 600; padding: 10px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
table.grid td { padding: 11px 10px; border-bottom: 1px solid #F0F1F6; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
.mono { font-variant-numeric: tabular-nums; }
.score-cell { display: inline-block; min-width: 44px; text-align: center; padding: 3px 8px; border-radius: 8px; background: #F3F4F9; font-weight: 600; font-size: 13.5px; }
.rank-1 { color: #B45309; font-weight: 700; }
.row-actions { display: flex; gap: 6px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 6px; }
.stat { background: #F8F9FD; border-radius: 12px; padding: 14px 16px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.judge-progress { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid #F0F1F6; }
.judge-progress:last-child { border-bottom: none; }
.judge-progress .nm { width: 90px; font-weight: 600; font-size: 14px; }
.judge-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: #EDEEF4; overflow: hidden; }
.judge-progress .bar i { display: block; height: 100%; background: var(--success); }
.judge-progress .ct { font-size: 12.5px; color: var(--text-2); width: 64px; text-align: right; }
.code-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--primary-soft); color: var(--primary-deep); padding: 3px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; letter-spacing: 1px; }

/* ===== 管理端实时刷新状态栏 ===== */
.refresh-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.refresh-status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.refresh-status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; }
.refresh-status .dot.live { background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); animation: pulse 2s infinite; }
.refresh-status .dot.off { background: var(--text-3); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .45); }
  70% { box-shadow: 0 0 0 7px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.danger-t { color: var(--danger); }
.ac-item { padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.55; }
.ac-item + .ac-item { margin-top: 8px; }
.ac-item.ac-warn { background: var(--danger-bg); color: #8F1D1D; }
.ac-item.ac-info { background: var(--warn-bg); color: #7C4A03; }
.ac-item b { margin-right: 4px; }
.type-chip { display: inline-block; font-size: 12px; font-weight: 600; color: var(--blue); background: var(--blue-bg); padding: 2px 9px; border-radius: 99px; margin-left: 6px; }
.judge-progress .nm .type-chip { margin-left: 8px; }
.w-label { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.window-ctrl { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 12px; }
.window-ctrl.open { background: var(--success-bg); }
.window-ctrl.closed { background: var(--danger-bg); }
.window-ctrl .st { font-size: 17px; font-weight: 700; }
.window-ctrl .st small { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-top: 2px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; flex: 1; min-width: 180px; }
.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #22263A; color: #fff; font-size: 14px; padding: 10px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: tin .2s; }
.toast.err { background: var(--danger); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.empty { text-align: center; color: var(--text-3); padding: 34px 0; font-size: 14px; }

/* ===== 结果页/打分页底部操作按钮 ===== */
.action-row { display: flex; gap: 10px; margin-top: 16px; }
.action-row .action-back { flex: 0 0 auto; white-space: nowrap; }
.action-row .action-primary { flex: 1 1 auto; }

/* ===== 自定义模态（替代 confirm/prompt） ===== */
.modal-layer { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-layer.hidden { display: none !important; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 24, 40, .45); }
.modal-box {
  position: relative; width: 100%; max-width: 420px; background: #fff; border-radius: 16px;
  box-shadow: 0 16px 48px rgba(20, 24, 40, .22); padding: 22px; animation: mpop .18s;
}
@keyframes mpop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-msg { font-size: 14px; color: var(--text-2); margin-top: 10px; line-height: 1.6; }
.modal-input { margin-top: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
/* ============================================================
   手机端适配（评委端主要跑在手机上：390×844 / 360×800 / 320×568）
   原则：不改业务与交互，只解决「横向溢出被 iOS 缩放」「点按目标过小」
        「iOS 输入框聚焦放大」「顶部两层 sticky 相互遮挡」四类问题
   ============================================================ */
@media (max-width: 560px) {
  /* ---- 顶栏：强制单行，隐藏赛道长标签（页面内已有赛道信息） ---- */
  .topbar { padding: 10px 14px; gap: 8px; }
  .brand small { display: none; }
  .track-tag { display: none; }
  .track-tag { display: none; }
  .topbar .brand { flex: 0 0 auto; font-size: 14px; letter-spacing: 0; }
  .topbar .spacer { flex: 1 1 0; min-width: 0; }
  .badge { flex: 0 0 auto; font-size: 11.5px; padding: 3px 9px; white-space: nowrap; }
  #btnLogout { flex: 0 0 auto; margin-left: 2px; }

  /* ---- 输入框字号 ≥16px：iOS 聚焦时不再自动放大整页 ---- */
  input, textarea, select, .input { font-size: 16px; }

  /* ---- 页面留白与底部安全区（全面屏 Home 条） ---- */
  main { padding: 12px 12px calc(48px + env(safe-area-inset-bottom)); }
  .card { padding: 16px 15px; border-radius: 13px; }

  /* ---- 登录页 ---- */
  h1 { font-size: 19px; }
  .sub { font-size: 13px; }
  .cat-picker { gap: 8px; }
  .cat-btn { padding: 14px 6px; font-size: 14.5px; min-height: 48px; }
  #trackPicker .track-btn { padding: 15px 8px; font-size: 15px; }
  .track-line { font-size: 13px; }
  .btn { min-height: 46px; }
  .btn.small { min-height: 34px; }

  /* ---- 队伍列表：整块可点、点击区不低于 46px ---- */
  .team-item { padding: 14px 14px 13px; }
  .team-item .tname { font-size: 16.5px; line-height: 1.4; }
  .stage-btn { min-height: 46px; margin-top: 8px; justify-content: center; }
  .stage-btn .stage-st { font-size: 13px; }
  .card h1 + .sub, #judgeNameLabel { min-width: 0; }
  #judgeNameLabel { flex: 0 1 auto; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* ---- 打分页总分条：改成两行网格，避免长队名把页面撑宽 ---- */
  .total-box {
    top: var(--topbar-h, 53px);
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "num bar bar" "name name type";
    align-items: center; gap: 4px 10px;
    padding: 10px 14px; margin: 10px 0; border-radius: 12px;
  }
  .total-box > .num { grid-area: num; font-size: 26px; line-height: 1.1; }
  .total-box > .num small { font-size: 12px; }
  .total-box > .bar { grid-area: bar; height: 8px; width: 100%; }
  .total-box > .hint:nth-child(3) { grid-area: name; font-size: 11.5px; line-height: 1.4; }
  .total-box > .hint:nth-child(4) { grid-area: type; justify-self: end; font-size: 11px; line-height: 1.4; }

  /* ---- 评分项：加减按钮放大到 46px，输入框自适应剩余宽度 ---- */
  .group { margin-top: 16px; }
  .group-head { gap: 8px; padding: 0 2px 8px; }
  .group-head .gname { font-size: 16px; }
  .item { padding: 13px 14px; }
  .item + .item { margin-top: 9px; }
  .item-head { gap: 6px; }
  .item-name { font-size: 15px; line-height: 1.45; }
  .item-max { font-size: 12px; }
  .item-tip { font-size: 13px; padding: 8px 10px; }
  .checks li { font-size: 13px; padding-left: 19px; }
  .stepper { gap: 10px; margin-top: 12px; }
  .stepper button {
    flex: 0 0 46px; width: 46px; height: 46px; font-size: 22px; border-radius: 11px;
  }
  .stepper button:active { background: var(--primary-soft); color: var(--primary); transform: scale(.96); }
  .stepper input { flex: 1 1 auto; width: auto; min-width: 0; height: 46px; font-size: 18px; border-radius: 11px; }

  /* ---- 提交/返回按钮区 ---- */
  .action-row { gap: 10px !important; margin-top: 14px; }
  .action-row .action-back { flex: 0 0 auto !important; padding: 0 16px; }
  .action-row .action-primary { flex: 1 1 auto !important; }
  .action-row .btn { min-height: 48px; font-size: 15.5px; white-space: nowrap; }

  /* ---- 结果页 ---- */
  .result-hero { padding: 18px 0 6px; }
  .result-hero .big { font-size: 42px; }
  .result-row { gap: 12px; font-size: 14px; line-height: 1.5; }
  .result-row span { min-width: 0; word-break: break-word; }
  .result-row b { flex: 0 0 auto; }

  /* ---- 模态框：手机上按钮并排占满，内容过高时内部滚动 ---- */
  .modal-layer { padding: 16px; align-items: center; }
  .modal-box { max-height: 82vh; overflow-y: auto; padding: 20px; }
  .modal-actions { gap: 10px; }
  .modal-actions .btn { flex: 1; min-height: 46px; }

  /* ---- 顶部提示条 ---- */
  .toast-wrap { bottom: calc(20px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast { text-align: center; font-size: 13.5px; }
}

/* 横屏（高度很小）：两层 sticky 会占掉大半屏，取消总分条吸附 */
@media (max-width: 900px) and (max-height: 480px) {
  .total-box { position: static; }
}

/* 超窄机型（iPhone SE 一代等 ≤360px） */
@media (max-width: 360px) {
  .brand { font-size: 13px; }
  .cat-btn { font-size: 13.5px; padding: 13px 4px; }
  #trackPicker .track-btn { font-size: 14px; }
  .total-box .num { font-size: 24px; }
}
@media (max-width: 340px) {
  .total-box { grid-template-areas: "num bar bar" "name name name"; }
  .total-box > .hint:nth-child(4) { display: none; }
}
