/* 文字竞价页（/auction-text）
 *
 * 布局：顶栏（与其它页一致）→ 工具条 → 2×2 四格（每格一只股票、自带列头）→ 文字描述框。
 * 设计要点：
 *  - 每格是一张独立小表，列宽用 --at-c1..--at-c6 单点定义，四格共一份，改一处全对齐；
 *  - 四格不吸顶（页面本身不长，且每格自带列头）；
 *  - 手机端 2×2 变 1 列（四格纵向排），列宽按容器比例压缩。
 */

/* 工具条：标题 / 时钟 / 相位 / 搜索 / 设置 排一行；窄屏才换行 */
.auc-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.at-title { flex: 0 0 auto; }

.at-pick { min-width: 96px; max-width: 140px; }

.at-title { font-size: 16px; margin: 0; }
.at-clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }

.at-pill {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  color: var(--fg-soft);
  white-space: nowrap;
}
.at-pill[data-phase="live"] { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.at-pill[data-phase="final"] { background: color-mix(in srgb, var(--warm, #d48806) 16%, transparent); color: var(--warm, #d48806); }
.at-pill[data-phase="delayed"] { background: color-mix(in srgb, var(--warm, #d48806) 14%, transparent); color: var(--warm, #d48806); }

.at-search {
  margin-left: auto;
  min-width: 180px;
  max-width: 260px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
.at-search:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: -1px; }

.at-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.at-btn:hover { filter: brightness(1.06); }
.at-btn-ghost { background: transparent; color: var(--accent); }

/* ── 四格 ───────────────────────────────────────────────────────────── */
.at-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.at-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}

.at-cell-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--fg) 3%, transparent);
}
.at-pick {
  height: 28px;
  max-width: 128px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 13px;
}
.at-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-code { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.at-state { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* 列宽单一来源（四格共用），改这里就全对齐 */
.at-cell { --at-c1: 78px; --at-c2: 70px; --at-c3: 64px; --at-c4: 68px; --at-c5: 66px; --at-c6: 70px; }
.at-row, .at-head-row {
  display: grid;
  grid-template-columns: var(--at-c1) var(--at-c2) var(--at-c3) var(--at-c4) var(--at-c5) var(--at-c6);
  align-items: center;
  height: 30px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.at-head-row {
  height: 26px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--fg) 2%, transparent);
}
.at-head-row span, .at-row span { padding: 0 4px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.at-head-row span:first-child, .at-row span:first-child { text-align: left; }

.at-rows { display: flex; flex-direction: column; }
.at-row + .at-row { border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.at-row.is-latest { background: var(--auction-latest, #e8f2ff); }
.at-row.is-delta  { background: var(--auction-delta, #e2e8f0); }
.at-row.is-final  { background: var(--auction-final, #fffbe6); box-shadow: inset 3px 0 0 #d48806; }

/* 红闪：沿用竞价页的观感，只动 box-shadow，不动布局 */
@keyframes at-flash {
  0%   { box-shadow: inset 0 0 0 2px rgba(229, 57, 53, 0); }
  15%  { box-shadow: inset 0 0 0 2px rgba(229, 57, 53, .95); }
  75%  { box-shadow: inset 0 0 0 2px rgba(229, 57, 53, .35); }
  100% { box-shadow: inset 0 0 0 2px rgba(229, 57, 53, 0); }
}
.at-cell.flash .at-rows { animation: at-flash 1s ease-out; }

.up { color: var(--up); }
.down { color: var(--down); }

/* ── 文字描述 ───────────────────────────────────────────────────────── */
.at-log {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}
.at-log-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--fg) 3%, transparent);
}
.at-log-sub { color: var(--muted); font-size: 12px; margin-left: auto; }
.at-log-list {
  list-style: none;
  margin: 0;
  padding: 6px 10px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.at-log-list li { display: flex; gap: 8px; }
.at-log-list li .t { color: var(--muted); flex: 0 0 auto; }
.at-log-list li .c { color: var(--fg-soft); flex: 0 0 auto; }
.at-log-list li .m { flex: 1 1 auto; min-width: 0; }
/* 回放提示行：不属于任何一条行情，弱化成一行小字，别和真实记录混在一起 */
.at-log-list li.note .m { color: var(--muted); font-size: 12px; font-style: italic; }
.at-log-empty { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 13px; }

/* ── 设置浮层 ───────────────────────────────────────────────────────── */
.at-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .45);
}
.at-modal[hidden] { display: none; }
.at-modal-box {
  width: min(680px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.at-modal-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.at-x { margin-left: auto; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.at-modal-body { padding: 8px 14px 14px; overflow-y: auto; }
.at-modal-body h3 { font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
.at-radio, .at-check { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 0; }
.at-num { width: 56px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-size: 13px; padding: 0 6px; }
.at-pick-list {
  margin-top: 8px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2px 8px;
  font-size: 13px;
}
.at-pick-list label { display: flex; align-items: center; gap: 6px; }
.at-hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.at-modal-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.at-modal-foot .at-btn { margin-left: auto; }

@media (max-width: 767px) {
  .at-grid { grid-template-columns: minmax(0, 1fr); }
  .at-search { min-width: 0; flex: 1 1 auto; }
  .at-log-list { max-height: 220px; }
}
