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

body {
  font-family: 'Klee One', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f0eef3 url('IMG_3070.jpg') center center / cover fixed;
  color: #111;
  height: 100dvh;
  overflow: hidden;
  overflow-x: hidden;
}

/* =============================
   ログイン画面
============================= */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  background: transparent;
}

.login-box {
  text-align: center;
  padding: 40px 32px;
}

.login-box h1 {
  font-size: 32px;
  margin-bottom: 16px;
  color: #00BCD4;
}

.login-box p {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 32px;
}

#login-btn {
  background: #00BCD4;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 14px 36px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

#login-btn:hover {
  background: #00ACC1;
}

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

/* =============================
   カレンダー画面
============================= */
#calendar-screen {
  display: none;
  flex-direction: column;
  height: 100dvh;
  background: transparent;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: rgba(240, 238, 243, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#month-title {
  font-size: 22px;
  font-weight: 600;
  font-family: 'Klee One', sans-serif;
  color: #00BCD4;
  letter-spacing: 0.05em;
}

.nav-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: #00BCD4;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
}

.nav-btn:active {
  background: #e0f7fa;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0;
}

#reload-btn {
  font-size: 18px;
}

/* =============================
   横スクロール本体
============================= */
#calendar-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#calendar-body::-webkit-scrollbar { display: none; }

/* =============================
   月パネル（前月 / 当月 / 翌月）
============================= */
.month-panel {
  min-width: 100%;
  width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* =============================
   カレンダーグリッド
============================= */
.calendar-grid-inner {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 72px;
  border-top: 2px solid rgba(216, 212, 224, 0.6);
  gap: 3px;
  padding: 3px;
  background: rgba(216, 212, 224, 0.5);
}

.day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 0;
  color: #222;
  background: rgba(228, 225, 236, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 6px 6px 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.day-header.sunday { color: #f44336; }
.day-header.saturday { color: #2196F3; }

.day-cell {
  border: none;
  padding: 3px 4px;
  min-width: 0;
  overflow: hidden;
  vertical-align: top;
  cursor: pointer;
  background: rgba(250, 249, 252, 0.75);
  border-radius: 6px;
}

.day-cell.empty {
  background: rgba(232, 229, 240, 0.4);
  border-radius: 6px;
}

.date-num {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #111;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  margin-bottom: 2px;
}

.day-cell.sunday .date-num { color: #e53935; }
.day-cell.saturday .date-num { color: #1e88e5; }
.day-cell.holiday .date-num { color: #e53935; }

.day-cell.today .date-num {
  background: #00BCD4;
  color: #fff;
}

/* =============================
   イベント
============================= */
.event-pill {
  display: block;
  font-size: 9px;
  font-weight: 700;
  font-family: 'Noto Sans JP', sans-serif;
  color: #111;
  border-radius: 2px;
  padding: 1px 1px 1px 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  max-width: 100%;
  line-height: 1.4;
  border-left: 2px solid transparent;
  background: rgba(0,0,0,0.05);
}

.more-events {
  font-size: 10px;
  color: #999;
  padding-left: 4px;
}

/* =============================
   フッター
============================= */
footer {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0 20px;
  border-top: 1px solid rgba(216, 212, 224, 0.6);
  background: rgba(240, 238, 243, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.footer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 20px;
}

.footer-btn.active {
  color: #00BCD4;
}

.footer-icon {
  font-size: 20px;
}

/* =============================
   年月ピッカー
============================= */
#month-title {
  cursor: pointer;
  user-select: none;
}
#month-title:active {
  opacity: 0.7;
}

#month-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
#month-picker-overlay.open {
  display: flex;
  animation: fadeIn 0.18s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

#month-picker {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 24px 20px 20px;
  width: 300px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

#picker-year-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
#picker-year {
  font-size: 20px;
  font-weight: 700;
  color: #222;
  font-family: 'Klee One', sans-serif;
}
#picker-prev-year, #picker-next-year {
  background: #f0eef3;
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 16px;
  color: #00BCD4;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#picker-prev-year:active, #picker-next-year:active {
  background: #e0f7fa;
}

#picker-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.picker-month-btn {
  background: #f5f4f8;
  border: none;
  border-radius: 12px;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.picker-month-btn:active {
  transform: scale(0.93);
}
.picker-month-btn.current-month {
  background: #00BCD4;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,188,212,0.35);
}
.picker-month-btn.today-month {
  border: 2px solid #00BCD4;
  color: #00BCD4;
  background: #fff;
}

/* =============================
   予定追加モーダル
============================= */
#add-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
}

#add-modal-overlay.open {
  display: flex;
}

#add-modal {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  padding-bottom: 40px;
}

.add-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.add-modal-header h3 {
  font-size: 16px;
  font-weight: bold;
}

.add-modal-header button {
  background: none;
  border: none;
  font-size: 15px;
  cursor: pointer;
  color: #00BCD4;
}

.add-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#add-title {
  border: none;
  border-bottom: 2px solid #00BCD4;
  font-size: 18px;
  padding: 8px 0;
  outline: none;
  width: 100%;
}

.allday-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #555;
}

#add-date-row, #add-time-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#add-date-row input,
#add-time-row input {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 15px;
  outline: none;
}

/* =============================
   モーダル
============================= */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}

#modal-overlay.open {
  display: flex;
}

#modal {
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-height: 60dvh;
  overflow-y: auto;
  position: relative;
}

#modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: #eee;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  color: #666;
}

.modal-date {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 16px;
  color: #333;
}

.modal-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.modal-event-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.modal-event-info {
  flex: 1;
  min-width: 0;
}

.modal-event-title {
  font-size: 15px;
  font-weight: 500;
}

.modal-event-time {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.modal-event-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.modal-event-actions button {
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.btn-edit {
  background: #e0f7fa;
  color: #00BCD4;
}

.btn-delete {
  background: #ffeaea;
  color: #f44336;
}

.modal-no-events {
  color: #aaa;
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* =============================
   ミニカレンダー（来月・再来月）
============================= */
#mini-calendars {
  display: flex;
  gap: 8px;
  padding: 12px 8px 20px;
  background: transparent;
}

.mini-cal {
  flex: 1;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 10px;
  padding: 8px 6px;
}

.mini-cal-title {
  font-size: 11px;
  font-weight: 700;
  color: #00BCD4;
  text-align: center;
  margin-bottom: 4px;
  font-family: 'Klee One', sans-serif;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.mini-day-header {
  font-size: 8px;
  font-weight: 700;
  text-align: center;
  color: #aaa;
  padding: 2px 0;
}

.mini-day-header.sunday { color: #f44336; }
.mini-day-header.saturday { color: #2196F3; }

.mini-day-cell {
  font-size: 9px;
  text-align: center;
  padding: 3px 0;
  color: #444;
  line-height: 1;
}

.mini-day-cell.sunday { color: #e53935; }
.mini-day-cell.saturday { color: #1e88e5; }

.mini-day-cell.today {
  background: #00BCD4;
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
}
