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

body {
  font-family: sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

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

h1 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  text-align: center;
  color: #333;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #555;
}

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

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 4px;
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: #4a90d9;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 10px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #357abd;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 10px;
  background: #eee;
  color: #555;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* 教材一覧 */
.list-section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.empty-msg {
  text-align: center;
  color: #aaa;
  padding: 20px 0;
}

.book-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  background: #fafafa;
}

.book-card:last-child {
  margin-bottom: 0;
}

.book-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.book-name {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  flex: 1;
  margin-right: 8px;
  word-break: break-all;
}

.book-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.book-delete:hover {
  color: #e55;
}

/* プログレスバー */
.progress-bar-wrap {
  background: #eee;
  border-radius: 20px;
  height: 12px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar {
  height: 100%;
  background: #4a90d9;
  border-radius: 20px;
  transition: width 0.3s;
}

.progress-bar.done {
  background: #4caf50;
}

/* 情報グリッド */
.book-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 10px;
}

.book-info span strong {
  color: #333;
}

.completion-date {
  font-size: 0.85rem;
  color: #4a90d9;
  margin-bottom: 10px;
}

.completion-date.done-label {
  color: #4caf50;
  font-weight: bold;
}

.btn-update {
  padding: 7px 14px;
  background: #fff;
  color: #4a90d9;
  border: 1.5px solid #4a90d9;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-update:hover {
  background: #4a90d9;
  color: #fff;
}

/* モーダル */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 380px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal h2 {
  margin-bottom: 16px;
  font-size: 1rem;
  color: #333;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 100;
}

.hidden {
  display: none;
}

@media (min-width: 480px) {
  .modal-actions {
    flex-direction: row;
  }
}
