:root {
  --pink: #ff6b9d;
  --pink-light: #ffd6e7;
  --pink-dark: #c94b7b;
  --purple: #9b59b6;
  --bg: #fff9fb;
  --card-bg: #ffffff;
  --text: #2d2d2d;
  --text-muted: #888;
  --border: #f0d4e0;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(255, 107, 157, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pink);
  text-decoration: none;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}
.hero h1 { font-size: 2.8rem; margin-bottom: 8px; }
.subtitle { color: var(--text-muted); font-size: 1.1rem; }

/* Couple cards on index */
.couples-list { display: flex; flex-direction: column; gap: 12px; max-width: 400px; margin: 0 auto; }
.couple-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: border-color .2s, box-shadow .2s;
}
.couple-card:hover { border-color: var(--pink); box-shadow: var(--shadow); }
.couple-icon { font-size: 1.5rem; }
.couple-code {
  margin-left: auto;
  font-size: .8rem;
  background: var(--pink-light);
  color: var(--pink-dark);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .05em;
}

/* Page header */
.page-header { margin-bottom: 20px; }
.page-header h2 { font-size: 1.5rem; margin-bottom: 8px; }
.members { display: flex; gap: 8px; flex-wrap: wrap; }
.member-chip {
  background: var(--pink-light);
  color: var(--pink-dark);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: .85rem;
  font-weight: 600;
}

/* Stats */
.stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--pink); }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Tag filter */
.tag-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.tag-btn {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
}
.tag-btn:hover { border-color: var(--pink); color: var(--pink); }
.tag-btn.active { background: var(--pink); color: white; border-color: var(--pink); }

/* Tag sections */
.tag-section { margin-bottom: 32px; }
.tag-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 12px;
}

/* Wish grid */
.wish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.wish-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.wish-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,157,.18); }
.wish-card.status-planned { border-color: #a3d8f4; }
.wish-card.status-done { opacity: .7; }

.wish-title { font-weight: 600; font-size: 1rem; margin-bottom: 8px; }
.wish-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.status-badge {
  font-size: .75rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.status-badge.status-want { background: var(--pink-light); color: var(--pink-dark); }
.status-badge.status-planned { background: #d4edfc; color: #1a7ab5; }
.status-badge.status-done { background: #d4f7e0; color: #1a8044; }

.tag-chip {
  font-size: .75rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: #f3f3f3;
  color: var(--text-muted);
}

/* AI block */
.ai-block { margin-top: 10px; }
.ai-block summary {
  cursor: pointer;
  font-size: .82rem;
  color: var(--purple);
  font-weight: 600;
  user-select: none;
}
.ai-text {
  margin-top: 8px;
  font-size: .82rem;
  color: var(--text);
  white-space: pre-line;
  line-height: 1.5;
  background: #f8f4fd;
  border-radius: 8px;
  padding: 10px;
}

/* Wish card edit button */
.wish-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.wish-edit-btn {
  background: none;
  border: none;
  font-size: .85rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}
.wish-card:hover .wish-edit-btn { opacity: 1; }

/* Description */
.wish-desc {
  font-size: .82rem;
  color: #666;
  margin-bottom: 8px;
  line-height: 1.45;
}

/* Options block */
.options-block { margin-top: 10px; }
.options-block summary {
  cursor: pointer;
  font-size: .8rem;
  color: var(--purple);
  font-weight: 600;
  user-select: none;
  list-style: none;
}
.options-block summary::-webkit-details-marker { display: none; }
.options-list {
  margin: 8px 0 0 4px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.options-list li {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.4;
  padding-left: 12px;
  position: relative;
}
.options-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--pink);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box {
  background: white;
  border-radius: 18px;
  padding: 28px 24px 24px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-right: 24px;
}

/* Edit form */
.edit-fields { display: flex; flex-direction: column; gap: 14px; }
.edit-field { display: flex; flex-direction: column; gap: 5px; }
.edit-field label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
.edit-field input, .edit-field textarea, .edit-field select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: .9rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  resize: vertical;
}
.edit-field input:focus, .edit-field textarea:focus, .edit-field select:focus {
  border-color: var(--pink);
}
.edit-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.edit-save-btn {
  flex: 1;
  background: var(--pink);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 11px;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.edit-save-btn:hover { background: var(--pink-dark); }
.edit-delete-btn {
  background: none;
  border: 1.5px solid #f0d4d4;
  color: #c94b4b;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.edit-delete-btn:hover { background: #fff0f0; }

/* Done section */
.done-section .tag-heading { color: #1a8044; }
.done-section .wish-card { background: #f8fdf9; }

/* Merge toggle button */
.merge-toggle {
  background: var(--pink-light);
  color: var(--pink-dark);
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.merge-toggle:hover { background: var(--pink); color: white; }

/* Merge panel */
.merge-panel {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}
.merge-panel h3 { font-size: .95rem; margin-bottom: 10px; color: var(--text-muted); }
.merge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.merge-row select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .9rem;
  background: var(--bg);
}
.merge-row button {
  background: var(--pink);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
}
.merge-row button:hover { background: var(--pink-dark); }
.merge-result { margin-top: 8px; font-size: .85rem; color: var(--purple); }
.hidden { display: none !important; }

/* Calendar widget */
.calendar-widget {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cal-month-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.cal-nav {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-nav:hover { border-color: var(--pink); color: var(--pink); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}
.cal-dow {
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 8px;
  cursor: default;
  min-height: 44px;
  transition: background .15s;
}
.cal-day-empty { visibility: hidden; }
.cal-day-num {
  font-size: .82rem;
  color: var(--text);
  line-height: 1;
}
.cal-past .cal-day-num { color: #ccc; }
.cal-today {
  background: var(--pink-light);
}
.cal-today .cal-day-num { color: var(--pink-dark); font-weight: 700; }
.cal-has-event {
  cursor: pointer;
}
.cal-has-event:hover { background: #fff0f7; }
.cal-dots {
  display: flex;
  gap: 3px;
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pink);
}

/* Upcoming events */
.cal-upcoming {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background .15s;
}
.cal-event-row:hover { background: var(--bg); }
.cal-event-date {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 80px;
}
.cal-event-title {
  font-size: .88rem;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-soon {
  font-size: .75rem;
  background: var(--pink-light);
  color: var(--pink-dark);
  border-radius: 12px;
  padding: 2px 8px;
  white-space: nowrap;
  font-weight: 600;
}

/* Date badge on card */
.date-badge {
  font-size: .73rem;
  padding: 3px 8px;
  border-radius: 20px;
  background: #fff3e0;
  color: #b35b00;
  font-weight: 600;
}

/* Calendar highlight */
.wish-card.cal-highlight {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255,107,157,.25);
  transform: translateY(-2px);
}

/* Empty */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 8px; font-size: 1rem; }

/* Mobile */
@media (max-width: 480px) {
  .stats-row { gap: 8px; }
  .stat-num { font-size: 1.4rem; }
  .wish-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
}
