:root {
  --bg: #faf6f0; --card: #ffffff; --ink: #2b2622; --muted: #8a7f75; --line: #eadfd2;
  --accent: #7a4b2a; --accent-ink: #ffffff; --soft: #f3e9dd; --danger: #b3261e; --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1916; --card: #26221e; --ink: #f1ebe4; --muted: #a59a8f; --line: #3a332d; --accent: #d39a6a; --accent-ink: #1c1916; --soft: #322b25; --danger: #ff8a80; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--accent); white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 14px; }
.top nav > a:not(.btn) { color: var(--ink); text-decoration: none; }
.menu { position: relative; }
.menu summary { cursor: pointer; list-style: none; color: var(--muted); }
.menu summary::-webkit-details-marker { display: none; }
.menu-items { position: absolute; right: 0; top: 130%; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px; min-width: 150px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu-items a, .menu-items .linklike { display: block; width: 100%; text-align: left; padding: 8px 10px; color: var(--ink); text-decoration: none; border-radius: 6px; }
.menu-items a:hover, .menu-items .linklike:hover { background: var(--soft); }

main { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.google { display: block; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.danger-text { color: var(--danger); }

.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input[type=email], input[type=text], input[type=date], textarea, select { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); width: 100%; }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: 6px; width: 100%; }
.notice { background: var(--soft); padding: 12px 14px; border-radius: 10px; }
.error { background: color-mix(in srgb, var(--danger) 14%, transparent); padding: 12px 14px; border-radius: 10px; }
.or { text-align: center; color: var(--muted); margin: 16px 0; position: relative; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: var(--card); padding: 0 10px; position: relative; }

/* posts */
.post { padding: 16px; }
.post-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.post-head .date { font-weight: 700; color: var(--ink); text-decoration: none; }
.post-head .edit { margin-left: auto; }
.tag { background: var(--soft); color: var(--accent); font-size: .75rem; padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.note { white-space: pre-wrap; margin: 12px 0 0; font-size: 1.05rem; }
.grid { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; }
.grid.n1 { grid-template-columns: 1fr; }
.grid.n2, .grid.n4 { grid-template-columns: 1fr 1fr; }
.grid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.grid.n3 .thumb:first-child { grid-row: span 2; }
.thumb { position: relative; display: block; background: var(--soft); aspect-ratio: 1; overflow: hidden; }
.grid.n1 .thumb { aspect-ratio: auto; max-height: 560px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid.n1 .thumb img { height: auto; max-height: 560px; object-fit: contain; background: var(--soft); }
.thumb .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.55); color: #fff; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; }
.thumb .noimg { width: 100%; height: 100%; min-height: 200px; }
.thumb .more { position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff; display: grid; place-items: center; font-size: 1.8rem; font-weight: 700; }
.full-media { display: flex; flex-direction: column; gap: 10px; }
.full-media img, .full-media video { width: 100%; border-radius: 10px; display: block; background: #000; }
.full-media img { background: var(--soft); }
.more-btn { display: block; }
.day-head { margin-bottom: 14px; }
.day-head h1 { margin-top: 6px; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-head h1 { margin: 0; text-align: center; }
.cal-jump { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.cal-jump select { width: auto; flex: 1; min-width: 110px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dow { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.day { aspect-ratio: 1; background: var(--card); border: 1px solid var(--line); border-radius: 8px; position: relative; overflow: hidden; display: block; text-decoration: none; }
.day.empty { background: transparent; border: 0; }
.day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.day img { width: 100%; height: 100%; object-fit: cover; display: block; }
.day .num { position: absolute; top: 3px; left: 5px; font-size: .75rem; color: var(--muted); }
.day.has .num { color: #fff; background: rgba(0,0,0,.45); border-radius: 6px; padding: 0 5px; }
.day.has:not(:has(img)) { background: var(--soft); }
.day .count { position: absolute; bottom: 3px; right: 4px; font-size: .7rem; color: #fff; background: var(--accent); border-radius: 99px; padding: 0 6px; }
.day.has:hover { transform: scale(1.03); transition: transform .1s; }

/* new post */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; font-weight: 600; }
.drop.over { border-color: var(--accent); background: var(--soft); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.preview { position: relative; aspect-ratio: 1; background: var(--soft); border-radius: 10px; overflow: hidden; font-size: .7rem; }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview .name { position: absolute; left: 4px; right: 4px; bottom: 8px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview img ~ .name { display: none; }
.preview.loading::after { content: "…"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5rem; color: var(--muted); }
.preview.video::before { content: "▶"; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: #fff; background: rgba(0,0,0,.5); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; z-index: 1; }
.preview .remove { position: absolute; top: 4px; right: 4px; z-index: 2; border: 0; border-radius: 50%; width: 24px; height: 24px; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; line-height: 1; }
.preview .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: transparent; }
.preview .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.preview.done .bar i { width: 100%; background: #3a8a4a; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }

/* members */
main:has(.card.wide) { max-width: 960px; }
.invite .row { display: grid; grid-template-columns: 1.3fr 1fr 1.2fr; gap: 8px; margin-bottom: 10px; }
.invite .btn { margin-top: 10px; }
.table-wrap { overflow-x: auto; }
table.members { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.members th, table.members td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.members select { width: auto; padding: 4px 8px; }

@media (max-width: 600px) {
  .top nav { gap: 10px; font-size: .92rem; }
  .top nav > a:not(.btn):nth-child(1) { display: none; }
  .brand { font-size: 1rem; }
  .invite .row { grid-template-columns: 1fr; }
  .day .num { font-size: .65rem; }
  .cal-grid { gap: 2px; }
}
