/* ============================================================
   圣诞留言树 · 样式
   色板取自平安夜：午夜蓝、松针绿、烛光金、莓果红、初雪白
   ============================================================ */

:root {
  --night-hi: #1d3a66;
  --night: #0f2346;
  --night-lo: #081630;
  --pine: #2f7d5b;
  --candle: #f4c26b;
  --candle-deep: #e3a541;
  --berry: #c8323c;
  --snow: #f4f1ea;
  --frost: #a9c6dd;
  --ink: #22304a;
  --paper: #f7f3ea;
  --paper-line: #ddd3c1;
  --intro-paper: #fbfbfa;
  --intro-ink: #1f2531;

  --font-card: 'LXGW WenKai Screen', 'Kaiti SC', 'STKaiti', 'KaiTi', serif;
  --font-script: 'Great Vibes', 'Snell Roundhand', cursive;
  --font-sign: 'Long Cang', 'Xingkai SC', 'STXingkai', 'KaiTi', cursive;
  --font-ui: system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;

  --tag-w: clamp(124px, 31vw, 186px);
  --ease-out: cubic-bezier(.2, .9, .25, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: radial-gradient(120% 85% at 50% 0%, var(--night-hi) 0%, var(--night) 46%, var(--night-lo) 100%) fixed;
  background-color: var(--night);
  color: var(--snow);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .swatch:has(input:focus-visible) {
  outline: 2px solid var(--candle);
  outline-offset: 3px;
}
svg { display: block; }
[hidden] { display: none !important; }

.sky, .rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.sky { z-index: 0; }

/* 开场阶段是白纸底，避免脚本加载前闪一下夜色 */
body.is-intro { background: var(--intro-paper); }

/* ---------------- 1. 开场：代码雨 + 签名 ---------------- */

/* 代码雨画布：开场时是白纸底，穿梭时由画布自己把底色画成夜色 */
.rain { z-index: 25; background: var(--intro-paper); }

.intro {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
  /* 签名后面留一片干净的纸面，代码雨从四周落下 */
  background: radial-gradient(ellipse 62% 30% at 50% 46%, rgba(251, 251, 250, .96) 0%, rgba(251, 251, 250, .82) 48%, rgba(251, 251, 250, 0) 100%);
}

.sig { position: relative; transform: translateY(-4vh); }

.sig-en, .sig-zh { margin: 0; line-height: 1.25; white-space: nowrap; }

.sig-en {
  font-family: var(--font-script);
  font-size: clamp(38px, 9.4vw, 92px);
  color: var(--intro-ink);
}

.sig-zh {
  margin-top: .35em;
  font-family: var(--font-sign);
  font-size: clamp(22px, 5.6vw, 54px);
  color: #3a404c;
  letter-spacing: .04em;
}

/* 英文模式：第二行是一整句英文，用花体并允许按单词换行 */
html[lang='en'] .sig-zh {
  font-family: var(--font-script);
  font-size: clamp(26px, 5.4vw, 50px);
  letter-spacing: 0;
  line-height: 1.3;
  white-space: normal;
  text-wrap: balance;
  max-width: min(92vw, 860px);
  margin-left: auto;
  margin-right: auto;
}

.word { display: inline-block; white-space: nowrap; }

.ch {
  display: inline-block;
  opacity: 0;
  white-space: pre;
  will-change: transform, opacity, filter;
}
/* 签名碎成的代码字符，和代码雨同一套字形 */
.ch.code {
  font-family: "MS Gothic", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans Mono CJK JP", ui-monospace, Menlo, Consolas, monospace;
  font-size: .62em;
  color: #6b717c;
}

.sig-flourish {
  width: min(78vw, 420px);
  height: auto;
  margin: 10px auto 0;
  overflow: visible;
}
.sig-flourish path {
  fill: none;
  stroke: #c39235;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.skip {
  position: fixed;
  z-index: 45;
  right: 16px;
  bottom: calc(16px + var(--safe-b));
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(40, 46, 56, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 14px;
  letter-spacing: .1em;
  color: #4a505b;
  transition: opacity .4s, background .2s;
}
.skip:hover { background: #fff; color: var(--intro-ink); }
.skip.gone { opacity: 0; pointer-events: none; }

.flash {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fffaf0 0%, #ffe9bd 35%, rgba(255, 220, 160, 0) 75%);
}

/* ---------------- 3. 主题页 ---------------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0;
  touch-action: none;
}
.stage.on { opacity: 1; transition: opacity 1.2s ease; }

.topbar {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-t)) 20px 0;
  pointer-events: none;
}

.brand {
  margin: 0;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(30px, 7vw, 50px);
  line-height: 1;
  background: linear-gradient(180deg, #fff3d6 10%, var(--candle) 60%, var(--candle-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(244, 194, 107, .35));
}

.count {
  margin: 0;
  font-family: var(--font-card);
  font-size: 14px;
  color: rgba(244, 241, 234, .72);
  white-space: nowrap;
}
.count b { font-weight: 400; font-size: 1.35em; color: var(--candle); margin-right: 2px; }

.tree-wrap { position: absolute; inset: 0; }
.tree { position: absolute; inset: 0; width: 100%; height: 100%; }
.tags { position: absolute; inset: 0; }

.empty {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(8, 22, 48, .55);
  font-family: var(--font-card);
  font-size: 16px;
  color: var(--snow);
  white-space: nowrap;
}

/* —— 挂在树上的卡片 —— */

.tag {
  position: absolute;
  width: 0;
  height: 0;
  z-index: 2;
}

.tag-swing {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  animation: sway var(--dur, 4s) ease-in-out var(--delay, 0s) infinite alternate;
}

@keyframes sway {
  from { transform: rotate(var(--a1, -2.4deg)); }
  to   { transform: rotate(var(--a2, 2.4deg)); }
}

.tag-string {
  position: absolute;
  left: 0;
  top: 0;
  width: 1.5px;
  transform-origin: 0 0;
  background: linear-gradient(180deg, rgba(244, 210, 150, .95), rgba(244, 210, 150, .55));
  box-shadow: 0 0 4px rgba(244, 194, 107, .5);
}

.hook {
  position: absolute;
  left: -4px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff2cf, var(--candle) 55%, #a8721c);
  box-shadow: 0 0 10px 2px rgba(244, 194, 107, .65);
}

.tag-card {
  --bg1: #cd434a;
  --bg2: #a62a33;
  --fg: #fff4e4;
  position: relative;
  display: block;
  width: var(--tag-w);
  margin: 0;
  padding: 22px 14px 12px;
  border: 0;
  text-align: left;
  color: var(--fg);
  background:
    radial-gradient(120% 60% at 30% 0%, rgba(255, 255, 255, .18), transparent 60%),
    linear-gradient(170deg, var(--bg1), var(--bg2));
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%, 0 16px);
  font-family: var(--font-card);
  user-select: none;
}
.tag-card::after {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed currentColor;
  opacity: .28;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%, 0 12px);
  pointer-events: none;
}

.tag-card[data-color='gold']  { --bg1: #f6d184; --bg2: #e2a945; --fg: #3d2608; }
.tag-card[data-color='green'] { --bg1: #3a8562; --bg2: #235a40; --fg: #eef7ef; }
.tag-card[data-color='snow']  { --bg1: #fbf8f1; --bg2: #e4dccb; --fg: #2a3550; }

.eyelet {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: var(--night);
  box-shadow: 0 0 0 2.5px rgba(255, 255, 255, .55);
}
.tag-card[data-color='snow'] .eyelet,
.tag-card[data-color='gold'] .eyelet { box-shadow: 0 0 0 2.5px rgba(80, 50, 10, .3); }

.tag-text {
  margin: 0;
  font-size: clamp(13.5px, 3.5vw, 16px);
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-from {
  margin: 8px 0 0;
  text-align: right;
  font-size: 12.5px;
  opacity: .78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag .tag-card {
  cursor: pointer;
  transition: filter .2s;
}
.tag-shadow {
  position: absolute;
  width: var(--tag-w);
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35));
}
.tag .tag-card:hover { filter: brightness(1.08); }
.tag .tag-card:active { filter: brightness(.95); }
.tag.is-new .tag-card { animation: newGlow 2.4s ease-out 1; }
@keyframes newGlow {
  0%, 30% { filter: brightness(1.25) drop-shadow(0 0 18px rgba(255, 230, 170, .95)); }
  100% { filter: none; }
}

/* —— 翻页 —— */

.pager {
  position: absolute;
  z-index: 6;
  right: max(16px, 2.4vw);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pager-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 241, 234, .22);
  border-radius: 50%;
  background: rgba(15, 35, 70, .45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .2s, border-color .2s, transform .15s;
}
.pager-btn:hover { background: rgba(244, 194, 107, .18); border-color: rgba(244, 194, 107, .6); }
.pager-btn:active { transform: scale(.94); }
.pager-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--snow); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pager-label {
  font-family: var(--font-card);
  font-size: 14px;
  color: rgba(244, 241, 234, .75);
  font-variant-numeric: tabular-nums;
  writing-mode: horizontal-tb;
}

/* —— 底部入口 —— */

.dock {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 16px calc(18px + var(--safe-b));
  pointer-events: none;
}
.dock > * { pointer-events: auto; }

.hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-family: var(--font-card);
  font-size: 13.5px;
  color: rgba(244, 241, 234, .7);
}
.hint svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--candle);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: nudge 1.8s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateY(2px); opacity: .6; }
  50% { transform: translateY(-3px); opacity: 1; }
}

.cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: min(260px, 76vw);
  height: 56px;
  padding: 0 32px;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--font-card);
  font-size: 19px;
  letter-spacing: .12em;
  color: #3b2205;
  background: linear-gradient(180deg, #ffe2a2, var(--candle) 55%, var(--candle-deep));
  box-shadow:
    0 0 0 1px rgba(255, 236, 190, .5) inset,
    0 10px 30px -6px rgba(244, 194, 107, .65),
    0 0 50px -10px rgba(244, 194, 107, .7);
  transition: transform .18s var(--ease-out), box-shadow .3s;
  animation: breathe 3.6s ease-in-out infinite;
}
.cta svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-20deg);
  transition: left .7s ease;
}
.cta:hover::before { left: 130%; }
.cta:active { transform: scale(.96); }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 236, 190, .5) inset, 0 10px 30px -6px rgba(244, 194, 107, .55), 0 0 40px -12px rgba(244, 194, 107, .6); }
  50% { box-shadow: 0 0 0 1px rgba(255, 236, 190, .5) inset, 0 12px 34px -6px rgba(244, 194, 107, .8), 0 0 70px -8px rgba(244, 194, 107, .85); }
}

.ground {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 17vh;
  pointer-events: none;
}
.ground .g1 { fill: rgba(214, 228, 244, .08); }
.ground .g2 { fill: rgba(226, 238, 250, .14); }

/* ---------------- 写留言（底部抽屉 / 桌面弹窗） ---------------- */

.sheet, .reader {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.sheet-backdrop, .reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 12, 28, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .35s ease;
}
.sheet.open .sheet-backdrop, .reader.open .reader-backdrop { opacity: 1; }

.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 20px calc(20px + var(--safe-b));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .35);
  transform: translateY(105%);
  transition: transform .42s var(--ease-out);
  user-select: text;
  -webkit-user-select: text;
}
.sheet.open .sheet-panel { transform: translateY(var(--drag, 0px)); }
.sheet-panel.dragging { transition: none; }

.grabber {
  width: 40px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 3px;
  background: #cfc5b2;
  touch-action: none;
}

.sheet-title {
  margin: 0 0 4px;
  text-align: center;
  font-family: var(--font-card);
  font-weight: 400;
  font-size: 21px;
}

.preview-row {
  display: flex;
  justify-content: center;
  padding: 12px 0 16px;
}
.tag-card.preview {
  --tag-w: 200px;
  transform: rotate(-2.5deg);
  filter: drop-shadow(0 8px 12px rgba(30, 30, 50, .22));
  transition: transform .3s var(--ease-spring);
}
.tag-card.preview.bump { transform: rotate(1.5deg) scale(1.03); }

.field { display: block; margin-bottom: 14px; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #4b5670;
}
.counter { font-weight: 400; font-size: 12.5px; color: #8a8f9c; font-variant-numeric: tabular-nums; }
.counter.warn { color: var(--berry); }

.field input, .field textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--paper-line);
  border-radius: 12px;
  background: #fffdf8;
  color: var(--ink);
  font-family: var(--font-card);
  font-size: 16px; /* ≥16px 防止 iOS 聚焦时页面放大 */
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s;
  resize: none;
}
.field input { height: 48px; }
.field input::placeholder, .field textarea::placeholder { color: #a9a395; }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--candle-deep);
  box-shadow: 0 0 0 4px rgba(244, 194, 107, .25);
}

.colors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0 0 6px;
  padding: 0;
  border: 0;
}
.colors legend { padding: 0; margin-bottom: 6px; }
.swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 64px;
  padding: 8px 4px;
  border: 1.5px solid var(--paper-line);
  border-radius: 12px;
  background: #fffdf8;
  font-size: 12.5px;
  color: #5b6378;
  cursor: pointer;
  transition: border-color .2s, transform .15s;
}
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch::before {
  content: '';
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
.swatch[data-color='red']   { --c1: #cd434a; --c2: #a62a33; }
.swatch[data-color='gold']  { --c1: #f6d184; --c2: #e2a945; }
.swatch[data-color='green'] { --c1: #3a8562; --c2: #235a40; }
.swatch[data-color='snow']  { --c1: #fbf8f1; --c2: #e4dccb; }
.swatch:has(input:checked) { border-color: var(--ink); color: var(--ink); }
.swatch:active { transform: scale(.96); }

/* 匿名开关 */
.anon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: -12px 0 -12px auto;
  padding: 0 2px 0 8px;
  font-weight: 500;
  font-size: 13.5px;
  color: #5b6378;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.anon input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.anon-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: #d9d1c1;
  transition: background .25s;
}
.anon-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .25s var(--ease-out);
}
.anon input:checked + .anon-track { background: var(--pine); }
.anon input:checked + .anon-track::after { transform: translateX(16px); }
.anon input:checked ~ span:last-child { color: var(--ink); }
.anon:has(input:focus-visible) .anon-track { outline: 2px solid var(--candle-deep); outline-offset: 2px; }
.field.is-anon input[type='text'] { background: #f1ece2; color: #9a9384; border-style: dashed; }
.field-label label { cursor: pointer; }
div.field > .field-label { align-items: center; }

.form-rules {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #8a8f9c;
}

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-error {
  min-height: 1.4em;
  margin: 4px 0 4px;
  font-size: 13.5px;
  color: var(--berry);
}

.sheet-actions { display: flex; gap: 10px; }
.btn {
  height: 52px;
  border-radius: 14px;
  border: 0;
  font-family: var(--font-card);
  font-size: 17px;
  transition: transform .15s, background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { flex: 0 0 34%; background: #ebe4d6; color: #4b5670; }
.btn.primary {
  flex: 1;
  background: linear-gradient(180deg, #d4464d, #a92a33);
  color: #fff6ea;
  letter-spacing: .08em;
  box-shadow: 0 8px 20px -8px rgba(169, 42, 51, .7);
}
.btn.primary[disabled] { opacity: .6; cursor: progress; }

@media (min-width: 720px) {
  .sheet-panel {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: 480px;
    max-height: 90dvh;
    padding: 22px 28px 26px;
    border-radius: 24px;
    transform: translate(-50%, -46%) scale(.96);
    opacity: 0;
    transition: transform .4s var(--ease-out), opacity .3s ease;
  }
  .sheet.open .sheet-panel { transform: translate(-50%, -50%); opacity: 1; }
  .grabber { display: none; }
}

/* ---------------- 读卡片 ---------------- */

.reader-body {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.reader-delete {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 225, 220, .42);
  border-radius: 50%;
  background: rgba(133, 33, 42, .78);
  opacity: 0;
  transition: opacity .3s .1s, background .2s;
}
.reader.open .reader-delete:not([hidden]) { opacity: 1; }
.reader-delete:hover { background: rgba(177, 45, 54, .95); }
.reader-delete:disabled { cursor: progress; opacity: .55; }
.reader-delete svg { width: 19px; height: 19px; fill: none; stroke: var(--snow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tag-card.big {
  --tag-w: min(84vw, 380px);
  padding: 34px 26px 22px;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .45));
  transform: scale(.6) rotate(-6deg);
  opacity: 0;
  transition: transform .5s var(--ease-spring), opacity .25s ease;
  user-select: text;
  -webkit-user-select: text;
}
.reader.open .tag-card.big { transform: none; opacity: 1; }
.tag-card.big .eyelet { top: 12px; width: 14px; height: 14px; margin-left: -7px; }
.tag-card.big .tag-text { font-size: clamp(18px, 4.8vw, 22px); line-height: 1.7; -webkit-line-clamp: unset; display: block; }
.tag-card.big .tag-from { font-size: 16px; margin-top: 16px; white-space: normal; }
.tag-date { margin: 4px 0 0; text-align: right; font-size: 12.5px; opacity: .6; }

.reader-close {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(244, 241, 234, .3);
  border-radius: 50%;
  background: rgba(15, 35, 70, .6);
  opacity: 0;
  transition: opacity .3s .1s;
}
.reader.open .reader-close { opacity: 1; }
.reader-close svg { width: 20px; height: 20px; fill: none; stroke: var(--snow); stroke-width: 2; stroke-linecap: round; }

/* ---------------- 提示 ---------------- */

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(150px + var(--safe-b));
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(10, 24, 50, .82);
  border: 1px solid rgba(244, 194, 107, .35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: var(--font-card);
  font-size: 15px;
  color: var(--snow);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity .3s, transform .4s var(--ease-out);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed;
  inset: auto 16px 40% 16px;
  text-align: center;
  font-size: 16px;
  z-index: 100;
}

/* ---------------- 适配 ---------------- */

/* 触屏设备：隐藏翻页按钮，用手势；提示里带上页码 */
@media (hover: none) and (pointer: coarse) {
  .pager { display: none; }
}
@media (hover: hover), (pointer: fine) {
  .hint .touch-only { display: none; }
}

@media (max-width: 380px) {
  .count { font-size: 12.5px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
}

/* 横屏手机：高度太矮时压缩底部 */
@media (max-height: 520px) {
  .hint { display: none; }
  .cta { height: 48px; font-size: 17px; }
  .dock { padding-bottom: calc(10px + var(--safe-b)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .15s !important;
  }
}
