:root {
  --highlight: #ffd21f;
  --timeline-height: 70px;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 2px solid var(--ink);
  background: rgba(255, 255, 255, 0.75);
}

.tl-year {
  display: flex;
  flex-direction: column;
  padding: 8px 4px 0;
  margin: 0;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition:
    background-color 0.2s,
    box-shadow 0.2s;
}

.tl-year:first-child {
  border-left: none;
}

.tl-year:hover {
  background: rgba(255, 225, 77, 0.25);
}

.tl-year.is-selected {
  position: relative;
  z-index: 1;
  background: rgba(255, 225, 77, 0.45);
  box-shadow: 0 0 14px 4px rgba(255, 225, 77, 0.8);
}

.tl-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: var(--timeline-height);
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
}

.tl-bar {
  flex: 1;
  background: var(--ink);
}

.tl-label {
  display: block;
  margin: 4px auto 6px;
  padding: 1px 6px;
  font-size: 0.9rem;
  font-weight: bold;
}

.tl-year.is-selected .tl-label {
  color: var(--highlight);
  background: var(--ink);
}

.tl-year:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: -4px;
}

.journal-actions {
  display: flex;
  margin: 14px 0;
}

.entry-box {
  display: flex;
  justify-content: center;
}

.entry {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1 / 1;
  background: url("/images/Entry.webp") center / 100% 100% no-repeat;
  border-radius: 28px 0 28px 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
  overflow: hidden;

  container-type: inline-size;
}

.entry-layout {
  position: absolute;
  left: 8%;
  right: 12%;
  top: 6%;
  bottom: 20%;
  display: flex;
  flex-direction: column;
}

.entry-head {
  width: 58%;
  min-height: 18cqi;
  margin-bottom: 8px;
}

.entry-title {
  margin: 0;
  text-align: left;
  font-size: clamp(0.95rem, 4.6cqi, 1.5rem);
  line-height: 1.2;
  overflow-wrap: break-word;
}

.entry-date {
  display: block;
  margin-top: 4px;
  padding-bottom: 4px;
  font-size: clamp(0.7rem, 2.6cqi, 0.9rem);
  border-bottom: 1.5px dashed var(--ink);
}

.entry-text {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  font-size: clamp(0.78rem, 3cqi, 1rem);
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: break-word;
}

.entry-text:focus-visible {
  outline: 1.5px dashed var(--ink);
  outline-offset: 4px;
}

.entry-text::-webkit-scrollbar {
  width: 5px;
}

.entry-message {
  width: 100%;
  padding: 30px 10px;
  text-align: center;
}

.entry-message.is-error {
  color: #b00020;
}

.cal {
  position: fixed;
  z-index: 10010;
  left: 0;
  top: 0;
  width: min(270px, calc(100vw - 8px));
  aspect-ratio: 1 / 1;
  font-size: 0.78rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
}

.cal[hidden] {
  display: none;
}

.cal.is-dragging {
  cursor: grabbing;
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, 0.3));
}

.cal::before {
  content: "";
  position: absolute;
  inset: -4%;
  z-index: -1;
  background: url("/images/sticky.webp") center / contain no-repeat;
  transform: rotate(6deg);
}

.cal-body {
  position: absolute;
  inset: 23% 12% 9% 12%;
  display: flex;
  flex-direction: column;
}

.cal-close {
  position: absolute;
  z-index: 1;
  top: 6%;
  left: 9%;
  padding: 0 6px;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.cal-title {
  font-weight: bold;
  font-size: 1.05em;
}

.cal-arrow {
  padding: 0 6px;
  font-size: 1.3em;
  line-height: 1.2;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
}

.cal-arrow:hover {
  transform: scale(1.2);
}

.cal-weekdays,
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.cal-weekdays {
  font-weight: bold;
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  margin-bottom: 2px;
}

.cal-days {
  flex: 1;
  grid-auto-rows: 1fr;
  align-items: center;
  justify-items: center;
}

.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.5em;
  padding: 0;
  font: inherit;
  color: var(--ink);
}

.cal-day.has-entry {
  font-weight: bold;
  background: var(--highlight);
  border: 1.5px solid var(--ink);
  cursor: pointer;
}

.cal-day.has-entry:hover {
  transform: scale(1.15);
}
