/* Mathmiu 谜题中心 —— 管理台。与访客端同一套视觉语言。 */
:root {
  --brand: #ea6a31;
  --accent: #5b2ca3;
  --page: #faf9f7;
  --panel: #ffffff;
  --ink: #2b2b2e;
  --muted: #7a7d85;
  --line: rgba(43, 43, 46, 0.12);
  --ok: #1e7a4a;
  --warn: #9a6100;
  --danger: #b3261e;
  --radius: 20px;
  /* cdn.1top1.app 只提供 .ttf 且不带 CORS 头，跨域永远加载不了，
     引它只会刷控制台报错。装了思源圆体的机器走本地字体，其余走系统字体。 */
  --font: "Resource Han Rounded CN", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* 缩放下限：窄到 320px 以下就横向滚动，不再继续压缩版面 */
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

/* —— 控件 —— */
/* .linkbtn 是长得像按钮的 <a>：要保留新标签页打开、中键、复制链接这些链接能力。 */
button,
.linkbtn {
  font: inherit;
  padding: 9px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.linkbtn {
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
}

button:hover:not(:disabled),
.linkbtn:hover {
  border-color: rgba(43, 43, 46, 0.34);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  background: #4d2489;
  border-color: #4d2489;
}

button.danger {
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.35);
}

button.danger:hover:not(:disabled) {
  background: rgba(179, 38, 30, 0.06);
  border-color: var(--danger);
}

input,
select,
textarea {
  font: inherit;
  width: 100%;
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
}

input[type="file"] {
  padding: 7px 10px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 44, 163, 0.12);
}

textarea {
  resize: vertical;
  min-height: 88px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--muted);
}

.field {
  margin-bottom: 16px;
}

.field__hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.form-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: #fdecea;
  color: var(--danger);
  font-size: 13px;
}

/* —— 品牌 —— */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand__logo {
  width: auto;
  height: 44px;
}

.brand__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

/* —— 登录页 —— */
.login-page {
  display: flex;
  min-height: 100vh;
  padding: 24px;
  background: #fff;
}

/* auto 外边距在空间不足时归零，比 align-items:center 更稳：
   高倍缩放下内容超出视口也不会被截掉顶部。 */
.login {
  width: 100%;
  max-width: 380px;
  margin: auto;
  text-align: center;
}

.login .brand {
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
}

.login .brand__logo {
  height: 76px;
}

.login label {
  text-align: left;
}

.login button {
  width: 100%;
  margin-top: 16px;
}

/* —— 顶栏 —— */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar__spacer {
  flex: 1;
}

.preview-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 11px 32px;
  background: #fff4d6;
  border-bottom: 1px solid #ecd9a0;
  color: var(--warn);
}

/* 顶栏里的品牌和按钮宁可换行，也不要被挤成一列竖排文字 */
.topbar .brand,
.topbar button,
.preview-banner button {
  flex: none;
  white-space: nowrap;
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* —— 面板 —— */
.panel {
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel > h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.panel h3 {
  margin: 22px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.panel__note {
  margin: 0 0 18px;
  font-size: 12px;
  color: var(--muted);
}

.panel__note[data-tone="live"] {
  color: var(--ok);
}

.panel__note[data-tone="staged"] {
  color: var(--warn);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* 列表最后一列的操作按钮：宁可把表格撑宽，也不要折成竖排文字 */
.row--actions {
  flex-wrap: nowrap;
}

.row--actions button {
  white-space: nowrap;
}

/* —— 列表 —— */
/* 十列的表格挤不进窄屏，给它一个最小宽度并在容器里横向滚动 */
.table-scroll {
  overflow-x: auto;
  margin: 0 -24px;
  padding: 0 24px;
}

table {
  width: 100%;
  /* 十列 + 三个操作按钮，挤到 1000 以下表头就会折行，交给容器横向滚动 */
  min-width: 1000px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

tbody tr:last-child td {
  border-bottom: none;
}

.thumb-cell {
  width: 52px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #f2f0ec;
  display: block;
}

.thumb-cell--empty {
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.badge[data-status="draft"] {
  background: #eeedea;
  color: var(--muted);
}

.badge[data-status="published"] {
  background: #e3f3ea;
  color: var(--ok);
}

.badge[data-status="unpublished"] {
  background: #fdecea;
  color: var(--danger);
}

.badge--staged {
  background: #fff4d6;
  color: var(--warn);
  margin-left: 6px;
}

.domain-chip {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 999px;
  background: var(--domain-color, #eee);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* —— 发布条件清单 —— */
.checks {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.checks li {
  display: flex;
  gap: 9px;
  padding: 5px 0;
  font-size: 14px;
}

.checks li[data-ok="false"] {
  color: var(--danger);
}

.checks li[data-ok="true"] {
  color: var(--muted);
}

/* —— 详情 —— */
.thumb-preview {
  width: 240px;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #f2f0ec;
}

.detail-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 760px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .topbar,
  .preview-banner,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.history {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.history li .grow {
  flex: 1;
}

.warnings {
  margin: 12px 0 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fff4d6;
  color: var(--warn);
  font-size: 13px;
}

.warnings ul {
  margin: 5px 0 0;
  padding-left: 18px;
}

/* —— 对话框 —— */
dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(20, 20, 24, 0.35);
}

dialog h2 {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

progress {
  width: 100%;
  height: 6px;
  margin-top: 6px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: 999px;
  background: #2b2b2e;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  z-index: 10;
}

.toast[data-tone="error"] {
  background: var(--danger);
}

[hidden] {
  display: none !important;
}
