:root {
  color-scheme: light;
  --ink: #191d2d;
  --muted: #565f73;
  --line: #e2e6ef;
  --surface: #fff;
  --editor: #f7f8fc;
  --brand: #5145cd;
  --brand-dark: #4035af;
  --selection: #efedff;
  font: 16px/1.5 "CalendarInter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--editor);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden], .icon-library { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 3px solid #7261f5; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand-dark); }
.icon { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .85rem clamp(1rem, 4vw, 3.5rem); background: white; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; gap: .8rem; align-items: center; color: var(--ink); text-decoration: none; }
.brand-icon { width: 2.65rem; height: 2.65rem; border-radius: .8rem; display: grid; place-items: center; color: white; background: var(--brand); }
.brand-icon .icon { width: 1.5rem; height: 1.5rem; }
.brand strong { display: block; font-size: 1.1rem; line-height: 1.25; letter-spacing: -.03em; }
.brand small { display: block; margin-top: .2rem; color: var(--muted); font-size: .65rem; font-weight: 600; line-height: 1.25; letter-spacing: .08em; }
.header-actions, .photo-actions { display: flex; align-items: center; gap: .55rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid transparent;
  border-radius: .65rem; padding: .55rem .85rem; background: transparent; color: var(--ink); font-size: .875rem; font-weight: 650;
  min-height: 2.5rem; white-space: nowrap;
}
.button.quiet:hover, .button.icon-only:hover:not(:disabled) { background: #f0f2f8; }
.button.primary { background: var(--brand); color: white; border-color: var(--brand); }
.button.primary:hover:not(:disabled) { background: var(--brand-dark); }
.button.secondary { background: white; border-color: var(--line); }
.button.secondary:hover { border-color: #9c93e6; color: var(--brand-dark); }
.button.icon-only { width: 2.45rem; padding: .45rem; }
.editor {
  display: grid; grid-template-columns: minmax(16.7rem, 19rem) minmax(0, 1fr); gap: clamp(1.25rem, 3vw, 2.5rem);
  max-width: 91rem; margin: auto; padding: 1.85rem clamp(1rem, 4vw, 3.5rem) 2rem;
}
.settings { display: grid; gap: .85rem; align-content: start; }
.panel { padding: 1rem 1.1rem 1.1rem; border-radius: .95rem; border: 1px solid var(--line); background: var(--surface); }
.panel h2 { font-size: 1.03rem; margin-bottom: .8rem; letter-spacing: -.02em; }
.field { display: block; font-weight: 600; font-size: .875rem; }
.field input, select {
  display: block; width: 100%; margin-top: .32rem; padding: .48rem .65rem; min-height: 2.55rem;
  border: 1px solid var(--line); border-radius: .58rem; background: #fff; color: var(--ink); font-size: .95rem;
}
select {
  appearance: none; padding-right: 2rem;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23565f73' stroke-width='1.5'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") right .6rem center / .95rem no-repeat;
}
fieldset { border: 0; padding: 0; min-width: 0; margin: 0; }
legend { padding: 0; font-size: .875rem; font-weight: 600; margin-bottom: .35rem; }
.orientation, .paper-size, .day-number-size, .palette { margin-top: .85rem; }
.segmented, .styles { display: grid; gap: .4rem; }
.segmented { grid-template-columns: 1fr 1fr; }
.day-number-size .segmented { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.styles { grid-template-columns: repeat(3, 1fr); }
.segmented label, .styles label, .swatches label { position: relative; cursor: pointer; }
.segmented input, .styles input, .swatches input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.segmented span, .styles span {
  display: flex; justify-content: center; align-items: center; gap: .35rem; min-height: 2.55rem;
  border: 1px solid var(--line); border-radius: .55rem; font-size: .875rem;
}
.styles span { flex-direction: column; padding: .35rem .14rem .4rem; gap: 0; font-size: .78rem; }
.sample { font-size: 1.6rem; line-height: 1.35; }
.sample.classic { font-family: CalendarSerif, Georgia, serif; }
.sample.compact { font-family: CalendarBarlow, "Arial Narrow", sans-serif; }
.sample.airy { font: 400 1.6rem/1.35 CalendarManrope, sans-serif; }
.sample.framed { font-family: CalendarBitter, Georgia, serif; }
.sample.mono { font-family: CalendarMono, monospace; }
.segmented input:checked + span, .styles input:checked + span { color: var(--brand-dark); border-color: #a99fed; background: var(--selection); }
fieldset input:focus-visible + span { outline: 3px solid #7261f5; outline-offset: 2px; }
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1.75rem)); gap: .2rem; }
.swatches span { display: grid; place-items: center; width: 100%; aspect-ratio: 1; background: var(--swatch); color: white; border-radius: 50%; }
.swatches .icon { visibility: hidden; width: 1rem; height: 1rem; }
.swatches input:checked + span .icon { visibility: visible; }
.palette output { display: block; margin-top: .3rem; font-size: .875rem; color: var(--muted); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .875rem; min-height: 2rem; cursor: pointer; }
.switch input {
  appearance: none; position: relative; height: 1.25rem; width: 2.2rem; flex: none; border: 1px solid #8a94a8;
  background: #e6e9f2; border-radius: 999px; margin: 0; cursor: pointer;
}
.switch input::after { content: ""; position: absolute; width: .87rem; height: .87rem; inset: .13rem auto auto .13rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #1521403d; }
.switch input:checked { background: var(--brand); border-color: var(--brand); }
.switch input:checked::after { left: 1.06rem; }
.event-panel .button { width: 100%; padding-inline: .5rem; justify-content: flex-start; white-space: normal; text-align: left; }
.count { margin-left: auto; border-radius: .55rem; padding: 0 .4rem; background: var(--selection); color: var(--brand-dark); }
.workspace { min-width: 0; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.workspace-heading h1 { font-size: 1.65rem; line-height: 1.2; letter-spacing: -.04em; }
.workspace-heading p { color: var(--muted); margin-top: .25rem; font-size: .875rem; }
.pager { display: flex; align-items: center; gap: .15rem; border-radius: .7rem; border: 1px solid var(--line); background: white; }
.pager span { min-width: 3rem; text-align: center; white-space: nowrap; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.month-nav { display: flex; gap: .25rem; padding: .25rem; margin-bottom: .75rem; overflow: auto; background: white; border: 1px solid var(--line); border-radius: .75rem; scrollbar-width: thin; }
.month-nav button {
  flex: 1 0 auto; color: var(--muted); border: 0; background: transparent; border-radius: .46rem;
  padding: .45rem .52rem; font-size: .875rem; font-weight: 650; min-height: 2.15rem;
}
.month-nav button:hover { background: #f2f3f8; }
.month-nav button[aria-current="page"] { color: var(--brand-dark); background: var(--selection); }
.month-nav button:focus-visible { outline-offset: -2px; }
.month-nav button.has-photo::after { content: ""; display: block; width: 1.15rem; height: 2px; background: currentColor; opacity: .65; margin: 0 auto -2px; }
.stage {
  display: grid; place-items: center; padding: clamp(.75rem, 2vw, 1.35rem); min-height: 20rem; border: 1px solid #dbe1ee;
  border-radius: .95rem; background: #e9edf5 radial-gradient(#c1cadb 1px, transparent 1px) 0 0 / 18px 18px;
}
.paper { position: relative; width: min(100%, 28.5rem); background: white; box-shadow: 0 8px 25px #24314e25, 0 0 0 1px #17213d0f; }
.paper.landscape { width: min(100%, 46rem); }
#sheet, #sheet svg { display: block; width: 100%; height: 100%; }
.cover-overlay #sheet { position: relative; z-index: 1; pointer-events: none; }
.binding-guide {
  z-index: 2;
  position: absolute; inset: 0 0 auto; display: flex; align-items: center; padding-inline: 4%;
  color: #515b70; background: #f4f5fc; border-bottom: 1px dashed #a8aeca;
  font-size: clamp(.55rem, 1.25vw, .7rem); line-height: 1;
}
.binding-guide::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: var(--hanger-width); aspect-ratio: 2; border: 1px dashed #7e86a2; border-top: 0;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.photo-frame { position: absolute; overflow: hidden; }
.print-logo { position: absolute; z-index: 3; display: block; }
.print-logo img { display: block; width: 100%; height: 100%; }
.photo-frame:focus-within { outline: 2px solid #7261f5; }
.photo-frame.dragging { box-shadow: inset 0 0 0 3px #7261f5; background-color: #d9d6ff; }
.photo-frame.movable-x { cursor: ew-resize; touch-action: none; }
.photo-frame.movable-y { cursor: ns-resize; touch-action: none; }
.photo-empty {
  display: grid; place-content: center; justify-items: center; width: 100%; height: 100%; padding: .4rem; text-align: center;
  gap: .25rem; color: #38345c; border: 1px dashed #aaa7c8; background: #f5f4fc;
}
.photo-empty:hover { background: #edeaff; }
.cover-full .photo-empty { align-content: end; padding-bottom: 8%; }
.cover-full.cover-year-bottom .photo-empty { align-content: start; padding: 8% .4rem .4rem; }
.photo-empty > span:last-child { font-size: clamp(.7rem, 2vw, .84rem); }
.photo-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; margin-bottom: .25rem; border-radius: .7rem; color: var(--brand-dark); background: #e9e5fb; }
.photo-icon .icon { width: 1.35rem; height: 1.35rem; }
.photo-controls {
  display: grid; grid-template-columns: 1fr auto; gap: .75rem; margin-bottom: .75rem;
  padding: .8rem .95rem; border-radius: .8rem; border: 1px solid var(--line); background: white; align-items: center;
}
.photo-details { display: flex; align-items: center; min-width: 0; gap: .65rem; font-size: .875rem; }
.photo-details div { min-width: 0; }
.photo-details > .icon { color: var(--brand); }
.photo-details small { display: block; color: var(--muted); font-size: .79rem; overflow: hidden; text-overflow: ellipsis; }
.position-control, .cover-fields { grid-column: 1 / -1; }
.cover-fields { display: grid; grid-template-columns: minmax(9rem, 1fr) minmax(0, 2fr); gap: .75rem; }
.cover-fields-full { grid-template-columns: minmax(9rem, 1fr) minmax(7rem, .75fr) minmax(0, 1.75fr); }
.position-control { display: flex; gap: .75rem; align-items: center; font-size: .875rem; }
.position-control input { min-width: 3rem; flex: 1; accent-color: var(--brand); }
.optional, .hint { font-size: .85rem; font-weight: 400; color: var(--muted); }
.status { margin-top: .6rem; font-size: .875rem; color: var(--brand-dark); }
.status.error { color: #9b263f; }
dialog {
  width: min(32rem, calc(100% - 2rem)); max-height: 88dvh; padding: 1.15rem 1.35rem; color: var(--ink);
  background: white; border: 1px solid var(--line); border-radius: .95rem; box-shadow: 0 16px 60px #18213f40;
}
dialog::backdrop { background: #17213d75; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .7rem; }
.dialog-heading h2 { font-size: 1.35rem; letter-spacing: -.03em; }
dialog h3 { font-size: 1rem; }
.credits { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; }
.credits dd { margin: 0; }
.privacy { margin-bottom: .85rem; color: var(--muted); font-size: .875rem; }
.license-list { padding-left: 1.1rem; font-size: .875rem; }
.license-list li + li { margin-top: .35rem; }
.date-fields { display: grid; grid-template-columns: 2fr 1fr; gap: .65rem; margin-bottom: .65rem; }
.event-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr); gap: .65rem; }
.event-icon-field { display: block; position: relative; }
.event-icon-field select { padding-left: 2rem; }
#event-icon-preview { position: absolute; display: flex; align-items: center; inset: 0 auto 0 .55rem; color: var(--brand-dark); pointer-events: none; }
.event-entry-heading { display: flex; align-items: center; gap: .4rem; }
.event-entry-heading .icon { color: var(--brand-dark); }
@media (max-width: 420px) {
  .event-fields { grid-template-columns: 1fr; }
}
#event-form .button { margin-top: .75rem; }
#event-notice { margin-top: .5rem; }
.event-list { list-style: none; margin: .9rem 0 0; padding: 0 .25rem 0 0; max-height: min(14rem, 36dvh); overflow-y: auto; overscroll-behavior: contain; }
.event-list:empty { margin-top: 0; }
.event-list li { display: flex; align-items: center; justify-content: space-between; gap: .4rem; border-top: 1px solid var(--line); padding: .3rem 0; overflow-wrap: anywhere; }
.event-list li > div:last-child { display: flex; flex: none; }
.event-list small { display: block; color: var(--muted); }
.event-backup { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
#event-storage, #event-feedback { margin-top: .45rem; }
#event-feedback:empty { margin: 0; }
#event-feedback.error { color: #9b263f; }
.site-footer {
  display: flex; justify-content: flex-end; max-width: 91rem; margin: auto;
  padding: 0 clamp(1rem, 4vw, 3.5rem) 1.25rem;
}
.cookie-banner {
  position: fixed; z-index: 2; inset: auto 1rem max(1rem, env(safe-area-inset-bottom));
  margin-left: auto; max-width: 31rem; max-height: calc(100dvh - 2rem); overflow: auto;
  padding: 1.15rem; border: 1px solid var(--line); border-radius: .95rem;
  background: white; box-shadow: 0 8px 32px #18213f30;
}
.cookie-banner h2 { font-size: 1.125rem; margin-bottom: .4rem; }
.cookie-banner p, .cookie-banner details { font-size: .875rem; }
.cookie-banner details { margin-top: .55rem; color: var(--muted); }
.cookie-banner summary { width: fit-content; cursor: pointer; font-weight: 650; color: var(--ink); }
.cookie-banner details p { margin: .45rem 0; }
.cookie-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .85rem; }
.cookie-actions .button { white-space: normal; }
@media (max-width: 760px) {
  .editor { grid-template-columns: 1fr; padding-top: 1rem; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .topbar { gap: .3rem; padding-inline: .75rem; }
  .brand { gap: .4rem; }
  .brand strong { font-size: .94rem; }
  .brand-icon { width: 2.1rem; height: 2.1rem; border-radius: .6rem; }
  .brand-icon .icon { width: 1.2rem; height: 1.2rem; }
  .header-actions { gap: .15rem; }
  #about-open span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .header-actions .button { padding-inline: .45rem; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .photo-controls { grid-template-columns: 1fr; }
  .cover-fields, .cover-fields-full { grid-template-columns: 1fr; }
}
@media (max-width: 360px) {
  .topbar { padding-inline: .55rem; }
  .brand strong { font-size: .87rem; }
  #export .icon { display: none; }
  #export span { white-space: normal; }
}
.month-nav { position: relative; }
.uploaded-photo { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; pointer-events: none; }
.stage.dragging { outline: 2px solid var(--brand); outline-offset: -2px; }
