/* 打卡页自己的一个强调色：完成/达标用绿。
   站点主色是纸+墨，没有绿色，所以在这里单独定义，只影响这个页面。 */
:root {
  --ck-ok: #2f6b4f;
}

/* 自律打卡页（/checkin）的样式。
   只在这个页面加载，所以不用给每个选择器套 .ck- 之外的前缀去躲别的页面 ——
   站点公共的纸/墨变量（--paper / --ink / --rule / --card）从 site.css 继承，
   这里只补这个页面自己的东西：环形进度、补卡条、热力图、任务清单。 */

.ck-hero {
  margin: 0 0 22px;
}

/* 只有读屏能听到的标题：这页不做大标题，但页面总得有个头 */
.ck-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.ck-hero__kicker {
  margin: 0;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .74rem;
  color: var(--ink-60);
}

/* 顶上第一眼看的是「今天什么状态」。日期是眉标，这句话是主角 */
.ck-hero__lede {
  max-width: 40em;
  margin: 9px 0 0;
  color: var(--ink-80);
  font-size: clamp(1.12rem, 2.6vw, 1.55rem);
  line-height: 1.5;
}

/* ---------- 顶部：进度环 + 统计 ---------- */
.ck-top {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  margin-bottom: 26px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.ck-ring {
  position: relative;
  width: 148px;
  height: 148px;
}

.ck-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ck-ring__track {
  fill: none;
  stroke: rgba(23, 20, 17, .08);
  stroke-width: 7;
}

.ck-ring__arc {
  fill: none;
  stroke: var(--ck-ok);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset .35s ease;
}

.ck-ring__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}

.ck-ring__num {
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.ck-ring__num strong {
  font-size: 2.3rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
}

.ck-ring__num i {
  font-style: normal;
  font-size: 1rem;
  color: var(--ink-55);
}

/* 达标 / 全清：数字变绿，环上再补一层极淡的底，一眼能看出今天守住了 */
.ck-ring.is-passed .ck-ring__num strong {
  color: var(--ck-ok);
}

.ck-ring.is-complete .ck-ring__text em {
  color: var(--ck-ok);
  font-weight: 600;
}

.ck-ring__text em {
  font-style: normal;
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--ink-60);
}

.ck-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 16px 20px;
  margin: 0;
}

.ck-stat dt {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.ck-stat dd {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 7px 0 0;
}

.ck-stat dd b {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
}

.ck-stat dd span {
  font-size: .8rem;
  color: var(--ink-60);
}

.ck-stat--main dd b {
  font-size: 2.6rem;
}

.ck-stat small {
  display: block;
  margin-top: 5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .7rem;
  line-height: 1.35;
  color: var(--ink-55);
}

.ck-stat small i {
  font-style: normal;
}

/* ---------- 卡片 ---------- */
.ck-card {
  margin-bottom: 22px;
  padding: 20px 22px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.ck-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ck-card__head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
}

.ck-jump {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .76rem;
  color: var(--ink-70);
  border-bottom: 1px solid var(--rule-strong);
}

/* ---------- 补卡条 ---------- */
.ck-days {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: thin;
}

.ck-day {
  flex: 0 0 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 0 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  text-decoration: none !important;
  transition: border-color .15s ease, background .15s ease;
}

.ck-day:hover {
  border-color: var(--rule-strong);
  background: rgba(255, 255, 255, .5);
}

.ck-day__w {
  font-size: .62rem;
  letter-spacing: .06em;
  color: var(--ink-60);
}

.ck-day__n {
  font-size: .96rem;
  color: var(--ink-80);
  line-height: 1;
}

.ck-day__bar {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: rgba(23, 20, 17, .09);
  overflow: hidden;
}

.ck-day__bar i {
  display: block;
  height: 100%;
  background: var(--ck-ok);
  transition: width .3s ease;
}

.ck-day.is-selected {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 1px 6px rgba(23, 20, 17, .08);
}

.ck-day.is-today .ck-day__w,
.ck-day.is-complete .ck-day__n {
  color: var(--ck-ok);
  font-weight: 600;
}

.ck-day.is-rest .ck-day__bar {
  background: transparent;
}

/* ---------- 任务清单 ---------- */
.ck-tasks {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.ck-task {
  background: rgba(255, 255, 255, .42);
  border: 1px solid var(--rule);
  border-radius: 8px;
  transition: border-color .15s ease, background .15s ease;
}

.ck-task:hover {
  border-color: var(--rule-strong);
}

.ck-task__btn {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 14px 15px;
  background: none;
  border: 0;
  border-radius: 8px;
  color: inherit;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.ck-task__btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.ck-task__box {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--rule-strong);
  border-radius: 6px;
  transition: background .15s ease, border-color .15s ease;
}

.ck-task__box::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg) scale(.4);
  opacity: 0;
  transition: transform .16s ease, opacity .16s ease;
}

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

.ck-task__name {
  font-family: Georgia, Iowan Old Style, 'Times New Roman', 'Songti SC', serif;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ck-task__note {
  font-size: .76rem;
  color: var(--ink-55);
}

.ck-task__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--ink-60);
}

.ck-sep {
  color: var(--ink-55);
}

.ck-task.is-done {
  background: rgba(255, 255, 255, .72);
  box-shadow: inset 3px 0 0 var(--ck-ok);
}

.ck-task.is-done .ck-task__box {
  background: var(--ck-ok);
  border-color: var(--ck-ok);
}

.ck-task.is-done .ck-task__box::after {
  opacity: 1;
  transform: rotate(42deg) scale(1);
}

.ck-task.is-done .ck-task__name {
  color: var(--ink-55);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.ck-task.is-off {
  opacity: .5;
}

.ck-task.is-off .ck-task__box {
  border-style: dashed;
}

/* 不排期的行是说明，不是能勾的框 */
.ck-task__btn--off {
  cursor: default;
}

.ck-cat {
  padding: 2px 7px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .66rem;
  font-style: normal;
  letter-spacing: .02em;
  color: var(--ck-c);
  background: var(--ck-c-bg);
}

.ck-cat--1 {
  --ck-c: #35506e;
  --ck-c-bg: #35506e1f;
}

.ck-cat--2 {
  --ck-c: #7a3f5c;
  --ck-c-bg: #7a3f5c1f;
}

.ck-cat--3 {
  --ck-c: #8a5a2b;
  --ck-c-bg: #8a5a2b1f;
}

.ck-cat--4 {
  --ck-c: #2f6f5e;
  --ck-c-bg: #2f6f5e1f;
}

.ck-cat--5 {
  --ck-c: #6b6459;
  --ck-c-bg: #6b64591f;
}

.ck-cat--6 {
  --ck-c: #3f5f7a;
  --ck-c-bg: #3f5f7a1f;
}

/* ---------- 小结 ---------- */
.ck-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
}

.ck-note label {
  display: block;
  margin-bottom: 7px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-60);
}

.ck-note textarea {
  width: 100%;
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(255, 255, 255, .6);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .92rem;
  line-height: 1.6;
  resize: vertical;
}

.ck-note textarea:focus {
  outline: none;
  border-color: var(--rule-strong);
  background: #fff;
}

.ck-note__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.ck-save {
  min-height: 1em;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .74rem;
  color: var(--ink-55);
}

.ck-save.is-ok {
  color: var(--ck-ok);
}

.ck-save.is-err {
  color: #b4452f;
}

/* ---------- 按钮 ---------- */
.ck-btn {
  padding: 9px 15px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-80);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .78rem;
  letter-spacing: .03em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .15s ease, color .15s ease;
}

.ck-btn:hover {
  background: rgba(23, 20, 17, .05);
}

.ck-btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.ck-btn--primary:hover {
  background: #000;
}

.ck-btn[disabled] {
  opacity: .5;
  cursor: default;
}

/* ---------- 热力图 ---------- */
:root {
  --ck-cell: 14px;
  --ck-gap: 3px;
}

.ck-heat {
  overflow-x: auto;
  padding-bottom: 4px;
}

.ck-heat__months {
  display: flex;
  gap: var(--ck-gap);
  margin-bottom: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .62rem;
  color: var(--ink-55);
}

.ck-heat__months span {
  flex: 0 0 var(--ck-cell);
  width: var(--ck-cell);
  white-space: nowrap;
}

.ck-heat__grid {
  display: flex;
  gap: var(--ck-gap);
}

.ck-heat__col {
  display: flex;
  flex-direction: column;
  gap: var(--ck-gap);
}

.ck-heat__cell {
  display: block;
  width: var(--ck-cell);
  height: var(--ck-cell);
  border-radius: 3px;
  background: rgba(23, 20, 17, .07);
}

.ck-heat__cell--blank {
  background: transparent;
}

.ck-heat__cell--rest {
  background: rgba(23, 20, 17, .04);
}

/* 排了却没做：泛红。跟「没排」的灰区分开，一眼能看出漏在哪天 */
.ck-heat__cell--0 {
  background: rgba(180, 69, 47, .16);
}

.ck-heat__cell--1 {
  background: #dbe7d9;
}

.ck-heat__cell--2 {
  background: #a9c9b2;
}

.ck-heat__cell--3 {
  background: #6ea684;
}

.ck-heat__cell--4 {
  background: var(--ck-ok);
}

.ck-heat__cell.is-today {
  box-shadow: 0 0 0 1.5px var(--ink);
}

.ck-heat__cell:hover {
  outline: 1px solid var(--rule-strong);
}

.ck-heat__hint,
.ck-manage__lede {
  margin: 10px 0 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .72rem;
  line-height: 1.6;
  color: var(--ink-55);
}

.ck-legend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .66rem;
  color: var(--ink-55);
}

.ck-legend .ck-heat__cell {
  margin: 0 1px;
}

/* ---------- 管理任务 ---------- */
.ck-manage summary {
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .78rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-70);
}

.ck-manage[open] summary {
  margin-bottom: 10px;
}

.ck-habit-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
}

.ck-habit {
  display: grid;
  gap: 9px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, .5);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.ck-habit__line {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ck-habit__line--sub {
  flex-wrap: wrap;
}

.ck-habit input[type='text'],
.ck-habit__name,
.ck-habit__cat,
.ck-habit__note {
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .86rem;
}

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

.ck-habit__cat {
  flex: 0 0 92px;
  width: 92px;
}

.ck-habit__note {
  flex: 1 1 140px;
  min-width: 120px;
}

.ck-habit input:focus {
  outline: none;
  border-color: var(--rule-strong);
}

.ck-habit__days {
  display: flex;
  gap: 4px;
}

.ck-habit__day {
  position: relative;
  cursor: pointer;
}

.ck-habit__day input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ck-habit__day span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .72rem;
  color: var(--ink-60);
  transition: background .15s ease, color .15s ease;
}

.ck-habit__day input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.ck-habit__day input:focus-visible + span {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.ck-habit__del {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-55);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.ck-habit__del:hover {
  border-color: var(--rule);
  color: #b4452f;
}

.ck-manage__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.ck-manage__foot .ck-save {
  margin-left: auto;
}

/* ---------- 访客模式 ---------- */
.ck-lock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 22px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
}

.ck-lock__text {
  flex: 1 1 260px;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: .78rem;
  line-height: 1.6;
  color: var(--ink-65);
}

.ck-lock__form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
}

/* display:flex 会盖掉 hidden 属性的 display:none，得自己兜一句 */
.ck-lock__form[hidden] {
  display: none;
}

/* 提示文字单独占一行，别挤在按钮旁边 */
.ck-lock__form .ck-save {
  flex: 1 1 100%;
  margin-top: 2px;
}

.ck-lock__form input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: .92rem;
}

.ck-lock__form input:focus {
  outline: none;
  border-color: var(--rule-strong);
}

/* 访客视角：清单照常看，框子淡一点，表示它现在勾不动 */
.ck-task.is-locked .ck-task__box {
  opacity: .55;
}

/* ---------- 手机 ---------- */
@media (max-width: 640px) {
  .ck-top {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
    padding: 20px 16px;
  }

  .ck-stats {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 14px;
    text-align: left;
  }

  .ck-stat dd b {
    font-size: 1.5rem;
  }

  .ck-stat--main dd b {
    font-size: 2.1rem;
  }

  .ck-card {
    padding: 17px 15px 15px;
  }

  .ck-task__btn {
    padding: 13px 12px;
  }

  .ck-habit__cat {
    flex-basis: 74px;
    width: 74px;
  }
}
