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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f0e8;
  color: #333;
  min-height: 100vh;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}

/* ヘッダー */
header {
  background: #8B6914;
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

header h1 {
  font-size: 1.4rem;
  font-weight: bold;
}

.stats {
  display: flex;
  gap: 16px;
  font-size: 0.9rem;
}

.stats span {
  background: rgba(255,255,255,0.2);
  padding: 4px 10px;
  border-radius: 20px;
}

/* フォームセクション */
.form-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.form-section h2 {
  font-size: 1rem;
  color: #8B6914;
  margin-bottom: 16px;
  font-weight: bold;
}

.form-group {
  margin-bottom: 14px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  color: #555;
  margin-bottom: 6px;
}

.required {
  color: #e05a5a;
}

input[type="text"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8B6914;
  background: #fff;
}

textarea {
  resize: vertical;
}

/* 星評価 */
.star-rating {
  display: flex;
  gap: 4px;
}

.star {
  font-size: 1.6rem;
  color: #ddd;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}

.star.active {
  color: #f5a623;
}

.star:hover {
  color: #f5a623;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: #8B6914;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

.btn-primary:hover {
  background: #7a5c10;
}

/* リストセクション */
.list-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* タブ */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  flex: 1;
  padding: 8px;
  border: 2px solid #ddd;
  background: #fafafa;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: bold;
  color: #777;
}

.tab.active {
  background: #8B6914;
  color: #fff;
  border-color: #8B6914;
}

/* 本カード */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.book-card {
  border: 1px solid #ecdfc4;
  border-radius: 10px;
  padding: 14px;
  background: #fffdf7;
  position: relative;
}

.book-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.book-title {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  flex: 1;
}

.book-author {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 6px;
}

.book-stars {
  font-size: 1rem;
  color: #f5a623;
  margin-bottom: 6px;
}

.book-memo {
  font-size: 0.85rem;
  color: #555;
  line-height: 1.5;
  background: #f9f4ea;
  border-radius: 6px;
  padding: 8px;
  margin-top: 8px;
  white-space: pre-wrap;
}

.book-status-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: bold;
  white-space: nowrap;
}

.badge-finished {
  background: #d4edda;
  color: #28a745;
}

.badge-toread {
  background: #fff3cd;
  color: #856404;
}

.book-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn-toggle {
  font-size: 0.78rem;
  padding: 4px 10px;
  border: 1px solid #8B6914;
  background: #fff;
  color: #8B6914;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-toggle:hover {
  background: #8B6914;
  color: #fff;
}

.btn-delete {
  font-size: 0.78rem;
  padding: 4px 10px;
  border: 1px solid #ddd;
  background: #fff;
  color: #999;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  margin-left: auto;
}

.btn-delete:hover {
  background: #e05a5a;
  color: #fff;
  border-color: #e05a5a;
}

.empty-msg {
  text-align: center;
  color: #aaa;
  padding: 32px 0;
  font-size: 0.95rem;
}

@media (max-width: 480px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  .stats {
    flex-wrap: wrap;
  }
}
