/* =====================================================
   今日の気分ログ – stylesheet
   ===================================================== */

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

:root {
  /* Mood palette */
  --c-sky:      #87CEEB;
  --c-sunshine: #FFE082;
  --c-coral:    #FFAB91;
  --c-mint:     #A5D6A7;
  --c-lavender: #CE93D8;
  --c-peach:    #FFCC80;
  --c-mist:     #B0BEC5;
  --c-indigo:   #9FA8DA;

  /* UI palette */
  --bg:         #F4F2EF;
  --card:       #FFFFFF;
  --accent:     #6AB4CF;
  --accent-lt:  #E2F4FA;
  --text:       #2A2A2A;
  --text-2:     #6A6A6A;
  --text-3:     #A0A0A0;
  --border:     #E6E2DC;
  --danger:     #F47875;

  --r:   14px;
  --r-s: 8px;
  --sh:  0 2px 14px rgba(0,0,0,.07);
  --sh2: 0 4px 24px rgba(0,0,0,.11);

  --nav-h: 62px;
  --font-head: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', sans-serif;
  --font-body: 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', sans-serif;
}

/* ---- Base ---- */

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(246, 252, 255, 0.7) 42%, rgba(244, 242, 239, 0.9) 100%),
    url("./assets/background-summer-sea.png") center top / cover fixed no-repeat,
    var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--nav-h);
}

button {
  font-family: inherit;
  cursor: pointer;
}

textarea, input, select {
  font-family: inherit;
  font-size: 15px;
}

/* ---- Bottom nav ---- */

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  backdrop-filter: blur(14px);
}

.nav-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 6px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-3);
  font-size: 11px;
  transition: color .18s;
}
.nav-btn.active { color: var(--accent); }
.nav-icon { font-size: 21px; line-height: 1; }

/* ---- Tabs ---- */

#app { max-width: 680px; margin: 0 auto; }

.tab {
  display: none;
  padding: 16px 14px 24px;
  animation: fadeUp .2s ease;
}
.tab.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Card ---- */

.card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--r);
  padding: 18px 16px;
  box-shadow: var(--sh);
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(12px);
}

.card-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: .02em;
}

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 14px;
}

.card-danger {
  border: 1.5px solid #FFDCDB;
}

/* ---- Input card ---- */

.input-card { margin-bottom: 14px; }

.input-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 8px;
}

.today-date {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.today-badge {
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-lt);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 9px;
  margin-top: 15px;
}
.field-label:first-of-type { margin-top: 0; }

.field-hint {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}

/* Label picker */

.label-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 7px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 13px;
  color: var(--text-2);
  transition: all .15s;
  cursor: pointer;
}
.label-chip:hover  { border-color: var(--accent); color: var(--accent); }
.label-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.label-icon {
  width: 26px;
  height: 26px;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

/* Energy picker */

.energy-picker {
  display: flex;
  gap: 6px;
}

.energy-star {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  font-size: 17px;
  color: var(--text-3);
  transition: background .15s, color .15s, transform .1s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.energy-star:hover  { transform: scale(1.1); }
.energy-star.active { background: var(--c-sunshine); color: #7a5c00; }

/* Note textarea */

.note-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  padding: 10px 12px;
  font-size: 15px;
  resize: none;
  background: #FAFAF8;
  color: var(--text);
  transition: border-color .2s;
  line-height: 1.5;
}
.note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}
.note-input::placeholder { color: var(--text-3); }

/* Save button */

.save-btn {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-s);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .04em;
  transition: opacity .15s, transform .1s;
}
.save-btn:hover   { opacity: .9; }
.save-btn:active  { transform: scale(.99); }

/* Utility buttons */

.btn-outline {
  padding: 9px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, color .15s;
  cursor: pointer;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-share {
  padding: 9px 18px;
  border: 1.5px solid var(--accent);
  border-radius: var(--r-s);
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
  cursor: pointer;
}
.btn-share:hover { background: var(--accent); color: #fff; }

.btn-primary {
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-s);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost {
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--text-3);
  font-size: 14px;
  cursor: pointer;
}

.btn-danger {
  padding: 9px 18px;
  border: 1.5px solid var(--danger);
  border-radius: var(--r-s);
  background: #fff;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.row-btns {
  display: flex;
  gap: 8px;
}
.row-btns > * { flex: 1; }

/* ---- Mini card (today + detail) ---- */

.mini-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r-s);
  background: var(--bg);
}

.mini-swatch {
  width: 48px;
  height: 48px;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.mini-body { flex: 1; min-width: 0; }

.mini-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.mini-label { font-size: 14px; font-weight: 700; }
.mini-stars { font-size: 12px; color: #c09000; }
.mini-note  { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Monthly summary ---- */

.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.summary-stat {
  text-align: center;
  background: var(--bg);
  border-radius: var(--r-s);
  padding: 10px 6px;
}

.stat-num {
  display: block;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
}

.stat-key {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
  letter-spacing: .03em;
}

.summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-2);
}

.empty-msg {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  padding: 12px 0;
}

/* ---- Auto summary ---- */

.auto-summary {
  background: var(--accent-lt);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--accent);
  line-height: 1.65;
  border: 1px solid rgba(107,180,207,.25);
}
.auto-summary p + p { margin-top: 6px; }

/* ---- Recent card ---- */

.recent-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-card:last-child { border-bottom: none; }

.recent-swatch {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.recent-body  { flex: 1; min-width: 0; }
.recent-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.recent-label { font-size: 14px; font-weight: 600; }
.recent-date  { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.recent-note  { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta  { font-size: 12px; color: #c09000; margin-top: 2px; }

/* ---- Log card (list tab) ---- */

.log-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 14px 14px 12px;
  margin-bottom: 10px;
  box-shadow: var(--sh);
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.log-swatch {
  width: 54px;
  height: 54px;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.log-body  { flex: 1; min-width: 0; }
.log-top   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.log-label { font-size: 15px; font-weight: 700; }
.log-date  { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.log-note  { font-size: 13px; color: var(--text-2); margin-bottom: 6px; line-height: 1.5; }
.log-meta  { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); }

/* ---- Empty state ---- */

.empty {
  text-align: center;
  padding: 36px 16px;
}

.empty-art {
  margin: 0 auto 16px;
}

.empty-illustration {
  width: min(190px, 72%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 10px 18px rgba(135, 206, 235, 0.18));
}

.empty-blob {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-sky), var(--c-lavender));
  margin: 0 auto 16px;
  opacity: .4;
}

.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.6;
}

/* ---- Calendar ---- */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.cal-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
}

.month-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .15s, color .15s;
  cursor: pointer;
}
.month-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
}

.cwd {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  padding: 8px 0;
  letter-spacing: .04em;
}
.cwd.sun { color: #e86561; }
.cwd.sat { color: #5b8eef; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px;
  background: var(--bg);
}

.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 4px 4px;
  border-radius: 8px;
  cursor: pointer;
  background: var(--card);
  transition: background .12s;
  min-height: 52px;
  position: relative;
}
.cal-cell:hover   { background: #EBF6FB; }
.cal-cell.empty   { background: transparent; cursor: default; }
.cal-cell.sun .cal-day-num { color: #e86561; }
.cal-cell.sat .cal-day-num { color: #5b8eef; }

.cal-cell.today .cal-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.cal-dot {
  width: min(64px, 92%);
  height: min(64px, 92%);
  display: block;
  border-radius: 50%;
  object-fit: contain;
  margin-top: 2px;
}

.cal-dot-empty {
  width: 8px;
  height: 8px;
}

/* Day detail sheet */

.day-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.day-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.3);
}

.day-sheet-panel {
  position: absolute;
  bottom: var(--nav-h);
  left: 0;
  right: 0;
  max-width: 680px;
  margin: 0 auto;
  background: var(--card);
  border-radius: var(--r) var(--r) 0 0;
  box-shadow: var(--sh2);
  padding: 18px 16px 24px;
  animation: slideUp .22s ease;
  max-height: 60vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.day-sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.day-sheet-ttl {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
}

.close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-2);
}

.day-sheet-body .mini-card + .mini-card { margin-top: 8px; }

/* ---- List tab ---- */

.list-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-sel {
  flex: 1;
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  background: var(--card);
  font-size: 13px;
  color: var(--text);
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23A0A0A0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ---- Settings ---- */

.settings-h1 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.banner-img {
  width: 100%;
  height: auto;
  aspect-ratio: 800 / 418;
  border-radius: var(--r-s);
  margin-bottom: 12px;
  object-fit: contain;
}


/* ---- Toast ---- */

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,30,.82);
  color: #fff;
  padding: 9px 20px;
  border-radius: 24px;
  font-size: 13px;
  z-index: 999;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  pointer-events: none;
  animation: toastIn .18s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Overlay / Dialog ---- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dialog {
  background: var(--card);
  border-radius: var(--r);
  padding: 24px 20px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--sh2);
}

.dialog-msg {
  font-size: 15px;
  line-height: 1.65;
  text-align: center;
  margin-bottom: 18px;
  color: var(--text);
}

.dialog-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.dialog-btns > button { flex: 1; }

/* ---- Desktop tweaks ---- */

@media (min-width: 640px) {
  body {
    padding-bottom: 0;
    padding-top: 56px;
  }

  .bottom-nav {
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
  }

  .nav-btn {
    flex-direction: row;
    gap: 6px;
    font-size: 14px;
    padding: 14px 20px;
  }

  .nav-icon { font-size: 18px; }

  .toast {
    bottom: 24px;
  }

  .day-sheet-panel {
    bottom: 0;
  }

  .tab { padding: 20px 20px 32px; }
}
