
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600&family=Yomogi&display=swap');

textarea {
  font-family: 'Yomogi', cursive;
  font-size: 18px;
  line-height: 2;
  font-weight: 400;
}

:root {
  --bg: #f8f4ec;
  --paper: #fffdf8;
  --accent: #b9a7d3;
  --text: #514b57;
  --border: #e7dfed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
}

.app {
  max-width: 850px;
  margin: auto;
  padding: 25px;
}

header {
  text-align: center;
  padding: 25px 0;
}

.logo {
  font-family: Georgia, serif;
  font-size: 35px;
  color: var(--accent);
}

.subtitle {
  font-size: 13px;
  letter-spacing: 2px;
}

nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 35px;
}

button {
  border: none;
  border-radius: 20px;
  padding: 11px 18px;
  cursor: pointer;
  background: #eee7f4;
  color: var(--text);
}

button:hover {
  filter: brightness(0.95);
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.date {
  text-align: center;
  font-family: Georgia, serif;
  font-size: 23px;
  margin-bottom: 20px;
}

.paper {
  min-height: 500px;
  background:
    repeating-linear-gradient(
      transparent,
      transparent 32px,
      #eae4dc 33px
    ),
    var(--paper);
  padding: 35px;
  border-radius: 12px;
  box-shadow: 0 5px 25px #0000000b;
}

.paper h1 {
  font-family: Georgia, serif;
  font-size: 28px;
  text-align: center;
}

.message {
  text-align: center;
  font-style: italic;
  color: #a59aab;
  margin-bottom: 35px;
}

.diary-section {
  background: #ffffffb8;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.section-header h3 {
  font-family: Georgia, serif;
  font-size: 22px;
  color: var(--accent);
  margin: 5px 0 15px;
}

textarea {
  width: 100%;
  min-height: 110px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffffaa;
  resize: vertical;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.8;
}

.add-btn,
.save-btn,
.back-btn {
  display: block;
  margin: 20px auto;
}

.save-btn {
  background: var(--accent);
  color: white;
  padding: 15px 35px;
}

.category {
  margin: 30px 0;
}

.category h3 {
  color: var(--accent);
}

.section-options {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(180px, 1fr)
  );
  gap: 12px;
}

.option-card {
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 15px;
  cursor: pointer;
  text-align: left;
}

.option-card strong {
  display: block;
  margin-bottom: 8px;
}

.option-card span {
  font-size: 12px;
  color: #91899a;
}

.option-card.selected {
  border: 2px solid var(--accent);
  background: #f1ebf7;
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 25px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.calendar-day {
  min-height: 70px;
  padding: 10px;
  border-radius: 10px;
  background: var(--paper);
  text-align: center;
  cursor: pointer;
}

.calendar-day.has-diary {
  background: #e8ddf2;
  border: 2px solid var(--accent);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.diary-card,
.setting-card {
  padding: 20px;
  background: var(--paper);
  border-radius: 15px;
  margin: 15px 0;
}

#searchInput {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

@media (max-width: 500px) {
  .app {
    padding: 12px;
  }

  .paper {
    padding: 18px;
  }

  .calendar-day {
    min-height: 50px;
    padding: 5px;
    font-size: 12px;
  }
}


.section-header > div {
  display: flex;
  gap: 5px;
}

.section-header button {
  padding: 6px 10px;
  background: #eee7f4;
  border-radius: 8px;
}

.section-header button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}


/* 日付切り替え */

.date-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-bottom: 20px;
}

.date-navigation .date {
  margin: 0;
  min-width: 220px;
}

.date-navigation button {
  background: #eee7f4;
  color: var(--text);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 28px;
}

/* 印刷ボタン */

.print-btn {
  display: block;
  margin: 15px auto;
  padding: 12px 28px;
  background: #eee7f4;
  border: 1px solid var(--accent);
  border-radius: 25px;
}

/* 印刷時のデザイン */

@media print {
  @page {
    size: A4;
    margin: 18mm;
  }

  body {
    background: white;
    color: #514b57;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app {
    max-width: 100%;
    padding: 0;
  }

  header,
  nav,
  .date-navigation button,
  .add-btn,
  .save-btn,
  .print-btn,
  .section-header button {
    display: none !important;
  }

  .page {
    display: none !important;
  }

  #home {
    display: block !important;
  }

  .date-navigation {
    display: block;
    text-align: center;
  }

  .date {
    margin: 0 auto 20px !important;
    font-size: 24px;
  }

  .paper {
    box-shadow: none;
    padding: 15px;
    background: white;
  }

  .diary-section {
    break-inside: avoid;
    page-break-inside: avoid;
    background: transparent;
    margin-bottom: 20px;
  }

  .diary-section textarea {
    display: none;
  }

  .print-content {
    display: block !important;
    font-family: 'Yomogi', cursive;
    font-size: 16px;
    line-height: 2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}




/* 日付切り替え */

.date-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 25px;
  margin-bottom: 20px;
}

.date-navigation .date {
  margin: 0;
  min-width: 220px;
}

.date-navigation button {
  background: #eee7f4;
  color: var(--text);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 28px;
}

/* 印刷ボタン */

.print-btn {
  display: block;
  margin: 15px auto;
  padding: 12px 28px;
  background: #eee7f4;
  border: 1px solid var(--accent);
  border-radius: 25px;
}

/* 印刷時のデザイン */

@media print {
  @page {
    size: A4;
    margin: 18mm;
  }

  body {
    background: white;
    color: #514b57;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app {
    max-width: 100%;
    padding: 0;
  }

  header,
  nav,
  .date-navigation button,
  .add-btn,
  .save-btn,
  .print-btn,
  .section-header button {
    display: none !important;
  }

  .page {
    display: none !important;
  }

  #home {
    display: block !important;
  }

  .date-navigation {
    display: block;
    text-align: center;
  }

  .date {
    margin: 0 auto 20px !important;
    font-size: 24px;
  }

  .paper {
    box-shadow: none;
    padding: 15px;
    background: white;
  }

  .diary-section {
    break-inside: avoid;
    page-break-inside: avoid;
    background: transparent;
    margin-bottom: 20px;
  }

  .diary-section textarea {
    display: none;
  }

  .print-content {
    display: block !important;
    font-family: 'Yomogi', cursive;
    font-size: 16px;
    line-height: 2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}


.print-content {
  display: none;
}


.today-box {
  background: #f3edf8;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 30px;
}

.today-box h2 {
  font-family: 'Caveat', 'Yomogi', cursive;
  font-size: 28px;
  color: var(--accent);
}

.today-task {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.today-task input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border: none;
  border-bottom: 1px solid #d4c6df;
  background: transparent;
  font-family: 'Yomogi', cursive;
  font-size: 16px;
}

.today-task input:checked + input {
  text-decoration: line-through;
  opacity: 0.5;
}

@media print {
  .today-box button,
  #showTodayButton {
    display: none !important;
  }
}

.custom-section-maker {
  background: #fffdf8;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin: 25px 0;
}

.custom-section-maker h3 {
  color: var(--accent);
  margin-top: 0;
}

.custom-section-maker input {
  width: 100%;
  padding: 12px 15px;
  margin: 7px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  font-family: 'Yomogi', cursive;
  font-size: 15px;
}

.custom-section-maker button {
  margin-top: 10px;
  background: var(--accent);
  color: white;
}

.custom-option-wrapper {
  position: relative;
}

.custom-option-wrapper .option-card {
  width: 100%;
  height: 100%;
}

.delete-custom-section {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 3px 8px;
  background: transparent;
  opacity: 0.5;
}

.delete-custom-section:hover {
  opacity: 1;
}