:root {
  --paper: #f7f7f9;
  --paper-2: #ffffff;
  --red: #cf0f22;
  --red-dark: #970916;
  --ink: #171212;
  --muted: #574d4f;
  --line: rgba(151, 9, 22, 0.28);
  --line-strong: rgba(151, 9, 22, 0.5);
  --gray-cell: #dfe1e5;
  --gray-line: rgba(40, 40, 44, 0.22);
  --shadow: 0 18px 38px rgba(34, 16, 19, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(207, 15, 34, 0.08), transparent 36%),
    linear-gradient(180deg, #f1f1f4 0%, #ececf0 100%);
}

.page-shell {
  width: 100%;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vh, 72px) clamp(22px, 8vw, 140px);
}

.calendar-shell {
  --calendar-scale: 1;
  width: min(1040px, 64vw);
  margin-inline: auto;
  justify-self: center;
  background: linear-gradient(180deg, #ffffff, #fbfbfc);
  border: 1px solid rgba(151, 9, 22, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(14px, 1.6vw, 20px);
  transition: filter 180ms ease, opacity 180ms ease, transform 180ms ease;
  transform-origin: top center;
  transform: scale(var(--calendar-scale));
}

body.focus-open .calendar-shell {
  filter: blur(6px) saturate(0.85);
  opacity: 0.72;
  transform: scale(calc(var(--calendar-scale) * 0.99));
}

.calendar-title-wrap {
  display: grid;
  place-items: center;
  margin: 0 0 14px;
  padding: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, #cf0f22, #b80b1b);
  border: 1px solid rgba(120, 6, 17, 0.45);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.14);
}

.title-arc {
  margin: 0;
  display: block;
  color: #fff;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.05rem, 1.55vw, 1.65rem);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
}

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.weekday-row span {
  text-align: center;
  color: var(--red-dark);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 6px 4px;
  border-radius: 2px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-card,
.day-empty {
  aspect-ratio: 1 / 1.08;
  min-height: 0;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.day-empty {
  border-color: var(--gray-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.34)),
    var(--gray-cell);
  position: relative;
  overflow: hidden;
}

.day-empty::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    135deg,
    rgba(90, 92, 98, 0.06) 25%,
    transparent 25%,
    transparent 50%,
    rgba(90, 92, 98, 0.06) 50%,
    rgba(90, 92, 98, 0.06) 75%,
    transparent 75%,
    transparent
  );
  background-size: 12px 12px;
}

.day-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 4px;
  padding: 5px;
  overflow: hidden;
}

.day-card.is-current {
  border-color: rgba(151, 9, 22, 0.52);
  box-shadow: inset 0 0 0 1px rgba(151, 9, 22, 0.14);
}

.day-card.is-future {
  border-color: var(--gray-line);
  background: linear-gradient(180deg, #f5f5f7, #eeeeef);
}

.day-card-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
  min-height: 22px;
}

.day-pill {
  --day-pill-color: var(--red-dark);
  --day-pill-bg: rgba(207, 15, 34, 0.08);
  --day-pill-border: rgba(151, 9, 22, 0.2);
  min-width: 26px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: var(--day-pill-bg);
  color: var(--day-pill-color);
  font-weight: 900;
  border: 1px solid var(--day-pill-border);
  font-size: 0.68rem;
  padding: 0 4px;
}

button.day-pill {
  cursor: pointer;
  font: inherit;
  transition: border-color 120ms ease, background-color 120ms ease;
}

button.day-pill:hover {
  border-color: var(--line-strong);
  background: rgba(207, 15, 34, 0.12);
}

.album-meta {
  min-width: 0;
  text-align: left;
}

.album-title {
  margin: 0;
  font-size: 0.6rem;
  line-height: 1.02;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-artist {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 0.54rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-cover-wrap {
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.album-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.month-cover {
  border-radius: 0;
  width: 74%;
  aspect-ratio: 1 / 1;
  justify-self: center;
  align-self: start;
  margin-bottom: 6px;
}

.month-rating-row {
  min-height: 20px;
  display: grid;
  place-items: center;
  padding-top: 4px;
}

.month-rating-row--locked {
  opacity: 0;
}

.future-cover-mask {
  min-height: 0;
  border: 1px dashed rgba(72, 72, 79, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.25)),
    repeating-linear-gradient(
      45deg,
      rgba(128, 131, 138, 0.08) 0 8px,
      rgba(128, 131, 138, 0.12) 8px 16px
    );
}

.day-card.is-future .album-title,
.day-card.is-future .album-artist {
  color: #6f7279;
}

.month-slider-placeholder {
  display: none;
}

.loading-state {
  grid-column: 1 / -1;
  min-height: 140px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
}

.error-state {
  border-color: rgba(207, 15, 34, 0.22);
  color: var(--red-dark);
}

.noscript-note {
  margin: 0;
  padding: 12px;
  text-align: center;
}

.focus-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  background: rgba(16, 14, 16, 0.2);
  backdrop-filter: blur(2px);
}

.focus-layer[hidden] {
  display: none !important;
}

.focus-layer-content {
  width: min(420px, 92vw);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.focus-welcome {
  margin: 0;
  color: #fff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

.focus-card {
  width: 100%;
  display: grid;
  gap: 8px;
  background: linear-gradient(180deg, #ffffff, #fafafc);
  border: 1px solid rgba(151, 9, 22, 0.22);
  box-shadow: 0 20px 38px rgba(20, 13, 15, 0.22);
  border-radius: 14px;
  padding: 11px;
}

.focus-card-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.focus-day-pill {
  width: 38px;
  height: 30px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.focus-meta {
  min-width: 0;
}

.focus-title {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.1;
  font-weight: 800;
}

.focus-artist {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.focus-cover-wrap {
  width: min(100%, 300px);
  aspect-ratio: 1 / 1;
  justify-self: center;
  overflow: hidden;
  background: #f4f4f7;
  border-radius: 12px;
}

.focus-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.focus-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.service-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 7px 8px;
  cursor: pointer;
}

.service-btn.spotify {
  background: rgba(30, 215, 96, 0.09);
}

.service-btn.apple {
  background: rgba(255, 255, 255, 0.98);
}

.focus-rating-panel {
  display: grid;
  justify-items: center;
  background: transparent;
  border: 0;
  padding: 0;
}

.focus-star-picker {
  position: relative;
  width: max-content;
  justify-self: center;
  min-height: 30px;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  padding: 0 1px;
}

.focus-star-picker .star-hitbox-row {
  inset: -3px 0;
}

.focus-star-hitbox {
  width: 100%;
}

.star-display {
  position: relative;
  line-height: 1;
  letter-spacing: 0.06em;
  font-size: 0.86rem;
  width: max-content;
}

.star-display::before,
.star-display::after {
  content: "★★★★★";
}

.star-display::before {
  color: rgba(45, 39, 27, 0.2);
}

.star-display::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--fill, 0%);
  overflow: hidden;
  color: transparent;
  background:
    radial-gradient(circle at 25% 28%, rgba(255, 255, 255, 0.65) 0 14%, transparent 16%),
    radial-gradient(circle at 72% 70%, rgba(120, 86, 8, 0.18) 0 18%, transparent 19%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 221, 92, 0.96) 0 2px,
      rgba(230, 183, 36, 0.98) 2px 4px,
      rgba(247, 206, 54, 0.98) 4px 6px
    );
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow:
    0 0 0.5px rgba(121, 90, 13, 0.7),
    0 1px 0 rgba(255, 238, 167, 0.22);
  white-space: nowrap;
}

.star-hitbox-row {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0;
}

.star-hit {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
}

.star-hit:focus-visible {
  outline: 2px solid rgba(199, 144, 18, 0.6);
  outline-offset: -1px;
  border-radius: 4px;
}

.month-stars {
  font-size: 0.78rem;
}

.focus-stars {
  font-size: 1.22rem;
  letter-spacing: 0.07em;
}

.focus-stars-interactive {
  cursor: pointer;
}

@media (max-width: 1180px) {
  body {
    overflow-x: hidden;
  }

  .page-shell {
    padding-inline: 10px;
  }

  .calendar-shell {
    width: 1040px;
    max-width: none;
    overflow: visible;
    --calendar-scale: min(1, calc((100vw - 20px) / 1040));
  }

  .weekday-row,
  .calendar-grid {
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .focus-layer-content {
    width: min(94vw, 420px);
  }

  .focus-title {
    font-size: 0.92rem;
  }

  .focus-artist {
    font-size: 0.8rem;
  }

  .focus-stars {
    font-size: 1.08rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
