:root {
  --bg: #f6f5ec;
  --card: #ffffff;
  --ink: #34402f;
  --sub: #86937f;
  --main: #b5d98a;
  --deep: #6fa05a;
  --soft: #e8f2d9;
  --accent: #f6d86b;
  --line: #e6e9da;
  --secret: #e9ece0;
  --secret-ink: #5b6655;
  --danger: #c4624f;
  --radius: 20px;
}
:root[data-skin="pink"] {
  --bg: #fbf3f2;
  --main: #f2b8c6;
  --deep: #d4708a;
  --soft: #fbe4ea;
  --line: #f0e1e1;
  --secret: #f0e6e8;
}
:root[data-skin="lavender"] {
  --bg: #f5f3fa;
  --main: #c5b8e8;
  --deep: #8574c0;
  --soft: #e9e4f6;
  --line: #e4e0ee;
  --secret: #e8e5f0;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.7;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
textarea, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

.wrap { max-width: 520px; margin: 0 auto; padding: 18px 16px 24px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top h1 { font-size: 20px; font-weight: 800; }
.sub { color: var(--sub); font-size: 13px; }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--deep); color: #fff; font-weight: 800; padding: 11px 20px; border-radius: 999px; }
a.btn { text-decoration: none; }
.btn.soft { background: var(--soft); color: var(--deep); }
.btn.line { background: transparent; color: var(--sub); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; }
.btn.block { display: flex; width: 100%; }

/* 下のタブ */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); display: flex; justify-content: center; z-index: 5; }
.tabs .in { display: flex; width: 100%; max-width: 520px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11px; font-weight: 800; color: var(--sub); padding: 6px 0; border-radius: 14px; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--deep); background: var(--soft); }

/* メンバーの並び */
.members { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.member { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; width: 52px; font-size: 11px; color: var(--sub); }
.member .done { position: absolute; top: -2px; right: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--deep); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 800; }
.member .nm { max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member.wait svg { opacity: 0.4; }

.nudge { background: var(--soft); color: var(--deep); font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.dayhead { margin: 18px 4px 8px; font-size: 13px; font-weight: 800; color: var(--sub); }

/* 日記カード */
.entry .head { display: flex; align-items: center; gap: 10px; }
.entry .who { flex: 1; min-width: 0; }
.entry .who b { display: block; font-weight: 800; line-height: 1.3; }
.entry .who .sub { line-height: 1.3; }
.entry .chip { display: inline-block; margin-top: 10px; background: var(--soft); color: var(--deep); font-size: 12px; font-weight: 800; padding: 1px 10px; border-radius: 999px; }
.entry .text { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mosaic { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mosaic i { display: block; height: 11px; border-radius: 6px; background: repeating-linear-gradient(135deg, #dfe4d2 0 6px, #d3d9c5 6px 12px); }
.mosaic .cap { font-size: 12px; color: var(--sub); margin-top: 2px; }
.stamps { margin-top: 12px; display: flex; gap: 8px; }
.stamp { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border-radius: 999px; background: var(--bg); font-size: 15px; }
.stamp.on { background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--main); }
.stamp .n { font-size: 12px; font-weight: 800; color: var(--sub); }
.stamp:active { transform: scale(0.94); }

/* エディタ */
.themecard > div:first-child { flex: 1 1 100%; }
.themecard .btn { white-space: nowrap; }
.themecard { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; background: var(--soft); border-radius: var(--radius); padding: 12px 14px; }
.themecard .lbl { font-size: 11px; font-weight: 800; color: var(--deep); }
.themecard .t { font-weight: 800; flex: 1; }
.themecard.off { background: var(--card); color: var(--sub); }
.moods { display: flex; justify-content: space-between; margin-top: 12px; }
.mood { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--sub); padding: 6px 4px; border-radius: 14px; flex: 1; }
.mood.on { background: var(--soft); color: var(--ink); font-weight: 800; }
.zone { margin-top: 12px; border-radius: var(--radius); padding: 12px 14px; }
.zone.open { background: var(--card); }
.zone.hidden { background: var(--secret); color: var(--secret-ink); }
.zone .lbl { font-size: 12px; font-weight: 800; color: var(--sub); display: flex; align-items: center; gap: 6px; }
.zone textarea { width: 100%; min-height: 110px; border: 0; outline: 0; background: transparent; resize: vertical; margin-top: 4px; line-height: 1.8; }
.divider { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 4px 2px; touch-action: none; user-select: none; cursor: ns-resize; }
.divider .bar { flex: 1; height: 0; border-top: 2px dashed var(--main); }
.divider .grip { font-size: 12px; font-weight: 800; color: var(--deep); background: var(--soft); padding: 4px 12px; border-radius: 999px; }
.divider button { width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--deep); font-weight: 800; }
.shares { margin-top: 12px; }
.shares label { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.shares input { width: 18px; height: 18px; accent-color: var(--deep); }
.actions { display: flex; gap: 10px; margin-top: 14px; }
.actions .btn { flex: 1; }

/* カレンダー */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px 2px; text-align: center; }
.cal .dow { font-size: 11px; color: var(--sub); font-weight: 800; }
.cal .cell { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 10px; color: var(--sub); padding: 2px 0; border-radius: 12px; }
.cal .cell.today { background: var(--soft); }
.cal .cell.empty-day svg { opacity: 0.7; }
.monthnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 800; }
.monthnav button { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); color: var(--deep); font-weight: 800; }

/* 設定 */
.field { display: block; margin-top: 10px; }
.field span { display: block; font-size: 12px; font-weight: 800; color: var(--sub); margin-bottom: 4px; }
.field input { width: 100%; border: 0; outline: 0; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pick button { padding: 3px; border-radius: 50%; }
.pick button.on { box-shadow: 0 0 0 2.5px var(--deep); }
.skin { width: 36px; height: 36px; border-radius: 50%; }
.circle-row { padding: 10px 0; }
.circle-row + .circle-row { border-top: 1.5px solid var(--line); }
.code { font-weight: 800; letter-spacing: 0.12em; background: var(--bg); border-radius: 10px; padding: 2px 10px; }
h2.sec { font-size: 14px; font-weight: 800; margin: 20px 4px 8px; }

/* シート・トースト */
.scrim { position: fixed; inset: 0; background: rgba(40, 50, 35, 0.4); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; border-radius: 26px 26px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet .hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-weight: 800; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 800; z-index: 20; }

/* ログイン前 */
.hero { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 24px; background: var(--main); }
.hero .logo { font-size: 38px; font-weight: 800; letter-spacing: 0.04em; }
.hero p { max-width: 300px; }
.hero .btn { background: var(--card); color: var(--deep); }
.hero .btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.hero .note { font-size: 12px; opacity: 0.7; }
.empty { text-align: center; color: var(--sub); padding: 28px 10px; }
.empty .btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
