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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

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

h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: #fff;
}

.card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
  color: #ccc;
}

.hint {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 1rem;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  font-family: inherit;
}

input[type="file"] {
  display: block;
  margin-bottom: 0.75rem;
  color: #888;
}

button {
  width: 100%;
  padding: 0.75rem;
  background: #3b82f6;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}

button:hover {
  background: #2563eb;
}

button:disabled {
  background: #444;
  cursor: not-allowed;
}

.status {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  min-height: 1.2rem;
}

.status.error {
  color: #f87171;
}

.status.ok {
  color: #4ade80;
}

/* collapsible clone section */
details.collapse {
  margin-bottom: 1.5rem;
}

details.collapse[open] {
  border-color: #3b82f6;
}

details.collapse summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: #e5e7eb;
  position: relative;
  padding: 0.2rem 0;
}

details.collapse summary::-webkit-details-marker {
  display: none;
}

details.collapse summary::before {
  content: "▸";
  display: inline-block;
  margin-left: 0.5rem;
  transition: transform 0.15s;
  color: #64748b;
}

details.collapse[open] summary::before {
  transform: rotate(90deg);
}

details.collapse summary:hover {
  color: #b6c5e0;
}

.collapse-body {
  margin-top: 0.8rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.refresh-btn {
  width: auto;
  padding: 0.3rem 0.7rem;
  background: #1e293b;
  color: #93c5fd;
  font-size: 1rem;
}

.refresh-btn:hover {
  background: #334155;
}

.filters {
  margin-bottom: 1rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.filter-btn,
.filter-pill {
  width: auto;
  padding: 0.35rem 0.85rem;
  background: #1e293b;
  color: #94a3b8;
  font-size: 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.filter-btn {
  border-radius: 8px;
}

.filter-btn:hover,
.filter-pill:hover {
  background: #334155;
}

.filter-btn.active,
.filter-pill.active {
  background: #3b82f6;
  color: #fff;
}

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

.voice-card {
  background: #161616;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.voice-card:hover {
  border-color: #3b82f6;
}

.voice-card.fav {
  border-color: #fbbf24;
}

.vc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.vc-fav {
  cursor: pointer;
  color: #64748b;
  font-size: 1.1rem;
}

.vc-fav.active {
  color: #fbbf24;
}

.vc-play {
  cursor: pointer;
  color: #4ade80;
  font-size: 1rem;
  padding: 0 0.4rem;
}

.vc-play:hover {
  color: #86efac;
}

.vc-del {
  cursor: pointer;
  color: #7f1d1d;
  font-size: 0.9rem;
  padding: 0 0.2rem;
}

.vc-del:hover {
  color: #ef4444;
}

.vc-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.vc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.badge {
  background: #1e293b;
  color: #93c5fd;
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.badge.use {
  color: #a5f3fc;
  background: #164e63;
}

.voice-id-row {
  margin-top: 0.5rem;
}

.history-list {
  list-style: none;
}

.history-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #222;
  font-size: 0.85rem;
  align-items: center;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item.clickable .h-text {
  cursor: pointer;
  color: #60a5fa;
}

.history-item.clickable .h-text:hover {
  text-decoration: underline;
}

.h-time {
  color: #64748b;
  font-size: 0.75rem;
  min-width: 6rem;
}

.h-text {
  color: #e5e7eb;
  flex: 1;
}

.h-voice {
  color: #93c5fd;
  background: #1e293b;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.refresh-btn.danger {
  background: #7f1d1d;
  color: #fecaca;
}

.refresh-btn.danger:hover {
  background: #991b1b;
}

#audioPlayer {
  width: 100%;
  margin-top: 1rem;
}

.samples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sample-chip {
  width: auto;
  padding: 0.4rem 0.9rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 999px;
  color: #93c5fd;
  font-size: 0.8rem;
  cursor: pointer;
}

.sample-chip:hover {
  background: #334155;
  color: #bfdbfe;
}

.tones {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}