:root {
  --sayori: #ff8fab;  --sayori-soft: #ffe4ec;
  --natsuki: #ff5fa2; --natsuki-soft: #ffe0ef;
  --yuri: #9a6bd6;    --yuri-soft: #efe6fb;
  --monika: #3fae6a;  --monika-soft: #e3f5ea;
  --ink: #4a3b47;
  --paper: #fff8fb;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Nunito, system-ui, sans-serif; color: var(--ink);
  background:
    linear-gradient(160deg, rgba(255,240,247,.82) 0%, rgba(253,241,247,.78) 50%, rgba(240,230,255,.72) 100%),
    url(images/wallpaper.png) center / cover fixed;
  min-height: 100vh;
}
button, select, input {
  font: inherit; border-radius: 999px; border: 2px solid #f3b6cc; background: #fff;
  padding: .4rem 1rem; color: var(--ink);
}
button { cursor: pointer; background: #ff8fab; color: #fff; border-color: #ff8fab; font-weight: 700; }
button:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* tabs */
.tabs { display: flex; justify-content: center; gap: .5rem; padding: 1rem; }
.tabs a {
  text-decoration: none; color: var(--ink); font-family: Fredoka, sans-serif; font-weight: 700;
  padding: .5rem 1.25rem; border-radius: 999px; background: #fff; box-shadow: 0 2px 8px #f6b9cd55;
}
.tabs a.active { background: #ff8fab; color: #fff; }

.sheet {
  width: min(210mm, 96vw); margin: 0 auto; background: #fff; border-radius: 14px;
  box-shadow: 0 10px 40px #d6849f33; overflow: hidden; position: relative;
}
.actions { text-align: center; margin: 1.25rem 0 3rem; }

/* ---------- calendar ---------- */
.cal-hero {
  background: url(images/dots.svg) center / 520px repeat, linear-gradient(180deg, #fde3ee 0%, #fff0f6 100%);
  text-align: center; padding-top: 1.25rem; position: relative; border-bottom: 4px solid #ffc2d4;
}
.year-row { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.year {
  font-family: Fredoka, sans-serif; font-size: clamp(3rem, 9vw, 5.5rem); margin: 0; line-height: 1;
  color: #ff8fab; letter-spacing: .05em; text-shadow: 3px 3px 0 #fff, 5px 5px 0 #ffc2d4;
}
.arrow { width: 2.5rem; height: 2.5rem; padding: 0; font-size: 1.5rem; line-height: 1; }
.script-title {
  font-family: "Patrick Hand", cursive; font-weight: 400; font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: .25rem 0 0; color: #8a4f6a;
}
.hero-art { height: 330px; display: flex; justify-content: center; align-items: flex-end; gap: 0; }
.hero-img { max-height: 100%; max-width: 100%; object-fit: contain; display: block; }
.hero-row { display: flex; align-items: flex-end; justify-content: center; height: 100%; }
.hero-row img { height: 100%; width: auto; max-width: 25%; object-fit: contain; object-position: bottom; }
.hero-row .ph { height: auto; width: 18%; margin: 0 2% 1.5rem; font-size: 2.5rem; }

.months {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem 1.4rem; padding: 1.25rem 1.5rem 1.5rem;
}
.month { break-inside: avoid; }
.month-head { display: flex; align-items: center; justify-content: center; gap: .4rem; height: 44px; }
.month-head h3 { font-family: Fredoka, sans-serif; margin: 0; font-size: 1.1rem; }
.month-head img, .month-head .ph { height: 42px; width: 42px; object-fit: contain; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .82rem; }
.grid .dow { font-size: .58rem; font-weight: 700; color: #9b8a96; padding-bottom: .2rem; border-bottom: 1px solid #f2dbe4; margin-bottom: .15rem; }
.day {
  padding: .18rem 0; border-radius: 6px; cursor: pointer; position: relative; font-weight: 700;
}
.day:hover { background: var(--soft); }
.day.weekend { color: var(--c); }
.day.today { background: var(--c); color: #fff; }
.day.has-event::after {
  content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%;
  left: 50%; bottom: 0; transform: translateX(-50%); background: var(--c);
}
.day.today.has-event::after { background: #fff; }

/* image placeholder when a picture file is missing */
.ph {
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--soft, #ffe4ec); color: var(--c, #ff8fab); font-family: Fredoka, sans-serif; font-weight: 700;
  aspect-ratio: 1; border: 2px dashed var(--c, #ff8fab);
}

/* ---------- dialog ---------- */
dialog { border: none; border-radius: 16px; padding: 0; box-shadow: 0 20px 60px #0003; width: min(440px, 92vw); }
dialog::backdrop { background: #4a3b4755; }
.dlg { padding: 1.25rem; }
.dlg h3 { font-family: Fredoka, sans-serif; margin: 0 0 .75rem; }
.dlg ul { list-style: none; padding: 0; margin: 0 0 1rem; max-height: 40vh; overflow: auto; }
.dlg li { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-radius: 10px; background: var(--soft); margin-bottom: .35rem; }
.dlg li span { flex: 1; }
.dlg li .who { flex: none; font-size: .7rem; font-weight: 700; color: var(--c); }
.dlg li button { padding: .1rem .55rem; background: transparent; color: #c06; border: none; }
.dlg-add { display: flex; gap: .4rem; flex-wrap: wrap; }
.dlg-add input { flex: 1 1 180px; border-radius: 10px; }
.dlg .close { margin-top: 1rem; width: 100%; background: #fff; color: var(--ink); }

/* ---------- card ---------- */
.card-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; align-items: center; margin-bottom: 1rem; padding: 0 1rem; }
.card-toolbar input { min-width: 240px; }
.card-sheet {
  container-type: inline-size; aspect-ratio: 210 / 297; background:
    radial-gradient(ellipse at 15% 85%, var(--soft) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, var(--soft) 0%, transparent 50%),
    linear-gradient(135deg, #fff 0%, var(--paper) 100%);
}
.card-chibi { position: absolute; top: 1%; left: 1.5%; width: 9.5%; z-index: 2; pointer-events: none; }
.card-full { position: absolute; bottom: 0; right: 1%; width: 27%; z-index: 2; pointer-events: none; }
.card-chibi.ph, .card-full.ph { width: 14%; font-size: 1.5rem; }
.card-full.ph { right: 4%; bottom: 3%; }
.card-to {
  position: absolute; top: 4%; left: 13%; right: 5%; font-family: "Patrick Hand", cursive;
  font-size: 5cqw; color: var(--c); z-index: 1;
}
.card-msg {
  position: absolute; top: 15%; left: 6%; right: 6%; bottom: 14%; overflow: hidden;
  font-family: "Patrick Hand", cursive; color: #5a4050; white-space: pre-line;
  --lh: 3.55cqw; font-size: calc(var(--lh) * .74); line-height: var(--lh);
  background-image: radial-gradient(circle, #8d7a86 .9px, transparent 1.2px);
  background-size: 7px var(--lh); background-position: 0 calc(var(--lh) - 3px);
}
.card-from {
  position: absolute; left: 6%; bottom: 6%; z-index: 3;
  font-family: "Patrick Hand", cursive; font-size: 5.2cqw; color: var(--c);
  background: rgba(255,255,255,.75); padding: .1em .6em; border-radius: 999px;
}
#cards { display: grid; gap: 2rem; padding-bottom: 3rem; }
#cards .sheet { scroll-margin-top: 1rem; }
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(150%);
  background: var(--ink); color: #fff; padding: .6rem 1.2rem; border-radius: 999px; transition: transform .25s;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* club logo + extra art */
.logo-heart { height: 1.1em; vertical-align: -.15em; }
.script-title .logo-heart { height: .9em; }
.club-strip {
  display: flex; justify-content: center; gap: 2.5rem; padding: .5rem 1rem 1.25rem;
  background: url(images/dots.svg) center / 420px repeat; border-top: 2px dashed #f6c6d6;
}
.club-strip figure { margin: 0; text-align: center; }
.club-strip img, .club-strip .ph { height: 90px; width: auto; display: block; margin: 0 auto; }
.club-strip figcaption { font-family: Fredoka, sans-serif; font-weight: 700; color: var(--c); font-size: .85rem; }
.dlg-head { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.dlg-head img { height: 72px; }
.dlg-head h3 { margin: 0; }
.char-picker { display: flex; gap: .4rem; }
.char-picker button {
  display: flex; flex-direction: column; align-items: center; gap: .1rem; border-radius: 14px;
  background: #fff; color: var(--c); border: 2px solid transparent; padding: .3rem .6rem; font-size: .8rem;
}
.char-picker button img, .char-picker button .ph { height: 54px; width: auto; }
.char-picker button[aria-checked="true"] { border-color: var(--c); background: var(--soft); }

@media (max-width: 640px) {
  .club-strip { gap: .75rem; } .club-strip img { height: 64px; }
  .months { grid-template-columns: repeat(2, 1fr); padding: 1rem; }
  .hero-art { height: 170px; }
}

/* ---------- print ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .no-print { display: none !important; }
  #cards { display: block; padding: 0; }
  #cards .sheet { break-after: page; }
  .sheet { width: 210mm; height: 297mm; box-shadow: none; border-radius: 0; }
  .calendar-sheet .months { grid-template-columns: repeat(3, 1fr); gap: 3mm 6mm; padding: 4mm 8mm; }
  .hero-art { height: 62mm; }
  .club-strip { padding: 1mm; } .club-strip img { height: 18mm; }
  .calendar-sheet .months { gap: 2mm 6mm; }
  .grid { font-size: 8.5pt; }
}
