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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  background: #fdf7f9;
  color: #333;
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 80px;
}

header { text-align: center; padding: 16px 0 8px; }
header h1 { font-size: 1.6rem; color: #c2185b; }
.subtitle { color: #888; font-size: 0.85rem; margin-top: 4px; }

.edit-title-btn {
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 0.75rem;
  line-height: 1;
  vertical-align: middle;
  background: none;
  border: 1px solid #f0c4d6;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.edit-title-btn:hover { opacity: 1; background: #fce4ec; }

.point-link {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: #c2185b;
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(194, 24, 91, 0.25);
  transition: transform 0.1s, box-shadow 0.15s;
}
.point-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(194, 24, 91, 0.35);
}
.point-link:active {
  transform: translateY(0);
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}
@media (min-width: 600px) {
  .summary { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: white;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: center;
}
.card-label { font-size: 0.75rem; color: #888; margin-bottom: 4px; }
.card-value { font-size: 1.2rem; font-weight: 700; color: #c2185b; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.tab {
  flex: 1;
  min-width: 80px;
  padding: 10px 8px;
  background: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #666;
  white-space: nowrap;
  transition: all 0.15s;
}
.tab.active {
  background: #c2185b;
  color: white;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.hint {
  font-size: 0.8rem;
  color: #777;
  background: #fff3e0;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.hint code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.activity-list, .usage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  background: white;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: opacity 0.2s;
}
.activity-item.done { opacity: 0.55; }
.activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.activity-info {
  cursor: pointer;
  user-select: none;
}
.chev {
  display: inline-block;
  font-size: 0.75rem;
  color: #aaa;
  margin-left: 2px;
}
.activity-item.open .chev { color: #c2185b; }

.history {
  border-top: 1px dashed #eee;
  padding-top: 8px;
  margin-top: 2px;
}
.history-title {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 6px;
  font-weight: 600;
}
.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 180px;
  overflow-y: auto;
}
.history-list li {
  font-size: 0.78rem;
  color: #555;
  background: #fafafa;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.history-list .hist-text { flex: 1; min-width: 0; }
.history-list .hist-del {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #bbb;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.history-list .hist-del:hover {
  background: #fde0e6;
  color: #c2185b;
}
.history-list li.empty {
  color: #aaa;
  background: transparent;
  padding: 4px 0;
  font-style: italic;
}

.history-add {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.history-add input[type="date"] {
  flex: 1;
  min-width: 140px;
  font-size: 0.8rem;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  color: #333;
}
.history-add button {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid #c2185b;
  background: white;
  color: #c2185b;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.history-add button:hover:not(:disabled) {
  background: #c2185b;
  color: white;
}
.history-add button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.activity-info { flex: 1; min-width: 0; }
.activity-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.activity-meta {
  font-size: 0.75rem;
  color: #888;
  line-height: 1.4;
}
.activity-point {
  font-size: 0.85rem;
  color: #c2185b;
  font-weight: 600;
  white-space: nowrap;
}

.counter {
  display: flex;
  align-items: center;
  gap: 4px;
}
.counter button {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #c2185b;
}
.counter button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.counter .count {
  min-width: 50px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ─── 댓글 카운터 ─────────────────────────────────── */
.comment-hint {
  margin-top: 24px;
}
.comment-counter {
  background: white;
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.comment-count {
  font-size: 3rem;
  font-weight: 700;
  color: #c2185b;
  line-height: 1;
  margin-bottom: 16px;
}
.comment-count .comment-target {
  font-size: 1.4rem;
  font-weight: 600;
  color: #bbb;
}
.comment-bar {
  height: 10px;
  background: #f0e6eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
}
.comment-bar-fill {
  height: 100%;
  width: 0;
  background: #c2185b;
  border-radius: 6px;
  transition: width 0.2s ease;
}
.comment-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}
.cc-btn {
  flex: 1;
  max-width: 130px;
  height: 56px;
  border-radius: 12px;
  border: none;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
}
.cc-plus { background: #c2185b; color: white; }
.cc-minus { background: #f7f7f7; color: #c2185b; border: 1px solid #eedce4; }
.cc-btn:active { transform: scale(0.97); }
.cc-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.comment-quick {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.cc-quick {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #eedce4;
  background: white;
  color: #c2185b;
  font-weight: 600;
  cursor: pointer;
}
.cc-quick:disabled { opacity: 0.4; cursor: not-allowed; }
.cc-reset { color: #999; border-color: #eee; margin-left: auto; }

.usage-item {
  background: white;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.usage-name { font-weight: 600; }
.usage-limit { color: #c2185b; font-weight: 600; }

footer {
  margin-top: 24px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reset-btn {
  background: transparent;
  border: 1px solid #ddd;
  color: #888;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
}
.reset-btn:hover { color: #c2185b; border-color: #c2185b; }

/* ─── Phase 2: 사용자 식별 / 환영 화면 ──────────────────── */
.user-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #c2185b;
  background: white;
  padding: 4px 12px;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.user-info .user-slug { color: #aaa; font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace; font-size: 0.75rem; }

.app-loading {
  text-align: center;
  padding: 40px;
  color: #888;
  font-size: 0.9rem;
}

.welcome { margin: 24px 0; }
.welcome h2 { color: #c2185b; font-size: 1.2rem; margin-bottom: 4px; }
.welcome > .hint { margin-bottom: 16px; }

.welcome-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.welcome-card h3 { font-size: 0.95rem; color: #333; margin-bottom: 8px; }
.welcome-card .hint { background: #f7f7f7; }

.welcome-row { display: flex; gap: 6px; flex-wrap: wrap; }
.welcome-row input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e0c4d0;
  border-radius: 8px;
  font-size: 0.9rem;
}
.welcome-row .btn {
  padding: 10px 16px;
  background: #c2185b;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.welcome-row .btn:hover { filter: brightness(1.05); }

.welcome-error {
  margin-top: 8px;
  padding: 8px 12px;
  background: #ffebee;
  color: #c62828;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ─── Toast ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100% - 32px);
}
.toast {
  background: white;
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-size: 0.9rem;
  border-left: 3px solid #888;
  color: #444;
  pointer-events: auto;
  animation: toast-in 0.2s ease-out;
  max-width: 360px;
}
.toast.error   { border-left-color: #c62828; color: #c62828; }
.toast.success { border-left-color: #2e7d32; color: #2e7d32; }
.toast.info    { border-left-color: #1976d2; color: #1976d2; }
.toast.fade-out { opacity: 0; transition: opacity 0.3s; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── 모달 (alert/confirm/prompt 대체) ────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modal-overlay-in 0.15s ease-out;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: white;
  border-radius: 16px;
  padding: 24px 22px 18px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: modal-in 0.18s ease-out;
}
.modal-message {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.55;
  white-space: pre-line;
  margin: 0 0 18px;
}
.modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 18px;
}
.modal-input:focus {
  outline: none;
  border-color: #c2185b;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-btn {
  padding: 9px 18px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
}
.modal-ok { background: #c2185b; color: white; }
.modal-ok:active { transform: scale(0.97); }
.modal-cancel { background: #f7f7f7; color: #666; border-color: #eee; }
.modal-cancel[hidden] { display: none; }
@keyframes modal-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
