/* 层积 Strata
   每个任务是一张卡，段位就是卡的稀有度。颜色只用来标稀有度：普通灰 → 稀有蓝 → 史诗紫 → 传说金。
   白天和夜间两套色值；顶栏一键切换，默认跟随系统。 */

:root {
  color-scheme: light;
  --paper: #f4f4f2;
  --card: #ffffff;
  --paper-2: #ebebe8;
  --paper-3: #fafaf9;
  --ink: #141414;
  --ink-2: #545458;
  --ink-3: #8b8b90;
  --rule: #e4e4e0;
  --rule-2: #d0d0cb;
  --focus: #2f6fd6;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .05);

  --sand: #8a8984;      /* Motivation：普通（灰） */
  --clay: #2b78c9;      /* Ego：稀有（蓝） */
  --stone: #7449d1;     /* Discipline：史诗（紫） */
  --x1: #c18714; --x2: #f0c75a; --x3: #a8620f; --x4: #c18714; /* Obsession：传说（金，闪卡） */
  --frost: #a2acb4;
  --miss: #c9c9c4;

  --font: 'Geist', 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --t-xs: 13px; --t-s: 14px; --t-m: 16px; --t-l: 19px; --t-xl: 24px; --t-2xl: 40px; --t-3xl: clamp(44px, 8vw, 72px);
  --gutter: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.4l2.9 2.8L11.5 4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* 夜间：系统是深色且没有手动选白天时，或手动选了夜间 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e0e0f; --card: #18181a; --paper-2: #222224; --paper-3: #141416;
    --ink: #f1f1ef; --ink-2: #b3b3b8; --ink-3: #7d7d83;
    --rule: #28282b; --rule-2: #3a3a3e; --focus: #7aa7f0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --sand: #a9a8a1; --clay: #5ea6ef; --stone: #a383f2; --x1: #e8b03c; --x2: #ffdb7a; --x3: #c9801f; --x4: #e8b03c;
    --frost: #59626b; --miss: #3a3a3e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e0e0f; --card: #18181a; --paper-2: #222224; --paper-3: #141416;
  --ink: #f1f1ef; --ink-2: #b3b3b8; --ink-3: #7d7d83;
  --rule: #28282b; --rule-2: #3a3a3e; --focus: #7aa7f0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --sand: #a9a8a1; --clay: #5ea6ef; --stone: #a383f2; --x1: #e8b03c; --x2: #ffdb7a; --x3: #c9801f; --x4: #e8b03c;
  --frost: #59626b; --miss: #3a3a3e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--t-m)/1.7 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-weight: 500; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; z-index: 20; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 框架 ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 0 var(--gutter); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0 0; }
.mark { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.mark b { font-weight: 600; font-size: 18px; letter-spacing: .06em; }
.mark span { display: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 6px 10px; border-radius: 999px; font-size: var(--t-s); position: relative; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.nav .due::after { content: ''; position: absolute; top: 6px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--clay); }
main { padding-bottom: 120px; }
.foot { padding: 24px 0 48px; font-size: var(--t-xs); color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- 文字层级 ---------- */
.date { font-size: var(--t-3xl); line-height: 1; font-weight: 300; letter-spacing: -.03em; margin: 72px 0 18px; }
.date small { font-size: .36em; letter-spacing: 0; color: var(--ink-3); margin-left: .5em; font-weight: 400; }
.lede { font-size: var(--t-l); color: var(--ink-2); max-width: 36em; }
.section { margin-top: 88px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-h h2 { font-size: var(--t-s); color: var(--ink-3); font-weight: 500; }
.page-h { margin: 64px 0 12px; font-size: var(--t-2xl); font-weight: 400; line-height: 1.1; letter-spacing: -.02em; }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--rule-2); background: transparent; border-radius: 999px; cursor: pointer; text-decoration: none; font-size: var(--t-s); font-weight: 500; transition: background-color .15s, border-color .15s, transform .12s var(--ease); }
.btn:active, .day:active { transform: scale(.96); }
.btn:hover { border-color: var(--ink-3); }
.btn.solid { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.solid:hover { background: var(--ink-2); }
.btn.quiet { border-color: transparent; padding: 0 10px; color: var(--ink-2); }
.btn.quiet:hover { color: var(--ink); background: var(--paper-2); }
.btn.danger { color: #9b3b2e; border-color: #d9b2aa; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 今日打卡 ---------- */
.today-list { list-style: none; margin: 64px 0 0; padding: 0; }
.goal-row { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 0 20px; padding: 30px 0 32px; isolation: isolate; }
.goal-row + .goal-row { border-top: 1px solid var(--rule); }
.goal-row .g { align-self: start; padding-top: 6px; }
.goal-row .name { font-size: var(--t-xl); font-weight: 500; letter-spacing: -.01em; text-decoration: none; line-height: 1.3; }
.goal-row .name:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.goal-row .meta { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 6px; font-size: var(--t-s); color: var(--ink-3); }
.flag { color: var(--ink); text-decoration: none; }
a.flag { border-bottom: 1px solid var(--ink-3); }
a.flag:hover { border-color: var(--ink); }
.flag.cold { color: var(--stone); }
.goal-row.off .name, .goal-row.off .g { opacity: .45; }
.goal-row.done .name { color: var(--ink-2); }
.acts { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.acts .btn { min-width: 104px; min-height: 48px; font-size: var(--t-m); }
.res { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; padding: 0 6px; }
.res i { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; }
.res i::after { content: ''; width: 14px; height: 14px; background: var(--paper); -webkit-mask: var(--check) center/contain no-repeat; mask: var(--check) center/contain no-repeat; }
.res.partial i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.res.partial i::after { background: var(--ink); }
.after { display: inline-flex; gap: 2px; margin-left: 6px; }
.after .link { font-size: var(--t-s); }
/* 本周进度：一条贴在行底的细线 */
.wkbar { position: absolute; left: 48px; right: 0; bottom: -1px; height: 2px; pointer-events: none; }
.wkbar i { display: block; height: 100%; background: var(--ink); }
.wkbar.lv1 i { background: var(--sand); } .wkbar.lv2 i { background: var(--clay); } .wkbar.lv3 i { background: var(--stone); }
.wkbar.lv4 i { background: linear-gradient(90deg, var(--x1), var(--x2)); }
/* 打卡后的反馈：勾号弹出、行亮一下、进度从原来的位置长到新位置 */
@keyframes seal { from { transform: scale(.2); opacity: 0; } }
@keyframes nudge { 40% { transform: translateY(-3px); } }
@keyframes glow { to { opacity: 0; } }
@keyframes fill { from { width: var(--from); } }
.add { margin-top: 40px; margin-left: -10px; }

.link { display: inline-flex; align-items: center; background: none; border: 0; padding: 0 10px; min-height: 44px; cursor: pointer; color: var(--ink-2); font-size: var(--t-m); text-decoration: none; border-radius: 6px; transition: color .15s, background-color .15s, transform .12s var(--ease); }
.link:hover { color: var(--ink); background: var(--paper-2); }
.link:active { transform: scale(.96); }

.note-line { padding: 14px 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap; }
.note-line .t { display: flex; gap: 12px; align-items: center; }

.meter, .progress { height: 2px; background: var(--rule); margin-top: 10px; position: relative; overflow: hidden; }
.meter i, .progress i { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.progress { margin: 0 0 8px; }
.progress.lv1 i { background: var(--sand); } .progress.lv2 i { background: var(--clay); } .progress.lv3 i { background: var(--stone); }
.meter.lv4 i, .progress.lv4 i { background: linear-gradient(90deg, var(--x1), var(--x2)); }

/* 层的四种成形方式 */
.core { display: block; overflow: visible; }
.ly.l1 { stroke: var(--sand); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0 5; }
.ly.l2 { fill: var(--clay); opacity: .85; }
.ly.l3 { fill: var(--stone); }
.ly.cold { fill: var(--frost) !important; stroke: var(--frost) !important; opacity: .7; }
.ly.now { opacity: .55; }
.ly-now { fill: none; stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 2 2; }
.ly-miss { stroke: var(--miss); stroke-width: 1; stroke-dasharray: 1 3; }
.ly-rest { stroke: var(--rule-2); stroke-width: .6; }
.core.cooling .ly { transition: fill .8s, stroke .8s, opacity .8s; }

.glyph { display: block; flex: none; }
.glyph.cooling { filter: grayscale(.85); opacity: .75; }

/* ---------- 目标页 ---------- */
.goal-head { display: grid; grid-template-columns: 1fr auto; gap: 32px 64px; align-items: start; margin-top: 64px; }
.goal-title { font-size: var(--t-3xl); font-weight: 300; line-height: 1.05; letter-spacing: -.03em; }
.lv-name { display: flex; align-items: center; gap: 10px; margin-top: 22px; font-size: var(--t-l); font-weight: 500; }
.lv-name .cn { color: var(--ink-3); font-weight: 400; }
.lv4 .lv-name .w { color: var(--x3); }
.std-line { color: var(--ink-2); margin-top: 18px; font-size: var(--t-l); }
.meta-line { color: var(--ink-3); margin-top: 6px; font-size: var(--t-s); }
.head-core { padding-top: 12px; }
.state { margin-top: 20px; color: var(--ink-2); font-size: var(--t-s); max-width: 40em; }
.state.cool { color: var(--stone); }
.folds { border-top: 1px solid var(--rule); }
.folds details { border-bottom: 1px solid var(--rule); }
.folds summary { list-style: none; cursor: pointer; padding: 22px 0; display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); transition: color .15s; }
.folds summary::-webkit-details-marker { display: none; }
.folds summary::after { content: ''; width: 8px; height: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); transition: transform .25s var(--ease); }
.folds details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.folds summary:hover { color: var(--ink); }
.folds details > :not(summary) { margin-bottom: 28px; }
.folds details[open] > :not(summary) { animation: fade .3s var(--ease); }
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; }
.crit { list-style: none; padding: 0; margin: 0; }
.crit li { padding: 12px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: baseline; }
.crit .ck { width: 14px; height: 14px; border: 1px solid var(--rule-2); border-radius: 50%; display: inline-block; transform: translateY(2px); }
.crit li.met .ck { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--paper); }
.crit .v { font-size: var(--t-s); color: var(--ink-3); }
.crit li.met .t { color: var(--ink-2); }

.cal { display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wl { font-size: var(--t-xs); color: var(--ink-3); align-self: center; }
.day { aspect-ratio: 1 / 1.05; min-height: 44px; border: 1px solid var(--rule); background: transparent; border-radius: 6px; padding: 5px; transition: border-color .15s, transform .12s var(--ease); display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; cursor: pointer; text-align: left; font-size: var(--t-xs); }
.day .d { color: var(--ink-3); }
.day .s { font-weight: 500; }
.day.off { border-style: dotted; }
.day.full { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.day.full .d { color: var(--paper); opacity: .7; }
.day.partial { background: linear-gradient(135deg, var(--ink) 50%, var(--paper-2) 50%); color: var(--paper); border-color: var(--ink); }
.day.partial .s { color: var(--ink); align-self: flex-end; }
.day.rest { background: repeating-linear-gradient(-45deg, var(--rule) 0 1px, transparent 1px 5px); }
.day.miss .s { color: var(--ink-3); }
.day.today { box-shadow: inset 0 0 0 2px var(--focus); }
.day[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 1px; }
.day[aria-disabled="true"] { opacity: .45; cursor: default; }
.day:hover:not([aria-disabled="true"]) { border-color: var(--ink-3); }
.day-panel { margin-top: 18px; min-height: 56px; }
.day-panel > * { animation: fade .25s var(--ease); }

.weeks-table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.weeks-table th, .weeks-table td { text-align: left; padding: 9px 8px 9px 0; border-bottom: 1px solid var(--rule); font-weight: 400; }
.weeks-table th { color: var(--ink-3); font-size: var(--t-xs); }

/* 晋级时刻：只在目标页，可跳过，不遮挡任何操作 */
.moment { margin-top: 28px; padding: 26px 24px; border: 1px solid var(--rule); background: var(--paper-3); display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; }
.moment h2 { font-size: var(--t-xl); font-weight: 400; }
.moment p { color: var(--ink-2); margin-top: 4px; }
.moment.m4 { padding: 40px 28px; border-color: transparent; background: var(--ink); color: var(--paper); }
.moment.m4 p { color: var(--paper); opacity: .75; }
.moment.m4 .btn { color: var(--paper); border-color: rgba(255, 255, 255, .3); }
.moment.cool { border-style: dashed; border-color: var(--frost); }
.draw h2, .draw p { animation: fade .6s .5s both; }
.draw.m4 h2 { animation: fade 1.2s 1.4s both; }
.draw.m4 p { animation: fade 1s 2s both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes facet { 0% { opacity: 0; transform: scale(.6) rotate(-30deg); transform-origin: center; } 60% { opacity: 1; } }
@keyframes line { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- 复盘 ---------- */
.cycle-bars { display: flex; gap: 10px; align-items: flex-end; height: 120px; margin: 18px 0 6px; }
.cb { flex: 1; max-width: 80px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 100%; }
.cb .bar { position: relative; background: var(--paper-2); height: 100%; }
.cb .bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); }
.cb .bar b { position: absolute; left: 0; right: 0; background: var(--ink-3); }
.cb .bar .line { position: absolute; left: -3px; right: -3px; border-top: 1px dashed var(--ink-2); }
.cb span { font-size: var(--t-xs); color: var(--ink-3); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 18px; margin: 24px 0; }
.fact .n { font-size: var(--t-2xl); font-weight: 300; line-height: 1; letter-spacing: -.02em; }
.fact .t { font-size: var(--t-xs); color: var(--ink-3); margin-top: 6px; }
.insight { padding: 12px 0; border-bottom: 1px solid var(--rule); max-width: 40em; }
.wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 360px; margin-top: 10px; }
.wd div { text-align: center; font-size: var(--t-xs); color: var(--ink-3); }
.wd i { display: block; height: 32px; background: var(--paper-2); position: relative; margin-bottom: 4px; }
.wd i b { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink-2); }

/* ---------- 表单 ---------- */
.form { max-width: 620px; }
.field { display: grid; gap: 6px; margin: 22px 0; }
.field > label, .field legend { font-weight: 500; padding: 0; }
.field .hint { font-size: var(--t-s); color: var(--ink-3); }
fieldset.field { border: 0; margin-left: 0; margin-right: 0; padding: 0; }
.input, textarea.input { width: 100%; min-height: 46px; padding: 10px 12px; background: var(--paper-3); border: 1px solid var(--rule-2); border-radius: 3px; }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--ink-2); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0 14px; border: 1px solid var(--rule-2); border-radius: 999px; cursor: pointer; font-size: var(--t-s); }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.sub { padding: 10px 0 0 0; }

/* ---------- 规则页 ---------- */
.rules { max-width: 44em; }
.rules h2 { font-size: var(--t-xl); font-weight: 400; margin: 56px 0 12px; }
.rules h3 { font-size: var(--t-l); margin: 28px 0 8px; display: flex; align-items: center; gap: 10px; }
.rules p, .rules li { margin: 8px 0; }
.rules ul { padding-left: 1.2em; }
.rules dl { display: grid; grid-template-columns: 7em 1fr; gap: 6px 16px; margin: 10px 0; }
.rules dt { color: var(--ink-3); }
.rules dd { margin: 0; }
.rules .lv { border-top: 1px solid var(--rule); padding-top: 4px; }

/* ---------- 提示与调试 ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); opacity: 0; transition: opacity .18s, transform .18s var(--ease); background: var(--ink); color: var(--paper); padding: 10px 10px 10px 18px; border-radius: 999px; display: flex; gap: 12px; align-items: center; font-size: var(--t-s); z-index: 30; max-width: calc(100% - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 0 12px; min-height: 34px; cursor: pointer; }
.debugbar { background: transparent; color: var(--ink-3); font-size: var(--t-xs); }
.debugbar summary { list-style: none; cursor: pointer; display: flex; gap: 12px; align-items: center; padding: 7px 0; }
.debugbar summary::-webkit-details-marker { display: none; }
.debugbar .more { margin-left: auto; opacity: .7; }
.debugbar .tools { display: flex; flex-wrap: wrap; gap: 6px 8px; padding-bottom: 10px; }
.debugbar b { font-weight: 600; color: var(--ink-2); }
.debugbar button, .debugbar input { background: var(--glass); color: var(--ink-2); border: 1px solid var(--rule-2); border-radius: 999px; padding: 0 10px; min-height: 30px; font-size: var(--t-xs); cursor: pointer; }
.debugbar input { cursor: text; }

/* ---------- 窄屏 ---------- */
@media (max-width: 720px) {
  .top { padding-top: 20px; }
  .nav a { padding: 6px 8px; }
  .nav { gap: 0; margin-right: -8px; }
  .date { margin-top: 48px; }
  .today-list { margin-top: 44px; }
  .goal-row { grid-template-columns: 24px minmax(0, 1fr); gap: 18px 16px; padding: 26px 0 28px; }
  .acts { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; }
  .acts .btn { order: -1; flex: 1; max-width: 220px; }
  .wkbar { left: 40px; }
  .goal-title { font-size: 44px; }
  .two { grid-template-columns: 1fr; gap: 32px; }
  .goal-head { grid-template-columns: 1fr; gap: 0; margin-top: 44px; }
  .moment { grid-template-columns: 1fr; }
  .cal { grid-template-columns: 36px repeat(7, minmax(0, 1fr)); gap: 3px; }
  .day { padding: 3px; }
  .rules dl { grid-template-columns: 1fr; gap: 0; }
  .rules dd { margin-bottom: 8px; }
}

/* ---------- 减弱动态效果 ---------- */
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) * { animation: none !important; transition: none !important; } }
:root[data-motion="reduce"] * { animation: none !important; transition: none !important; }

h1[tabindex="-1"]:focus { outline: none; }

/* 打完卡以后，改自评和撤销只在需要时出现（触屏始终可见） */
@media (hover: hover) {
  .after { opacity: 0; transition: opacity .2s; }
  .goal-row:hover .after, .after:focus-within { opacity: 1; }
}

/* 等级时刻：一块安静的浅底，没有边框 */
.moment { border: 0; border-radius: 14px; padding: 32px; margin-top: 40px; }
.moment.cool { border: 0; background: transparent; box-shadow: inset 0 0 0 1px var(--frost); }
.goal-head .link { margin-left: -10px; }
@media (max-width: 720px) { .moment { padding: 24px; gap: 16px; } }

/* 直白的提示 */
.hint-line { margin-top: 4px; font-size: var(--t-s); color: var(--ink-2); }
.hint-line.cold { color: var(--stone); }
.how { margin-top: 56px; max-width: 34em; font-size: var(--t-s); color: var(--ink-3); line-height: 1.8; }
.how a { color: var(--ink-2); margin-left: .4em; }

/* ---------- 今日手牌 ---------- */
.board-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-top: 64px; }
.board-h h1 { font-size: 34px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.board-h .when { color: var(--ink-3); font-size: var(--t-s); }
.board-h + .lede { margin-top: 10px; font-size: var(--t-m); color: var(--ink-3); }

/* 稀有度色：普通灰 → 稀有蓝 → 史诗紫 → 传说金 */
.r1, .b1 { --rk: var(--sand); }
.r2, .b2 { --rk: var(--clay); }
.r3, .b3 { --rk: var(--stone); }
.r4, .b4 { --rk: var(--x1); }
.badge { display: block; flex: none; color: var(--rk); overflow: visible; }
.badge.cooling { color: var(--frost); filter: grayscale(1); }

.rank { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: var(--t-s); color: var(--ink-2); }
.rank b { font-weight: 700; color: var(--rk); }
.rank small { color: var(--ink-3); font-size: var(--t-xs); }
.rank.sm { font-size: var(--t-xs); }
.rank.cooling b { color: var(--frost); }

/* 手牌：像钱包里的一叠卡。卡面材质就是稀有度，信息只留名字、目标、本周进度和一个按钮。 */
.hand { list-style: none; margin: 32px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 28px 24px; perspective: 1400px; }
.card { display: flex; flex-direction: column; min-width: 0; }
.card-in {
  --face: linear-gradient(140deg, #55575d, #2c2d31 70%);
  --face-ink: #fff; --face-ink-2: rgba(255, 255, 255, .68); --face-line: rgba(255, 255, 255, .2);
  position: relative; aspect-ratio: 1.586; display: flex; flex-direction: column; padding: 20px 22px 18px; border-radius: 20px; overflow: hidden; isolation: isolate;
  color: var(--face-ink);
  background: radial-gradient(130% 90% at 0% 0%, rgba(255, 255, 255, .28), transparent 52%), var(--face);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .08), 0 14px 34px -10px rgba(20, 20, 40, .35);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .45s var(--ease), box-shadow .3s;
}
.r2 .card-in { --face: linear-gradient(140deg, #3a8be0, #1a4b8f 72%); }
.r3 .card-in { --face: linear-gradient(140deg, #9a6cf5, #4a2a9e 72%); }
.r4 .card-in { --face: linear-gradient(125deg, #f7dc8a 0%, #d6a23a 28%, #a86f17 52%, #e9bf55 74%, #b47d1f 100%); --face-ink: #2b1b04; --face-ink-2: rgba(43, 27, 4, .7); --face-line: rgba(43, 27, 4, .2); }
.card-in.tilting { transition: transform .08s linear, box-shadow .3s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 30px 60px -16px rgba(20, 20, 40, .45); }
.cooling .card-in { filter: saturate(.25) brightness(.95); }

.c-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.c-rar { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; letter-spacing: .14em; }
.c-rar .badge { color: currentColor; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.c-rar .badge * { fill: currentColor; }
.c-lv { color: var(--face-ink-2); letter-spacing: .04em; }
.c-news { padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .22); color: inherit; font-weight: 600; text-decoration: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.c-main { margin-top: auto; min-width: 0; }
.c-name { display: block; color: inherit; font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.c-goal { margin-top: 4px; color: var(--face-ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--face-line); }
.c-week { display: grid; gap: 7px; font-size: 12px; color: var(--face-ink-2); min-width: 0; }
.pips { display: flex; gap: 3px; }
.pips i { width: 14px; height: 4px; border-radius: 2px; background: var(--face-line); }
.pips i.on { background: var(--face-ink); }
.pips i.half { background: linear-gradient(90deg, var(--face-ink) 50%, var(--face-line) 50%); }

/* 卡面上的按钮：一颗白色药丸「完成」，旁边是轻一点的「一部分」 */
.card .acts { display: flex; align-items: center; gap: 4px; margin: 0; flex: none; }
.go { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px 0 14px; border: 0; border-radius: 999px; background: #fff; color: #17171a; font-size: 15px; font-weight: 600; letter-spacing: .02em; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); transition: transform .15s var(--ease), box-shadow .2s; }
.r4 .go { background: #2b1b04; color: #f7dc8a; }
.go svg, .stamp svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.go:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, .24); }
.go:active { transform: scale(.95); }
.half-btn { min-height: 44px; padding: 0 12px; border: 0; border-radius: 999px; background: none; color: var(--face-ink-2); font-size: 14px; cursor: pointer; transition: background-color .2s, color .2s; }
.half-btn:hover { background: rgba(255, 255, 255, .16); color: var(--face-ink); }
.stamp { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 12px; border-radius: 999px; background: rgba(255, 255, 255, .2); color: inherit; font-size: 15px; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }
.r4 .stamp { background: rgba(43, 27, 4, .12); }
.stamp.partial svg path { stroke-dasharray: 3 3; }
.plus { position: absolute; right: 8px; top: -6px; font-size: 14px; font-weight: 700; pointer-events: none; animation: plus 1.2s .45s var(--ease) both; }

/* 卡下面的一行小字 */
.c-cap { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; padding: 10px 6px 0; min-height: 40px; }
.c-next { font-size: 13px; color: var(--ink-3); }
.c-next.cold { color: var(--stone); }
.c-cap .after { display: flex; gap: 0; margin-left: auto; }
.c-cap .after .link { font-size: 13px; min-height: 32px; padding: 0 8px; }

/* 反光：指针下的高光；传说卡还有一道慢慢流过的金属光 */
.glare { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; z-index: 2; background: radial-gradient(circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, .32), transparent 50%); opacity: 0; transition: opacity .3s; mix-blend-mode: soft-light; }
.tilting .glare { opacity: 1; }
.r4 .glare { opacity: .9; mix-blend-mode: soft-light; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .7) 45%, rgba(255, 255, 255, 0) 60%) var(--mx, 0%) 0 / 250% 100% no-repeat; animation: foil 6s ease-in-out infinite; }
.r4 .tilting .glare { animation: none; background-position: var(--mx) 0; }
@keyframes foil { 0% { background-position: 140% 0; } 60%, 100% { background-position: -140% 0; } }

/* 已完成：卡面压暗一点，像已经收进卡包 */
.done .card-in { filter: saturate(.75) brightness(.97); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 18px -10px rgba(20, 20, 40, .3); }

/* 完成的瞬间：卡翻一面、「已完成」落下、本周新的一格亮起、+1 浮起 */
.just .card-in { animation: flip .7s var(--ease); }
.just .stamp { animation: settle .45s .4s var(--spring) both; }
.just .pips i.on:nth-last-child(1 of .on), .just .pips i.half:nth-last-child(1 of .half) { animation: pip .5s .5s var(--spring) both; transform-origin: left; }
@keyframes flip { 0% { transform: none; } 45% { transform: rotateY(90deg) scale(1.03); } 55% { transform: rotateY(-90deg) scale(1.03); } 100% { transform: none; } }
@keyframes settle { from { transform: scale(.9); opacity: 0; } }
@keyframes pip { from { transform: scaleX(0); } }
@keyframes plus { 0% { opacity: 0; transform: translateY(6px); } 30% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-18px); } }

@media (max-width: 720px) {
  .hand { gap: 22px; }
  .card-in { padding: 18px 18px 16px; border-radius: 18px; }
  .c-name { font-size: 23px; }
}

/* 牌库：今天不用做的卡 */
.deck { margin-top: 52px; }
.deck h2 { font-size: var(--t-xs); color: var(--ink-3); font-weight: 500; margin-bottom: 6px; }
.idles { list-style: none; margin: 0; padding: 0; }
.idle { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--rule); }
.idle > a { text-decoration: none; font-weight: 500; }
.idle > a:hover { text-decoration: underline; }
.idle .muted { font-size: var(--t-s); }
.idle .link { margin-left: auto; font-size: var(--t-s); }

/* 目标页和升级时刻：一张小卡面 */
.next-say { margin: 6px 0 4px; font-size: var(--t-l); }
.next-say.cold { color: var(--stone); }
.lv-name .rank { font-size: var(--t-m); }
.head-core { display: grid; place-items: center; width: 168px; height: 200px; border-radius: 18px; border: 3px solid color-mix(in srgb, var(--rk) 60%, var(--rule)); background: color-mix(in srgb, var(--rk) 9%, var(--paper-3)); }
.head-core.r4 { border-color: var(--x2); background: repeating-conic-gradient(from 0deg at 50% 50%, color-mix(in srgb, var(--x2) 20%, transparent) 0 7deg, transparent 7deg 15deg), color-mix(in srgb, var(--x2) 10%, var(--paper-3)); }
.moment .big { display: grid; place-items: center; width: 96px; height: 116px; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--rk) 60%, var(--rule)); background: color-mix(in srgb, var(--rk) 12%, transparent); }
.draw .big { animation: flip 1s var(--ease) both; }
.draw.m4 .big { animation-duration: 1.6s; }

/* ---------- 白天 / 夜间切换 ---------- */
.top-r { display: flex; align-items: center; gap: 8px; }
.theme { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--rule-2); border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; transition: color .2s, border-color .2s, transform .15s var(--ease); }
.theme:hover { color: var(--ink); border-color: var(--ink-3); }
.theme:active { transform: scale(.92); }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme .sun { display: none; }
.is-dark .theme .sun { display: block; animation: spin .5s var(--ease); }
.is-dark .theme .moon { display: none; }
.theme .moon { animation: spin .5s var(--ease); }
@keyframes spin { from { transform: rotate(-90deg) scale(.6); opacity: 0; } }
.theme-anim, .theme-anim * { transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease) !important; }

@media (max-width: 720px) {
  .board-h { margin-top: 40px; }
  .hand { gap: 16px; }
  .c-art { height: 116px; }
  .head-core { display: none; }
}

/* ---------- 换页动画 ---------- */
/* 导航：一块胶囊在标签之间滑动，文字颜色跟着淡入淡出 */
.nav { position: relative; }
.nav a { z-index: 1; transition: color .25s var(--ease); }
.nav-pill.off { opacity: 0; }
/* 内容：新页面从下方 10px 浮上来并淡入，前几块依次出现 */
.enter > * { animation: page-in .45s var(--ease) both; }
.enter > :nth-child(2) { animation-delay: .04s; }
.enter > :nth-child(3) { animation-delay: .08s; }
.enter > :nth-child(n+4) { animation-delay: .12s; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 液态玻璃 ---------- */
/* 玻璃的四层：半透明底 + 背景模糊提饱和 + 上亮下暗的边缘高光 + 柔和投影。底下要有颜色，玻璃才看得出来。 */
:root {
  --glass: rgba(255, 255, 255, .52);
  --glass-strong: rgba(255, 255, 255, .72);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-edge-2: rgba(255, 255, 255, .25);
  --glass-shadow: 0 10px 34px rgba(40, 46, 80, .12), 0 2px 6px rgba(40, 46, 80, .06);
  --glass-blur: blur(22px) saturate(190%);
  --amb-1: rgba(43, 120, 201, .38); --amb-2: rgba(116, 73, 209, .32); --amb-3: rgba(240, 199, 90, .42); --amb-4: rgba(255, 140, 170, .22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --glass: rgba(34, 34, 40, .46); --glass-strong: rgba(48, 48, 56, .62);
    --glass-edge: rgba(255, 255, 255, .22); --glass-edge-2: rgba(255, 255, 255, .05);
    --glass-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
    --amb-1: rgba(70, 140, 230, .32); --amb-2: rgba(140, 100, 240, .3); --amb-3: rgba(232, 176, 60, .22); --amb-4: rgba(255, 110, 150, .14);
  }
}
:root[data-theme="dark"] {
  --glass: rgba(34, 34, 40, .46); --glass-strong: rgba(48, 48, 56, .62);
  --glass-edge: rgba(255, 255, 255, .22); --glass-edge-2: rgba(255, 255, 255, .05);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .3);
  --amb-1: rgba(70, 140, 230, .32); --amb-2: rgba(140, 100, 240, .3); --amb-3: rgba(232, 176, 60, .22); --amb-4: rgba(255, 110, 150, .14);
}

/* 玻璃底下的环境光：四团稀有度色的柔光，非常慢地漂 */
.ambient { position: fixed; inset: -10vmax; z-index: -1; pointer-events: none; overflow: hidden; }
.ambient i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(60px); animation: drift 38s ease-in-out infinite alternate; }
.ambient i:nth-child(1) { left: -5%; top: 0; background: radial-gradient(circle, var(--amb-1), transparent 65%); }
.ambient i:nth-child(2) { right: -10%; top: 10%; background: radial-gradient(circle, var(--amb-2), transparent 65%); animation-duration: 46s; animation-direction: alternate-reverse; }
.ambient i:nth-child(3) { left: 25%; bottom: -15%; background: radial-gradient(circle, var(--amb-3), transparent 65%); animation-duration: 52s; }
.ambient i:nth-child(4) { right: 15%; bottom: 5%; width: 40vmax; height: 40vmax; background: radial-gradient(circle, var(--amb-4), transparent 65%); animation-duration: 34s; animation-direction: alternate-reverse; }
@keyframes drift { 50% { transform: translate(6vmax, -4vmax) scale(1.1); } 100% { transform: translate(-4vmax, 5vmax) scale(.95); } }

/* 一块玻璃 */
.top, .theme, .toast, .moment, .head-core, .deck, .btn:not(.solid):not(.danger) {
  background-color: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}

/* 顶栏：浮在页面上的玻璃胶囊，滚动时一直在顶上 */
.top { position: sticky; top: 12px; z-index: 30; margin: 16px -12px 0; padding: 8px 8px 8px 22px; border-radius: 999px; border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -1px 0 var(--glass-edge-2), var(--glass-shadow); }
.theme { border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), 0 2px 8px rgba(0, 0, 0, .06); }
.board-h { margin-top: 48px; }

/* 导航的玻璃胶囊：像一滴水，移动时被拉长，到位回弹；靠近哪个标签就吸过去 */
.nav-pill { position: absolute; top: 0; bottom: 0; left: 0; right: 100%; border-radius: 999px; pointer-events: none; transform: translateX(var(--pull, 0px)); background: var(--glass-strong); border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 -2px 6px var(--glass-edge-2), 0 4px 14px rgba(0, 0, 0, .1); }
.nav-pill.ready { transition: left .5s var(--spring), right .5s var(--spring), transform .3s var(--spring), opacity .2s; }
.nav-pill.ready[data-dir="r"] { transition: right .34s cubic-bezier(.3, 1.45, .5, 1), left .58s cubic-bezier(.3, 1.25, .4, 1) .05s, transform .3s var(--spring), opacity .2s; }
.nav-pill.ready[data-dir="l"] { transition: left .34s cubic-bezier(.3, 1.45, .5, 1), right .58s cubic-bezier(.3, 1.25, .4, 1) .05s, transform .3s var(--spring), opacity .2s; }
.nav:active .nav-pill { transform: translateX(var(--pull, 0px)) scale(.94); }
.nav a { background: none !important; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* 其他玻璃面 */
.deck { margin-top: 44px; padding: 16px 20px 6px; border-radius: 20px; border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
.idle:first-child { border-top: 0; }
.idle { border-top-color: color-mix(in srgb, var(--ink) 8%, transparent); }
.moment { border-radius: 22px !important; border: 1px solid var(--glass-edge-2) !important; box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
.moment.m4 { background-color: color-mix(in srgb, var(--ink) 82%, transparent); }
.head-core { box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow); }
.toast { color: var(--ink) !important; border: 1px solid var(--glass-edge-2); box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow) !important; }

/* Chromium 里给顶栏加一点真实的折射：背景经过玻璃边缘时轻微弯曲 */
.refract .top { -webkit-backdrop-filter: url(#lg-refract) blur(14px) saturate(190%); backdrop-filter: url(#lg-refract) blur(14px) saturate(190%); }

@media (max-width: 720px) {
  .top { margin: 10px -8px 0; padding: 6px 6px 6px 16px; top: 8px; }
  .board-h { margin-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .ambient i { animation: none; } }
:root[data-motion="reduce"] .ambient i { animation: none; }
.toast button { border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
/* 提示条：按内容定宽（居中定位会把可用宽度压成一半），按钮不折行 */
.toast { width: max-content; }
.toast button { flex: none; white-space: nowrap; }
.c-cap .after { opacity: 1 !important; }

/* 装到主屏幕全屏打开时，顶栏让出状态栏和刘海 */
@media (display-mode: standalone) {
  body { padding-top: env(safe-area-inset-top); }
  .top { top: calc(8px + env(safe-area-inset-top)); }
  .debugbar { padding-top: env(safe-area-inset-top); }
}

/* ---------- 动效：发牌、完成、全清、全息、撤销 ---------- */
/* 打开今日手牌：卡从下方一张张发到桌上，带一点角度和景深模糊，落定后摆正 */
.card { position: relative; }
.enter > .hand { animation: none; }
.enter .hand > .card { animation: deal 1.1s calc(.08s + min(var(--i, 0), 6) * .13s) linear both; transform-origin: 50% 100%; }
/* 每一段自己的缓动：飞上来先快后慢，落定时轻轻一顿再摆正 */
@keyframes deal {
  0% { opacity: 0; transform: translate3d(calc(-60px + var(--i, 0) * 30px), 220px, 0) rotate(calc(-14deg + var(--i, 0) * 7deg)) rotateX(40deg) scale(.78); filter: blur(12px); animation-timing-function: cubic-bezier(.3, .55, .35, 1); }
  20% { opacity: 1; }
  62% { transform: translate3d(0, -10px, 0) rotate(calc(1.5deg - var(--i, 0) * 1deg)) rotateX(-4deg) scale(1.02); filter: blur(0); animation-timing-function: cubic-bezier(.45, 0, .3, 1); }
  100% { opacity: 1; transform: none; filter: none; }
}

/* 完成：卡翻面以后一道光从左扫到右 */
.card-in::after { content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0; transform: translateX(-120%); background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, .6) 47%, rgba(255, 255, 255, .15) 53%, transparent 64%); mix-blend-mode: overlay; }
.just .card-in::after { animation: sweep 1s .5s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes sweep { from { opacity: 1; transform: translateX(-120%); } to { opacity: 1; transform: translateX(120%); } }
.just .card-in { animation: flip .7s var(--ease), lift 1.1s var(--ease); }
@keyframes lift { 40% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 34px 60px -18px color-mix(in srgb, var(--rk) 70%, transparent); } }

/* 今天最后一张也完成了：整手牌从左到右依次闪一遍 */
.wave .card-in::after { animation: sweep 1.1s calc(1.05s + var(--i, 0) * .14s) cubic-bezier(.16, 1, .3, 1) both; }
.wave .card:not(.just) .card-in { animation: hop .7s calc(1s + var(--i, 0) * .14s) cubic-bezier(.16, 1, .3, 1) both; }
@keyframes hop { 45% { transform: translateY(-8px) rotate(-1deg); } }

/* 碎片和光圈（位置和轨迹由脚本给） */
.burst { position: absolute; z-index: 5; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; left: -3px; top: -6px; width: 6px; height: 12px; border-radius: 1.5px; box-shadow: 0 0 6px rgba(255, 255, 255, .5); }
.burst i.dot { width: 6px; height: 6px; top: -3px; border-radius: 50%; }
.burst b { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid; }
.r4 .burst i { box-shadow: 0 0 8px rgba(255, 220, 120, .8); }

/* 撤销：卡翻回去，像把卡从卡包里重新抽出来 */
.undo .card-in { animation: unflip .55s var(--ease); }
@keyframes unflip { 0% { transform: none; } 45% { transform: rotateY(-90deg) scale(.97); } 55% { transform: rotateY(90deg) scale(.97); } 100% { transform: none; } }

/* 全息：史诗和传说卡在指针下浮现一层彩虹镭射，跟着指针流动 */
.r3 .card-in::before, .r4 .card-in::before { content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s; mix-blend-mode: color-dodge;
  background: linear-gradient(115deg, transparent 18%, rgba(255, 60, 180, .55) 32%, rgba(60, 220, 255, .55) 44%, rgba(120, 255, 150, .5) 56%, rgba(255, 230, 60, .55) 68%, transparent 82%) var(--mx, 50%) var(--my, 50%) / 280% 280% no-repeat; }
.r3 .card-in.tilting::before { opacity: .32; }
.r4 .card-in.tilting::before { opacity: .45; }

/* 白天 / 夜间切换：新主题从按钮处圆形扩散，旧画面不淡出 */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* 浏览器自带的部分也跟着主题 */
::selection { background: color-mix(in srgb, var(--clay) 30%, transparent); }
input, textarea { caret-color: var(--clay); }
html { scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }

@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .burst { display: none; } }
:root[data-motion="reduce"] .burst { display: none; }
