:root {
  --paper: #f7f5ee;
  --panel: #fffefa;
  --ink: #242421;
  --muted: #77766f;
  --line: #ddd9ce;
  --soft: #ece9df;
  --wide-open: #373a35;
  --oruga: #d86b43;
  --event-ink: #fff;
  --overlap: #e16642;
  --woco: #3d6b62;
  --hello: #756b5e;
  --bns: #6d7283;
  --shadow: rgba(38, 37, 31, .055);
  --popover-shadow: rgba(20, 20, 18, .16);
}

body.is-night {
  --paper: #181a19;
  --panel: #222523;
  --ink: #f4f1e8;
  --muted: #b1b0a9;
  --line: #3c403d;
  --soft: #303532;
  --wide-open: #eff1e9;
  --oruga: #f0a17d;
  --event-ink: #20231f;
  --overlap: #ff8a68;
  --woco: #7eb8a9;
  --hello: #d8bf99;
  --bns: #b7bed3;
  --shadow: rgba(0, 0, 0, .28);
  --popover-shadow: rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

button { font: inherit; cursor: pointer; }

.shell { width: min(1440px, calc(100vw - 64px)); margin: 0 auto; padding: 22px 0 72px; }

.hero { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding: 0 0 16px; }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.eyebrow-separator { opacity: .45; }
.eyebrow-name { color: var(--ink); letter-spacing: .08em; }
.meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }

.ghost, .theme-toggle, .event-visibility, .popover-close, .timezone-control, .week-start-toggle {
  border: 1px solid var(--line);
  background: rgba(255, 254, 250, .7);
  color: var(--ink);
  transition: background .16s ease, transform .16s ease, opacity .16s ease;
}
.ghost, .theme-toggle, .event-visibility { border-radius: 999px; padding: 9px 13px; }
.ghost:hover, .theme-toggle:hover, .event-visibility:hover { transform: translateY(-1px); background: var(--panel); }
.fc .fc-today-button { margin-left: 10px !important; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; opacity: 1 !important; }
.theme-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.theme-toggle-icon { font-size: 16px; line-height: .8; }
.timezone-control { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border-radius: 999px; }
.timezone-label { color: var(--muted); font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.timezone-control select { max-width: 170px; border: 0; outline: 0; background: transparent; color: var(--ink); font: 600 12px/1.2 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; cursor: pointer; }
.timezone-control:focus-within { box-shadow: 0 0 0 2px rgba(58, 57, 49, .18); }
.week-start-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 7px 6px 11px; border-radius: 999px; }
.week-start-label { color: var(--muted); font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.week-start-value { display: grid; place-items: center; min-width: 34px; min-height: 24px; border-radius: 999px; background: var(--soft); color: var(--ink); font-size: 11px; font-weight: 750; }
.week-start-toggle:hover { transform: translateY(-1px); background: var(--panel); }
.week-start-toggle:focus-visible { outline: 2px solid color-mix(in srgb, var(--ink) 22%, transparent); outline-offset: 2px; }
body.is-night .ghost, body.is-night .theme-toggle, body.is-night .timezone-control, body.is-night .week-start-toggle { background: rgba(34, 37, 35, .8); }

.account-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border-radius: 999px; background: var(--soft); color: var(--wide-open); font: 600 11px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.03em; }
.account-nico-wideopencompany-com { background: #dfece8; color: var(--woco); }
.account-hello-niconico-me { background: #eee6d8; color: var(--hello); }
.account-nico-brandnewschool-com { background: #e5e6ef; color: var(--bns); }

.notice { margin: -10px 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff9eb; color: #6b593c; font-size: 13px; }
.notice[data-kind="error"] { background: #fff1ee; color: #914f46; }

.calendar-wrap { min-height: 600px; margin-top: 16px; padding: clamp(18px, 3vw, 36px); border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: 0 24px 72px var(--shadow); }

.fc { --fc-border-color: var(--line); --fc-button-bg-color: var(--soft); --fc-button-border-color: var(--soft); --fc-button-hover-bg-color: color-mix(in srgb, var(--soft) 75%, var(--ink)); --fc-button-hover-border-color: color-mix(in srgb, var(--soft) 75%, var(--ink)); --fc-button-active-bg-color: var(--wide-open); --fc-button-active-border-color: var(--wide-open); --fc-event-bg-color: var(--wide-open); --fc-event-border-color: var(--wide-open); --fc-event-text-color: var(--event-ink); --fc-page-bg-color: transparent; --fc-neutral-bg-color: transparent; font-size: 13px; }
.fc .fc-toolbar { margin-bottom: 28px; gap: 14px; flex-wrap: wrap; }
.fc .fc-toolbar-title { font: 500 clamp(28px, 3.2vw, 48px)/.95 Georgia, "Times New Roman", serif; letter-spacing: -.045em; }
.fc .fc-button { border-radius: 999px !important; box-shadow: none !important; color: var(--ink); font-size: 12px; font-weight: 650; padding: 8px 12px; text-transform: none; }
.fc .fc-button:focus { box-shadow: 0 0 0 2px rgba(58, 57, 49, .18) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: var(--panel); }
.fc .fc-col-header-cell { padding: 0 0 10px; border: 0; color: var(--muted); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }
.fc .fc-col-header-cell-cushion { color: inherit; text-decoration: none; }
.fc .fc-daygrid-day-top { flex-direction: row; padding: 8px 10px 4px; }
.fc .fc-daygrid-day-number { color: var(--ink); font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-decoration: none; }
.fc .fc-daygrid-day.fc-day-today, .fc .fc-timegrid-col.fc-day-today { background: color-mix(in srgb, var(--soft) 75%, transparent); }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--wide-open); color: var(--panel); }
.fc .fc-daygrid-day-frame { min-height: 108px; }
.fc .fc-daygrid-event-harness { margin: 2px 5px; }
.fc .fc-event { --event-fill: var(--wide-open); overflow: hidden; border-color: var(--event-fill); border-radius: 7px; background: var(--event-fill); padding: 2px 5px; box-shadow: none; color: var(--event-ink); font-size: 11px; line-height: 1.25; }
.fc .fc-event .fc-event-main { color: var(--event-ink); }
.fc .fc-event:hover { filter: brightness(.93); }
.fc .fc-event.account-hello-niconico-me { --event-fill: var(--hello); }
.fc .fc-event.account-nico-brandnewschool-com { --event-fill: var(--bns); }
.fc .fc-event.account-nico-wideopencompany-com { --event-fill: var(--woco); }
.fc .fc-event.account-scheduled { --event-fill: var(--wide-open); }
.fc .fc-event.affiliation-oruga { --event-fill: var(--oruga); }
.fc .fc-event.affiliation-brandnewschool { --event-fill: var(--bns); }
.fc .fc-event.affiliation-wideopencompany { --event-fill: var(--woco); }
.fc .fc-event.has-overlap {
  border: 2px solid var(--overlap);
  background: color-mix(in srgb, var(--event-fill) 86%, var(--overlap));
  box-shadow: inset 5px 0 0 var(--overlap), 0 0 0 1px color-mix(in srgb, var(--overlap) 30%, transparent);
  font-weight: 700;
}
.fc .fc-event.is-hidden-event { opacity: .4; text-decoration: line-through; }
.fc .fc-timegrid-slot { height: 42px; }
.fc .fc-timegrid-slot-label-cushion { color: var(--muted); font: 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.fc .fc-timegrid-axis-cushion { color: var(--muted); }
.fc .fc-timeGridWeek-view .fc-col-header-cell { padding: 7px 0 11px; }
.fc .fc-timeGridWeek-view .fc-col-header-cell-cushion { display: inline-flex; flex-direction: column; align-items: center; gap: 5px; }
.fc .fc-timeGridWeek-view .week-day-name { color: var(--muted); font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; text-transform: uppercase; }
.fc .fc-timeGridWeek-view .week-day-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--ink); font: 650 16px/1 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; letter-spacing: 0; }
.fc .fc-timeGridWeek-view .fc-day-today .week-day-number { background: var(--wide-open); color: var(--panel); }
.fc .fc-timeGridWeek-view .fc-timegrid-axis,
.fc .fc-timeGridWeek-view .fc-timegrid-allday { background: color-mix(in srgb, var(--soft) 38%, transparent); }
.fc .fc-timeGridWeek-view .fc-timegrid-now-indicator-line { border-color: var(--overlap); border-width: 2px 0 0; }
.fc .fc-timeGridWeek-view .fc-timegrid-now-indicator-arrow { border-color: var(--overlap); border-top-color: transparent; border-bottom-color: transparent; }
.fc .fc-timeGridWeek-view .fc-timegrid-event { border-radius: 8px; padding: 3px 5px; }
.fc .fc-daygrid-more-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin: 3px 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.fc .fc-daygrid-more-link:hover { background: color-mix(in srgb, var(--soft) 76%, var(--ink)); }
.fc .fc-popover {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 55px var(--popover-shadow);
}
.fc .fc-popover-header { padding: 11px 14px; background: var(--soft); color: var(--ink); }
.fc .fc-popover-title { font-weight: 700; }
.fc .fc-popover-close { color: var(--muted); opacity: 1; }
.fc .fc-popover-body { padding: 10px; background: var(--panel); }
.fc .fc-popover .fc-daygrid-event-harness { margin: 4px 0; }

.event-popover { position: fixed; z-index: 30; right: max(24px, calc((100vw - 1440px) / 2)); bottom: 24px; width: min(360px, calc(100vw - 40px)); padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: 0 24px 70px var(--popover-shadow); }
.event-popover h2 { margin: 14px 30px 6px 0; font: 500 29px/.95 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.popover-close { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 22px; line-height: 1; }
.popover-time, .popover-description { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.popover-description { margin-top: 12px; white-space: pre-wrap; }
.event-visibility { margin-top: 18px; font-size: 12px; }

.loading-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(247, 245, 238, .76);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .18s ease;
}
.loading-overlay[hidden] { display: none; }
.loading-overlay.is-visible { opacity: 1; }
.loading-dialog {
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 70px var(--popover-shadow);
}
.loading-eyebrow { margin: 0; color: var(--muted); font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; }
.loading-dialog h2 { margin: 10px 0 7px; font: 500 32px/.95 Georgia, "Times New Roman", serif; letter-spacing: -.045em; }
.loading-dialog p:not(.loading-eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }
.loading-progress { height: 5px; margin-top: 22px; overflow: hidden; border-radius: 999px; background: var(--soft); }
.loading-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--wide-open); transition: width .34s cubic-bezier(.2, .8, .2, 1); }
body.is-night .loading-overlay { background: rgba(24, 26, 25, .76); }

@media (max-width: 780px) {
  .shell { width: min(100vw - 28px, 1440px); padding: 18px 0 48px; }
  .hero { display: grid; gap: 16px; }
  .meta { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .timezone-control { flex: 1 1 100%; justify-content: space-between; }
  .timezone-control select { max-width: none; }
  .week-start-toggle { flex: 1 1 auto; justify-content: space-between; }
  .calendar-wrap { padding: 16px 10px; border-radius: 20px; overflow-x: auto; }
  .fc .fc-toolbar { display: grid; grid-template-columns: 1fr; text-align: left; }
  .fc .fc-toolbar-chunk { display: flex; flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-chunk:nth-child(2) { order: -1; }
  .fc .fc-daygrid-day-frame { min-height: 76px; }
  .fc .fc-daygrid-event-harness { margin: 2px; }
  .fc .fc-timeGridWeek-view { min-width: 820px; }
  .fc .fc-timeGridWeek-view .fc-timegrid-slot { height: 36px; }
}
