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

body {
  background-color: #efefef;
  color: #1e1e1e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  line-height: 1.8;
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.container {
  max-width: 900px;
  width: 100%;
}

.header-bar {
  text-align: center;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e1e1e;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 0;
}

.subtitle {
  color: #555;
  font-size: 0.9rem;
  font-weight: 400;
  padding-left: 0;
  margin-left: 0;
  border-left: none;
}

.stats {
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
  background: #ffffff;
  border: 1px solid #ccc;
  padding: 4px 18px;
  border-radius: 40px;
  align-items: center;
}

.stats span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats strong {
  color: #1e1e1e;
}

.stats .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.green {
  background: #10b981;
}

.dot.red {
  background: #e74c3c;
}

.checklist-block {
  background-color: #ffffff;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  box-shadow: 0 0px 4px rgb(18 18 18 / 15%);
  margin-bottom: 16px;
  overflow: hidden;
}

.checklist-block:last-of-type {
  margin-bottom: 0;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #eee;
  font-size: 1rem;
  font-weight: 600;
  color: #1e1e1e;
  margin: 0;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s, background-color 0.2s;
}

.block-title:hover {
  background: #fafafa;
}

.block-title .badge {
  font-size: 0.8rem;
  background: #efefef;
  color: #555;
  font-weight: 500;
  padding: 0 12px;
  border-radius: 40px;
  line-height: 22px;
}

.block-name {
  flex: 0 1 auto;
}

.block-stats,
.section-stats {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  background: #efefef;
  color: #555;
  padding: 0 10px;
  border-radius: 40px;
  line-height: 22px;
  white-space: nowrap;
}

.block-stats .c-green,
.section-stats .c-green {
  color: #10b981;
  font-weight: 700;
}

.block-stats.complete .c-green,
.section-stats.complete .c-green {
  color: #1e1e1e;
}

.block-stats .c-total,
.section-stats .c-total {
  color: #1e1e1e;
  font-weight: 700;
}

.block-stats .stat-sep,
.section-stats .stat-sep {
  color: #aaa;
  font-weight: 400;
}

/* ---- 块级折叠 ---- */
.block-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.block-body-inner {
  overflow: hidden;
  min-height: 0;
}

.checklist-block.collapsed .block-body {
  grid-template-rows: 0fr;
}

.block-title .collapse-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.25s;
}

.block-title[aria-expanded="true"] .collapse-arrow {
  transform: rotate(180deg);
}

/* ---- 分类 ---- */
.section {
  padding: 14px;
  margin-bottom: 0;
}

.section+.section {
  padding-top: 0;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.3px;
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}

.section-title:hover {
  color: #1e1e1e;
}

.section-title .collapse-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.25s;
}

.section-title[aria-expanded="true"] .collapse-arrow {
  transform: rotate(180deg);
}

.section-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-body>.item-grid {
  overflow: hidden;
  min-height: 0;
}

.section.collapsed .section-body {
  grid-template-rows: 0fr;
}

.section-title .badge {
  background: #efefef;
  color: #555;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0 12px;
  border-radius: 40px;
  line-height: 22px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #ccc;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
  user-select: none;
}

.check-item:hover {
  background: #efefef;
}

.check-item .label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e1e1e;
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 40px;
  background: #e74c3c;
  /* 红色 = 未准备 */
  transition: background 0.25s ease, box-shadow 0.2s;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.switch.checked {
  background: #10b981;
  /* 绿色 = 已准备 */
}

.switch .toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: transform 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.switch.checked .toggle-knob {
  transform: translateX(18px);
}

.switch:active .toggle-knob {
  transform: scale(0.92);
}

.switch.checked:active .toggle-knob {
  transform: translateX(18px) scale(0.92);
}

.check-item input[type="checkbox"] {
  display: none;
}

.container_que {
  text-align: center;
}

.container_que img {
  max-width: 100%;
  height: auto;
  border: none;
}

#resetBtn {
  background: #ffffff;
  border: 1px solid #ccc;
  padding: 8px 24px;
  width: 160px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e1e1e;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-family: inherit;
}

#resetBtn:hover {
  background: #efefef;
}

#resetBtn:active {
  transform: scale(0.97);
}

#resetBtn.armed {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #ffffff;
}

#resetBtn.armed:hover {
  background: #d63a2a;
}

#resetBtn.armed:active {
  transform: scale(0.97);
}

#resetBtn.done {
  background: #2196f3;
  border-color: #2196f3;
  color: #ffffff;
}

#resetBtn.done:hover {
  background: #2196f3;
}

#resetBtn:disabled {
  cursor: not-allowed;
}

#resetBtn:disabled:active {
  transform: none;
}

/* ---- 通用按钮 ---- */
.ghost-btn {
  background: #ffffff;
  border: 1px solid #ccc;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #1e1e1e;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-family: inherit;
}

.ghost-btn:hover {
  background: #efefef;
}

.ghost-btn:active {
  transform: scale(0.97);
}

.primary-btn {
  background: #1e1e1e;
  border: 1px solid #1e1e1e;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  font-family: inherit;
}

.primary-btn:hover {
  background: #333333;
}

.primary-btn:active {
  transform: scale(0.97);
}

/* ---- 加载错误 / 空内容提示 ---- */
.load-error {
  background: #fff5f5;
  border: 1px solid #e74c3c;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
  font-size: 0.92rem;
  color: #1e1e1e;
  line-height: 1.8;
}

.load-error strong {
  display: block;
  color: #e74c3c;
  margin-bottom: 6px;
}

.load-error code {
  display: inline-block;
  background: #ffecec;
  border: 1px solid #f0c4c4;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.85rem;
  word-break: break-all;
}

.load-error .hint {
  color: #666;
  font-size: 0.85rem;
}

.empty-note {
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: #666;
  margin-bottom: 16px;
}

/* ---- 设置弹窗 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: #ffffff;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e1e1e;
  margin: 0;
}

.modal-body {
  padding: 16px 18px;
}

.modal-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.modal-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1e1e1e;
  background: #ffffff;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-input:focus {
  outline: none;
  border-color: #1e1e1e;
  box-shadow: 0 0 0 2px rgba(30, 30, 30, 0.12);
}

.modal-hint {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #666;
  line-height: 1.7;
}

.modal-hint code {
  background: #efefef;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.78rem;
  word-break: break-all;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid #eee;
}

@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .header-bar {
    gap: 6px;
  }

  .stats {
    font-size: 0.85rem;
    padding: 2px 14px;
  }

  .block-stats,
  .section-stats {
    font-size: 0.72rem;
    padding: 0 8px;
    line-height: 20px;
  }

  .block-title {
    padding: 10px 12px;
  }

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

  .check-item {
    padding: 10px 12px;
  }

  .switch {
    width: 40px;
    height: 24px;
  }

  .switch .toggle-knob {
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
  }

  .switch.checked .toggle-knob {
    transform: translateX(16px);
  }

  .switch.checked:active .toggle-knob {
    transform: translateX(16px) scale(0.92);
  }
}

@media (max-width: 400px) {
  .check-item .label {
    font-size: 0.85rem;
  }
}

@media print {
  .switch {
    background: #ccc !important;
  }

  .switch.checked {
    background: #10b981 !important;
  }

  .check-item {
    break-inside: avoid;
  }

  body {
    background: white;
    padding: 10px;
  }

  .checklist-block {
    box-shadow: none;
  }
}