@font-face {
  font-family: "Putian Wordmark";
  src: url("/fonts/putian-wordmark.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0f1419;
  --card: #1a2332;
  --card2: #243044;
  --text: #e8eef7;
  --muted: #9aabbf;
  --accent: #3d9cfd;
  --accent2: #2ecc71;
  --danger: #ff6b6b;
  --warn: #f0b429;
  --border: #2e3d52;
  --radius: 14px;
  --tap: 52px;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC",
    "Source Han Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}
body { padding: 12px 12px 40px; }
a { color: var(--accent); text-decoration: none; }

.app {
  max-width: 560px;
  margin: 0 auto;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
header h1 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
}
header .sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 2px;
  min-width: 4.4em;
}
.brand-logo { width: 46px; height: 46px; object-fit: contain; flex: 0 0 auto; background: transparent; display: block; margin: 0 auto; }
.brand-caption {
  display: grid;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  justify-items: stretch;
  font-size: 0.7rem;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
  color: #111;
  text-align: center;
}
.brand-caption-zh,
.brand-caption-en {
  display: block;
  margin: 0;
  text-align: justify;
  text-align-last: justify;
  white-space: nowrap;
  color: inherit;
}
.brand-caption-zh {
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}
.brand-caption-en {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 2px;
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  text-transform: uppercase;
  text-align: left;
  text-align-last: auto;
}
.brand-caption-en i {
  font-style: normal;
  font-weight: inherit;
  font-family: inherit;
  flex: 0 0 auto;
}
.brand-title { min-width: 0; }
.wordmark {
  display: grid;
  width: max-content;
  max-width: 100%;
  justify-items: stretch;
  margin: 0;
}
.wordmark-zh,
.wordmark-en {
  display: block;
  margin: 0;
  text-align: justify;
  text-align-last: justify;
  white-space: nowrap;
}
.wordmark-zh {
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  color: #111;
}
.wordmark-en {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 3px;
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--muted);
  text-transform: uppercase;
  text-align: left;
  text-align-last: auto;
}
.wordmark-en i {
  font-style: normal;
  font-weight: inherit;
  font-family: inherit;
  flex: 0 0 auto;
}
.wordmark-en i.sp {
  flex: 0 0 0.3em;
  width: 0.3em;
}
.wordmark-tag {
  margin-top: 4px;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 28px;
  padding-top: 14px;
  padding-bottom: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.site-footer img { width: 22px; height: 22px; object-fit: contain; background: transparent; }
.site-credit { margin: 0; line-height: 1.5; color: var(--muted); font-size: 0.78rem; }
.brand-about { text-align: center; }
.brand-about img { width: min(240px, 72%); height: auto; margin: 6px auto 10px; display: block; background: transparent; }
.brand-about .site-credit { margin-top: 6px; }
.nav-link {
  font-size: 0.9rem;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  white-space: nowrap;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-btn {
  min-height: var(--tap);
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}
.mode-btn.active {
  border-color: var(--accent);
  background: rgba(61, 156, 253, 0.18);
  color: #fff;
}

.prompt-box {
  background: var(--card2);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.prompt-label {
  color: var(--muted);
  font-size: 0.8rem;
}
.prompt-text {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}
.prompt-nav {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.prompt-nav button {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

label.field {
  display: block;
  margin-bottom: 10px;
}
label.field > span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
label.field .req { color: var(--danger); }
label.field > input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  outline: none;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

.row2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}
.consent input {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}

.record-panel {
  text-align: center;
}
.rec-status {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
  min-height: 1.2em;
}
.rec-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--warn);
}
.btn-record {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  background: rgba(61, 156, 253, 0.15);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin: 6px auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 rgba(61, 156, 253, 0.4);
}
.btn-record.recording {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.25);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.55); }
  70% { box-shadow: 0 0 0 18px rgba(255, 107, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

.btn {
  min-height: var(--tap);
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 16px;
  width: 100%;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--accent2); color: #0b1a10; }
.btn-ghost {
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

audio {
  width: 100%;
  margin-top: 8px;
  border-radius: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111a24;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 90vw;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none;
}
.toast.show { display: block; }
.toast.ok { border-color: var(--accent2); }
.toast.err { border-color: var(--danger); }

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 6px;
}

/* Admin */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.stat {
  background: var(--card2);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
}
.stat .n {
  font-size: 1.4rem;
  font-weight: 700;
}
.stat .l {
  font-size: 0.75rem;
  color: var(--muted);
}

.sample-list { display: flex; flex-direction: column; gap: 8px; }
.sample-item {
  background: var(--card2);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--border);
}
.sample-item .top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
.sample-item .texts {
  font-size: 0.95rem;
  line-height: 1.4;
}
.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(61,156,253,0.2);
  color: var(--accent);
  margin-right: 4px;
}
.badge.pt { background: rgba(46,204,113,0.2); color: var(--accent2); }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 8px;
}


.pack-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}
.prompt-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  max-height: 10em;
  overflow-y: auto;
}


/* Login / profile */
#loginView[hidden], #collectView[hidden] { display: none !important; }

.profile-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.profile-summary {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.profile-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-sm {
  min-height: 36px !important;
  padding: 6px 12px !important;
  font-size: 0.85rem !important;
}

/* ===== 游戏化 ===== */
#hud[hidden], .tab-pane[hidden], [hidden] { display: none !important; }
.hud {
  background: linear-gradient(135deg, #1f2b44 0%, #2a1f3d 100%);
  border-color: #4b3b6e;
}
.hud-top { display: flex; gap: 12px; align-items: center; }
.lvl-badge {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #f0b429 60%, #b07800);
  box-shadow: 0 0 18px rgba(240,180,41,0.45);
}
.hud-main { flex: 1; min-width: 0; }
.lvl-name { font-weight: 700; font-size: 1rem; }
.lvl-name small { color: var(--warn); font-weight: 600; margin-left: 4px; }
.points { font-size: 2.1rem; font-weight: 800; line-height: 1.1; color: #ffd166; font-variant-numeric: tabular-nums; }
.points small { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.points.bump { animation: bump 0.6s ease; }
@keyframes bump { 0%{transform:scale(1)} 30%{transform:scale(1.25)} 100%{transform:scale(1)} }
.bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 6px; }
.bar.thin { height: 6px; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3d9cfd, #2ecc71); transition: width 0.8s ease; }
.bar-fill.gold { background: linear-gradient(90deg, #f0b429, #ff7a45); }
.hud-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hud-cell { background: rgba(0,0,0,0.22); border-radius: 12px; padding: 8px 4px; text-align: center; position: relative; }
.flame { font-size: 1.6rem; height: 44px; line-height: 44px; }
.flame.off { filter: grayscale(1); opacity: 0.45; }
.flame.on { animation: flicker 1.4s infinite alternate; }
@keyframes flicker { from{transform:scale(1) rotate(-3deg)} to{transform:scale(1.12) rotate(3deg)} }
.hud-n { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hud-l { font-size: 0.72rem; color: var(--muted); }
.ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 5; }
.ring-fg { fill: none; stroke: #2ecc71; stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset 0.8s ease; }
.streak-warn {
  margin-top: 10px; padding: 8px 10px; border-radius: 10px; font-size: 0.85rem; line-height: 1.4;
  background: rgba(255,107,107,0.14); border: 1px solid rgba(255,107,107,0.5); color: #ffb3b3;
}
.streak-warn.ok { background: rgba(46,204,113,0.12); border-color: rgba(46,204,113,0.5); color: #b6f0cb; }

.task-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task-prog { color: var(--warn); font-size: 0.95rem; margin-left: 4px; }
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  min-height: 48px; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card2); color: var(--text); cursor: pointer; font-size: 0.92rem;
}
.task-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(61,156,253,0.35); }
.task-item.done { opacity: 0.6; }
.task-item.done .task-text { text-decoration: line-through; }
.task-check {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; border: 2px solid var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 0.85rem;
}
.task-item.done .task-check { background: var(--accent2); border-color: var(--accent2); color: #0b1a10; }
.task-type { font-size: 0.7rem; padding: 2px 7px; border-radius: 999px; flex-shrink: 0; font-weight: 700; }
.tt-word { background: rgba(61,156,253,0.2); color: #8cc4ff; }
.tt-sentence { background: rgba(46,204,113,0.2); color: #8ee3b0; }
.tt-dubbing { background: rgba(255,122,69,0.22); color: #ffb08f; }
.tt-singing { background: rgba(200,120,255,0.22); color: #e0b3ff; }
.task-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-pts { color: #ffd166; font-weight: 700; font-size: 0.82rem; flex-shrink: 0; }
.task-chip { align-self: center; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(240,180,41,0.2); color: var(--warn); }
.prompt-scene { font-size: 0.82rem; color: #ffb08f; line-height: 1.4; }
.prompt-emotion { font-size: 0.8rem; color: var(--muted); }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.tab { min-height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--card2); color: var(--text); font-size: 0.85rem; cursor: pointer; }
.tab.active { border-color: var(--warn); background: rgba(240,180,41,0.15); }
.ach-wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ach { background: var(--card2); border-radius: 12px; padding: 10px 6px; text-align: center; border: 1px solid var(--border); }
.ach .ic { font-size: 1.7rem; }
.ach .nm { font-size: 0.8rem; font-weight: 700; margin-top: 2px; }
.ach .ds { font-size: 0.68rem; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.ach.locked .ic { filter: grayscale(1); opacity: 0.3; }
.ach.locked .nm { color: var(--muted); }
.ach.unlocked { border-color: rgba(240,180,41,0.6); box-shadow: inset 0 0 12px rgba(240,180,41,0.15); }

.region-map {
  display: grid; gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.region {
  border-radius: 14px; padding: 10px 6px; text-align: center; min-height: 78px;
  border: 1px solid var(--border); background: #141c28; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  min-width: 0;
}
.region .rn { font-weight: 800; font-size: 0.95rem; white-space: nowrap; }
.region .rs { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.region .rbar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 99px; margin-top: 6px; overflow: hidden; }
.region .rbar i { display: block; height: 100%; background: #ffd166; }
.region.l1 { background: #1d2a22; } .region.l2 { background: #24402d; }
.region.l3 { background: #2e5a3a; } .region.l4 { background: #3c7a4a; }
.region.l5 { background: #4caf50; box-shadow: 0 0 16px rgba(76,175,80,0.6); }
.region.mine { border: 2px solid #ffd166; box-shadow: 0 0 14px rgba(255,209,102,0.45); }
.region.mine::after { content: "我的家乡"; position: absolute; top: 4px; right: 6px; font-size: 0.6rem; color: #ffd166; }

.rank-switch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.rank-switch .mode-btn { min-height: 38px; font-size: 0.75rem; padding: 4px 2px; }
@media (max-width: 420px) {
  .rank-switch { grid-template-columns: repeat(4, 1fr); }
}
.rank-badge { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; vertical-align: middle; }
.rank-badge.lock { background: #e8c56b; color: #4a3208; }
.rank-badge.paid { background: #c8e6c0; color: #1b4d1b; }
.rank-badge.wait { background: #f3e0b8; color: #5a3d0a; }
.rank-badge.off { background: #ece7dc; color: #5c5648; }
.invite-stages { margin: 10px 0 0; padding-left: 1.2em; line-height: 1.7; font-size: 0.92rem; color: var(--ink, #2b2416); }
.invite-stages li { margin: 0.35em 0; }
table.rank { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.rank th, table.rank td { padding: 7px 4px; border-bottom: 1px solid var(--border); text-align: left; }
table.rank th { color: var(--muted); font-weight: 600; font-size: 0.75rem; }
table.rank td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.rank tr.me td { background: rgba(240,180,41,0.12); font-weight: 700; }
.me-hero { font-size: 1.05rem; font-weight: 800; text-align: center; padding: 12px 6px; color: #ffd166; }

/* 成就弹窗 + 庆祝特效 */
.ach-pop { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.ach-pop .pop {
  background: linear-gradient(135deg, #3a2a00, #5a3d00); border: 1px solid #f0b429; color: #fff;
  border-radius: 14px; padding: 10px 14px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: popin 0.4s ease, popout 0.4s ease 3.6s forwards;
}
.ach-pop .pop .ic { font-size: 1.8rem; }
.ach-pop .pop b { display: block; color: #ffd166; font-size: 0.75rem; }
@keyframes popin { from{transform:translateY(-20px);opacity:0} to{transform:none;opacity:1} }
@keyframes popout { to{transform:translateY(-20px);opacity:0} }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 55; overflow: hidden; }
.fx-plus { position: absolute; left: 50%; top: 45%; transform: translate(-50%,-50%); font-size: 2.6rem; font-weight: 900; color: #ffd166;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6); animation: floatup 1.4s ease-out forwards; white-space: nowrap; }
.fx-plus small { display: block; font-size: 0.9rem; text-align: center; color: #fff; }
@keyframes floatup { 0%{opacity:0;transform:translate(-50%,-30%) scale(0.6)} 20%{opacity:1;transform:translate(-50%,-50%) scale(1.15)} 100%{opacity:0;transform:translate(-50%,-160%) scale(1)} }
.fx-bit { position: absolute; top: 45%; left: 50%; font-size: 1.4rem; animation: burst 1.1s ease-out forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
.levelup-banner { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); background: linear-gradient(135deg,#f0b429,#ff7a45); color: #1a1000;
  font-weight: 900; padding: 14px 20px; border-radius: 16px; font-size: 1.2rem; text-align: center; animation: popin 0.4s ease, popout 0.5s ease 2.4s forwards; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }

/* 莆田之声：得物式结构 — 白底、大卡片、强对比；保留妈祖红作为唯一品牌强调色。 */
:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --card2: #f7f7f7;
  --text: #111111;
  --muted: #5c5c5c;
  --accent: #111111;
  --accent2: #c41230;
  --danger: #c41230;
  --warn: #c41230;
  --border: #ececec;
  --radius: 12px;
  --hairline: #eeeeee;
  --brand: #c41230;
}

body {
  background: var(--bg);
  color: var(--text);
  padding: 0 0 40px;
}
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 28px;
}

header.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -16px 16px;
  padding: 10px 16px 12px;
  background: #fff;
  border-bottom: 1px solid var(--hairline);
  align-items: center;
}
header h1,
header h1.wordmark {
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
  line-height: 1.15;
}
header h1 small,
header .wordmark-en {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: "Putian Wordmark", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0;
  margin-top: 3px;
  color: var(--muted);
  text-transform: uppercase;
  line-height: 1.2;
}
header .sub { color: var(--muted); font-size: 0.75rem; margin-top: 4px; line-height: 1.45; }
.brand { gap: 12px; align-items: center; }
.brand-mark { min-width: 0; width: max-content; gap: 4px; }
.brand-logo { width: 40px; height: 40px; }
.brand-caption {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
  color: #111;
  line-height: 1.15;
}
.site-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
}
.site-credit { color: var(--muted); }
.nav-link {
  background: #f5f5f5;
  border: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
}

.card {
  background: #fff;
  border: 0;
  border-radius: var(--radius);
  box-shadow: none;
  padding: 18px 16px;
  margin-bottom: 12px;
}
.card h2, h2, .section-bar h2 {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text);
  margin: 0 0 12px;
}

/* Login hero: compact campaign banner, not a folk brochure */
.coast-hero {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0 16px;
  position: relative;
  border: 0;
}
.hero-kicker {
  padding: 20px 20px 0;
  color: var(--brand);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.coast-hero h2 {
  font: 800 26px/1.3 system-ui, -apple-system, "PingFang SC", "Noto Sans SC", sans-serif;
  margin: 8px 20px 0;
  letter-spacing: 0;
  color: #111;
}
.coast-hero p {
  margin: 8px 20px 0;
  font-size: 13px;
  line-height: 1.7;
  max-width: 28em;
  color: var(--muted);
}
.coast-hero > svg { display: block; width: 100%; margin-top: 4px; opacity: 0.92; }
.culture-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-start;
  background: #fafafa;
  color: var(--muted);
  padding: 10px 16px 12px;
  font-size: 11px;
  letter-spacing: 0;
  border-top: 1px solid var(--hairline);
}
.culture-strip span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; flex: 0 0 auto; }
.culture-icon { width: 18px; height: 20px; flex-shrink: 0; }

.prompt-box {
  background: #f7f7f7;
  border-radius: 12px;
  border: 0;
  padding: 18px 16px;
  text-align: left;
}
.prompt-text {
  color: #111;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 10em;
  overflow-y: auto;
}
label.field > input, select, textarea {
  background: #f7f7f7;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 16px;
}
input:focus, select:focus, textarea:focus {
  border-color: #111;
  background: #fff;
}
.btn {
  border-radius: 10px;
  font-weight: 700;
  min-height: 48px;
}
.btn-primary, .btn-success {
  background: #111;
  color: #fff;
  box-shadow: none;
}
.btn-primary:active, .btn-success:active { background: #2a2a2a; }
.btn-ghost, .prompt-nav button {
  background: #f5f5f5;
  color: #111;
  border: 0;
}
.btn-danger { background: var(--brand); color: #fff; }
.mode-btn {
  background: #f5f5f5;
  border: 0;
  border-radius: 999px;
  color: #111;
  font-weight: 600;
}
.mode-btn.active, .tab.active {
  background: #111;
  color: #fff;
  border: 0;
}
.hud {
  background: #fff;
  border: 0;
  border-color: transparent;
}
.record-panel { border: 0; }
.rec-timer { color: var(--brand); }
.bar { background: #ececec; }
.bar-fill { background: #111; }
.bar-fill.gold { background: var(--brand); }
:focus-visible { outline: 3px solid #111; outline-offset: 3px; }
button, a, input, select { touch-action: manipulation; }
[hidden] { display: none !important; }
.rank { font-size: 13px; }
.rank td { overflow-wrap: break-word; }
.rank .region-name { white-space: nowrap; }
.task-list { max-height: 380px; overflow: auto; }

@media (min-width: 620px) {
  .coast-hero h2 { font-size: 32px; }
  .coast-hero > svg { margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.task-pts, .me-hero { color: #111; font-weight: 800; }
.tt-word { background: #f0f0f0; color: #111; }
.tt-sentence { background: #111; color: #fff; }
.tt-dubbing, .prompt-scene { color: var(--brand); }
.tt-singing { background: #f0f0f0; color: #111; }
.region { background: #f7f7f7; }
.region.l1 { background: #f0f0f0; }
.region.l2 { background: #e6e6e6; }
.region.l3 { background: #d8d8d8; }
.region.l4 { background: #c4c4c4; }
.region.l5 { background: #111; color: #fff; box-shadow: none; }
.region.l5 .rs, .region.l5 .rbar { color: #cfcfcf; }
.region.l5 .rbar { background: rgba(255,255,255,0.2); }
.region.l5 .rbar i { background: var(--brand); }
.region.mine { border: 2px solid #111; box-shadow: none; }
.region.mine::after { color: var(--brand); font-weight: 700; }
.points { color: #111; }
.hud-cell { background: #f7f7f7; }
.streak-warn { color: #8a1c28; background: #fff1f2; border-color: #ffd0d4; }
.streak-warn.ok { color: #1a1a1a; background: #f0f0f0; border-color: #e0e0e0; }

.achievement-heading { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; }
.achievement-heading .culture-icon { width: 36px; height: 42px; }
.achievement-heading p { margin: 0; }
label.field { min-width: 0; }
.region-field { min-width: 0; }
.region-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.region-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 0;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: #f5f5f5;
  color: #111;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  cursor: pointer;
}
.region-pill[aria-pressed="true"] {
  background: #111;
  color: #fff;
}
.profile-actions .btn { width: auto; white-space: nowrap; }

.pending-pts { color: var(--brand); }
.points.is-negative #ptsNum { color: var(--danger); }
.dock {
  background: #fff;
  border-top: 1px solid var(--hairline);
  box-shadow: none;
}
.dock-btn.active { color: var(--brand); background: #f5f5f5; font-weight: 700; }

/* Product-tile cards */
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.wiki-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 0;
  border-radius: 10px;
  padding: 0 0 12px;
  background: #fff;
  min-height: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
  overflow: hidden;
  box-shadow: none;
}
.wiki-card .card-art {
  position: relative;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.wiki-card.px,
.wiki-card.highlight-px { background: #fff; border: 0; }
.wiki-card .rarity {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  background: #111;
  color: #fff;
  z-index: 1;
}
.wiki-card .extract {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
  padding: 0 10px;
  line-height: 1.45;
  max-height: 3.2em;
  overflow: hidden;
}
.wiki-card .stats {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  align-items: baseline;
}
.wiki-card .stats b {
  display: inline;
  margin-left: 2px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #111;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.wiki-card .copies { font-size: 0.68rem; color: var(--muted); margin-top: 2px; padding: 0 10px; }
.wiki-card.selected { box-shadow: 0 0 0 2px #111; }
.wiki-card.used { opacity: 0.45; filter: grayscale(0.3); }
.wiki-card .flavor { font-size: 0.68rem; font-style: normal; color: var(--muted); margin-top: 4px; padding: 0 10px; line-height: 1.4; }
.wiki-card.highlight-px { box-shadow: 0 0 0 2px var(--brand); transform: none; }
.wiki-card.highlight-lr, .wiki-card.highlight-ur { box-shadow: 0 0 0 2px #111; }

/* card-face:begin */
.card-face {
  --face-bg-1: #f4f4f2; --face-bg-2: #e7e7e3; --face-ink: #1f2328; --face-pattern: none;
  background: linear-gradient(160deg, var(--face-bg-1) 0%, var(--face-bg-2) 100%);
  color: var(--face-ink);
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; padding: 30px 12px 14px; text-align: center;
  overflow: hidden; isolation: isolate;
}
.card-face::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--face-pattern); }
.card-face > .rarity { position: absolute; top: 8px; left: 8px; font-size: .66rem; font-weight: 800; padding: 3px 7px; border-radius: 4px; background: var(--face-ink); color: var(--face-bg-1); }
.wiki-card .card-face + .extract, .wiki-card .card-face + .flavor, .wiki-card .card-face + .stats { margin-top: 10px; }

.card-face-title {
  position: relative; z-index: 1; max-width: 100%;
  display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere; word-break: normal; text-wrap: balance; user-select: none;
  font-family: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", STSong, serif;
}
.card-face-title.tier-short  { font-size: 1.85rem; font-size: clamp(1.6rem, 8.2vw, 2.1rem);  font-weight: 900; line-height: 1.12; letter-spacing: .02em; -webkit-line-clamp: 2; max-height: calc(1.12em * 2); }
.card-face-title.tier-medium { font-size: 1.2rem;  font-size: clamp(1.15rem, 5.2vw, 1.35rem); font-weight: 800; line-height: 1.25; -webkit-line-clamp: 3; max-height: calc(1.25em * 3); }
.card-face-title.tier-long   { font-size: .95rem;  font-size: clamp(.9rem, 4vw, 1rem);       font-weight: 700; line-height: 1.3;  -webkit-line-clamp: 3; max-height: calc(1.3em * 3); font-family: inherit; }

/* Surface overrides: box sizes come from existing rules; only type and padding scale. */
.pack-hero-card .card-face { padding: 26px 10px 10px; }
.pack-hero-card .card-face-title.tier-short  { font-size: 1.9rem; }
.pack-hero-card .card-face-title.tier-medium { font-size: 1.2rem; }
.pack-hero-card .card-face-title.tier-long   { font-size: .95rem; }
.card-modal .card-face { padding: 34px 16px 18px; }
.card-modal .card-face-title.tier-short  { font-size: 3.2rem; }
.card-modal .card-face-title.tier-medium { font-size: 2rem; }
.card-modal .card-face-title.tier-long   { font-size: 1.45rem; }
.pack-flip .face.card-face { padding: 6px 4px; flex-direction: column; }      /* keeps position/transform from .pack-flip .face */
.pack-flip .card-face-title.tier-short  { font-size: .9rem; }
.pack-flip .card-face-title.tier-medium { font-size: .8rem; }
.pack-flip .card-face-title.tier-long   { font-size: .68rem; }
.card-face--compact { position: relative; width: 88px; height: 120px; flex: 0 0 88px; border-radius: 8px; padding: 22px 6px 8px; }
.card-face--compact .rarity { position: absolute; top: 5px; left: 5px; font-size: .58rem; padding: 2px 5px; border-radius: 3px; font-weight: 800; }
.card-face--compact .card-face-title.tier-short  { font-size: 1.15rem; }
.card-face--compact .card-face-title.tier-medium { font-size: .85rem; }
.card-face--compact .card-face-title.tier-long   { font-size: .72rem; }
.card-face--chip { position: relative; display: inline-flex; width: 28px; height: 36px; flex: 0 0 28px; padding: 0; border-radius: 5px; font-size: .55rem; font-weight: 800; }
.battle-vs, .raid-summary { display: flex; align-items: center; gap: 12px; margin: 8px 0; }
.battle-vs { justify-content: center; } .battle-vs .vs { font-weight: 900; }
.raid-hits { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .82rem; }
.raid-hits li { display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "c t d" "c s d"; column-gap: 8px; align-items: center; }
.raid-hits .card-face--chip { grid-area: c; } .raid-hits .t { grid-area: t; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.raid-hits .s { grid-area: s; color: var(--muted); font-size: .72rem; } .raid-hits .d { grid-area: d; font-variant-numeric: tabular-nums; }

/* Rarity palettes and motifs — pure CSS, no image resources, motif alpha <= .20 */
.card-face.r-c   { --face-bg-1: #f4f4f2; --face-bg-2: #e7e7e3; --face-ink: #1f2328;
  --face-pattern: radial-gradient(rgba(31, 35, 40, .08) 1px, transparent 1.5px) 0 0 / 10px 10px; }                     /* paper dots */
.card-face.r-uc  { --face-bg-1: #eef6f1; --face-bg-2: #d7ebdf; --face-ink: #14432a;
  --face-pattern: repeating-linear-gradient(135deg, rgba(20, 67, 42, .08) 0 1px, transparent 1px 9px); }               /* jade hairlines */
.card-face.r-r   { --face-bg-1: #edf3fc; --face-bg-2: #d3e2f6; --face-ink: #133a6b;
  --face-pattern: repeating-radial-gradient(circle at 50% 120%, rgba(19, 58, 107, .09) 0 1px, transparent 1px 12px); } /* sea ripples */
.card-face.r-sr  { --face-bg-1: #f4eefc; --face-bg-2: #e0d3f4; --face-ink: #3b1d6e;
  --face-pattern: repeating-linear-gradient(45deg, rgba(59, 29, 110, .07) 0 1px, transparent 1px 10px),
                  repeating-linear-gradient(-45deg, rgba(59, 29, 110, .07) 0 1px, transparent 1px 10px); }             /* lattice */
.card-face.r-ssr { --face-bg-1: #fdf5df; --face-bg-2: #f6e1a8; --face-ink: #5a3a00;
  --face-pattern: repeating-conic-gradient(from 0deg at 50% 62%, rgba(90, 58, 0, .08) 0deg 6deg, transparent 6deg 12deg); } /* gold sunburst */
.card-face.r-ur  { --face-bg-1: #2b3550; --face-bg-2: #1d2433; --face-ink: #f4f6fb;
  --face-pattern: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1.5px) 0 0 / 18px 18px,
                  radial-gradient(rgba(159, 180, 255, .16) 1px, transparent 1.5px) 9px 9px / 18px 18px; }             /* starfield */
.card-face.r-lr  { --face-bg-1: #2a2a2a; --face-bg-2: #111111; --face-ink: #f7e7b4;
  --face-pattern: linear-gradient(115deg, transparent 40%, rgba(247, 231, 180, .12) 50%, transparent 60%);
  box-shadow: inset 0 0 0 4px #111111, inset 0 0 0 5px rgba(247, 231, 180, .45); }                                  /* ink + gold frame */
.card-face.r-px  { --face-bg-1: #c41230; --face-bg-2: #8f0d22; --face-ink: #fff7e6;
  --face-pattern: repeating-radial-gradient(circle at 50% 135%, rgba(255, 214, 130, .16) 0 2px, transparent 2px 14px);
  box-shadow: inset 0 0 0 4px #8f0d22, inset 0 0 0 5px rgba(255, 214, 130, .55); text-shadow: 0 1px 0 rgba(0, 0, 0, .25); } /* Meizhou tide on brand red */
/* card-face:end */

/* Layers: header 30 < fx 55 / achievements 60 < pack 80/82 < modal 90 < toast 100. */
.card-modal-back {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
  animation: card-modal-fade 0.16s ease-out;
}
.card-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(100%, 560px);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 16px;
  padding: 0 0 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.card-modal > * { flex-shrink: 0; }
.card-modal-x {
  position: sticky;
  top: 8px;
  align-self: flex-end;
  z-index: 2;
  width: 40px;
  height: 40px;
  margin: 8px 8px -48px 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  color: #111;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.card-modal-x:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
body.modal-open { overflow: hidden; }
@keyframes card-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card-modal-back { animation: none; } }
.card-modal .card-art {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 16px;
  position: relative;
}
.card-modal .modal-body { padding: 0 20px; }
.card-modal h3 {
  margin: 0 0 6px;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0;
}
.card-modal h3 small { font-size: 0.72rem; color: var(--brand); font-weight: 800; margin-left: 6px; }
.card-modal .flavor { font-style: normal; color: var(--muted); margin: 8px 0; }
.card-modal .modal-stats {
  display: flex;
  gap: 16px;
  margin: 8px 0 12px;
  font-variant-numeric: tabular-nums;
}
.card-modal .modal-stats b {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: #111;
  line-height: 1.1;
}
.card-modal .modal-stats span { font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.card-modal .btn { width: calc(100% - 40px); margin: 8px 20px 0; }
.gift-box { margin: 16px 20px 0; text-align: left; }
.gift-box input { width: 100%; }
.gift-box .btn { width: 100%; margin: 8px 0 0; }
.card-modal .card-wiki { margin: 12px 0 4px; }
.card-modal .card-wiki-link {
  display: block; text-align: center; padding: 10px 14px; border-radius: 10px;
  border: 1px solid #111; color: #111; font-weight: 700;
}
.card-modal .card-attr a { color: inherit; text-decoration: underline; }

.event-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 0.82rem; }
.event-list .ev { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.card-grid > .pick-cell { position: relative; display: flex; min-width: 0; }
.pick-cell > .wiki-card { flex: 1 1 auto; width: 100%; min-width: 0; }
.card-detail-btn {
  position: absolute; top: 0; right: 0; z-index: 2;
  width: 52px; height: 44px;                 /* >= 44px hit target */
  display: flex; align-items: flex-start; justify-content: flex-end;
  margin: 0; padding: 6px 6px 0 0; border: 0; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card-detail-btn span {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.94); color: #111;
  font-size: 0.68rem; font-weight: 800; line-height: 1.4;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.card-detail-btn:focus-visible span { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-detail-btn:active span { background: #111; color: #fff; }
.battle-chip {
  display: inline; padding: 0 2px; margin: 0; border: 0; background: none;
  font: inherit; font-weight: 800; color: #111; text-decoration: underline; cursor: pointer;
}
.battle-rounds { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: 0.82rem; line-height: 1.9; }
.battle-rounds li { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: baseline; }
.battle-round-no, .battle-round-res { color: var(--muted); font-weight: 600; }

.battle-log { font-size: 0.82rem; line-height: 1.6; }
@media (min-width: 620px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

.battle-opts { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.battle-opts .field { margin: 0; }
.coin-tray { display: flex; flex-wrap: wrap; gap: 10px 12px; margin-top: 8px; }
.raid-coin-wrap {
  width: 64px;
  margin: 0;
  text-align: center;
}
.raid-coin {
  width: 64px; height: 64px; border-radius: 50%;
  background: #111;
  border: 2px solid #111;
  box-shadow: 0 0 0 1px #e6e6e6, inset 0 0 0 1px rgba(255,255,255,0.55);
  color: #fff;
  font-weight: 800;
  font-family: inherit;
  font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 0;
}
.raid-coin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  pointer-events: none;
}
.raid-coin-wrap figcaption {
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.raid-coin-award { width: 88px; height: 88px; margin: 10px auto; border-width: 3px; }
.raid-hp { height: 8px; border-radius: 999px; background: #ececec; overflow: hidden; margin: 8px 0 12px; }
.raid-hp span { display: block; height: 100%; background: var(--brand); width: 0; }

/* Logged-in header + hub grid */
body.is-collect { padding-top: 0; padding-bottom: 28px; }
body.is-collect .coast-hero { display: none; }
.compact-header { align-items: flex-start; gap: 10px; margin-bottom: 12px; flex-wrap: nowrap; min-width: 0; }
.compact-header .brand { flex: 1 1 0; min-width: 0; }
.compact-header .brand-title { min-width: 0; overflow: hidden; }
.compact-header .brand-mark { min-width: 0; width: max-content; flex: 0 0 auto; }
.compact-header .brand-logo { width: 40px; height: 40px; }
.compact-header .brand-caption { font-size: 0.7rem; color: #111; }
.compact-header h1,
.compact-header h1.wordmark { font-size: 1.18rem; letter-spacing: 0; }
.compact-header .wordmark-zh { font-size: 1.18rem; }
.compact-header .wordmark-en,
.compact-header h1 small { font-size: 0.58rem; }
.compact-header .sub {
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0;
  row-gap: 2px;
  overflow-wrap: normal;
  word-break: keep-all;
}
.compact-header .sub .meta-item {
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  max-width: 100%;
}
.compact-header .sub .meta-sep {
  display: inline-block;
  margin: 0 0.35em;
  flex: 0 0 auto;
}
.compact-header .header-meta { flex: 0 0 auto; }
.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  flex-direction: column;
  gap: 4px 8px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.header-meta .points {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
  color: #111;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}
.header-meta .points small { font-size: 0.72rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.header-credit { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.profile-actions { gap: 6px; }
.profile-actions .btn-sm {
  min-height: 32px !important;
  padding: 4px 10px !important;
  font-size: 0.78rem !important;
  background: #f5f5f5;
  border: 0;
  border-radius: 8px;
}

.hub-card {
  margin-bottom: 8px;
  background: transparent;
  padding: 4px 0 8px;
  box-shadow: none;
}
.hub-card h2 { margin-bottom: 4px; }
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.hub-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 100px;
  padding: 16px 14px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  background: #fff;
  color: inherit;
  text-align: left;
  box-shadow: none;
}
.hub-btn:focus-visible, .hub-btn.active {
  border: 0;
  box-shadow: 0 0 0 2px #111;
}
.hub-btn.active { background: #fff; }
.hub-ico { font-size: 1.45rem; line-height: 1; }
.hub-label { font-weight: 800; font-size: 0.98rem; color: #111; }
.hub-btn small { color: var(--muted); font-size: 0.72rem; line-height: 1.4; }

.section-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px 12px;
  padding: 0 16px 12px;
  min-width: 0;
  border-bottom: 1px solid var(--hairline);
}
.section-bar h2 { margin: 0; font-family: inherit; color: #111; letter-spacing: 0; font-weight: 800; }
.btn-back {
  flex: 0 0 auto;
  width: auto;
  min-height: 44px;
  padding: 6px 12px;
  background: #f5f5f5;
  font-weight: 700;
}

@media (min-width: 620px) {
  .hub-grid { grid-template-columns: repeat(4, 1fr); }
  .compact-header { align-items: center; }
  .header-meta { flex-direction: row; align-items: center; }
  .region-picker,
  .region-map { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

.points-legend {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f7f7;
  color: #333;
  font-size: 0.82rem;
  line-height: 1.6;
  font-weight: 500;
}
#packSwitch { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
#packSwitch .mode-btn { min-height: 52px; padding: 8px 6px; font-size: 0.92rem; line-height: 1.25; border-radius: 12px; }
#packSwitch .mode-btn small { display: block; font-weight: 700; color: var(--muted); font-size: 0.78rem; }
#packSwitch .mode-btn.active small { color: #fff; }
#freeQuota { margin: 8px 0 0; }
#packSwitch.entry-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.entry-btn { min-height: 72px; width: 100%; }
@media (min-width: 620px) {
  #packSwitch.entry-grid { grid-template-columns: 1fr 1fr 1fr; }
}
#recorderSheet[hidden] { display: none !important; }
.rank-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 6px; background: transparent; }

/* Record button */
.btn-record {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid #111;
  background: #111;
  color: #fff;
  box-shadow: none;
}
.btn-record.recording {
  border-color: var(--brand);
  background: var(--brand);
}

/* Tabs & rank filters as pills */
.tabs, .rank-switch {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar, .rank-switch::-webkit-scrollbar { display: none; }
.tab, .rank-switch .mode-btn {
  flex: 0 0 auto;
  min-height: 44px;
  border-radius: 999px;
  border: 0;
  background: #f5f5f5;
  color: #111;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
}
@media (max-width: 420px) {
  .rank-switch { grid-template-columns: none; }
}

table.rank { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.rank th, table.rank td { padding: 10px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
table.rank th { color: var(--muted); font-weight: 600; font-size: 0.72rem; }
table.rank td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; color: #111; font-size: 0.95rem; }
table.rank tr.me td { background: #f7f7f7; font-weight: 700; }
.me-hero { font-size: 1.15rem; font-weight: 800; text-align: left; padding: 8px 0 12px; color: #111; }
.invite-stages { margin: 10px 0 0; padding-left: 1.2em; line-height: 1.7; font-size: 0.92rem; color: var(--text); }
.invite-stages li { margin: 0.35em 0; }
.rank-badge { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; vertical-align: middle; }
.rank-badge.lock { background: #111; color: #fff; }
.rank-badge.paid { background: var(--brand); color: #fff; }
.rank-badge.wait { background: #f0f0f0; color: #111; }
.rank-badge.off { background: #f0f0f0; color: #5c5c5c; }

.task-item {
  border: 0;
  background: #f7f7f7;
  border-radius: 12px;
}
.task-item.active { border: 0; box-shadow: 0 0 0 2px #111; }
.task-item.done .task-check { background: #111; border-color: #111; color: #fff; }
.ach {
  background: #f7f7f7;
  border: 0;
  border-radius: 12px;
}
.ach.unlocked { border: 0; box-shadow: inset 0 0 0 2px #111; }
.lvl-badge {
  box-shadow: none;
  background: #111;
  color: #fff;
}
.lvl-name small { color: var(--muted); }

/* Toasts stay dark — marketplace style */
.toast {
  z-index: 100;
  background: #111;
  border: 0;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.toast.ok { border: 0; }
.toast.err { background: var(--brand); }

/* Achievement pop + effects */
.ach-pop .pop {
  background: #111;
  border: 0;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.ach-pop .pop b { color: #fff; }
.fx-plus { color: var(--brand); text-shadow: none; }
.levelup-banner {
  background: #111;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}


/* Pack cinematic structure (full-screen overlay) */
.pack-cine {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
}
.pack-cine[hidden] { display: none !important; }
.pack-cine-bg { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(196,18,48,0.45), rgba(0,0,0,0.92)); }
.pack-cine-lanterns { position: absolute; inset: 0; pointer-events: none; }
.pack-cine-lanterns span { position: absolute; font-size: 1.4rem; opacity: 0.7; animation: lantern-float 3s ease-in-out infinite; }
.pack-cine-lanterns span:nth-child(1) { left: 10%; top: 18%; animation-delay: 0s; }
.pack-cine-lanterns span:nth-child(2) { right: 12%; top: 22%; animation-delay: .4s; }
.pack-cine-lanterns span:nth-child(3) { left: 18%; bottom: 20%; animation-delay: .8s; }
.pack-cine-lanterns span:nth-child(4) { right: 16%; bottom: 16%; animation-delay: .2s; }
@keyframes lantern-float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
.pack-cine-stage { position: relative; z-index: 1; width: min(420px, 92vw); text-align: center; color: #fff; }
.pack-seal { display: flex; justify-content: center; }
.pack-seal-body {
  width: 180px; height: 230px; border-radius: 12px;
  background: #111;
  border: 0;
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  animation: pack-shake 0.7s ease-in-out infinite;
  color: #fff;
}
.pack-seal-body b { font-size: 1.35rem; letter-spacing: 0.12em; }
.pack-seal-body small { font-size: 0.85rem; opacity: 0.9; }
.pack-cine.tier-px .pack-seal-body { box-shadow: 0 0 40px rgba(196,18,48,0.7), 0 16px 40px rgba(0,0,0,0.5); border: 2px solid var(--brand); }
@keyframes pack-shake {
  0%,100%{ transform: rotate(0deg) scale(1); }
  25%{ transform: rotate(-4deg) scale(1.03); }
  50%{ transform: rotate(3deg) scale(1.05); }
  75%{ transform: rotate(-2deg) scale(1.02); }
}
.pack-flip-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 150px; }
.pack-flip { width: 68px; height: 96px; perspective: 400px; }
.pack-flip .inner { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.45s ease; }
.pack-flip.revealed .inner { transform: rotateY(180deg); }
.pack-flip .back, .pack-flip .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 10px; overflow: hidden; }
.pack-flip .back { background: #111; border: 0; color: #fff; font-weight: 800; font-size: 1.2rem; display:flex; align-items:center; justify-content:center; }
.pack-flip .face { transform: rotateY(180deg); border: 0; font-size: 11px; padding: 6px 4px; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.pack-flip .face .rr { font-size: 10px; font-weight: 800; margin-bottom: 4px; }
.pack-hero-title {
  font-family: inherit;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,0.85);
  margin-bottom: 12px;
  animation: popin 0.35s ease;
}
.pack-hero.tier-px .pack-hero-title { font-size: 2.2rem; color: #fff; }
.pack-hero-card, #packHeroCard { display:flex; justify-content:center; }
.pack-hero-card .wiki-card { min-width: 200px; animation: pack-hero-in 0.5s ease; }
.pack-hero-card .wiki-card .card-art { height: 110px; }
.pack-hero-card .wiki-card .extract,
.pack-hero-card .wiki-card .flavor { display: none; }
@keyframes pack-hero-in { from{transform:scale(0.6) rotate(-6deg);opacity:0} to{transform:none;opacity:1} }
.pack-cine-hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(24px + env(safe-area-inset-bottom));
  margin: 0;
  font-size: 0.8rem;
  color: #eee;
  text-shadow: 0 1px 8px rgba(0,0,0,0.85);
  z-index: 82;
}
.pack-cine-lanterns span { font-size: 1.4rem; opacity: 0.7; }

/* Primary actions stay full-width and high-contrast, but not sticky — long forms must stay readable. */
#loginView .btn-row .btn,
#viewPack .btn-row .btn,
#viewBattle > .card .btn-row .btn,
#viewShare .btn-row .btn,
.record-panel .btn-row .btn { min-height: 48px; }

.stat { background: #f7f7f7; }
.stat .n { font-size: 1.5rem; font-weight: 800; color: #111; font-variant-numeric: tabular-nums; }
.sample-item { background: #f7f7f7; border: 0; }
.badge { background: #111; color: #fff; }
.badge.pt { background: var(--brand); color: #fff; }

a { color: #111; text-decoration: underline; text-underline-offset: 2px; }
.nav-link { text-decoration: none; }
.card a, .hint a, .site-footer a { text-decoration: underline; }

.coin-attr { margin-top: 12px; font-size: 0.82rem; color: var(--muted); }
.coin-attr summary { cursor: pointer; font-weight: 650; color: var(--text); }
.coin-attr ul { margin: 8px 0 0; padding-left: 1.2em; line-height: 1.55; }
.coin-attr li { margin: 0 0 4px; }

.battle-chip.battle-face { display: flex; padding: 0; text-decoration: none; border-radius: 8px; }
.battle-face:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.raid-summary > p { min-width: 0; overflow-wrap: anywhere; }
.raid-hits li { min-width: 0; grid-template-columns: 28px minmax(0, 1fr) auto; }

/* Numeric review controls reuse the existing brand and tap targets. */
.score-group { display: grid; gap: 12px; }
.score-band { border-left: 3px solid var(--accent); padding-left: 8px; }
.score-band[data-band="low"] { border-color: var(--brand); }
.score-band[data-band="mid"] { border-color: var(--muted); }
.score-band[data-band="high"] { border-color: var(--accent); }
.score-band-label { font-size: .9rem; margin-bottom: 8px; }
.score-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.score-pill { min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--muted); background: var(--card); color: var(--accent); border-radius: 12px; font: inherit; cursor: pointer; }
.score-pill[aria-checked="true"] { background: var(--accent); color: white; }
.score-pill[aria-disabled="true"] { opacity: .5; cursor: default; }
.score-pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.score-summary { min-height: 1.5em; }
.review-demo { border: 1px solid var(--muted); padding: 12px; border-radius: 12px; animation: review-reveal 150ms ease-out; }
.review-demo audio, #reviewAudio { width: 100%; margin: 12px 0; }
.review-actionbar { position: sticky; bottom: 0; background: var(--card); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
.review-actionbar .btn-primary { flex: 1; }
.review-kind-chip { margin-bottom: 8px; }
@keyframes review-reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .review-demo { animation: none; transition: none; } }
