/* ============================================================================
   点数系统 / 后台入口 / 新增工具 / 后台管理
   延续 site.css 的 Liquid Glass 与系统色，在其之后引入。
   ========================================================================= */

/* ============================================================ 顶栏点数 */

.points-hud {
  display: inline-flex;
  min-height: 34px;
  padding: 0 11px;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  background: var(--fill-1);
  color: var(--label);
  font-size: 13px;
  font-weight: 590;
  white-space: nowrap;
  transition: background .2s var(--ease), transform .2s var(--ease);
}

.points-hud:hover { background: var(--fill-2); }
.points-hud:active { transform: scale(.95); }
.points-hud .points-value { font-size: 14.5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.points-hud .points-label { color: var(--label-2); font-size: 11.5px; }

.points-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent);
}

.points-dot.offline { background: var(--label-3); box-shadow: none; }

.points-cta {
  margin-left: 1px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 620;
}

/* ============================================================ 徽标与公告 */

.cost-badge {
  display: inline-flex;
  padding: 2px 9px;
  align-items: center;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: var(--orange);
  font-size: 11.5px;
  font-weight: 620;
  letter-spacing: 0;
}

.cost-badge.is-free { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }

.notice-bar {
  display: flex;
  margin: 0 0 6px;
  padding: 13px 16px;
  align-items: center;
  gap: 9px;
  border-radius: var(--r-md);
  background: var(--fill-3);
  color: var(--label-2);
  font-size: 13.5px;
  line-height: 1.45;
}

.notice-bar::before { flex: none; color: var(--blue); content: "ⓘ"; font-size: 14px; }

/* ============================================================ 签到卡（首页顶部 widget） */

/* 签到卡：一行搞定，不抢首页的位置 */
.checkin-widget {
  display: flex;
  margin-bottom: 6px;
  padding: 10px 12px;
  align-items: center;
  gap: 12px;
  border-radius: var(--r-lg);
  color: var(--label);
}

.checkin-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, var(--green), var(--teal));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 1px 3px rgba(0, 0, 0, .14);
  color: #fff;
  font-size: 19px;
}

.checkin-copy { display: grid; min-width: 0; flex: 1; gap: 1px; }
.checkin-copy strong { font-size: 15.5px; font-weight: 600; letter-spacing: -.018em; }

.checkin-copy small {
  overflow: hidden;
  color: var(--label-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkin-widget .tool-btn { min-height: 36px; flex: none; padding: 0 15px; font-size: 14.5px; }

/* ============================================================ 投稿入口 & 自定义按钮 */

.entry-list {
  display: grid;
  padding: 5px;
  gap: 2px;
  border-radius: var(--r-lg);
}

/* 后台注入的入口用透明包裹层，保持和静态行同一层网格 */
[data-submit-entry],
[data-custom-buttons] { display: contents; }

.submit-entry,
.custom-button {
  position: relative;
  display: flex;
  min-height: 60px;
  padding: 11px 12px;
  align-items: center;
  gap: 13px;
  border-radius: var(--r-md);
  color: var(--label);
  transition: background .18s var(--ease), transform .18s var(--ease);
}

.submit-entry:hover,
.custom-button:hover { background: var(--fill-3); }
.submit-entry:active,
.custom-button:active { background: var(--fill-1); transform: scale(.988); }

.submit-icon,
.custom-icon {
  display: grid;
  width: 40px;
  height: 40px;
  flex: none;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(160deg, var(--indigo), var(--purple));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 1px 3px rgba(0, 0, 0, .14);
  color: #fff;
  font-size: 17px;
}

.custom-icon { background: linear-gradient(160deg, var(--yellow), var(--orange)); }

.submit-copy,
.custom-copy { display: grid; min-width: 0; gap: 1px; }

.submit-copy strong,
.custom-copy strong { font-size: 16px; font-weight: 570; letter-spacing: -.015em; }

.submit-copy small,
.custom-copy small {
  overflow: hidden;
  color: var(--label-2);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.submit-arrow,
.custom-arrow { margin-left: auto; color: var(--label-3); font-size: 19px; font-weight: 600; }

.custom-grid { display: grid; padding: 5px; gap: 2px; border-radius: var(--r-lg); }

/* ============================================================ 字符画 */

.ascii-output { font-variant-east-asian: full-width; tab-size: 2; }
.ascii-output[data-style="block"] { font-size: 13px; line-height: 1.1; }

.ascii-variants { display: grid; margin-top: 14px; gap: 10px; }

.ascii-variant {
  position: relative;
  border-radius: var(--r-md);
  background: #0b0d10;
}

.ascii-variant pre {
  margin: 0;
  padding: 32px 56px 16px 18px;
  overflow-x: auto;
  color: #7ff0c8;
  font-family: "Noto Sans Mono CJK SC", "Sarasa Mono SC", "SF Mono", "SimSun", Consolas, monospace;
  font-size: 13px;
  line-height: 1.14;
  white-space: pre;
}

.ascii-variant .variant-no {
  position: absolute;
  top: 11px;
  left: 18px;
  color: rgba(127, 240, 200, .45);
  font-size: 11.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.ascii-variant .copy-btn {
  position: absolute;
  top: 9px;
  right: 10px;
  background: rgba(255, 255, 255, .1);
  color: #7ff0c8;
}

.ascii-variant .copy-btn:hover { background: rgba(255, 255, 255, .18); }

/* ============================================================ 特殊 ID */

.id-result-grid {
  display: grid;
  margin-top: 14px;
  padding: 5px;
  gap: 2px;
  border-radius: var(--r-lg);
  background: var(--fill-3);
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
}

.id-card {
  display: flex;
  min-height: 58px;
  padding: 10px 12px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .16s var(--ease), transform .16s var(--ease);
}

.id-card:hover { background: var(--fill-1); }
.id-card:active { transform: scale(.975); }

.id-card .id-value { min-width: 0; flex: 1; color: var(--label); font-size: 15.5px; line-height: 1.35; word-break: break-all; }
.id-card .id-value.is-blank { color: var(--label-3); font-style: italic; }
.id-card .id-copy { flex: none; color: var(--label-3); font-size: 15px; }

.id-card .id-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--label-2);
  font-size: 11.5px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.id-empty { grid-column: 1 / -1; padding: 30px; color: var(--label-2); font-size: 13.5px; text-align: center; }

/* ============================================================ 手机清灰 */

.dust-stage {
  position: relative;
  display: grid;
  min-height: 292px;
  overflow: hidden;
  padding: 26px;
  place-items: center;
  border-radius: var(--r-lg);
  background:
    radial-gradient(closest-side, color-mix(in srgb, var(--blue) 16%, transparent), transparent 72%),
    var(--fill-3);
}

.dust-ring {
  position: absolute;
  width: 168px;
  height: 168px;
  border: 2px solid color-mix(in srgb, var(--blue) 40%, transparent);
  border-radius: 50%;
  opacity: 0;
}

.dust-stage.running .dust-ring { animation: dust-wave 2.2s ease-out infinite; }
.dust-stage.running .dust-ring:nth-of-type(2) { animation-delay: .55s; }
.dust-stage.running .dust-ring:nth-of-type(3) { animation-delay: 1.1s; }
.dust-stage.running .dust-ring:nth-of-type(4) { animation-delay: 1.65s; }

@keyframes dust-wave {
  0% { opacity: .8; transform: scale(.32); }
  100% { opacity: 0; transform: scale(2.05); }
}

.dust-readout { position: relative; display: grid; gap: 5px; place-items: center; text-align: center; }

.dust-freq {
  font-size: clamp(40px, 10vw, 58px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  line-height: 1;
}

.dust-freq small { margin-left: 5px; color: var(--label-2); font-size: 16px; font-weight: 560; letter-spacing: -.01em; }
.dust-phase { color: var(--label-2); font-size: 14px; }

.dust-progress {
  position: relative;
  width: min(400px, 72vw);
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--fill-2);
}

.dust-progress i {
  position: absolute;
  inset: 0 100% 0 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--teal), var(--blue));
  transition: inset .18s linear;
}

.dust-canvas {
  display: block;
  width: 100%;
  height: 88px;
  margin-top: 12px;
  border-radius: var(--r-md);
  background: #0b0d10;
}

/* ============================================================ 手持弹幕 */

.danmaku-preview {
  display: grid;
  height: 136px;
  overflow: hidden;
  align-items: center;
  border-radius: var(--r-md);
  background: #000;
}

.danmaku-preview span { padding: 0 18px; font-size: 44px; font-weight: 900; white-space: nowrap; }

.danmaku-stage {
  position: fixed;
  z-index: 9999;
  display: none;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.danmaku-stage.show { display: block; }

.danmaku-rotor {
  position: absolute;
  top: 50%;
  left: 50%;
  overflow: hidden;
  white-space: nowrap;
  /* JS 用 translate(-50%,-50%) rotate(90deg)，必须绕自身中心转 */
  transform-origin: center center;
}

.danmaku-text {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  will-change: transform;
}

.danmaku-exit {
  position: fixed;
  z-index: 10001;
  top: 16px;
  right: 16px;
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.danmaku-exit.show { display: flex; }
.danmaku-exit:hover { background: rgba(255, 255, 255, .28); }

.danmaku-hint {
  position: fixed;
  z-index: 10000;
  bottom: 18px;
  left: 50%;
  display: none;
  padding: 9px 17px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .82);
  font-size: 12.5px;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.danmaku-hint.show { display: block; animation: fade-away 4s ease forwards; }

@keyframes fade-away {
  0%, 55% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================================ 签到 / 邀请 */

.point-hero {
  display: grid;
  padding: 5px;
  gap: 2px;
  border-radius: var(--r-lg);
  background: var(--fill-3);
  grid-template-columns: repeat(4, 1fr);
}

.point-tile {
  display: grid;
  padding: 16px 12px;
  place-items: center;
  gap: 2px;
  border-radius: var(--r-md);
  text-align: center;
}

.point-tile strong { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.point-tile span { color: var(--label-2); font-size: 12px; }

.signin-days { display: flex; margin-top: 14px; flex-wrap: wrap; gap: 7px; }

.signin-day {
  display: grid;
  width: 54px;
  height: 60px;
  place-content: center;
  gap: 2px;
  border-radius: var(--r-sm);
  background: var(--fill-1);
  text-align: center;
}

.signin-day.done {
  background: linear-gradient(160deg, var(--green), var(--teal));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
  color: #fff;
}

.signin-day b { font-size: 15px; font-weight: 640; }
.signin-day small { font-size: 10.5px; opacity: .78; }

.invite-box {
  display: flex;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--fill-3);
}

.invite-code {
  padding: 3px 12px;
  border-radius: var(--r-sm);
  background: var(--elevated);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
}

.ledger-list { display: grid; padding: 5px; gap: 2px; border-radius: var(--r-md); background: var(--fill-3); }

.ledger-row {
  display: flex;
  padding: 11px 12px;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
}

.ledger-row > span:first-child { font-weight: 560; }
.ledger-row time { color: var(--label-3); font-size: 11.5px; }
.ledger-row .ledger-delta { margin-left: auto; font-weight: 680; font-variant-numeric: tabular-nums; }
.ledger-row .ledger-delta.plus { color: var(--green); }
.ledger-row .ledger-delta.minus { color: var(--red); }

/* ============================================================ 一键签到落地页 */

.quick-stage {
  display: grid;
  min-height: 100dvh;
  padding: var(--gutter);
  place-items: center;
}

.quick-card {
  width: min(380px, 100%);
  padding: 32px 26px 26px;
  border-radius: var(--r-xl);
  text-align: center;
}

.quick-mark {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 19px;
  background: linear-gradient(160deg, var(--green), var(--teal));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 8px 22px -10px color-mix(in srgb, var(--green) 90%, transparent);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}

.quick-card[data-state="loading"] .quick-mark { background: var(--fill-2); box-shadow: none; }
.quick-card[data-state="done"] .quick-mark { background: linear-gradient(160deg, var(--blue), var(--indigo)); }
.quick-card[data-state="error"] .quick-mark { background: linear-gradient(160deg, var(--orange), var(--red)); }
.quick-card[data-state="offline"] .quick-mark { background: var(--fill-2); box-shadow: none; color: var(--label-2); }

.quick-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--label-3);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.quick-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.quick-sub { margin: 7px 0 0; color: var(--label-2); font-size: 14.5px; line-height: 1.45; }

.quick-amount {
  margin: 18px 0 4px;
  color: var(--green);
  font-size: 46px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  line-height: 1;
}

.quick-amount small { margin-left: 4px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }

.quick-rows {
  display: grid;
  margin-top: 20px;
  padding: 4px;
  gap: 2px;
  border-radius: var(--r-md);
  background: var(--fill-3);
}

.quick-row {
  display: flex;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--r-sm);
  font-size: 14px;
}

.quick-row span { color: var(--label-2); }
.quick-row b { font-weight: 620; font-variant-numeric: tabular-nums; }

.quick-actions { justify-content: center; }
.quick-actions .tool-btn { flex: 1; min-width: 96px; }
.quick-hint { margin: 12px 0 0; color: var(--label-3); font-size: 12.5px; }

/* ============================================================ 快捷链接生成 */

.link-preview {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--r-sm);
  background: var(--fill-3);
  color: var(--label-2);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  white-space: nowrap;
}

/* ============================================================ 荣誉墙 */

.wall-stage {
  position: relative;
  display: grid;
  margin-top: 16px;
  padding: 12px;
  place-items: center;
  border-radius: var(--r-lg);
  background: var(--fill-3);
}

.wall-preview {
  display: block;
  width: 100%;
  max-width: 640px;
  height: auto;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

/* 素材是透明底的，用棋盘格提示一下 */
.wall-stage[data-bg="checker"] .wall-preview {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%),
    linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%);
  background-position: 0 0, 8px 8px;
  background-size: 16px 16px;
}

.wall-loading {
  padding: 40px 0;
  color: var(--label-2);
  font-size: 13.5px;
}

/* ============================================================ 紧急回避 */

.panic-btn {
  display: inline-flex;
  min-height: 40px;
  padding: 0 18px;
  flex: none;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--red);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 4px 14px -4px color-mix(in srgb, var(--red) 70%, transparent);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 680;
  letter-spacing: -.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s var(--ease), background .16s var(--ease);
}

.panic-btn:hover { background: color-mix(in srgb, var(--red) 86%, #000); }
.panic-btn:active { transform: scale(.95); }
.panic-icon { font-size: 13px; opacity: .85; }

.panic-hint {
  display: flex;
  margin-bottom: 16px;
  padding: 12px 16px;
  align-items: center;
  gap: 9px;
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--red) 10%, transparent);
  color: var(--label-2);
  font-size: 13px;
  line-height: 1.5;
}

.panic-hint b { color: var(--red); }

/* 回避中的状态横幅 */
.panic-banner {
  display: flex;
  margin-bottom: 16px;
  padding: 16px 18px;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--red) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent);
}

.panic-banner-icon { font-size: 24px; }
.panic-banner-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.panic-banner-copy strong { color: var(--red); font-size: 16px; font-weight: 700; }
.panic-banner-copy small { color: var(--label-2); font-size: 13px; line-height: 1.45; }
.panic-banner .tool-btn { flex: none; }

@media (max-width: 680px) {
  .panic-btn { min-height: 36px; padding: 0 13px; font-size: 14px; }
  .panic-text { display: none; }
  .panic-icon { font-size: 15px; opacity: 1; }
  .panic-btn::after { content: "回避"; }
}

/* ============================================================ 后台管理 */

.admin-login { display: grid; max-width: 380px; margin: 90px auto; padding: 24px; gap: 14px; }

.admin-stats {
  display: grid;
  margin-bottom: 18px;
  padding: 5px;
  gap: 2px;
  border-radius: var(--r-lg);
  background: var(--fill-3);
  grid-template-columns: repeat(6, 1fr);
}

.admin-tabs { margin-bottom: 16px; }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.admin-table th,
.admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--separator); text-align: left; vertical-align: middle; }

.admin-table tr:last-child td { border-bottom: 0; }
.admin-table th { color: var(--label-2); font-size: 12px; font-weight: 600; }
.admin-table td.num { font-variant-numeric: tabular-nums; }
.admin-table .input { min-height: 36px; padding: 0 10px; font-size: 14px; }
.admin-table code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
.admin-table-wrap { overflow-x: auto; margin-top: 8px; }

.tool-group-block { margin-bottom: 18px; }

.tool-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-group-head .input { max-width: 190px; font-weight: 600; }

.tool-move { display: flex; gap: 4px; }
.tool-move .tool-btn { min-height: 30px; padding: 0 9px; font-size: 13px; }

.admin-row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-row-actions .tool-btn { min-height: 32px; padding: 0 11px; font-size: 13px; }

.switch-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--label-2); font-size: 12.5px; }
.switch-cell input { accent-color: var(--green); width: 17px; height: 17px; }

.template-editor { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }

.template-card {
  display: grid;
  padding: 16px;
  gap: 9px;
  border-radius: var(--r-md);
  background: var(--fill-3);
}

.template-card h4 { display: flex; margin: 0; align-items: baseline; gap: 8px; font-size: 14.5px; font-weight: 620; }
.template-card .textarea { min-height: 168px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 13px; }
.template-count { color: var(--label-3); font-size: 12px; font-weight: 480; }

.admin-save-bar {
  position: sticky;
  z-index: 20;
  bottom: 14px;
  display: flex;
  margin-top: 18px;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background-color: var(--glass-fill-thick);
}

/* ============================================================ 响应式 */

@media (max-width: 900px) {
  .admin-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .points-hud { padding: 0 9px; }
  .points-hud .points-label { display: none; }
  .id-result-grid { grid-template-columns: 1fr; }
  .point-hero { grid-template-columns: repeat(2, 1fr); }
  .danmaku-preview span { font-size: 32px; }
  .checkin-widget { padding: 9px 10px; gap: 10px; }
  .checkin-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 17px; }
  .checkin-copy strong { font-size: 14.5px; }
  .checkin-copy small { font-size: 11.5px; }
  .checkin-widget .tool-btn { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
}
