/* 良师益友 · 深色信息大屏。颜色角色见 DESIGN.md */

:root {
  --bg: #090b0c;
  --band: #050607;
  --panel: #101315;
  --panel-2: #161a1d;
  --cell: #181c1f;
  --field: #0b0d0f;
  --line: #24292d;
  --line-2: #30363b;
  --text: #eef0f1;
  --text-2: #b3babf;
  --text-3: #868f95;
  --amber: #ffc53d;
  --amber-hover: #ffd266;
  --amber-ink: #1a1404;
  --amber-soft: rgba(255, 197, 61, 0.14);
  --green: #3dd68c;
  --red: #ff6b6b;
  --radius: 6px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei",
    "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
html.locked { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ol, ul, figure, blockquote, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a { color: inherit; }

.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-2);
}
.label::before { content: ""; width: 6px; height: 6px; background: var(--amber); border-radius: 1px; flex: none; }

.muted { color: var(--text-3); font-size: 14px; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font: 600 11px/18px var(--sans);
  vertical-align: 2px;
}

/* ---------- 按钮、表单 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { background: #1d2226; border-color: #3b4248; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn.primary:hover { background: var(--amber-hover); border-color: var(--amber-hover); }
.btn.danger { color: var(--red); border-color: rgba(255, 107, 107, 0.35); background: transparent; }
.btn.danger:hover { background: rgba(255, 107, 107, 0.1); }
.btn.block { width: 100%; min-height: 46px; font-size: 16px; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-underline-offset: 4px;
}
.text-btn:hover { color: var(--text); text-decoration-color: var(--text-3); }
.text-btn.center { align-self: center; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { font-weight: 400; color: var(--text-3); margin-left: 6px; }
.field input, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--field);
  font-size: 16px; /* 低于 16px iOS 会自动放大页面 */
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input::placeholder, .field textarea::placeholder { color: #5f686e; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.field.has-error input, .field.has-error textarea { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13px; min-height: 0; }
.field-error:empty { display: none; }
.field-meta { display: flex; justify-content: space-between; gap: 12px; }
.counter { margin-left: auto; font: 12px var(--mono); color: var(--text-3); }
.counter.over { color: var(--red); }
.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 107, 107, 0.08);
  color: #ffb3b3;
  font-size: 14px;
}

/* ---------- 顶部信息带 ---------- */

.band { position: relative; background: var(--band); border-bottom: 1px solid var(--line); }
.band::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--amber); }

.band-inner {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto minmax(200px, 1fr);
  align-items: center;
  gap: 20px 32px;
  padding: 26px 28px 22px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--amber);
  flex: none;
  /* 两条横线：信息屏的意思 */
  background-image: linear-gradient(var(--amber-ink), var(--amber-ink)), linear-gradient(var(--amber-ink), var(--amber-ink));
  background-size: 18px 3px, 12px 3px;
  background-position: 8px 11px, 8px 19px;
  background-repeat: no-repeat;
}
.brand-name { font-size: 22px; font-weight: 700; letter-spacing: 0.06em; line-height: 1.2; }
.brand-sub { font-size: 13px; color: var(--text-3); }

.clock { display: flex; align-items: center; gap: 22px; font-variant-numeric: tabular-nums; }
.clock-date, .clock-time { display: flex; align-items: center; gap: 4px; font-size: clamp(34px, 3.9vw, 62px); line-height: 1; }
.clock-date { color: var(--text); }
.clock-time { color: var(--amber); }

.cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.74em;
  height: 1.22em;
  border-radius: 5px;
  background: var(--cell);
  font-family: var(--mono);
  font-weight: 600;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}
.cell::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--band);
}
.cell.flip { animation: flip 0.32s cubic-bezier(0.3, 0.7, 0.3, 1); }
@keyframes flip {
  from { transform: perspective(240px) rotateX(-75deg); filter: brightness(0.55); }
  to { transform: none; filter: none; }
}

.unit { font-size: 0.4em; color: var(--text-2); margin: 0 0.25em 0 0.12em; align-self: flex-end; padding-bottom: 0.15em; }
.unit:last-child { margin-right: 0; }
.colon { width: 0.32em; text-align: center; font-family: var(--mono); font-size: 0.8em; opacity: 0.8; }

.clock-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.clock-week { font-size: clamp(16px, 1.5vw, 22px); font-weight: 600; white-space: nowrap; }
.clock-tz {
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.band-tools { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.stats { display: flex; gap: 24px; }
.stats div { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.stats dt { font-size: 12px; color: var(--text-3); }
.stats dd { font: 600 22px/1.2 var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- 主体：侧栏 + 留言墙 ---------- */

.layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); align-items: start; }

.side {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border-right: 1px solid var(--line);
  min-height: calc(100vh - 120px);
  scrollbar-width: thin;
}

.side-block { display: flex; flex-direction: column; gap: 12px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }

.group-tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.group-tabs button {
  max-width: 7em;
  padding: 3px 9px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.group-tabs button[aria-selected="true"] { border-color: var(--amber); color: var(--amber); }

.qr-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.qr-skeleton { height: 330px; border-radius: 4px; background: var(--panel-2); }
.qr-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.qr-name strong { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-state { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.18); }
.status-dot.warn { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18); }

.qr-figure { position: relative; padding: 10px; border-radius: 4px; background: #fff; }
.qr-img { width: 100%; max-height: 400px; object-fit: contain; margin: 0 auto; }
.qr-figure.expired .qr-img { opacity: 0.12; filter: grayscale(1); }
.qr-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #1b1f22;
  text-align: center;
}
.qr-overlay strong { font-size: 18px; }
.qr-overlay span { font-size: 14px; color: #4a5258; }

.qr-how { font-size: 14px; color: var(--text); text-align: center; }
.qr-expiry { font: 13px var(--mono); color: var(--text-3); text-align: center; }
.qr-expiry.soon { color: var(--amber); }
.qr-note { font-size: 13px; color: var(--text-2); padding-top: 10px; border-top: 1px dashed var(--line); }

.qr-empty { display: flex; flex-direction: column; gap: 6px; padding: 22px 4px; text-align: center; }
.qr-empty strong { font-size: 16px; }
.qr-empty p { font-size: 14px; color: var(--text-3); }
.qr-empty .contact { margin-top: 10px; text-align: left; }
.qr-empty .btn { align-self: center; margin-top: 8px; }

.contact { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 4px; background: var(--panel-2); }
.contact-label { font-size: 12px; color: var(--text-3); }
.contact-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.contact-id { font: 600 15px var(--mono); overflow-wrap: anywhere; }

.notice-text {
  padding: 12px 14px;
  border-left: 3px solid var(--amber);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.me-block { gap: 10px; }
.me-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
}
.me-card:hover { border-color: var(--line-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-motto { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.me-login { font-size: 14px; color: var(--text-3); text-align: center; }

.history { padding-top: 14px; border-top: 1px solid var(--line); }
.history summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.history summary::-webkit-details-marker { display: none; }
.history summary::after { content: "展开"; font-size: 12px; color: var(--text-3); }
.history[open] summary::after { content: "收起"; }
.history-count { margin-left: auto; margin-right: 10px; font: 12px var(--mono); color: var(--text-3); }
.history-list { display: flex; flex-direction: column; margin-top: 8px; }
.history-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
  color: var(--text-2);
}
.history-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list time { font: 12px var(--mono); color: var(--text-3); }
.badge { padding: 0 6px; border-radius: 3px; font-size: 12px; line-height: 20px; }
.badge.banned { background: rgba(255, 107, 107, 0.12); color: var(--red); }
.badge.full { background: rgba(255, 197, 61, 0.12); color: var(--amber); }

/* 留言墙 */

.wall { padding: 24px 28px 56px; min-width: 0; }
.wall-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.wall-tools { display: flex; align-items: center; gap: 10px; flex: none; }
.wall-title { font-size: 22px; font-weight: 700; line-height: 1.3; }
.wall-sub { font-size: 14px; color: var(--text-3); }

.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); flex: none; }
.segmented button {
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
}
.segmented button[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.tiles > li { display: flex; min-width: 0; }

.tile {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: 176px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.tile:hover { background: var(--panel-2); border-color: var(--line-2); }
.tile.mine { border-left: 3px solid var(--amber); padding-left: 14px; }
.tile.just { border-color: var(--amber); animation: settle 2.4s ease-out forwards; }
@keyframes settle { 70% { border-color: var(--amber); } to { border-color: var(--line); } }

.tile-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tile-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tile-name { font-size: 16px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-no { font: 12px var(--mono); color: var(--text-3); }
.tile-time { align-self: flex-start; font: 12px var(--mono); color: var(--text-3); white-space: nowrap; }
.tile-time.fresh { color: var(--amber); }
.tile-time.fresh::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--amber); vertical-align: 1px; }

.tile-motto {
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.tile-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--text-3);
}
.tile-comments { display: inline-flex; align-items: center; gap: 5px; }
.tile-comments.has { color: var(--text-2); }

.wall-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 64px 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  text-align: center;
}
.wall-state strong { font-size: 18px; }
.wall-state p { color: var(--text-3); }
.wall-state .btn { margin-top: 8px; }
.tiles[aria-busy="true"]::before {
  content: "留言墙加载中…";
  grid-column: 1 / -1;
  padding: 64px 0;
  text-align: center;
  color: var(--text-3);
}

.wall-foot { display: flex; justify-content: center; padding-top: 20px; }
.wall-foot:empty { display: none; }

/* 头像：微信那种圆角方形 */
.avatar { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; flex: none; background: var(--cell); }
.avatar-initial { display: grid; place-items: center; font-size: 20px; font-weight: 600; color: rgba(255, 255, 255, 0.9); }
.avatar-lg { width: 88px; height: 88px; border-radius: 10px; font-size: 36px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 5px; font-size: 14px; }

/* ---------- 弹层 ---------- */

dialog.sheet {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 32px 20px;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.sheet[open] { display: flex; }
dialog.sheet::backdrop { background: rgba(3, 4, 5, 0.8); }

.sheet-panel {
  position: relative;
  margin: auto;
  width: min(680px, 100%);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.panel-close { position: absolute; top: 10px; right: 10px; }

.card-panel { padding: 28px 28px 24px; }
.card-head { display: flex; align-items: center; gap: 18px; padding-right: 40px; }
.card-who { min-width: 0; }
.card-name { font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { font: 13px var(--mono); color: var(--text-3); margin-top: 4px; }
.card-motto {
  margin-top: 22px;
  padding: 18px 20px;
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel-2);
  font-size: 20px;
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.card-updated { margin-top: 8px; font: 12px var(--mono); color: var(--text-3); }
.card-owner { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.card-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 56px 16px; text-align: center; }
.card-state strong { font-size: 18px; }
.card-state p { color: var(--text-3); }

.comments { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.comment-list { display: flex; flex-direction: column; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.comment:first-child { padding-top: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; }
.comment-head strong { font-size: 14px; }
.comment-head .tag { margin-left: 0; }
.comment-head time { font: 12px var(--mono); color: var(--text-3); }
.comment-text { margin-top: 2px; font-size: 15px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.comments-empty { padding: 4px 0; }

.comment-form { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); background: var(--panel-2); }
.comment-form .field input, .comment-form .field textarea { background: var(--field); }
.comment-as { font-size: 13px; color: var(--text-3); }
.comment-as strong { color: var(--text); }
.comment-actions { display: flex; justify-content: flex-end; }

.form-panel { display: flex; flex-direction: column; }
.form-panel.narrow { width: min(440px, 100%); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px 24px; }
.panel-head h2 { font-size: 20px; }
.form-body { display: flex; flex-direction: column; gap: 18px; padding: 12px 24px 8px; }
.panel-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 20px;
}
.spacer { flex: 1; }

.avatar-field { gap: 4px; }
.avatar-pick {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.avatar-pick:hover { border-color: var(--text-3); }
.avatar-field:focus-within .avatar-pick { border-color: var(--amber); }
.avatar-preview {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: var(--field);
  overflow: hidden;
  flex: none;
  color: var(--text-3);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-pick-text { display: flex; flex-direction: column; gap: 2px; }
.avatar-pick-text strong { font-size: 15px; }
.avatar-pick-text small { font-size: 13px; color: var(--text-3); line-height: 1.5; }
.avatar-field .text-btn { align-self: flex-start; }

.key-box {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
}
.key-box legend { padding: 0 6px; font-size: 14px; font-weight: 600; color: var(--amber); }
.key-help { font-size: 13px; line-height: 1.7; color: var(--text-2); }
.key-help strong { color: var(--text); }
.key-box .field input { background: var(--field); }

/* 手机底部的「我要留言」 */
.fab { display: none; }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #1d2125;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast[data-kind="error"] { border-color: rgba(255, 107, 107, 0.5); color: #ffc2c2; }

/* ---------- 响应式 ---------- */

@media (max-width: 1240px) {
  .band-inner { grid-template-columns: 1fr auto; }
  .clock { grid-column: 1 / -1; grid-row: 2; }
  .clock-date, .clock-time { font-size: clamp(34px, 5.4vw, 58px); }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .qr-panel { max-width: 460px; width: 100%; align-self: center; }
  .side > .side-block { max-width: 460px; width: 100%; align-self: center; }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  .band-inner { grid-template-columns: 1fr; gap: 14px; padding: 18px 16px 16px; }
  .brand-name { font-size: 19px; }
  .brand-mark { width: 30px; height: 30px; background-position: 6px 9px, 6px 17px; background-size: 17px 3px, 11px 3px; }
  .band-tools { justify-content: space-between; grid-row: 3; }
  .stats { gap: 0; width: 100%; justify-content: space-between; }
  .stats div { flex-direction: row-reverse; align-items: baseline; gap: 6px; }
  .stats dd { font-size: 17px; }
  #fullscreen { display: none; }

  .clock {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "date date" "time side";
    justify-items: start;
    gap: 10px 14px;
  }
  .clock-date { grid-area: date; font-size: min(9.2vw, 40px); }
  .clock-time { grid-area: time; font-size: min(9.2vw, 40px); }
  .clock-side { grid-area: side; }
  .cell { border-radius: 4px; }

  .side { padding: 16px; gap: 16px; }
  .qr-img { max-height: 320px; } /* 手机上留出「长按识别」那一行 */

  .wall { padding: 20px 16px 32px; }
  .wall-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .wall-tools { justify-content: space-between; }
  #wall-cta, .wall-state.empty .btn { display: none; } /* 手机用底部按钮 */
  .tiles { grid-template-columns: 1fr; gap: 10px; }
  .tile { min-height: 0; }

  .fab {
    display: flex;
    position: fixed;
    z-index: 20;
    left: 16px;
    right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    min-height: 50px;
    font-size: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  }

  dialog.sheet { padding: 0; }
  .sheet-panel, .form-panel.narrow { width: 100%; min-height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .card-panel { padding: 22px 16px 28px; }
  .card-head { gap: 14px; }
  .avatar-lg { width: 72px; height: 72px; font-size: 30px; }
  .card-name { font-size: 21px; }
  .card-motto { font-size: 18px; padding: 14px 16px; }
  .panel-head { padding: 14px 8px 4px 16px; }
  .form-body { padding: 10px 16px 8px; }
  .panel-foot { padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
  .panel-foot .text-btn { width: 100%; justify-content: center; order: 3; }
  .panel-foot .spacer { display: none; }
  .panel-foot .btn { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .cell.flip, .tile.just { animation: none; }
  .btn, .tile, #toast { transition: none; }
}
