:root {
  --bg: #1b1b1d;
  --panel: rgba(36, 37, 38, 0.78);
  --panel-strong: rgba(36, 37, 38, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.055);
  --text: #e3e3e3;
  --muted: #bec3c9;
  --subtle: #7f8497;
  --border: rgba(255, 255, 255, 0.12);
  --movie: #fa5252;
  --tv: #8fb3c7;
  --accent: #fa5252;
  --today-bg: rgba(250, 82, 82, 0.09);
  --today-border: rgba(250, 82, 82, 0.28);
  --danger: #fa5252;
  --ok: #00a400;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(250, 82, 82, 0.16) 0%, rgba(27, 27, 29, 0.96) 34%, rgba(24, 24, 24, 1) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 56px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Nunito Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(2rem, 4vw, 4.1rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 10px 38px rgba(0, 0, 0, 0.36);
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--subtle);
  font-size: 0.93rem;
  white-space: nowrap;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.movie-dot {
  background: var(--movie);
}

.tv-dot {
  background: var(--tv);
}

.status-panel {
  display: flex;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(24, 24, 24, 0.76);
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.status-pill.ok {
  color: var(--ok);
}

.status-pill.warning {
  color: var(--danger);
}

.calendar-panel {
  min-height: 72vh;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(24, 24, 24, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.15);
}

.fc {
  color: var(--text);
}

.fc .fc-toolbar {
  gap: 12px;
  flex-wrap: wrap;
}

.fc .fc-toolbar-title {
  font-size: clamp(1.25rem, 2vw, 1.9rem);
  font-weight: 800;
}

.fc .fc-button-primary {
  background: rgba(36, 37, 38, 0.86);
  border-color: var(--border);
  color: var(--text);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-transform: capitalize;
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:focus,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: rgba(250, 82, 82, 0.16);
  border-color: rgba(250, 82, 82, 0.42);
}

.fc .fc-today-button,
.fc .fc-today-button:disabled {
  background: var(--today-bg);
  border-color: var(--today-border);
  color: var(--text);
  opacity: 1;
}

.fc .fc-today-button:hover,
.fc .fc-today-button:focus {
  background: rgba(250, 82, 82, 0.16);
  border-color: rgba(250, 82, 82, 0.42);
}

.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
  border-color: var(--border);
}

.fc-theme-standard th {
  background: rgba(36, 37, 38, 0.96);
}

.fc .fc-col-header-cell {
  border-bottom-color: rgba(250, 82, 82, 0.22);
}

.fc .fc-col-header-cell-cushion {
  display: block;
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.fc .fc-daygrid-day,
.fc .fc-list-day-cushion,
.fc .fc-list-table td {
  background: transparent;
}

.fc .fc-daygrid-day-frame {
  background: rgba(27, 27, 29, 0.38);
}

.fc .fc-day-today .fc-daygrid-day-frame {
  background: transparent;
}

.fc .fc-daygrid-day.fc-day-today {
  background: var(--today-bg);
  box-shadow: inset 0 0 0 1px var(--today-border);
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number {
  color: var(--muted);
  text-decoration: none;
}

.fc-h-event,
.fc-v-event,
.fc-daygrid-dot-event {
  border: 0;
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
}

.fc .media-event {
  min-height: 20px;
  line-height: 1.25;
  font-weight: 700;
}

.fc .media-event .fc-event-main,
.fc .media-event .fc-event-title,
.fc .media-event .fc-event-title-container {
  min-width: 0;
}

.fc .media-event .fc-event-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc .tv-event {
  background: linear-gradient(135deg, rgba(143, 179, 199, 0.9), rgba(79, 112, 130, 0.88));
  border-color: rgba(190, 208, 218, 0.55);
}

.fc .movie-event {
  background: linear-gradient(135deg, rgba(250, 82, 82, 0.98), rgba(210, 6, 6, 0.92));
  border-color: rgba(253, 195, 195, 0.72);
}

.fc-theme-standard .fc-list {
  overflow: hidden;
  border-color: var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025)),
    rgba(24, 24, 24, 0.94);
}

.fc-theme-standard .fc-list-day-cushion {
  background: rgba(36, 37, 38, 0.96);
  color: var(--text);
}

.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: #e7eef8;
  font-weight: 800;
  text-decoration: none;
}

.fc .fc-list-table td {
  border-color: rgba(38, 50, 68, 0.82);
  color: var(--text);
}

.fc .fc-list-event.media-event td {
  background: rgba(255, 255, 255, 0.055);
}

.fc .fc-list-event.movie-event td {
  background: rgba(250, 82, 82, 0.17);
}

.fc .fc-list-event.tv-event td {
  background: rgba(143, 179, 199, 0.14);
}

.fc .fc-list-event-time {
  display: none;
  color: #b7c5d8;
  font-weight: 700;
}

.fc .fc-list-event-title {
  font-weight: 750;
}

.fc .fc-list-event-dot {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.fc .fc-list-event:hover td {
  background: rgba(255, 255, 255, 0.08);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 12, 0.74);
  backdrop-filter: blur(12px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 320px) minmax(0, 1fr);
  gap: 24px;
  width: min(860px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(24, 24, 24, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.16);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(36, 37, 38, 0.92);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.poster-frame {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: #181818;
  border: 1px solid var(--border);
}

#posterCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.modal-content {
  min-width: 0;
  padding-right: 30px;
}

.media-type {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal h2 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  line-height: 1.05;
}

.modal-date {
  color: var(--muted);
  margin: 12px 0 18px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metadata-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
}

.metadata-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.metadata-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
}

.overview {
  margin: 0;
  color: #c5d0df;
  line-height: 1.65;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1500px);
    padding: 18px 0;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
    gap: 14px;
  }

  .status-panel {
    justify-content: flex-start;
    width: auto;
    min-height: 0;
  }

  .calendar-panel {
    padding: 10px;
  }

  .fc .fc-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc .fc-list-day-cushion,
  .fc .fc-list-table td {
    padding: 10px 12px;
  }

  .fc .fc-list-event-title {
    line-height: 1.35;
  }

  .fc .fc-list-event-title a {
    white-space: normal;
  }

  .fc .fc-list-event-graphic {
    padding-left: 10px;
    width: 24px;
  }

  .modal {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .poster-frame {
    width: min(240px, 100%);
    margin: 0 auto;
  }

  .modal-content {
    padding-right: 0;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }
}
