/* まいにちスタンプ。PCは左にカレンダー、右にその日のスタンプ。狭い画面は、カレンダー → スタンプの縦一列 */
:root {
	--bg: #fef4e8; --paper: #fffaf1; --ink: #2b2a26; --ink2: #6b655a; --line: #e8dcc8;
	--accent: #858c4f; --head: #84491b; --soft: #f6ead8; --sel: #fbe3c4;
	--sun: #c9645a; --sat: #3d6a8c;
	--display: "Klee One", "Zen Maru Gothic", serif;
	--body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #141a15; --paper: #1d261e; --ink: #fef4e8; --ink2: #b9b3a3; --line: #34402f;
		--accent: #bfbb80; --head: #c79254; --soft: #253024; --sel: #3a3a24;
		--sun: #e08a80; --sat: #8fb3d0;
		color-scheme: dark;
	}
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
body {
	margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.6;
	padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: calc(96px + env(safe-area-inset-bottom));
	padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible, .filebtn:focus-within { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.app { max-width: 1080px; margin: 0 auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h1 { font-family: var(--display); font-weight: 600; color: var(--head); font-size: 26px; margin: 0; letter-spacing: .04em; }
h2 { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 0; color: var(--head); }
.btn { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent); color: var(--paper); font-weight: 700; font-size: 14px; }
.btn.ghost { background: none; color: var(--ink); border: 1.5px solid var(--line); font-weight: 500; }
.btn.danger { background: var(--sun); color: var(--paper); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 5px 14px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--paper); }
.grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.sheet { min-width: 0; background: var(--paper); border: 1.5px solid var(--line); border-radius: 18px; padding: 18px; scroll-margin-top: 12px; }
.th { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.back { border: 0; background: none; color: var(--ink2); font-size: 13px; text-decoration: underline; padding: 0; }

/* その日のスタンプ */
.tlist { display: flex; flex-direction: column; gap: 6px; }
.trw { display: flex; align-items: center; gap: 4px; }
.trow { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; border-radius: 14px; padding: 8px 10px; text-align: left; }
.trow:hover { background: var(--soft); }
.trow .name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.trow .sub { display: block; font-size: 12px; color: var(--ink2); font-weight: 500; font-variant-numeric: tabular-nums; }
.slot { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 2px dashed var(--line); color: var(--ink2); }
.slot svg { width: 20px; height: 20px; opacity: .55; }
.edit { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--ink2); display: grid; place-items: center; opacity: .75; }
.edit:hover { background: var(--soft); opacity: 1; }
.edit svg { width: 18px; height: 18px; }
.empty-note { text-align: center; padding: 12px 0 4px; color: var(--ink2); }
.empty-note p { margin: 0 0 10px; }
.foot { margin-top: 14px; }

/* スタンプ（少し傾いた、はんこの形） */
.stamp { display: grid; place-items: center; flex: none; }
.stamp svg { width: 48%; height: 48%; }
.stamp.pop { animation: pop .38s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop {
	0% { transform: scale(0) rotate(var(--r)); }
	35% { transform: scale(1.3, .7) rotate(var(--r)); }
	60% { transform: scale(.95, 1.08) rotate(var(--r)); }
	100% { transform: scale(1) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) { .stamp.pop { animation: none; } }

/* カレンダー */
.mnav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 8px; }
.mnav b { font-size: 16px; min-width: 120px; text-align: center; font-variant-numeric: tabular-nums; }
.mnav button { border: 0; background: none; font-size: 22px; padding: 0 10px; color: var(--ink2); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1.5px solid var(--line); }
.wd { text-align: center; font-size: 12px; font-weight: 700; padding: 6px 0; }
.wd.su { color: var(--sun); } .wd.sa { color: var(--sat); }
.cell { min-height: 74px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 4px 2px 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 0; }
.cell .d { font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; line-height: 1; }
.cell.today .d { background: var(--accent); color: var(--paper); border-radius: 999px; padding: 3px 7px; font-weight: 700; }
.cell.future { opacity: .4; cursor: default; }
.cell.sel { background: var(--sel); border-radius: 10px; }
.cell .ms { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; max-width: 58px; }
.cell .ms .stamp { width: 20px; height: 20px; }
.cell .more { font-size: 10px; color: var(--ink2); line-height: 20px; }
.cell.big .ms .stamp { width: 34px; height: 34px; }
@media (max-width: 480px) {
	.cell { min-height: 62px; }
	.cell .ms .stamp { width: 17px; height: 17px; }
	.cell.big .ms .stamp { width: 30px; height: 30px; }
}

/* カレンダーの下：絞り込みと日数 */
.below { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px 4px 6px; font-size: 13px; max-width: 100%; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.all { padding-left: 12px; }
.chip i { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.chip i svg { width: 12px; height: 12px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--soft); font-weight: 700; }
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; background: var(--soft); border-radius: 12px; padding: 8px 12px; font-size: 13px; color: var(--ink2); }
.stats b { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; margin: 0 2px; }

footer { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; font-size: 12px; color: var(--ink2); }
footer a { color: inherit; }

/* ダイアログ */
dialog { border: 0; border-radius: 20px; background: var(--paper); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); }
dialog::backdrop { background: rgba(20, 26, 21, .45); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.t { font-size: 13px; color: var(--ink2); display: block; margin-bottom: 6px; }
.t.inline { margin: 0; }
.small { font-size: 13px; color: var(--ink2); margin: 0; }
.dlg input[type=text] { width: 100%; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 16px; }
.tabs { margin-bottom: 8px; }
.icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; max-height: 212px; overflow-y: auto; padding: 2px; }
.ico { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--soft); display: grid; place-items: center; color: var(--ink2); }
.ico svg { width: 22px; height: 22px; }
.ico[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); background: var(--sel); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.col { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 2px transparent; }
.col[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); }
.custom { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dlg .custom input[type=text] { width: 8em; padding: 6px 10px; font-size: 15px; font-variant-numeric: tabular-nums; }
.custom input[aria-invalid="true"] { border-color: var(--sun); }
.cp { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; background: conic-gradient(#e06060, #e0c060, #60c080, #60a0e0, #a070d0, #e06060); border: 3px solid var(--paper); box-shadow: 0 0 0 2px transparent; cursor: pointer; overflow: hidden; }
.cp.on { box-shadow: 0 0 0 2.5px var(--ink); }
.cp input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.prev { display: flex; align-items: center; gap: 12px; background: var(--soft); border-radius: 14px; padding: 10px 12px; }
.prev .stamp { width: 46px; height: 46px; }
.dact { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dact.start { justify-content: flex-start; }
.delw { border-top: 1.5px dashed var(--line); padding-top: 12px; }
.del { border: 0; background: none; color: var(--sun); font-size: 14px; padding: 0; text-decoration: underline; }
.confirm { display: flex; flex-direction: column; gap: 8px; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.filebtn { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.err { color: var(--sun); font-size: 14px; margin: 0; }
.toast {
	z-index: 5; position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom));
	max-width: calc(100vw - 32px); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 8px 8px 18px;
	display: flex; gap: 12px; align-items: center; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast:not(:has(button:not([hidden]))) { padding-right: 18px; }
.toast button { flex: none; border: 0; background: var(--bg); color: var(--ink); border-radius: 999px; padding: 4px 12px; font-weight: 700; }
