:root {
  color-scheme: dark;
  --bg: #14141a;
  --surface: #1e1e26;
  --surface-2: #262631;
  --border: #33333f;
  --text: #e8e8ee;
  --text-dim: #9797a6;
  --accent: #a684ff;
  --accent-hover: #b99bff;
  --danger: #ff6b7a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  line-height: 1.5;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header {
  margin-bottom: 24px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 4px;
}

.subtitle {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

input[type="text"],
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button {
  background: var(--accent);
  color: #1a1225;
  border: none;
  border-radius: 6px;
  padding: 9px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 6px 12px;
}

button.secondary:hover {
  border-color: var(--accent);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-weight: 500;
  padding: 6px 12px;
}

button.danger:hover {
  background: rgba(255, 107, 122, 0.12);
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.controls #search-input {
  flex: 1;
  min-width: 160px;
}

select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 10px;
  font-size: 0.85rem;
  font-family: inherit;
}

select:focus {
  outline: none;
  border-color: var(--accent);
}

.rating-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rating-field-label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.star-input {
  display: flex;
  gap: 2px;
}

.star-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px;
  cursor: pointer;
}

.star-btn.filled {
  color: var(--accent);
}

.star-btn:hover {
  color: var(--accent-hover);
}

.entry-rating {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 1px;
  flex: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.entry-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.chevron {
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  flex: none;
}

.chevron.open {
  transform: rotate(90deg);
}

.entry-body {
  margin-top: 12px;
}

.entry-name {
  font-size: 1.05rem;
  font-weight: 700;
  word-break: break-word;
}

.entry-date {
  color: var(--text-dim);
  font-size: 0.78rem;
  white-space: nowrap;
}

.field {
  margin-bottom: 10px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.field-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 160px;
  overflow-y: auto;
}

.entry-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.entry-body > input,
.entry-body > textarea {
  margin-bottom: 10px;
}

.empty {
  color: var(--text-dim);
  text-align: center;
  padding: 40px 0;
}
