:root{
  --bg: #FFFFFF;
  --text: #20242A;
  --muted: #6B7280;
  --line: rgba(17, 24, 39, 0.08);
  --blue: #22C7FF;
  --blue-soft: rgba(34, 199, 255, 0.18);
  --card-blue: rgba(34, 199, 255, 0.85);
  --card-blue-text: #FFFFFF;
  --card-gray: #A5B1BE;
  --card-gray-text: #FFFFFF;
  --shadow: 0 12px 40px rgba(17, 24, 39, 0.14);
  --radius-lg: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app{
  height: 100%;
  display:flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

/* ---- TopBar ---- */
.topbar{
  height: 86px;
  padding: 18px 18px 14px;
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.date{
  appearance: none; border: none; background: transparent;
  padding: 0; text-align: left; color: inherit;
}
.date__title{ font-size: 34px; font-weight: 800; line-height: 1.05; }
.date__sub{ margin-top: 6px; font-size: 14px; color: var(--muted); }
.mode-tag{
  margin-top: 4px; padding: 10px 12px;
  background: var(--blue-soft); color: #0B6B86;
  border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap;
}

/* ---- Content ---- */
.content{
  flex:1; overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px calc(110px + var(--safe-bottom));
}
.timeline{ display:flex; flex-direction: column; gap: 18px; }

.group{
  display:grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items:flex-start;
}
.group__label{
  font-size: 16px; font-weight: 800;
  padding-top: 10px; color: #111827;
}
.group__list{
  display:flex; flex-direction: column; gap: 10px;
  min-height: 10px;
}

/* ============================================================
   Card Row
   flex 布局：[card(flex:1)] [actions(宽度 0 → 展开)]
   ============================================================ */
.card-row{
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--radius-lg);
  /* 不 overflow:hidden，让按钮展开时也有圆角 */
}

/* 拖拽状态 */
.card-row.is-dragging{
  z-index: 50;
  box-shadow: var(--shadow);
  opacity: 0.92;
  position: relative;
}

/* ---- Card ---- */
.card{
  flex: 1;
  min-width: 0;
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.2;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  position: relative;
  transition: margin-right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.card.is-todo{ background: var(--card-blue); color: var(--card-blue-text); }
.card.is-done{ background: var(--card-gray); color: var(--card-gray-text); opacity: 0.96; }
.card .hint{
  position:absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  opacity: 0.55; font-weight: 800; letter-spacing: 2px;
  pointer-events: none;
}

/* 滑出时卡片右边留出空间给按钮 */
.card-row.is-swiped .card{
  margin-right: 8px;
}

/* ============================================================
   Action Buttons — 参考图样式
   金黄色编辑 + 粉红色删除
   圆角方形，纯图标无文字
   ============================================================ */
.card-actions{
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  /* 默认隐藏：宽度 0 + 透明 */
  width: 0;
  min-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              min-width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.25s ease;
}

/* 展开 */
.card-row.is-swiped .card-actions{
  width: 100px;
  min-width: 100px;
  opacity: 1;
}

.card-action{
  width: 44px;
  min-width: 44px;
  border: none;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, opacity 0.15s;
}
.card-action:active{
  transform: scale(0.9);
  opacity: 0.85;
}

/* 编辑：金黄色 */
.card-action--edit{
  background: #FFB800;
}
/* 删除：粉红/玫红色 */
.card-action--delete{
  background: #FF5A7A;
}

.card-action svg{
  display: block;
}

/* ---- FAB ---- */
.fab{
  position: fixed;
  right: 18px;
  bottom: calc(18px + var(--safe-bottom));
  width: 64px; height: 64px;
  border: none; border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 14px 28px rgba(34, 199, 255, 0.34);
  color: #FFFFFF;
  display:flex; align-items:center; justify-content:center;
}
.fab__plus{ font-size: 34px; font-weight: 900; margin-top: -2px; }
.fab:active{ transform: translateY(1px) scale(0.99); }

/* ---- Sheet ---- */
.sheet-backdrop{
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sheet{
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #FFF;
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  padding: 10px 18px calc(18px + var(--safe-bottom));
  box-shadow: 0 -20px 60px rgba(17, 24, 39, 0.22);
}
.sheet__grab{
  width: 44px; height: 5px;
  background: rgba(17, 24, 39, 0.14);
  border-radius: 999px; margin: 8px auto 14px;
}
.sheet__title{
  font-size: 26px; font-weight: 900; color: #111827;
  padding: 2px 0 4px;
}
.sheet__question{ margin-top: 12px; }
.sheet__textarea{
  width: 100%; border: none; resize: none;
  padding: 6px 0 0; font-size: 22px; line-height: 1.4;
  font-weight: 600; color: rgba(17, 24, 39, 0.92); outline: none;
}
.sheet__textarea::placeholder{ color: rgba(17, 24, 39, 0.15); }

.seg{ margin-top: 14px; display:flex; gap: 10px; }
.seg__item{
  flex: 1; height: 40px; border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.10);
  background: #FFF; font-size: 14px; font-weight: 800;
  color: rgba(17, 24, 39, 0.72);
}
.seg__item.is-active{
  border-color: rgba(34, 199, 255, 0.45);
  background: rgba(34, 199, 255, 0.10);
  color: #0B6B86;
}

.primary-btn{
  margin-top: 14px; width: 100%; height: 50px;
  border: none; border-radius: 16px;
  background: var(--blue); color: #FFF;
  font-size: 16px; font-weight: 900;
}
.primary-btn:active{ transform: translateY(1px); }
.primary-btn:disabled{ opacity: 0.55; }

.hidden{ display:none; }

@media (min-width: 520px){
  body{ background: linear-gradient(180deg, rgba(34,199,255,0.06) 0%, #fff 55%); }
  .app{
    max-width: 420px; margin: 0 auto;
    box-shadow: 0 22px 70px rgba(17, 24, 39, 0.12);
    border-left: 1px solid rgba(17, 24, 39, 0.06);
    border-right: 1px solid rgba(17, 24, 39, 0.06);
  }
}

