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

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

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: #1a1a1a;
}

/* Upload Page */
.upload-area {
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 4rem 2rem;
  text-align: center;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #0070f3;
  background: #f0f7ff;
}

.upload-area p {
  font-size: 1.1rem;
  color: #666;
}

.upload-area .hint {
  font-size: 0.875rem;
  color: #999;
  margin-top: 0.5rem;
}

.upload-area .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

#fileInput {
  display: none;
}

.upload-status {
  margin-top: 1rem;
  text-align: center;
}

.upload-status.loading {
  color: #0070f3;
}

.upload-status.error {
  color: #d32f2f;
}

/* Book Page */
.book-info {
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.book-info h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.book-info p {
  color: #666;
}

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

.chapter-header h3 {
  font-size: 1rem;
  color: #1a1a1a;
}

.chapter-actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.btn-primary {
  background: #0070f3;
  color: #fff;
}

.btn-primary:hover {
  background: #005bb5;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.chapter-list {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  max-height: 400px;
  overflow-y: auto;
}

.chapter-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

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

.chapter-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.75rem;
  cursor: pointer;
}

.chapter-item label {
  flex: 1;
  cursor: pointer;
  font-size: 0.9375rem;
}

.selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.selection-count {
  color: #666;
  font-size: 0.9375rem;
}

/* Status */
.status-area {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #fff;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.status-area.loading {
  color: #0070f3;
}

.status-area.success {
  color: #2e7d32;
}

.status-area.error {
  color: #d32f2f;
}

.status-area a {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 2rem;
  background: #0070f3;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
}

.status-area a:hover {
  background: #005bb5;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #0070f3;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
