/* 极简打卡 —— 一屏、两个页面、没有导航栏 */

:root {
    --bg: #f2f2f7;
    --card: #ffffff;
    --text: #000000;
    --muted: #8e8e93;
    --faint: #c7c7cc;
    --sep: #e5e5ea;
    /* 强调色由设置里的 Colour 覆盖 */
    --accent: #af52de;
    --defer: #f06292;
    --radius: 14px;
    --tap: 52px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --card: #1c1c1e;
        --text: #ffffff;
        --muted: #8e8e93;
        --faint: #3a3a3c;
        --sep: #2c2c2e;
        --accent: #bf5af2;
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    /* 别让 iOS Safari 按容器宽度自己放大字号，那会把固定排版挤爆 */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 10px) 16px
        calc(env(safe-area-inset-bottom) + 76px);
    display: flex;
    flex-direction: column;
}

/* ── 顶栏 ── */

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 2px 0 16px;
}

.headline {
    flex: 1 1 auto;
    min-width: 0;
}

.pagetitle {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.datebtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
    padding: 4px 0 2px;
    margin-top: 1px;
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* 日期后面一个小箭头，提示点开是 Stats；Stats 页用 ‹ 返回，不再画箭头 */
.datebtn::after {
    content: '';
    flex: 0 0 auto;
    width: 5px;
    height: 5px;
    margin-left: 6px;
    border-right: 1.6px solid var(--faint);
    border-bottom: 1.6px solid var(--faint);
    transform: translateY(-1px) rotate(45deg);
}

.datebtn[data-stats="true"]::after {
    display: none;
}

.topactions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
    padding-top: 2px;
}

.iconbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.iconbtn svg {
    width: 20px;
    height: 20px;
}

.iconbtn[aria-pressed="true"] {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}

/* 同步状态：一个小圆点，点开进设置看完整文字 */
.syncdot {
    appearance: none;
    border: 0;
    background: transparent;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.syncdot::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    transition: background 0.15s ease;
}

.syncdot[data-tone="ok"]::before {
    background: #34c759;
}

.syncdot[data-tone="idle"]::before {
    background: var(--faint);
}

.syncdot[data-tone="warn"]::before {
    background: #ff9f0a;
}

.syncdot[data-tone="error"]::before {
    background: #ff3b30;
}

/* ── 底部 Tab ── */

.tabbar {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 40;
    width: 100%;
    max-width: 480px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--card);
    border-top: 1px solid var(--sep);
}

/* iOS 风味：内容从底部栏后面滑过时轻微透出并模糊 */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .tabbar {
        background: color-mix(in srgb, var(--card) 78%, transparent);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top-color: color-mix(in srgb, var(--sep) 60%, transparent);
    }
}

.tab {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 54px;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
}

.tab svg {
    width: 22px;
    height: 22px;
}

.tab span {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.01em;
}

.tab[aria-current="page"] {
    color: var(--accent);
}

/* ── 进度条 ── */

.progress {
    display: flex;
    height: 6px;
    border-radius: 3px;
    background: var(--sep);
    overflow: hidden;
}

.progress i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width 0.28s cubic-bezier(0.34, 1.36, 0.64, 1);
}

/* 明确标了"未完成"的习惯：也算处理过，但用中性灰，不跟完成混在一起 */
.progress i.p-missed {
    background: var(--muted);
}

/* Habits 页顶部的 0/4 + 进度条 */
.habitbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 16px;
}

.habitbar .progress {
    flex: 1 1 auto;
}

.habitcount {
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.habitcount.done {
    color: var(--accent);
}

/* ── 列表卡片 ── */

.card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    /* 极轻的一圈描边：纯色卡片在纯黑/纯白底上更有边界感 */
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 5%, transparent);
}

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--tap);
    padding: 8px 14px;
    border: 0;
    width: 100%;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.row + .row {
    border-top: 1px solid var(--sep);
}

.row:active {
    background: color-mix(in srgb, var(--sep) 55%, transparent);
}

/* 有批注的长行：圆点和累计天数贴着名字顶部，不再跟着整块垂直居中 */
.row.with-meta {
    align-items: flex-start;
}

.row .names {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.row .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

/* 习惯定义：最小要求、启动步骤、批注，按 - 列表逐行显示 */
.row .habitmeta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--muted);
}

.row .metaline {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 右侧的坚持天数：完成了就能点开心情/心得，没完成只是个数字 */
/* 右侧：大号的累计天数 + 下面一行小字标签 */
.total {
    flex: 0 0 auto;
    min-width: 54px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.total b {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.15;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.total i {
    font-style: normal;
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
    margin-top: 1px;
}

.row.on .name {
    opacity: 0.55;
}

.row .val {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 16px;
}

/* 今天被标成「未完成」：灰边圆点 + 灰叉 */
.row .tick.x {
    border-color: var(--muted);
}

.row .tick.x > svg {
    opacity: 0;
}

.xmark {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
}

/* 要比 .tick svg 更具体，否则会继承它的 opacity: 0 和 scale(0.6)，叉又小又看不见 */
.row .tick .xmark svg {
    width: 12px;
    height: 12px;
    opacity: 1;
    transform: none;
}

/* 圆圈 */

.tick {
    position: relative;
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--faint);
    display: grid;
    place-items: center;
    transition: background 0.15s ease, border-color 0.15s ease;
}

/* 圆点本身只有 24px，把触摸区撑到 32×40，但横向不侵入名字那一栏 */
.tick::after {
    content: '';
    position: absolute;
    inset: -8px -4px;
    border-radius: 999px;
}

.tick svg {
    width: 13px;
    height: 13px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.36, 0.64, 1);
}

.row.on .tick {
    background: var(--accent);
    border-color: var(--accent);
}

.row.on .tick svg {
    opacity: 1;
    transform: scale(1);
}

/* 今天不需要打卡（周末休息）：虚线圆点 + 名字淡一点，点了仍然可以记一笔 */
.row.rest .tick {
    border-style: dashed;
    border-color: var(--sep);
}

.row.rest .name {
    color: var(--muted);
}

/* ── 分区标题 ── */

.section {
    margin: 22px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.02em;
    padding-left: 4px;
}

/* ── 近 7 天 ── */

.days {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.days .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sep);
}

.days .dot.partial {
    background: color-mix(in srgb, var(--accent) 45%, var(--sep));
}

.days .dot.full {
    background: var(--accent);
}

.days .dot.today {
    outline: 2px solid color-mix(in srgb, var(--text) 22%, transparent);
    outline-offset: 3px;
}

.days .label {
    margin-left: auto;
    font-size: 13px;
    color: var(--muted);
}

/* ── 训练页 ── */

.workout-row .name {
    flex: 1 1 auto;
}

.workout-row .kg {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 16px;
    min-width: 66px;
    text-align: right;
}

.workout-row .reps {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 15px;
    min-width: 60px;
    text-align: right;
}

.scroller {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
}

table.history {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

table.history th,
table.history td {
    padding: 9px 10px;
    text-align: right;
    white-space: nowrap;
}

table.history th:first-child,
table.history td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--card);
}

table.history thead th {
    color: var(--muted);
    font-weight: 600;
    font-size: 12px;
    border-bottom: 1px solid var(--sep);
}

table.history tbody tr + tr td {
    border-top: 1px solid var(--sep);
}

table.history td.miss {
    color: color-mix(in srgb, var(--muted) 45%, transparent);
}

table.history tbody tr.yearrow td {
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    border-top: 1px solid var(--sep);
}

table.history tbody tr.yearrow td:first-child {
    background: var(--bg);
}

.wpickdot {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
}

table.history th:last-child,
table.history td:last-child {
    padding-right: 16px;
}

/* ── 训练：今天的表单 ── */

.wrow {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

.wrow + .wrow {
    border-top: 1px solid var(--sep);
}

.wrow-slide {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 54px;
    padding: 4px 6px 4px 14px;
    background: var(--card);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.wname {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

/* 动作名现在可点：按下进这个动作的统计页 */
.namebtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font-family: inherit;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

.win {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding: 8px 6px;
    border-radius: 7px;
}

.win:focus {
    outline: none;
    background: color-mix(in srgb, var(--sep) 62%, transparent);
}

.win.w {
    width: 74px;
    font-size: 17px;
    font-weight: 600;
}

.win.r {
    width: 84px;
    font-size: 16px;
    color: var(--muted);
}

/* 单字段动作（跑步 / 自重）：一个输入 + 自己设的单位 */
.win.s {
    width: 104px;
    font-size: 16px;
}

.unit {
    font-size: 12px;
    color: var(--muted);
    margin-right: 2px;
}

.addrow {
    border-top: 1px solid var(--sep);
}

.addbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 15px;
    width: 100%;
    min-height: 46px;
    text-align: left;
    padding: 0 14px;
    cursor: pointer;
}

.picker {
    border-top: 1px solid var(--sep);
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.picker .pick {
    appearance: none;
    border: 0;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.newname {
    flex: 1 1 100%;
    border: 1px dashed var(--faint);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    padding: 8px 10px;
    border-radius: 8px;
}

.savebar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 0 2px;
}

.savebar.tight {
    margin-top: 10px;
}

.savebtn {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
}

.hint {
    font-size: 12px;
    color: var(--muted);
}

.statusline {
    margin: 0;
    padding: 0 4px 10px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ── 空态 ── */

.empty {
    padding: 22px 16px;
    color: var(--muted);
    font-size: 15px;
    text-align: center;
}

/* ── 笔记页 ── */

.notehead {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    margin: 0 0 8px;
}

.editbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    padding: 4px 2px;
    cursor: pointer;
}

.prose {
    padding: 16px 18px 20px;
    font-size: 15.5px;
    line-height: 1.6;
}

.prose > :first-child {
    margin-top: 0;
}

.prose > :last-child {
    margin-bottom: 0;
}

/* 标题按字号分级，都能明显大于正文（正文 = 1em）；h3 以前比正文还小 */
.prose h1 {
    font-size: 1.5em;
    line-height: 1.3;
    margin: 0 0 10px;
}

.prose h2 {
    font-size: 1.25em;
    line-height: 1.35;
    margin: 20px 0 6px;
}

.prose h3 {
    font-size: 1.12em;
    line-height: 1.4;
    margin: 16px 0 4px;
}

.prose h4 {
    font-size: 1.02em;
    margin: 14px 0 4px;
}

.prose h5,
.prose h6 {
    font-size: 1em;
    margin: 12px 0 4px;
    color: var(--muted);
}

.prose p {
    margin: 0 0 10px;
}

.prose ul,
.prose ol {
    margin: 0 0 10px;
    padding-left: 22px;
}

.prose li {
    margin: 3px 0;
}

.prose li.task {
    list-style: none;
    margin-left: -20px;
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.prose li.task .box {
    color: var(--accent);
    font-size: 13px;
    flex: 0 0 auto;
}

.prose mark {
    background: color-mix(in srgb, #ffd60a 42%, transparent);
    color: inherit;
    padding: 0 2px;
    border-radius: 4px;
}

.prose code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.84em;
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 4px;
}

.prose pre {
    background: var(--bg);
    padding: 12px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0 0 10px;
}

.prose pre code {
    background: none;
    padding: 0;
    font-size: 0.81em;
    line-height: 1.6;
}

.prose blockquote {
    margin: 0 0 10px;
    padding-left: 12px;
    border-left: 3px solid var(--sep);
    color: var(--muted);
}

.prose hr {
    border: 0;
    border-top: 1px solid var(--sep);
    margin: 16px 0;
}

.prose a {
    color: var(--accent);
}

.noteedit {
    display: block;
    width: 100%;
    min-height: 58vh;
    border: 0;
    resize: none;
    background: var(--card);
    color: var(--text);
    font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace;
    padding: 16px 18px;
    border-radius: var(--radius);
    outline: none;
}

.noteedit::placeholder {
    color: var(--faint);
}

/* ── 每个习惯的近 7 天 ── */

/* 日期行：和下面点列共用同一套宽度，数字才刚好落在每个圈上方 */
.h7head {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 14px 4px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.h7head .spacer {
    flex: 1 1 auto;
    min-width: 0;
}

.h7days {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.h7days span {
    width: 14px;
    text-align: center;
}

.h7row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
}

.h7row + .h7row {
    border-top: 1px solid var(--sep);
}

.h7name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13.5px;
}

/* ── 最近 7 天全勤：整行发光 + 扫光 + 圆点波浪 ── */

.h7row.streak7 {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: linear-gradient(
        100deg,
        color-mix(in srgb, var(--accent) 18%, transparent),
        transparent 62%
    );
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}

.h7row.streak7::after {
    content: '';
    position: absolute;
    inset: -40% -30%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
    background: linear-gradient(
        100deg,
        transparent 38%,
        color-mix(in srgb, var(--accent) 55%, #fff) 50%,
        transparent 62%
    );
    transform: translateX(-75%);
    animation: streakSweep 2.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.h7row.streak7 .dot {
    box-shadow: 0 0 7px color-mix(in srgb, var(--accent) 55%, transparent);
    animation: streakDot 2.8s ease-in-out infinite;
}

.h7row.streak7 .dot:nth-child(2) {
    animation-delay: 0.08s;
}
.h7row.streak7 .dot:nth-child(3) {
    animation-delay: 0.16s;
}
.h7row.streak7 .dot:nth-child(4) {
    animation-delay: 0.24s;
}
.h7row.streak7 .dot:nth-child(5) {
    animation-delay: 0.32s;
}
.h7row.streak7 .dot:nth-child(6) {
    animation-delay: 0.4s;
}
.h7row.streak7 .dot:nth-child(7) {
    animation-delay: 0.48s;
}

.h7name .bolt {
    width: 12px;
    height: 12px;
    margin-left: 5px;
    vertical-align: -1px;
    fill: var(--accent);
    filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 70%, transparent));
    animation: boltGlow 2.8s ease-in-out infinite;
}

@keyframes streakSweep {
    0% {
        transform: translateX(-75%);
    }
    55%,
    100% {
        transform: translateX(75%);
    }
}

@keyframes streakDot {
    0%,
    62%,
    100% {
        transform: scale(1);
    }
    18% {
        transform: scale(1.38);
    }
}

@keyframes boltGlow {
    0%,
    100% {
        opacity: 0.75;
    }
    45% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .h7row.streak7::after,
    .h7row.streak7 .dot,
    .h7name .bolt {
        animation: none;
    }
}

.h7dots {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.h7dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--sep);
}

.h7dots .dot.on {
    background: var(--accent);
}

/* 周末休息：空心点，和"没做"分开 */
.h7dots .dot.rest {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--sep);
}

.hatedit {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    padding: 0;
    cursor: pointer;
}

/* ── 统计页 ── */

.hcard {
    margin-bottom: 14px;
}

.hhead {
    padding: 14px 14px 0;
}

.hname {
    font-size: 15px;
    font-weight: 600;
}

.hmapwrap {
    padding: 10px 14px 12px;
    overflow-x: auto;
}

.hmonths {
    display: grid;
    gap: 2px;
    height: 12px;
    margin-bottom: 4px;
    font-size: 9.5px;
    line-height: 1;
    color: var(--muted);
    width: max-content;
}

.hmap {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 13px);
    gap: 2px;
    width: max-content;
}

.hcell {
    width: 13px;
    height: 13px;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: var(--sep);
}

/* 只表示做没做，不跟心情走色 */
.hcell.on {
    background: var(--accent);
}

.hcell.blank {
    background: transparent;
}

/* 周末休息：不画灰块，免得看起来像缺勤 */
.hcell.rest {
    background: transparent;
}

/* 热力图下面的两个汇总：总完成次数 / 当前连击 */
.hfoot {
    display: flex;
    gap: 28px;
    padding: 0 14px 14px;
}

.hfoot span {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.hfoot b {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.hfoot i {
    font-style: normal;
    font-size: 11px;
    color: var(--muted);
}

/* ── 单个习惯的月度页 ── */

.pushhead {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 2px 0 12px;
}

.backbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text);
    width: 36px;
    height: 36px;
    padding: 0;
    margin-left: -8px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.backbtn svg {
    width: 24px;
    height: 24px;
}

.inforbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    width: 36px;
    height: 36px;
    padding: 0;
    margin-right: -8px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.inforbtn svg {
    width: 22px;
    height: 22px;
}

.pushspacer {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
}

/* 动作统计页右上角：体重叠加开关 */
.kgbtn {
    appearance: none;
    border: 0;
    background: var(--bg);
    color: var(--muted);
    width: 38px;
    height: 38px;
    margin-right: -4px;
    padding: 0;
    border-radius: 50%;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    flex: 0 0 auto;
}

.kgbtn[aria-pressed='true'] {
    background: var(--accent);
    color: #fff;
}

/* 标题真正居中：按钮和占位各占一边 */
.pushtitle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 96px);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hcalcard {
    padding: 6px 10px 14px;
}

.hcalhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 0 6px;
}

.hcalbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 22px;
    line-height: 1;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
}

.hcalbtn:disabled {
    color: var(--faint);
    cursor: default;
}

.hcallabel {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.hcalweek {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 0 0 6px;
}

.hcalweek span {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.hcal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.hcal-cell {
    appearance: none;
    border: 0;
    padding: 0;
    font: inherit;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

/* 没说打卡的日子＝很浅的强调色，和实心的"已完成"区分开 */
.hcal-cell.off {
    background: color-mix(in srgb, var(--accent) 13%, transparent);
    color: var(--muted);
}

/* 周末休息＝空心圈，不算缺勤 */
.hcal-cell.rest {
    background: transparent;
    color: var(--faint);
    box-shadow: inset 0 0 0 1px var(--sep);
}

/* 明确标了「未完成」＝浅一档的强调色 + 大一点的白叉盖住日期 */
.hcal-cell.skip {
    background: color-mix(in srgb, var(--accent) 32%, transparent);
    color: color-mix(in srgb, var(--accent) 55%, #000);
    font-size: 17px;
    font-weight: 700;
}

/* 浅色模式下白叉看不清，改回深一档的强调色；深色模式用纯白 */
@media (prefers-color-scheme: dark) {
    .hcal-cell.skip {
        color: #fff;
    }
}

.hcal-cell.on {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* 还没到的日子＝不画圈，只留淡淡的数字 */
.hcal-cell.future {
    color: var(--faint);
    cursor: default;
}

.hcal-cell.today {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 26%, transparent);
}

/* 统计四宫格 */
.statcard {
    padding: 14px 14px 16px;
}

.schead {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    padding: 0 2px 10px;
}

.sgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.scard {
    background: color-mix(in srgb, var(--sep) 45%, var(--card));
    border-radius: 12px;
    padding: 10px 12px 12px;
}

.slabel {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    line-height: 1.25;
    color: var(--muted);
    min-height: 18px;
}

.sico {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--accent);
}

.sico svg {
    width: 12px;
    height: 12px;
}

.svalue {
    margin-top: 6px;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.svalue i {
    font-style: normal;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    margin-left: 5px;
}

.swapbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    margin-left: 2px;
    border-radius: 6px;
    cursor: pointer;
}

/* 这个月的打卡日志 */
.mlist {
    padding: 14px 0 6px;
}

.mlist .schead {
    padding: 0 16px 8px;
}

.mitem {
    padding: 10px 16px;
}

.mitem + .mitem {
    border-top: 1px solid var(--sep);
}

.mrow {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mtick {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: transparent;
}

.mtick.on {
    background: var(--accent);
    color: #fff;
}

.mtick.miss {
    color: var(--muted);
}

.mdate {
    flex: 1 1 auto;
    font-size: 15px;
    color: var(--muted);
}

.memoji {
    font-size: 17px;
    line-height: 1;
}

.mnote {
    margin: 6px 0 0 32px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--muted);
}

/* 补记抽屉里的两个状态开关：Done / Not done */
.daytoggles {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.donetoggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 8px;
    border: 0;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 14.5px;
    cursor: pointer;
}

.donetoggle .dtbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--faint);
    display: grid;
    place-items: center;
    font-size: 12px;
    color: transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.donetoggle.on {
    background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.donetoggle.on .dtbox {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* 「未完成」走灰色，不抢强调色 */
.donetoggle.x {
    background: color-mix(in srgb, var(--muted) 14%, var(--bg));
}

.donetoggle.x .dtbox {
    border-color: var(--muted);
    color: var(--muted);
}

/* ── 每日状态弹层 ── */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadein 0.18s ease;
}

@keyframes fadein {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.sheet {
    width: 100%;
    max-width: 480px;
    background: var(--card);
    border-radius: 20px 20px 0 0;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
    animation: slideup 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideup {
    from {
        transform: translateY(24px);
    }
    to {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .overlay,
    .sheet {
        animation: none;
    }
}

.sheet-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.sheet-sub {
    margin-top: 2px;
    font-size: 13px;
    color: var(--muted);
}

.moods {
    display: flex;
    gap: 10px;
    margin: 16px 0 6px;
}

.mood {
    /* min-width:0 + padding:0 才允许被压缩，否则按钮的 min-content（emoji + 浏览器默认内边距）
       会把整行顶出屏幕 —— 窄屏上第五个就是这么跑出去的 */
    appearance: none;
    -webkit-appearance: none;
    flex: 1 1 0;
    min-width: 0;
    padding: 0;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid transparent;
    background: transparent;
    font-size: clamp(22px, 7.6vw, 30px);
    line-height: 1;
    /* iOS 上 button 的匿名行盒会把 emoji 顶偏：关掉原生外观，
       改用 flex 居中一个块级 span，位置才是确定的 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    filter: grayscale(0.7);
    transition: transform 0.14s ease, background 0.14s ease, border-color 0.14s ease,
        opacity 0.14s ease, filter 0.14s ease;
}

.mood > span {
    display: block;
    line-height: 1;
}

.mood.sel {
    background: color-mix(in srgb, var(--m) 14%, transparent);
    border-color: var(--m);
    opacity: 1;
    filter: none;
    transform: scale(1.06);
}

.moodlabels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    padding: 0 4px;
}

.statenote {
    width: 100%;
    margin-top: 14px;
    border: 0;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    padding: 12px;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

.statenote::placeholder {
    color: var(--faint);
}

.sheet-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.sheet-actions .savebtn {
    flex: 1 1 auto;
}

.sheet-actions .savebtn:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* 编辑习惯定义的 sheet：字段竖排，textarea 可以拉着改高度 */
.editsheet,
.aboutsheet {
    max-height: 82vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sheetfield {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.sheetfield > span {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
}

.sheetfield input,
.sheetfield textarea {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.sheetfield input::placeholder,
.sheetfield textarea::placeholder {
    color: var(--faint);
}

/* 习惯编辑里的开关行：文字在左，iOS 式开关在右 */
.sheetcheck {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    cursor: pointer;
}

.sheetcheck-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.sheetcheck-text b {
    font-size: 14px;
    font-weight: 500;
}

.sheetcheck-text i {
    font-style: normal;
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--muted);
}

.sheetcheck input {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    position: relative;
    width: 46px;
    height: 28px;
    margin: 0;
    border-radius: 999px;
    background: var(--sep);
    cursor: pointer;
    transition: background 0.18s ease;
}

.sheetcheck input::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.sheetcheck input:checked {
    background: var(--accent);
}

.sheetcheck input:checked::after {
    transform: translateX(18px);
}

/* 动作类型：两个互斥选项 */
.seg2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 3px;
    border-radius: 10px;
    background: var(--bg);
}

.seg2 button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 9px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.seg2 button.on {
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 8%, transparent);
}

.fieldhint {
    margin: 7px 2px 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--muted);
}

.formerror {
    min-height: 16px;
    margin: 8px 2px 0;
    font-size: 12.5px;
    color: #ff3b30;
}

/* 月度页的 About：最小要求 / 启动步骤 / 完整批注 */
.aboutrow {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 16px;
}

.aboutlabel {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: uppercase;
}

.aboutvalue {
    font-size: 16px;
}

.aboutblock {
    margin-top: 18px;
}

.aboutblock > .aboutlabel {
    display: block;
    margin-bottom: 6px;
}

.launcherlist {
    margin: 0;
    padding-left: 22px;
    font-size: 15px;
    line-height: 1.45;
}

.launcherlist li {
    margin: 4px 0;
}

.prose.aboutmd {
    padding: 0;
    font-size: 14.5px;
    line-height: 1.55;
}

/* ── 体重 ── */

.weightcard {
    margin-bottom: 4px;
}

.weighthead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 0;
}

.wlabel {
    font-size: 15px;
    font-weight: 600;
}

.wdate {
    font-size: 13px;
    color: var(--muted);
}

.weightbody {
    padding: 4px 14px 12px;
}

.wvalue {
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.wunit {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-left: 3px;
}

.wdelta {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
}

.wchart {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 6px;
}

.wchart .warea {
    fill: color-mix(in srgb, var(--accent) 14%, transparent);
    stroke: none;
}

.wchart .wline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.wchart .wdot {
    fill: var(--accent);
}

/* 叠加的体重线：虚线 + 自己独立的纵轴刻度，颜色和主数据分开 */
.wchart .wline2 {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.4;
    stroke-dasharray: 4 3;
    stroke-linejoin: round;
    stroke-linecap: round;
    opacity: 0.9;
}

.wchart .wdot2 {
    fill: var(--muted);
}

.wchart .ctick {
    font-size: 10px;
    fill: var(--muted);
    font-variant-numeric: tabular-nums;
}

.elegend {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--muted);
}

.elegend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.elegend .sw {
    width: 10px;
    height: 3px;
    border-radius: 2px;
}

.elegend .sw1 {
    background: var(--accent);
}

.elegend .sw2 {
    background: var(--muted);
}

.wcaption {
    margin-top: 6px;
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ── 训练月度热力图 ── */

.wocard {
    margin-top: 10px;
}

.womonth {
    display: flex;
    align-items: center;
    gap: 2px;
}

.wobtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 19px;
    line-height: 1;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

.wobtn:disabled {
    color: var(--faint);
    cursor: default;
}

.wolabel {
    min-width: 74px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.wobody {
    padding: 2px 14px 12px;
}

.woweek {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    padding-bottom: 5px;
}

.woweek span {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.wogrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.wocell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-height: 46px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

/* 日期下面的体重：比日期大一号；没体重的日子也占住这一行，日期才对得齐 */
.woweight {
    min-height: 15px;
    font-size: clamp(12px, 3.6vw, 14.5px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--muted);
}

.wocell.l1 .woweight,
.wocell.l2 .woweight,
.wocell.l3 .woweight,
.wocell.l4 .woweight {
    color: var(--text);
}

.wocell.l5 .woweight {
    color: #fff;
}

.wocell.l1 {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--text);
}

.wocell.l2 {
    background: color-mix(in srgb, var(--accent) 36%, transparent);
    color: var(--text);
}

.wocell.l3 {
    background: color-mix(in srgb, var(--accent) 52%, transparent);
    color: var(--text);
}

.wocell.l4 {
    background: color-mix(in srgb, var(--accent) 70%, transparent);
    color: var(--text);
}

.wocell.l5 {
    background: var(--accent);
    color: #fff;
}

.wocell.future {
    opacity: 0.35;
}

.wocell.today {
    box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--text) 30%, transparent);
}

.wocap {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.weightentry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 14px;
}

.weightentry input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 20px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    padding: 8px 10px;
    outline: none;
    text-align: right;
}

.savebtn.small {
    padding: 8px 14px;
    font-size: 14px;
}

/* ── 训练动作管理 ── */

.exrow {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 6px 8px 6px 14px;
}

.exrow + .exrow {
    border-top: 1px solid var(--sep);
}

.exname {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.exmeta {
    margin-left: 7px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--muted);
}

.exaddbtn.wide {
    flex: 1 1 auto;
}

/* 设置里的排序箭头：比删除按钮窄，避免挤掉名字 */
.orderbtn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    line-height: 1;
    width: 26px;
    height: 34px;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.orderbtn svg {
    width: 18px;
    height: 18px;
}

.orderbtn:disabled {
    color: var(--faint);
    cursor: default;
}

.exdel {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--faint);
    font-size: 19px;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    cursor: pointer;
}

.exadd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--sep);
}

.exadd input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    padding: 9px 10px;
    border-radius: 8px;
    outline: none;
}

.exaddbtn {
    appearance: none;
    border: 0;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 14px;
    border-radius: 8px;
    flex: 0 0 auto;
    cursor: pointer;
}

/* ── 步进器（设置里的加减） ── */

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex: 0 0 auto;
}

.stepper b {
    min-width: 42px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.stepbtn {
    appearance: none;
    border: 0;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 17px;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
}

/* ── 强调色（设置里的色块） ── */

.swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    justify-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.swatch {
    appearance: none;
    border: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: var(--s);
    cursor: pointer;
    flex: 0 0 auto;
    transition: box-shadow 0.15s ease;
}

.swatch.on {
    box-shadow:
        0 0 0 2px var(--card),
        0 0 0 4px var(--s);
}

/* ── 连接设置 ── */

.setup {
    padding: 2px 0;
}

.field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    min-height: 48px;
}

.field + .field {
    border-top: 1px solid var(--sep);
}

.field > span {
    flex: 0 0 86px;
    font-size: 14px;
    color: var(--muted);
}

.field input,
.field select {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 16px;
    text-align: right;
    padding: 6px 0;
    outline: none;
}

.field input::placeholder {
    color: var(--faint);
}

.danger {
    color: #ff3b30;
}

.muted {
    color: var(--muted);
}

.warn {
    color: #ff3b30;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

/* ── 底栏 ── */

.pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--sep);
    color: var(--muted);
    font-size: 11.5px;
}

/* ── 等级页 ── */

.lvlhero {
    padding: 18px 16px 14px;
    background:
        radial-gradient(
            130% 120% at 100% 0%,
            color-mix(in srgb, var(--accent) 11%, transparent),
            transparent 62%
        ),
        var(--card);
}

.lvlrealm {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.08;
}

.lvlxpline {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.lvlxpline b {
    color: var(--text);
    font-size: 17px;
    font-weight: 600;
}

.lvlbar {
    height: 8px;
    border-radius: 4px;
    margin-top: 12px;
}

.lvlbar i {
    animation: lvlfill 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes lvlfill {
    from {
        width: 0;
    }
    to {
        width: var(--w);
    }
}

.lvlnext {
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.lvlmeta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.lvltoday {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--sep);
    font-size: 11.5px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.lvltoday span.on {
    color: var(--accent);
    font-weight: 600;
}

.dims {
    margin-top: 0;
}

.dimrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
}

.dimrow + .dimrow {
    border-top: 1px solid var(--sep);
}

.dimbadge {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 12%, var(--bg));
    color: var(--accent);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}

.dimmain {
    flex: 1 1 auto;
    min-width: 0;
}

.dimname {
    display: flex;
    align-items: baseline;
    gap: 7px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.dimname i {
    font-style: normal;
    font-size: 11px;
    font-weight: 500;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dimpips {
    display: flex;
    gap: 3px;
    margin-top: 6px;
}

.dimpips i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--sep);
}

.dimpips i.on {
    background: var(--accent);
}

.dimright {
    flex: 0 0 auto;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dimright b {
    display: block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.dimright i {
    font-style: normal;
    font-size: 11px;
    color: var(--muted);
}

.ladder {
    padding: 4px 0;
}

.ladderrow {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--muted);
    font-size: 12.5px;
}

.ladderrow + .ladderrow {
    border-top: 1px solid var(--sep);
}

.ladderrow.now {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    box-shadow: inset 3px 0 0 var(--accent);
    color: var(--text);
}

.laddername {
    font-weight: 600;
    color: var(--text);
}

.ladderrow.now .laddername {
    color: var(--accent);
}

.ladderstages {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--muted);
}

.ladderxp {
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.ladderrow.now .ladderxp {
    color: var(--accent);
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .lvlbar i {
        animation: none;
    }
}
