[hidden] { display: none !important; }
:root {
  --bg: #f6f1e7;
  --paper: #fffdf8;
  --ink: #2b2521;
  --sub: #6f655c;
  --line: #e4dccd;
  --red: #b5443a;
  --green: #2f5a4a;
  --navy: #33496e;
  --mustard: #c4923a;
  --plum: #7a4a63;
  --ribbon: #f3e3bd;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', sans-serif;
  font-weight: 500;
  line-height: 1.8;
}
a { color: var(--green); }
button { font: inherit; color: inherit; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* ---- 見出し ---- */
.hero { text-align: center; padding: 48px 0 28px; }
.hero .eyebrow { margin: 0; letter-spacing: .3em; font-size: 13px; color: var(--sub); }
.hero h1 { margin: 6px 0 0; font-size: clamp(26px, 6vw, 40px); line-height: 1.35; font-weight: 700; }
.hero h1 .year { display: block; font-size: .5em; letter-spacing: .2em; color: var(--red); margin-top: 4px; }
.theme {
  margin: 26px auto 0; max-width: 520px; background: var(--paper);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px;
}
.theme .label {
  display: inline-block; font-size: 12px; letter-spacing: .15em; color: #fff;
  background: var(--green); border-radius: 99px; padding: 1px 12px; margin-bottom: 6px;
}
.theme .q { margin: 0; font-size: clamp(18px, 4.6vw, 22px); font-weight: 700; line-height: 1.6; }
.themes { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: t; text-align: left; display: grid; gap: 6px; }
.themes li { counter-increment: t; display: flex; gap: 10px; align-items: baseline; font-weight: 700; font-size: clamp(15px, 4vw, 18px); line-height: 1.55; }
.themes li::before { content: counter(t); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; transform: translateY(-1px); }
.themes li:nth-child(2)::before { background: var(--green); } .themes li:nth-child(3)::before { background: var(--navy); } .themes li:nth-child(4)::before { background: var(--mustard); }
.theme .label { margin-bottom: 10px; }
.join .more { margin-top: 10px; font-size: 14px; }
.entry .theme-tag { margin: 8px 0 0; font-size: 12px; color: var(--sub); }
.lead { margin: 14px 0 0; color: var(--sub); font-size: 14px; white-space: pre-line; }

/* ---- カレンダー ---- */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  margin: 8px 0 0;
}
@media (min-width: 640px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 12px; } }
.tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden;
  border: 0; padding: 0; text-align: left; display: block; width: 100%;
}
.tile .num {
  position: absolute; left: 10px; top: 6px; font-size: 26px; font-weight: 700; line-height: 1.2; z-index: 2;
}
.tile .who {
  position: absolute; left: 8px; right: 8px; bottom: 7px; font-size: 12px; line-height: 1.4; z-index: 2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* まだ開かない日：リボンのかかった箱 */
.tile.closed { color: #fff; cursor: pointer; }
.tile.closed::before, .tile.closed::after { content: ''; position: absolute; background: var(--ribbon); opacity: .9; }
.tile.closed::before { left: 58%; top: 0; bottom: 0; width: 12px; }
.tile.closed::after { top: 58%; left: 0; right: 0; height: 12px; }
.tile.closed .who { background: rgba(0,0,0,.18); border-radius: 6px; padding: 1px 6px; width: fit-content; max-width: calc(100% - 16px); }
.c0 { background: var(--red); } .c1 { background: var(--green); } .c2 { background: var(--navy); }
.c3 { background: var(--mustard); } .c4 { background: var(--plum); }
/* 開いた日 */
.tile.open { background: var(--paper); border: 1.5px solid var(--line); cursor: pointer; transition: transform .15s; }
.tile.open:hover { transform: translateY(-2px); }
.tile.open img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile.open.has-photo .num { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.45); }
.tile.open.has-photo .who { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.tile.open.has-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.45)); }
.tile.open:not(.has-photo) .gift { position: absolute; left: 10px; right: 10px; top: 42px; font-size: 13px; line-height: 1.5; font-weight: 700; color: var(--green);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
/* 空いている日 */
.tile.empty { background: transparent; border: 1.5px dashed #d3c8b5; color: #b3a793; }
.tile.today { outline: 3px solid var(--mustard); outline-offset: 3px; }

.note { text-align: center; color: var(--sub); font-size: 13px; margin: 14px 0 0; }

/* ---- 募集・アーカイブ ---- */
section.block { margin: 48px 0 0; }
section.block h2 { font-size: 18px; margin: 0 0 10px; text-align: center; }
.join { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; }
.join p { margin: 0; }
.years { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-width: 560px; margin: 0 auto; }
.years a {
  display: flex; gap: 14px; align-items: baseline; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 16px;
}
.years a.current { border-color: var(--green); }
.years .y { font-weight: 700; color: var(--red); }
.years .t { flex: 1; font-size: 14px; }
.years .n { font-size: 12px; color: var(--sub); white-space: nowrap; }

footer { text-align: center; color: var(--sub); font-size: 13px; padding: 48px 16px 40px; }

/* ---- 記事 ---- */
dialog.entry {
  border: 0; padding: 0; background: var(--paper); color: var(--ink);
  width: min(640px, 100vw); max-width: 100vw; max-height: 100dvh; border-radius: 18px;
}
dialog.entry::backdrop { background: rgba(40, 32, 26, .55); }
@media (max-width: 640px) { dialog.entry { width: 100vw; height: 100dvh; border-radius: 0; margin: 0; } }
.entry article { padding: 22px 20px 26px; }
.entry .top {
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 3; background: var(--paper);
  margin: -22px -20px 0; padding: 12px 20px 8px;
}
.entry .date { margin: 0; font-size: 13px; color: var(--red); letter-spacing: .08em; font-weight: 700; }
.entry .close { border: 0; background: var(--bg); width: 40px; height: 40px; border-radius: 50%; font-size: 22px; cursor: pointer; line-height: 1; }
.entry h2 { margin: 6px 0 0; font-size: 22px; line-height: 1.5; }
.entry .recipient { margin: 2px 0 0; color: var(--sub); font-size: 14px; }
.entry .photos { display: grid; gap: 10px; margin: 16px 0 0; }
.entry .photos img { width: 100%; height: auto; display: block; border-radius: 12px; background: var(--bg); }
.entry .body { margin: 18px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.95; }
.entry .author { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.entry .author .name { font-weight: 700; }
.entry .author a { font-size: 13px; }
.entry .share { margin: 18px 0 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--ink); border-radius: 99px; padding: 6px 18px; background: transparent;
  text-decoration: none; color: var(--ink); font-size: 14px; cursor: pointer;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.entry nav { display: flex; justify-content: space-between; margin: 22px 0 0; gap: 10px; }
.entry nav button { min-width: 0; }
.entry nav button[hidden] { display: none; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 99px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; }
