* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  background-color: #fdf6f8;
  background-image: url("./assets/yumekawa-bg-tile.png");
  background-repeat: repeat;
  background-size: 420px 420px;
  background-attachment: fixed;
  color: #4a3540;
  min-height: 100vh;
}
header {
  background: linear-gradient(135deg, #fce4ec, #f8bbd0, #e1bee7);
  padding: 14px 14px 20px;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(233,150,180,0.3);
}
header h1 {
  font-size: clamp(1.35rem, 3.4vw, 2.15rem);
  color: #c2185b;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.top-actions {
  position: absolute;
  top: 10px;
  right: 14px;
  display: flex;
  gap: 8px;
}
.chat-link,
.mini-btn {
  border: 1.5px solid #f48fb1;
  background: rgba(255,255,255,0.72);
  color: #c2185b;
  border-radius: 20px;
  padding: 4px 10px;
  text-decoration: none;
  font-size: 0.78rem;
  cursor: pointer;
}
.filters {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.filter-btn {
  min-width: 82px;
  padding: 8px 18px;
  border: 2px solid #f48fb1;
  background: rgba(255,255,255,0.55);
  color: #c2185b;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
  font-weight: 700;
}
.filter-btn.active,
.filter-btn:hover {
  background: linear-gradient(135deg, #f48fb1, #ce93d8);
  color: white;
  border-color: transparent;
}
.search-box {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}
.search-box input {
  padding: 8px 18px;
  border: 2px solid #f48fb1;
  background: rgba(255,255,255,0.82);
  color: #4a3540;
  border-radius: 999px;
  font-size: 0.86rem;
  width: min(340px, calc(100vw - 36px));
}
.search-box input::placeholder { color: #b990a0; }
.search-box input:focus {
  outline: none;
  border-color: #ce93d8;
  box-shadow: 0 0 8px rgba(206,147,216,0.3);
}
.sync-status {
  margin-top: 8px;
  color: #9d7486;
  font-size: 0.72rem;
  font-weight: 700;
}
.sync-status:empty {
  display: none;
}
.conversation-list {
  padding: 22px clamp(22px, 10vw, 120px);
  max-width: 1080px;
  margin: 0 auto;
}
.conv-card {
  width: 100%;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  border: 0;
  border-left: 5px solid #f48fb1;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(233,150,180,0.15);
  overflow: hidden;
}
.conv-card.kotemaru { border-left-color: #81d4fa; }
.conv-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(233,150,180,0.25);
}
.conv-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 8px;
}
.date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #ad8495;
  font-size: 0.78rem;
  font-weight: 700;
}
.rec-id { font-size: 0.7rem; }
.char-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex: 0 0 auto;
}
.character {
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  color: white;
}
.character.tetsuro { background: linear-gradient(135deg, #f48fb1, #e91e63); }
.character.kotemaru { background: linear-gradient(135deg, #81d4fa, #7e57c2); }
.device {
  color: #b0879a;
  font-size: 0.62rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}
.title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.conv-title {
  flex: 1 1 auto;
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  font-weight: 800;
  color: #4a3540;
  line-height: 1.35;
  user-select: text;
}
.conv-title.untitled { color: #a98a98; }
.line-count {
  color: #c49baa;
  font-size: 0.74rem;
  font-weight: 700;
}
.card-actions {
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
}
.card-delete {
  border: 1.5px solid #f2a0b8;
  background: #fff;
  color: #c2185b;
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}
.copy-btn {
  border: 1px solid #d9bad0;
  background: rgba(255,255,255,0.86);
  color: #9b6f84;
  border-radius: 999px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.35;
  flex: 0 0 auto;
}
.copy-btn:hover {
  border-color: #81d4fa;
  color: #5b86a3;
}
.copy-btn.copied {
  border-color: #81d4fa;
  background: #eefaff;
  color: #2f7899;
}
.title-copy {
  margin-top: 2px;
}
.conv-detail {
  display: none;
  padding: 24px 16px;
  max-width: 980px;
  margin: 0 auto;
}
.conv-detail.show { display: block; }
.back-btn,
.delete-btn {
  background: linear-gradient(135deg, #f48fb1, #ce93d8);
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  margin: 0 8px 16px 0;
  box-shadow: 0 2px 8px rgba(233,150,180,0.3);
}
.delete-btn {
  background: white;
  color: #c2185b;
  border: 1.5px solid #f48fb1;
}
.conv-content {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 22px;
  line-height: 1.85;
  white-space: pre-wrap;
  font-size: 1rem;
  color: #4a3540;
  box-shadow: 0 2px 10px rgba(233,150,180,0.12);
}
.speaker-ayaka { color: #e91e63; font-weight: 800; }
.speaker-tetsuro { color: #c2185b; font-weight: 800; }
.speaker-kotemaru { color: #7e57c2; font-weight: 800; }
.loading,
.empty {
  text-align: center;
  padding: 60px 20px;
  color: #b990a0;
  font-weight: 700;
}
@media (max-width: 700px) {
  header h1 { font-size: 1.35rem; }
  .top-actions {
    position: static;
    justify-content: center;
    margin-bottom: 12px;
  }
  .filter-btn {
    min-width: 74px;
    padding: 8px 15px;
    font-size: 0.86rem;
  }
  .conversation-list {
    padding: 16px 14px;
  }
  .conv-card {
    padding: 12px 14px;
  }
  .conv-card .meta {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
  }
  .date-row {
    flex-wrap: wrap;
    font-size: 0.78rem;
  }
  .char-side {
    align-items: flex-end;
    width: auto;
    flex: 0 0 auto;
  }
  .character {
    padding: 2px 10px;
    font-size: 0.7rem;
  }
  .device {
    font-size: 0.6rem;
  }
  .conv-title {
    font-size: 0.98rem;
    margin-bottom: 3px;
  }
  .copy-btn {
    display: none;
  }
  .line-count {
    font-size: 0.72rem;
  }
  .card-actions {
    margin-top: 4px;
  }
  .card-delete {
    padding: 3px 11px;
    font-size: 0.7rem;
  }
}
