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

body {
  font-family: -apple-system, 'Hiragino Sans', sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

.header {
  background: #d32f2f;
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header h1 { font-size: 18px; font-weight: 700; }

.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 54px;
  z-index: 99;
}
.tab {
  flex: 1;
  padding: 11px 0;
  text-align: center;
  font-size: 12px;
  color: #999;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}
.tab.active { color: #d32f2f; border-bottom-color: #d32f2f; font-weight: 600; }

.content { padding: 12px; }

/* ========== ホーム ========== */
.home-greeting {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  color: white;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
}
.home-greeting h2 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.home-greeting p  { font-size: 13px; opacity: 0.85; }

.home-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #555;
  padding: 4px 2px 8px;
}

/* 未回答カード（ホーム用・横長） */
.pending-card {
  background: white;
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.pending-card-top {
  padding: 14px 16px 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.pending-type-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.pending-info { flex: 1; }
.pending-name { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.pending-meta { font-size: 13px; color: #888; }
.pending-count { font-size: 12px; color: #aaa; margin-top: 4px; }

.pending-actions {
  display: flex;
  border-top: 1px solid #f5f5f5;
}
.pending-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.pending-btn:active { opacity: 0.7; }
.pending-btn.join   { color: #2e7d32; }
.pending-btn.absent { color: #c62828; border-left: 1px solid #f5f5f5; }
.pending-btn.detail { color: #888; border-left: 1px solid #f5f5f5; font-size: 12px; }

.all-done {
  text-align: center;
  padding: 32px 16px;
  color: #aaa;
  font-size: 14px;
}
.all-done .icon { font-size: 40px; margin-bottom: 8px; }

/* ========== カレンダー ========== */
.calendar-wrap {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 12px;
}
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}
.cal-nav-btn {
  background: none; border: none;
  font-size: 22px; color: #888;
  cursor: pointer; padding: 4px 10px; border-radius: 8px;
}
.cal-nav-btn:active { background: #f5f5f5; }
.cal-month { font-size: 17px; font-weight: 700; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px; color: #999;
  padding: 0 8px 6px;
}
.cal-weekdays span:first-child { color: #e53935; }
.cal-weekdays span:last-child  { color: #1e88e5; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 8px 12px;
  gap: 2px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding-top: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.cal-day:active { background: #f5f5f5; }
.cal-day.empty  { cursor: default; }
.cal-day.today .day-num {
  background: #d32f2f; color: white;
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
}
.cal-day.selected        { background: #fff3f3; }
.cal-day.sunday .day-num { color: #e53935; }
.cal-day.saturday .day-num { color: #1e88e5; }
.cal-day.other-month .day-num { color: #ccc; }
.day-num {
  font-size: 14px; font-weight: 500;
  line-height: 26px; width: 26px; height: 26px; text-align: center;
}
.day-dots {
  display: flex; gap: 2px;
  margin-top: 2px; flex-wrap: wrap; justify-content: center;
}
.day-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.legend {
  display: flex; gap: 10px;
  padding: 0 4px 12px; flex-wrap: wrap;
}
.legend span {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: #555;
}

/* イベント作成FAB */
.fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 52px; height: 52px;
  background: #d32f2f; color: white;
  border: none; border-radius: 50%;
  font-size: 26px; line-height: 1;
  box-shadow: 0 4px 14px rgba(211,47,47,0.5);
  cursor: pointer; z-index: 150;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:active { transform: scale(0.92); }

/* イベント作成シート */
.create-sheet {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300; align-items: flex-end; justify-content: center;
}
.create-sheet.open { display: flex; }
.create-body {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 36px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
}
.create-body h3 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
.create-label { font-size: 12px; color: #888; font-weight: 600; margin-bottom: 6px; margin-top: 14px; }
.create-input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid #e0e0e0; border-radius: 10px;
  font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
.create-input:focus { border-color: #d32f2f; }

.event-name-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}
.event-name-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: #555;
  cursor: pointer; background: white;
  transition: all 0.15s;
}
.event-name-chip.selected {
  border-width: 2px;
  color: white;
}
.other-chip { color: #aaa; }
.other-chip.selected { color: white; }
.event-name-chip .chip-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.time-row { display: flex; gap: 8px; }
.time-row .create-input { flex: 1; }

/* 火災メンバー選択チップ */
.fire-member-chip {
  padding: 7px 12px;
  border: 1.5px solid #e0e0e0; border-radius: 20px;
  background: white; font-size: 13px; color: #555;
  cursor: pointer; transition: all 0.15s;
}
.fire-member-chip.selected {
  background: #c62828; border-color: #c62828; color: white; font-weight: 600;
}

.place-chip {
  padding: 8px 16px;
  border: 1.5px solid #e0e0e0; border-radius: 20px;
  background: white; font-size: 14px; color: #555;
  cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.place-chip.selected {
  background: #1a1a1a; border-color: #1a1a1a; color: white;
}
.place-chip.other { color: #aaa; }
.place-chip.other.selected { background: #888; border-color: #888; color: white; }

.create-submit {
  width: 100%; padding: 14px; margin-top: 20px;
  background: #d32f2f; color: white;
  border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.create-submit:active { opacity: 0.85; }

.day-events {
  background: white; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden; margin-bottom: 12px;
}
.day-events-header {
  padding: 12px 16px;
  background: #ffebee;
  font-size: 14px; font-weight: 700; color: #c62828;
}
.day-event-row {
  padding: 12px 16px;
  border-top: 1px solid #f5f5f5;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
}
.day-event-row:active { background: #fafafa; }
.day-event-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.day-event-info { flex: 1; }
.day-event-name { font-size: 14px; font-weight: 600; }
.day-event-time { font-size: 12px; color: #888; margin-top: 2px; }
.day-no-events { padding: 20px 16px; text-align: center; color: #bbb; font-size: 14px; }

/* ========== 一覧 ========== */
.section { margin-bottom: 16px; }
.section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 4px; margin-bottom: 6px;
}
.section-title {
  font-size: 13px; font-weight: 700; color: #555;
  letter-spacing: 0.5px;
}
.section-badge {
  font-size: 11px; background: #eee; color: #666;
  padding: 2px 8px; border-radius: 10px;
}

.event-card {
  background: white; border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden; cursor: pointer;
  transition: transform 0.15s;
}
.event-card:active { transform: scale(0.98); }
.event-card-inner {
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.event-date-block { text-align: center; min-width: 44px; }
.event-month  { font-size: 11px; color: #999; }
.event-day    { font-size: 24px; font-weight: 700; line-height: 1; }
.event-weekday{ font-size: 11px; color: #999; }
.event-info   { flex: 1; }
.event-name   { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.event-time   { font-size: 13px; color: #888; margin-bottom: 6px; }
.event-progress { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 5px; background: #eee; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; }
.progress-text { font-size: 12px; color: #888; white-space: nowrap; }
.event-status {
  display: inline-block; font-size: 11px;
  padding: 3px 10px; border-radius: 10px; font-weight: 600;
}
.status-joined  { background: #e8f5e9; color: #2e7d32; }
.status-absent  { background: #fce4ec; color: #c62828; }
.status-pending { background: #fff8e1; color: #f57f17; }
.event-arrow    { color: #ccc; font-size: 18px; }

/* ========== 一括登録バナー ========== */
.bulk-banner {
  background: #f3e5f5;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bulk-banner-info { flex: 1; }
.bulk-banner-info h3 { font-size: 14px; font-weight: 700; color: #6a1b9a; margin-bottom: 2px; }
.bulk-banner-info p  { font-size: 12px; color: #888; }
.bulk-btn {
  background: #7b1fa2; color: white;
  border: none; border-radius: 10px;
  padding: 9px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: opacity 0.2s;
}
.bulk-btn:active { opacity: 0.8; }
.bulk-btn.orange { background: #e65100; }

.group-card {
  background: white; border-radius: 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
.session-row {
  padding: 12px 16px;
  border-top: 1px solid #f5f5f5;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
}
.session-row:active { background: #fafafa; }
.session-date  { font-size: 13px; font-weight: 600; min-width: 80px; }
.session-count { flex: 1; font-size: 13px; color: #888; }

/* フィルターチップ */
.filter-chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border: 1.5px solid #e0e0e0;
  border-radius: 20px;
  background: white;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-chip.active {
  background: #d32f2f;
  border-color: #d32f2f;
  color: white;
}
.filter-chip.past { color: #aaa; border-color: #e0e0e0; }
.filter-chip.past.active { background: #757575; border-color: #757575; color: white; }

/* 夜警バナー */
.yake-banner {
  background: #fff3e0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.yake-banner-info h3 { font-size: 14px; font-weight: 700; color: #e65100; margin-bottom: 2px; }
.yake-banner-info p  { font-size: 12px; color: #888; }

/* ========== 詳細画面 ========== */
.detail-screen {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: #f0f2f5;
  max-width: 480px; margin: 0 auto;
  z-index: 200; overflow-y: auto;
}
.detail-screen.open { display: block; }
.detail-header {
  background: #d32f2f; color: white;
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
}
.back-btn {
  background: none; border: none; color: white;
  font-size: 24px; cursor: pointer; padding: 0 4px; line-height: 1;
}
.detail-title    { font-size: 17px; font-weight: 700; }
.detail-subtitle { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.detail-body { padding: 16px; }
.info-card {
  background: white; border-radius: 12px;
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.info-card h3 { font-size: 13px; color: #888; margin-bottom: 12px; font-weight: 600; }
.stats-row { display: flex; gap: 12px; }
.stat-box { flex: 1; text-align: center; padding: 12px 8px; border-radius: 10px; }
.stat-box.green { background: #e8f5e9; }
.stat-box.red   { background: #fce4ec; }
.stat-box.gray  { background: #f5f5f5; }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-box.green .stat-num { color: #2e7d32; }
.stat-box.red   .stat-num { color: #c62828; }
.stat-box.gray  .stat-num { color: #757575; }
.stat-label { font-size: 12px; color: #888; margin-top: 2px; }
.member-list { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: flex; align-items: center; gap: 6px;
  background: #f5f5f5; border-radius: 20px;
  padding: 6px 12px; font-size: 13px;
}
.member-chip.joined  { background: #e8f5e9; color: #2e7d32; }
.member-chip.absent  { background: #fce4ec; color: #c62828; }
.member-chip.pending { background: #fff8e1; color: #e65100; }
.member-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; background: #ccc;
}
.member-chip.joined  .member-avatar { background: #4caf50; }
.member-chip.absent  .member-avatar { background: #e57373; }
.member-chip.pending .member-avatar { background: #ffb74d; }

.action-bar {
  position: sticky; bottom: 0;
  background: white; padding: 12px 16px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  display: flex; gap: 10px;
}
.btn {
  flex: 1; padding: 14px; border: none;
  border-radius: 12px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: opacity 0.2s, transform 0.1s;
}
.btn:active { opacity: 0.8; transform: scale(0.97); }
.btn-join   { background: #2e7d32; color: white; }
.btn-absent { background: #f5f5f5; color: #c62828; border: 2px solid #f0f0f0; }
.btn-joined { background: #4caf50; color: white; }

/* トースト */
.toast {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323232; color: white;
  padding: 10px 20px; border-radius: 24px;
  font-size: 14px; opacity: 0;
  transition: all 0.3s; pointer-events: none;
  white-space: nowrap; z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 確認ダイアログ */
.dialog-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.dialog-overlay.open { display: flex; }
.dialog {
  background: white;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 32px;
  width: 100%; max-width: 480px;
}
.dialog h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.dialog p  { font-size: 14px; color: #666; margin-bottom: 20px; line-height: 1.6; }
.dialog-btns { display: flex; flex-direction: column; gap: 10px; }
.dialog-btn {
  padding: 14px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.dialog-btn.primary { background: #7b1fa2; color: white; }
.dialog-btn.primary.orange { background: #e65100; }
.dialog-btn.cancel  { background: #f5f5f5; color: #555; }

/* ローディング */
.loading-screen {
  position: fixed; inset: 0;
  background: white;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 500;
  gap: 16px;
}
.loading-screen p { color: #888; font-size: 14px; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #d32f2f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 自己登録画面 */
.register-screen {
  position: fixed; inset: 0;
  background: white;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 500;
  gap: 16px; padding: 32px;
  text-align: center;
}
.register-screen.show { display: flex; }
.register-screen h2 { font-size: 18px; font-weight: 700; color: #333; }
.register-screen p  { font-size: 14px; color: #555; line-height: 1.6; }
.register-btn {
  margin-top: 8px;
  padding: 14px 32px;
  background: #d32f2f;
  color: white;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
}
.register-btn:disabled { background: #aaa; }

/* エラー画面 */
.error-screen {
  position: fixed; inset: 0;
  background: white;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 500;
  gap: 16px; padding: 32px;
  text-align: center;
}
.error-screen.show { display: flex; }
.error-screen h2 { font-size: 18px; font-weight: 700; color: #333; }
.error-screen p  { font-size: 14px; color: #888; line-height: 1.6; }
