:root {
  --paper: #eef1ef;
  --ink: #1f2a44;
  --ink-soft: #566076;
  --line: #c4cbc8;
  --bloom-1: #f0bfcf;
  --bloom-2: #e58fad;
  --bloom-3: #b8335f;
  --mincho: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", serif;
  --gothic: "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, "Noto Sans CJK JP", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--gothic);
  line-height: 1.75;
}

a {
  color: var(--ink);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--bloom-3);
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.875rem;
}

.brand {
  font-family: var(--mincho);
  font-size: 1.125rem;
  text-decoration: none;
}

.site-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin: 0;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

main.wide {
  max-width: 60rem;
}

h1 {
  margin: 0 0 1rem;
  font-family: var(--mincho);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1.35;
}

h1 span {
  display: block;
  font-size: 1rem;
  font-weight: normal;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font-family: var(--mincho);
  font-weight: 600;
  font-size: 1.25rem;
}

.plain {
  padding: 0;
  list-style: none;
}

.alert {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--bloom-3);
  background: #fff;
}

.done {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--ink);
  background: #fff;
}

.linked-accounts {
  padding: 0;
  list-style: none;
}

.linked-accounts li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.linked-accounts form {
  margin: 0;
}

/* フォーム */

label {
  display: block;
  margin-top: 1rem;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="number"],
textarea {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--ink-soft);
  border-radius: 0;
  background: #fff;
  color: inherit;
  font: inherit;
}

fieldset {
  margin: 1.25rem 0 0;
  padding: 0.5rem 0.75rem 0.75rem;
  border: 1px solid var(--line);
}

legend {
  padding: 0 0.25rem;
}

.choice {
  margin-top: 0.5rem;
}

.field-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
}

button {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--bloom-3);
  border-radius: 0;
  background: var(--bloom-3);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button.quiet {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* 暦。この器の見どころは、埋まるほどマスが紅梅色に濃くなること */

.calendar-title {
  margin-bottom: 0.5rem;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
}

.theme {
  max-width: 40rem;
  margin: 0 0 0.5rem;
}

.fill-count {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.weekdays,
.koyomi.month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  margin-bottom: 0.25rem;
  color: var(--ink-soft);
  font-family: var(--mincho);
  font-size: 0.875rem;
  text-align: center;
}

.koyomi {
  margin: 0;
  padding: 0;
  list-style: none;
}

.koyomi.band {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
}

/* 隣のマスと罫線を重ねて、マスのあるところだけに線を引く */
.koyomi li {
  margin: 0 -1px -1px 0;
  border: 1px solid var(--line);
}

.koyomi .blank {
  background: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px);
  opacity: 0.45;
}

.masu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  min-height: 7.75rem;
  padding: 0.4rem 0.5rem;
  color: var(--ink);
  text-decoration: none;
}

.masu:hover {
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.masu:focus-visible {
  position: relative;
  outline-offset: -3px;
}

.masu-date {
  font-family: var(--mincho);
  font-size: 1.75rem;
  line-height: 1.1;
}

.masu-date small {
  display: block;
  font-size: 0.75rem;
}

.masu-weekday {
  font-size: 0.75rem;
}

/* アイコン。マスの主役 */

.avatar-wrap {
  position: relative;
  display: inline-block;
  flex: none;
}

.avatar {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background-color: #fff;
  object-fit: cover;
}

.avatar-none {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ink-soft);
  color: #fff;
  font-size: 1.125rem;
}

/* 赤い印をアイコンの左上に置く */
.mark {
  position: absolute;
  z-index: 1; /* 重ねたアイコンの下に隠れないように */
  top: -0.2rem;
  left: -0.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background-color: #fff;
  color: #c4001d;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.mark-text {
  color: #c4001d;
  font-weight: 700;
}

.mark-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
}

.masu-people {
  display: flex;
  align-items: center;
  margin-top: auto;
}

.masu-people .avatar-wrap + .avatar-wrap {
  margin-left: -0.85rem;
}

.masu-more {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.level-3 .masu-more .mark-text {
  color: #fff;
}

.reserved .avatar {
  opacity: 0.5;
}

.masu-label {
  overflow: hidden;
  min-height: 1.35em;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 色だけを指定する。background でまとめて書くと、カーソルを合わせた時に梅の画像まで消える */
.level-1 {
  background-color: var(--bloom-1);
}

.level-2 {
  background-color: var(--bloom-2);
}

.level-3,
.level-3:hover {
  background-color: var(--bloom-3);
  color: #fff;
}

.reserved {
  outline: 2px dashed var(--bloom-3);
  outline-offset: -5px;
}

.today .masu-date {
  display: inline-block;
  align-self: flex-start;
  padding: 0 0.3rem;
  background-color: var(--ink);
  color: #fff;
}

/* 当日を過ぎてリンクが入ったマスに、小さな梅が散る。日付と名前を避けて右側に置く */
.bloomed {
  background-repeat: no-repeat;
}

.scatter-0 {
  background-image: url("ume.svg"), url("ume.svg"), url("ume.svg");
  background-position: top 0.4rem right 0.5rem, top 1.7rem right 1.6rem, top 3rem right 0.4rem;
  background-size: 0.95rem, 0.6rem, 0.75rem;
}

.scatter-1 {
  background-image: url("ume.svg"), url("ume.svg");
  background-position: top 0.9rem right 1.1rem, top 2.6rem right 0.5rem;
  background-size: 0.75rem, 0.95rem;
}

.scatter-2 {
  background-image: url("ume.svg"), url("ume.svg"), url("ume.svg");
  background-position: top 0.5rem right 1.5rem, top 1.5rem right 0.45rem, top 3.3rem right 1.3rem;
  background-size: 0.65rem, 0.9rem, 0.6rem;
}

.scatter-3 {
  background-image: url("ume.svg"), url("ume.svg");
  background-position: top 0.45rem right 0.9rem, top 2rem right 1.5rem;
  background-size: 0.85rem, 0.7rem;
}

.owner-edit {
  margin-left: 1rem;
}

.rules {
  max-width: 40rem;
  margin: 0 0 1.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
}

.rules summary {
  font-family: var(--mincho);
  font-weight: 600;
  cursor: pointer;
}

.rules-body {
  overflow-wrap: anywhere;
}

.rules-body > * {
  margin: 0.5rem 0 0;
}

.rules-body ol,
.rules-body ul {
  padding-left: 1.5rem;
}

.rules-body h1,
.rules-body h2,
.rules-body h3,
.rules-body h4,
.rules-body h5,
.rules-body h6 {
  font-size: 1rem;
  font-weight: 700;
}

.rules-body blockquote {
  margin-left: 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--line);
  color: var(--ink-soft);
}

.rules-body pre {
  overflow-x: auto;
  padding: 0.5rem;
  background-color: #fff;
}

.rules-body table {
  border-collapse: collapse;
}

.rules-body th,
.rules-body td {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--line);
}

/* 登録の一覧 */

.listing {
  max-width: 40rem;
  margin-top: 3rem;
}

.listing-day {
  margin-top: 2rem;
}

.listing-day h3 {
  margin: 0 0 0.25rem;
  font-family: var(--mincho);
  font-weight: 600;
  font-size: 1.25rem;
}

.listing-day h3 a {
  text-decoration: none;
}

.listing-day h3 span {
  margin-left: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.listing-day .entries > li:first-child {
  border-top: 0;
}

.listing-day .entries > li {
  padding: 0.5rem 0 0.75rem;
}

/* 日付の画面 */

.day-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.day-steps a + a {
  margin-left: 1rem;
}

.day-title {
  font-size: 2.75rem;
}

.day-title span {
  margin-top: 0.25rem;
  color: var(--ink-soft);
}

.entries {
  margin: 0;
  padding: 0;
  list-style: none;
}

.entries > li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.entries p {
  margin: 0;
}

.entry-who {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.mark-field {
  margin-top: 0.75rem;
}

.choice-inline {
  display: inline-block;
  margin: 0 1rem 0 0;
}

.entry-name span {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.entry-link {
  font-size: 1.125rem;
  overflow-wrap: anywhere;
}

.entry-address {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.entry-comment {
  margin-top: 0.25rem !important;
}

.note {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.entry-edit {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.entry-edit summary {
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.entry-remove {
  margin-top: 0.5rem;
}

.empty,
.register-hint {
  margin-top: 1rem;
}

@media (max-width: 34rem) {
  main {
    padding-inline: 0.75rem;
  }

  .masu {
    min-height: 5.5rem;
    padding: 0.25rem;
  }

  .masu .avatar {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
  }

  .masu .mark {
    width: 0.85rem;
    height: 0.85rem;
    font-size: 0.5625rem;
  }

  .masu-people .avatar-wrap + .avatar-wrap {
    margin-left: -1.1rem;
  }

  .masu-more {
    font-size: 0.6875rem;
  }

  .masu-date {
    font-size: 1.25rem;
  }

  .month .masu-label {
    font-size: 0.6875rem;
  }

  /* 狭いマスでは日付と重ならないよう、右上に2輪だけ */
  .scatter-0,
  .scatter-1,
  .scatter-2,
  .scatter-3 {
    background-image: url("ume.svg"), url("ume.svg");
    background-position: top 0.2rem right 0.2rem, top 1.1rem right 0.45rem;
    background-size: 0.6rem, 0.45rem;
  }

  .today .masu-date {
    padding: 0 0.15rem;
  }
}
