/* --- 全体スタイル定義 --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: #f2f4f8;
  color: #333;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh; /* ★追加: スマホブラウザの表示領域にフィットさせる */
  background-color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ヘッダー */
.app-header {
  padding: 12px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #eef0f3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
  height: 50px;
}

.app-header h1 {
  font-size: 1.1rem;
  color: #333;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header-action-btn {
  background: none;
  border: none;
  color: #007aff;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  margin-left: auto;
  z-index: 1;
}

/* メインコンテンツ表示エリア */
.app-content {
  flex: 1;
  padding-bottom: 70px;
  overflow-y: auto;
}

.view-page {
  display: none;
  padding: 16px;
}

.view-page.active {
  display: block;
}

/* --- 下部ナビゲーションバー --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  height: 60px;
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: #8e8e93;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  cursor: pointer;
  width: 33%;
}

.nav-item i {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.nav-item.active {
  color: #007aff;
  font-weight: bold;
}

/* --- 固定削除バー --- */
.delete-bar {
  position: fixed;
  bottom: 60px; /* ★修正: ナビバーの真上に配置し、ナビバーを隠さないようにする */
  width: 100%;
  max-width: 480px;
  height: 60px;
  background-color: #ffffff;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 16px;
  z-index: 110;
}

/* --- 本棚 (記録画面) --- */
.category-group {
  margin-bottom: 24px;
}

.category-title {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-title i {
  color: #007aff;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.book-card {
  background-color: #f9fbfd;
  border: 1.5px solid #e5e9f0;
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.book-card:active {
  transform: scale(0.96);
}

.book-card.select-mode {
  border-color: #ccc;
}

.book-card .select-checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #ccc;
  background-color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: white;
}

.book-card.select-mode .select-checkbox {
  display: flex;
}

.book-card.selected {
  border-color: #007aff;
  background-color: #f0f7ff;
}

.book-card.selected .select-checkbox {
  background-color: #007aff;
  border-color: #007aff;
}

.book-cover {
  width: 44px;
  height: 56px;
  background-color: #4a90e2;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  margin-bottom: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.book-title {
  font-size: 0.75rem;
  color: #333;
  line-height: 1.2;
  height: 2.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* フローティング追加ボタン (FAB) */
.fab {
  position: fixed;
  bottom: 75px;
  right: calc(50% - 220px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: #007aff;
  color: white;
  border: none;
  font-size: 1.4rem;
  box-shadow: 0 4px 10px rgba(0,122,255,0.3);
  cursor: pointer;
  z-index: 90;
}

@media (max-width: 480px) {
  .fab {
    right: 20px;
  }
}

/* --- レポート画面 --- */
.summary-table {
  display: flex;
  background-color: #6c757d;
  color: white;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.summary-cell {
  flex: 1;
  text-align: center;
  padding: 12px 4px;
  border-right: 1px solid rgba(255,255,255,0.2);
}

.summary-cell:last-child {
  border-right: none;
}

.summary-cell .label {
  display: block;
  font-size: 0.75rem;
  margin-bottom: 4px;
  opacity: 0.9;
}

.summary-cell .val {
  font-size: 1.1rem;
  font-weight: bold;
}

.card {
  background-color: #fff;
  border: 1px solid #eef0f3;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.highlight-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #fff8e6;
  border-color: #ffe599;
}

.highlight-card .card-icon {
  font-size: 1.8rem;
  color: #f5a623;
}

.card-label {
  font-size: 0.75rem;
  color: #888;
}

.card-title {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-header h3, .card h3 {
  font-size: 0.95rem;
  color: #444;
}

.card-header select {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 0.8rem;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 200px;
}

/* --- モーダル共通 --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: white;
  width: 85%;
  max-width: 360px;
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.input-group {
  margin-top: 12px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 4px;
}

.input-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn:disabled {
  background-color: #ccc !important;
  cursor: not-allowed;
}

.btn-primary { background: #007aff; color: white; }
.btn-secondary { background: #e5e5ea; color: #333; }
.btn-success { background: #34c759; color: white; }
.btn-danger { background: #ff3b30; color: white; }
.btn-block { width: 100%; padding: 12px; font-weight: bold; }

/* --- タイマーモーダル --- */
.timer-card { text-align: center; }
.timer-category { font-size: 0.8rem; color: #888; margin-top: 4px; }
.timer-display {
  font-size: 2.8rem;
  font-weight: bold;
  font-family: monospace;
  margin: 24px 0;
  color: #1c1c1e;
}

.timer-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #aaa;
  cursor: pointer;
}

.hidden { display: none !important; }

/* プロフィール */
.profile-card {
  text-align: center;
  padding: 40px 20px;
}
.profile-avatar {
  font-size: 4rem;
  color: #007aff;
  margin-bottom: 12px;
}