:root {
  --ink: #1B2340;
  --muted: #4A5475;
  --line: #D9DEEC;
  --field: #8A93AE;
  --soft: #F4F6FB;
  --pink: #F4A6C0;
  --pink-soft: #FCE8EF;
  --pink-deep: #C2577F;
  --sage: #A9BFA0;
  --sage-soft: #DCE9D5;
  --night: #101A3F;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.4;
}
body.sky {
  min-height: 100vh;
  background-color: var(--night);
  background-image:
    radial-gradient(circle, #fff 1px, transparent 1.6px),
    radial-gradient(circle, #fff 1.3px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, .65) .8px, transparent 1.4px);
  background-size: 140px 140px, 230px 230px, 90px 90px;
  background-position: 20px 30px, 110px 150px, 60px 80px;
}
h1, h2 { font-family: 'Gloock', serif; font-weight: 400; margin: 0; }
h1 { font-size: 2.5rem; line-height: 1.05; color: #fff; }
h2 { font-size: 1.375rem; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #7FA0FF; outline-offset: 2px; }

.page { max-width: 1200px; margin: 0 auto; padding: 1.5rem .75rem 3rem; display: flex; flex-direction: column; gap: 1.5rem; }
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.names { color: #C9D2EC; font-weight: 700; font-size: .9375rem; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; color: #fff; font-weight: 700; font-size: .9375rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend .ico { width: 18px; height: 18px; }
.swatch { width: 16px; height: 16px; border-radius: 5px; background: var(--sage-soft); display: inline-block; }

.cols { display: flex; flex-direction: column; gap: 1.5rem; }
.side { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
@media (min-width: 900px) {
  .cols { flex-direction: row; align-items: flex-start; }
  .month { flex: 1 1 0; }
  .side { flex: 0 0 380px; }
}

.card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 1.25rem; min-width: 0; }
.card.month { padding: .5rem; margin-inline: -.5rem; display: flex; flex-direction: column; gap: .75rem; }
.month > .row { flex-wrap: wrap; padding: .25rem .25rem 0; }
.month h2 { white-space: nowrap; font-size: 1.5rem; }
.month .btn { padding: 0 .75rem; }
@media (min-width: 900px) { .card.month { margin-inline: 0; padding: .75rem; } }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; align-items: center; gap: .5rem; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.end { align-items: flex-end; }
.row.start { align-items: flex-start; }
.row.tight { gap: .25rem; }
.grow { flex: 1 1 140px; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; font-weight: 700; color: var(--muted); }

.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.dow { text-align: center; font-size: .875rem; font-weight: 700; color: var(--muted); }
.cell {
  min-height: 92px; min-width: 0; padding: 6px 4px; border-radius: 12px;
  border: 3px solid transparent; background: var(--soft);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  text-align: left; overflow: hidden;
}
.cell.today { background: var(--pink-soft); border-color: var(--pink-deep); }
.cell.together { background: var(--sage-soft); }
.cell.sel { border-color: var(--ink); }
.cell .num { font-weight: 800; font-size: 1.125rem; }
.marks { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-height: 16px; }
.ico { width: 16px; height: 16px; flex: none; }
.ico.heart { fill: var(--pink); }
.ico.star { fill: var(--sage); }
.emo { font-size: 15px; line-height: 18px; letter-spacing: 1px; }

.btn {
  min-height: 44px; padding: 0 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-weight: 700; font-size: .9375rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none;
}
.btn.icon { width: 44px; padding: 0; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 800; min-height: 48px; }
.btn.outline { border: 2px solid var(--ink); font-weight: 800; }
.btn.ghost { border: none; background: transparent; color: var(--muted); }
.btn.mini { width: 40px; min-height: 40px; }
.btn.link { border: none; background: transparent; color: #C9D2EC; text-decoration: underline; }
.btn.file { position: relative; cursor: pointer; }
.btn.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.btn.file:focus-within { outline: 3px solid #7FA0FF; outline-offset: 2px; }
.logout { align-self: center; }

label { font-size: .875rem; font-weight: 700; }
input[type=text], input[type=url], input[type=password] {
  width: 100%; height: 46px; padding: 0 .875rem; border: 1px solid var(--field); border-radius: 12px;
  background: #fff; font-size: 1rem;
}
.field { display: flex; flex-direction: column; gap: .25rem; }
.field.emoji { width: 72px; }
.field.emoji input { text-align: center; padding: 0; font-size: 1.25rem; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips.plain { list-style: none; margin: 0; padding: 0; }
.chip {
  min-height: 44px; padding: 0 .875rem; border-radius: 999px; border: 2px solid var(--field);
  background: #fff; font-weight: 700; font-size: .9375rem;
  display: inline-flex; align-items: center; gap: .375rem;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.who.a.on { background: var(--pink); border-color: var(--pink); color: var(--ink); }
.chip.who.b.on { background: var(--sage); border-color: var(--sage); color: var(--ink); }
.chip.static { border: none; background: var(--soft); padding-right: .25rem; }
.chip.static:not(:has(button)) { padding-right: .875rem; }

.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.entry { display: flex; align-items: center; gap: .625rem; padding: .5rem .25rem .5rem .75rem; background: var(--soft); border-radius: 12px; }
.entry.together { background: var(--sage-soft); }
.entry.note { background: var(--pink-soft); }
.entry .big { font-size: 1.375rem; line-height: 1; flex: none; }
.entry .grow { display: flex; flex-direction: column; gap: 2px; flex: 1 1 0; }
.entry .txt { font-weight: 700; overflow-wrap: anywhere; }
.entry.note .txt { font-family: 'Caveat', cursive; font-size: 1.375rem; font-weight: 600; }
.entry .meta { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.links { display: flex; gap: 1rem; }
.links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 800; font-size: .875rem; color: var(--ink); }
.tag { flex: none; font-size: .75rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: #fff; }
.tag.a { background: var(--pink); color: var(--ink); }
.tag.b { background: var(--sage); color: var(--ink); }

.empty { border: 2px dashed var(--field); border-radius: 14px; padding: 1.5rem 1rem; text-align: center; color: var(--muted); }
.polaroids { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px 16px; padding: 8px 4px; }
.polaroid .small span:first-child { white-space: nowrap; }
.polaroid {
  margin: 0; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(27, 35, 64, .18);
  padding: 10px 10px 4px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.polaroid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #E6EAF4; }
.polaroid figcaption { display: flex; flex-direction: column; min-width: 0; }
.caption {
  width: 100%; min-height: 56px; padding: 4px 0; resize: none; line-height: 1.15; border: none; border-bottom: 1px dashed var(--field); border-radius: 0;
  font-family: 'Caveat', cursive; font-size: 1.375rem; font-weight: 600; background: transparent;
}

#toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); max-width: calc(100% - 2rem);
  background: var(--ink); color: #fff; border: 1px solid #fff; padding: .75rem 1rem; border-radius: 12px; font-weight: 700; z-index: 10;
}

.login { max-width: 380px; margin: 0 auto; padding: 4rem 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
.error { color: #A3264F; font-weight: 700; }
